← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2240: 1. Some warnings were commented (please, don't leave unused variables!)

 

------------------------------------------------------------
revno: 2240
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-05-19 00:10:18 +0200
message:
  1. Some warnings were commented (please, don't leave unused variables!)
  2. In Shop created getStressForEachBody method to clean up VTKRecorder a little bit (not tested yet, but compiles)
modified:
  pkg/dem/Engine/GlobalEngine/NormalInelasticityLaw.cpp
  pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp
  pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp
  pkg/dem/meta/Shop.cpp
  pkg/dem/meta/Shop.hpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'pkg/dem/Engine/GlobalEngine/NormalInelasticityLaw.cpp'
--- pkg/dem/Engine/GlobalEngine/NormalInelasticityLaw.cpp	2010-05-18 10:28:02 +0000
+++ pkg/dem/Engine/GlobalEngine/NormalInelasticityLaw.cpp	2010-05-18 22:10:18 +0000
@@ -22,7 +22,7 @@
 // void Law2_ScGeom_NormalInelasticityPhys_NormalInelasticity::go(shared_ptr<InteractionGeometry>& iG, shared_ptr<InteractionPhysics>& iP, Interaction* contact, Scene* scene)
 {
 // 	cout << "\n Nvlle it :"<< endl;
-	shared_ptr<BodyContainer>& bodies = scene->bodies;
+	//shared_ptr<BodyContainer>& bodies = scene->bodies;				//It gave a warning. Anton Gladky.
 
 	const Real& dt = scene->dt;
 

=== modified file 'pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp'
--- pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp	2010-05-18 13:57:34 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp	2010-05-18 22:10:18 +0000
@@ -16,6 +16,7 @@
 #include<yade/pkg-common/Sphere.hpp>
 #include<yade/pkg-common/Facet.hpp>
 #include<yade/pkg-dem/ConcretePM.hpp>
+#include<yade/pkg-dem/Shop.hpp>
 
 
 YADE_PLUGIN((VTKRecorder));
@@ -175,33 +176,10 @@
 	}
 
 	//Additional Vector for storing forces
-	vector<bodyState> bodyStates;
+	vector<Shop::bodyState> bodyStates;
 	if(recActive[REC_STRESS]){
-		bodyStates.resize(scene->bodies->size());
-		FOREACH(const shared_ptr<Interaction>& I, *scene->interactions){
-			if(!I->isReal()) continue;
-			const NormShearPhys* phys = YADE_CAST<NormShearPhys*>(I->interactionPhysics.get());
-			Dem3DofGeom* geom=YADE_CAST<Dem3DofGeom*>(I->interactionGeometry.get());	//For the moment only for Dem3DofGeom!!!
-			if(!phys) continue;
-			const body_id_t id1=I->getId1(), id2=I->getId2();
-			
-			Real minRad=(geom->refR1<=0?geom->refR2:(geom->refR2<=0?geom->refR1:min(geom->refR1,geom->refR2)));
-			Real crossSection=Mathr::PI*pow(minRad,2);
-			
-			Vector3r normalStress=((1./crossSection)*geom->normal.dot(phys->normalForce))*geom->normal;
-			Vector3r shearStress;
-			for(int i=0; i<3; i++){
-				int ix1=(i+1)%3,ix2=(i+2)%3;
-				shearStress[i]=geom->normal[ix1]*phys->shearForce[ix1]+geom->normal[ix2]*phys->shearForce[ix2];
-				shearStress[i]/=crossSection;
-			}
-			
-			bodyStates[id1].normStress+=normalStress;
-			bodyStates[id2].normStress+=normalStress;
-			
-			bodyStates[id1].shearStress+=shearStress;
-			bodyStates[id2].shearStress+=shearStress;
-		}
+		Shop shopTemp;
+		shopTemp.getStressForEachBody(bodyStates);
 	}
 	
 	FOREACH(const shared_ptr<Body>& b, *scene->bodies){

=== modified file 'pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp'
--- pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp	2010-05-18 13:57:34 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp	2010-05-18 22:10:18 +0000
@@ -19,14 +19,4 @@
 	);
 	DECLARE_LOGGER;
 };
-
-//Class for storing forces, affected on bodies, obtained from Interactions
-class bodyState{
-	public:
-		Vector3r normStress, shearStress;
-		bodyState (){
-			normStress = Vector3r(0.0,0.0,0.0);
-			shearStress = Vector3r(0.0,0.0,0.0);
-		}
-};
 REGISTER_SERIALIZABLE(VTKRecorder);

=== modified file 'pkg/dem/meta/Shop.cpp'
--- pkg/dem/meta/Shop.cpp	2010-05-18 16:29:56 +0000
+++ pkg/dem/meta/Shop.cpp	2010-05-18 22:10:18 +0000
@@ -175,7 +175,8 @@
 	}
 	Real meanF=sumF/nb;
 	// get max force on contacts
