← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3763: Fix the behavior of FlowEngine.updateTriangulation=True

 

------------------------------------------------------------
revno: 3763
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxxxxxx>
timestamp: Mon 2013-11-25 01:52:12 +0100
message:
  Fix the behavior of FlowEngine.updateTriangulation=True
modified:
  pkg/dem/FlowEngine.cpp
  pkg/dem/FlowEngine.hpp


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

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'pkg/dem/FlowEngine.cpp'
--- pkg/dem/FlowEngine.cpp	2013-11-21 01:28:17 +0000
+++ pkg/dem/FlowEngine.cpp	2013-11-25 00:52:12 +0000
@@ -62,15 +62,8 @@
         timingDeltas->checkpoint ( "Update_Volumes" );
 	
         Eps_Vol_Cumulative += eps_vol_max;
-        if ( (defTolerance>0 && Eps_Vol_Cumulative > defTolerance) || retriangulationLastIter>meshUpdateInterval) {
-                updateTriangulation = true;
-                Eps_Vol_Cumulative=0;
-                retriangulationLastIter=0;
-                ReTrg++;
-        } else  {
-		updateTriangulation = false;
-		retriangulationLastIter++;}
-
+	if (!updateTriangulation) updateTriangulation = // If not already set true by another function of by the user, check conditions
+		(defTolerance>0 && Eps_Vol_Cumulative > defTolerance) || retriangulationLastIter>meshUpdateInterval;
 
         ///Compute flow and and forces here
 	if (pressureForce){
@@ -117,6 +110,7 @@
 			backgroundCompleted=false;
 			retriangulationLastIter=ellapsedIter;
 			updateTriangulation=false;
+			Eps_Vol_Cumulative=0;
 			ellapsedIter=0;
 			boost::thread workerThread(&FlowEngine::backgroundAction,this);
 			workerThread.detach();
@@ -134,7 +128,10 @@
 			Build_Triangulation (P_zero, solver);
 			Initialize_volumes(solver);
 			ComputeViscousForces(*solver);
-               		updateTriangulation = false;}
+               		updateTriangulation = false;
+			Eps_Vol_Cumulative=0;
+			retriangulationLastIter=0;
+			ReTrg++;}
         }
         first=false;
         timingDeltas->checkpoint ( "Triangulate + init volumes" );
@@ -732,14 +729,10 @@
 	timingDeltas->checkpoint("Triangulating");
         UpdateVolumes (solver);
         Eps_Vol_Cumulative += eps_vol_max;
-        if ( (defTolerance>0 && Eps_Vol_Cumulative > defTolerance) || retriangulationLastIter>meshUpdateInterval ) {
-                updateTriangulation = true;
-                Eps_Vol_Cumulative=0;
-                retriangulationLastIter=0;
-                ReTrg++;
-         } else  {
-		updateTriangulation = false;
-		retriangulationLastIter++;}
+	
+	if (!updateTriangulation) updateTriangulation = // If not already set true by another function of by the user, check conditions
+		(defTolerance>0 && Eps_Vol_Cumulative > defTolerance) || retriangulationLastIter>meshUpdateInterval;
+
 	timingDeltas->checkpoint("Update_Volumes");
 
 	///Compute flow and and forces here
@@ -784,6 +777,7 @@
 			backgroundCompleted=false;
 			retriangulationLastIter=ellapsedIter;
 			ellapsedIter=0;
+			Eps_Vol_Cumulative=0;
 			boost::thread workerThread(&PeriodicFlowEngine::backgroundAction,this);
 			workerThread.detach();
 			Initialize_volumes(solver);
@@ -798,7 +792,10 @@
 			Build_Triangulation (P_zero, solver);
 			Initialize_volumes(solver);
 			ComputeViscousForces(*solver);
-               		updateTriangulation = false;}
+               		updateTriangulation = false;
+			Eps_Vol_Cumulative=0;
+                	retriangulationLastIter=0;
+                	ReTrg++;}
         }
         first=false;
 	timingDeltas->checkpoint("Ending");

=== modified file 'pkg/dem/FlowEngine.hpp'
--- pkg/dem/FlowEngine.hpp	2013-11-21 13:20:15 +0000
+++ pkg/dem/FlowEngine.hpp	2013-11-25 00:52:12 +0000
@@ -276,7 +276,6 @@
 					normal[wall_ymax].y()=normal[wall_xmax].x()=normal[wall_zmax].z()=-1;
 					solver = shared_ptr<FlowSolver> (new FlowSolver);
 					first=true;
-					updateTriangulation=false;
 					eps_vol_max=Eps_Vol_Cumulative=retriangulationLastIter=0;
 					ReTrg=1;
 					backgroundCompleted=true;
@@ -437,7 +436,6 @@
 			wallIds=vector<int>(6,-1);
 // 			wallTopId=wallBottomId=wallFrontId=wallBackId=wallLeftId=wallRightId=-1;
 			solver = shared_ptr<FlowSolver> (new FlowSolver);
-			updateTriangulation=false;
 			eps_vol_max=Eps_Vol_Cumulative=retriangulationLastIter=0;
 			ReTrg=1;
 			first=true;