← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 3033: Return the average speed of calculation from the last 10 iterations instead of current speed for ...

 

------------------------------------------------------------
revno: 3033
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: yade
timestamp: Thu 2012-02-16 22:43:12 +0100
message:
  Return the average speed of calculation from the last 10 iterations instead of current speed for the last step. Hopefully makes prediction of finish-time in batch-mode more accurate.
modified:
  core/Scene.cpp
  core/Scene.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 'core/Scene.cpp'
--- core/Scene.cpp	2012-02-13 20:38:28 +0000
+++ core/Scene.cpp	2012-02-16 21:43:12 +0000
@@ -104,7 +104,10 @@
 			boost::posix_time::ptime timeNow = boost::posix_time::microsec_clock::local_time();
 			boost::posix_time::time_duration duration = timeNow - prevTime;
 			long dif = duration.total_microseconds();
-			speed = 1000000.0 / dif;
+			
+			SpeedElements(iter%10,0)=1000000.0 / dif;
+			speed = SpeedElements.mean();
+			
 			prevTime = timeNow;
 		}
 		

=== modified file 'core/Scene.hpp'
--- core/Scene.hpp	2012-02-13 20:38:28 +0000
+++ core/Scene.hpp	2012-02-16 21:43:12 +0000
@@ -54,6 +54,8 @@
 		bool timeStepperActive();
 		// (de)activate TimeStepper; returns whether the operation was successful (i.e. whether a TimeStepper was found)
 		bool timeStepperActivate(bool activate);
+		Eigen::Matrix<Real,10,1> SpeedElements; //Array for saving speed-values for last 10 iterations
+
 
 		shared_ptr<Engine> engineByName(const string& s);
 
@@ -72,7 +74,6 @@
 		void setCompressionNegative(bool d){ if(d) flags|=COMPRESSION_NEGATIVE; else flags&=~(COMPRESSION_NEGATIVE); }
 		boost::posix_time::ptime prevTime; //Time value on the previous step
 
-
 	YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(Scene,Serializable,"Object comprising the whole simulation.",
 		((Real,dt,1e-8,,"Current timestep for integration."))
 		((long,iter,0,Attr::readonly,"Current iteration (computational step) number"))
@@ -105,11 +106,11 @@
 		((shared_ptr<Cell>,cell,new Cell,Attr::hidden,"Information on periodicity; only should be used if Scene::isPeriodic."))
 		((vector<shared_ptr<Serializable> >,miscParams,,Attr::hidden,"Store for arbitrary Serializable objects; will set static parameters during deserialization (primarily for GLDraw functors which otherwise have no attribute access)"))
 		((vector<shared_ptr<DisplayParameters> >,dispParams,,Attr::hidden,"'hash maps' of display parameters (since yade::serialization had no support for maps, emulate it via vector of strings in format key=value)"))
-
 		,
 		/*ctor*/
 			fillDefaultTags();
 			interactions->postLoad__calledFromScene(bodies);
+			SpeedElements.Zero();
 		,
 		/* py */
 		.add_property("localCoords",&Scene::usesLocalCoords,"Whether local coordianate system is used on interactions (set by :yref:`Ig2Functor`.")