-	Real maxContactF=0; sumF=0; nb=0;
+	// Real maxContactF=0; 										//It gave a warning. Anton Gladky.
+	sumF=0; nb=0;
 	FOREACH(const shared_ptr<Interaction>& I, *rb->interactions){
 		if(!I->isReal()) continue;
 		shared_ptr<NormShearPhys> nsi=YADE_PTR_CAST<NormShearPhys>(I->interactionPhysics); assert(nsi);
@@ -1159,3 +1160,32 @@
 	if(period) *period=(long)floor(xNorm);
 	return x0+xxNorm*(x1-x0);
 }
+
+void Shop::getStressForEachBody(vector<Shop::bodyState>& bodyStates){
+	const shared_ptr<Scene>& scene=Omega::instance().getScene();
+	bodyStates.resize(scene->bodies->size());
+	FOREACH(const shared_ptr<Interaction>& I, *scene->interactions){
+		if(!I->isReal()) continue;
+		const NormShearPhys* phys = YADE_CAST<NormShearPhys*>(I->interactionPhysics.get());
+		Dem3DofGeom* geom=YADE_CAST<Dem3DofGeom*>(I->interactionGeometry.get());	//For the moment only for Dem3DofGeom!!!
+		if(!phys) continue;
+		const body_id_t id1=I->getId1(), id2=I->getId2();
+		
+		Real minRad=(geom->refR1<=0?geom->refR2:(geom->refR2<=0?geom->refR1:min(geom->refR1,geom->refR2)));
+		Real crossSection=Mathr::PI*pow(minRad,2);
+		
+		Vector3r normalStress=((1./crossSection)*geom->normal.dot(phys->normalForce))*geom->normal;
+		Vector3r shearStress;
+		for(int i=0; i<3; i++){
+			int ix1=(i+1)%3,ix2=(i+2)%3;
+			shearStress[i]=geom->normal[ix1]*phys->shearForce[ix1]+geom->normal[ix2]*phys->shearForce[ix2];
+			shearStress[i]/=crossSection;
+		}
+		
+		bodyStates[id1].normStress+=normalStress;
+		bodyStates[id2].normStress+=normalStress;
+		
+		bodyStates[id1].shearStress+=shearStress;
+		bodyStates[id2].shearStress+=shearStress;
+	}
+}

=== modified file 'pkg/dem/meta/Shop.hpp'
--- pkg/dem/meta/Shop.hpp	2010-04-25 13:18:11 +0000
+++ pkg/dem/meta/Shop.hpp	2010-05-18 22:10:18 +0000
@@ -119,4 +119,15 @@
 		//! Flip cell shear without affecting interactions; if flip is zeros, it will be computed such that abs of shear strain is minimal for each shear component
 		//! Diagonal terms of flip are meaningless and ignored.
 		static Matrix3r flipCell(const Matrix3r& flip=Matrix3r::Zero());
+
+		//! Class for storing stresses, affected on bodies, obtained from Interactions
+		struct bodyState{
+				Vector3r normStress, shearStress;
+				bodyState (){
+					normStress = Vector3r(0.0,0.0,0.0);
+					shearStress = Vector3r(0.0,0.0,0.0);
+				}
+		};
+		//! Function of getting stresses for each body
+		void getStressForEachBody(vector<Shop::bodyState>&);
 };