← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1999: 1. Fix class registration macro without attributes (remove "cap" in Rpm LawFunctor as well)

 

------------------------------------------------------------
revno: 1999
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-02-02 13:26:33 +0100
message:
  1. Fix class registration macro without attributes (remove "cap" in Rpm LawFunctor as well)
  2. Remove StretchPeriodicEngine, it was probably too complicated to be really used; remove yade.plot data reduction which was relying on StretchPeriodicEngine
  3. Properly expose PeriodicEngine, PythonPeriodicRunner, VTKRecorder, FileGenerator to python
modified:
  core/Body.hpp
  core/FileGenerator.cpp
  core/FileGenerator.hpp
  core/Omega.cpp
  core/corePlugins.cpp
  core/main/main.py.in
  lib/serialization/Serializable.hpp
  pkg/common/Engine/GlobalEngine/PeriodicEngines.hpp
  pkg/common/Engine/GlobalEngine/PeriodicPythonRunner.hpp
  pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp
  pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp
  pkg/dem/meta/RockPM.hpp
  py/plot.py
  py/yadeWrapper/yadeWrapper.cpp


--
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/Body.hpp'
--- core/Body.hpp	2010-02-02 11:05:09 +0000
+++ core/Body.hpp	2010-02-02 12:26:33 +0000
@@ -87,10 +87,6 @@
 		Body ();
 		Body (body_id_t newId, int newGroup);
 
-	// Serialization
-	//protected:
-	//	REGISTER_ATTRIBUTES(Serializable,(id)(groupMask)(isDynamic)(material)(state)(shape)(bound)(clumpId));
-	//REGISTER_CLASS_AND_BASE(Body,Serializable);
 	YADE_CLASS_BASE_DOC_ATTRS_PY(Body,Serializable,"Basic element of simulation; interacts with other bodies.",
 		((id,"[will be overridden]"))((groupMask,"Bitmask for determining interactions"))((isDynamic,"Whether this body will be moved by forces"))((material,"Material instance associated with this body"))((state,"Physical state"))((shape,"Shape of this body"))((bound,"Bound of this body"))((clumpId,"Id of clump this body makes part of; invalid number if not part of clump; see Body().isStandalone, Body().isClump, Body().isClumpMember properties")),
 		.def_readwrite("mat",&Body::material,"Shorthand for material")

=== modified file 'core/FileGenerator.cpp'
--- core/FileGenerator.cpp	2009-12-04 23:07:34 +0000
+++ core/FileGenerator.cpp	2010-02-02 12:26:33 +0000
@@ -7,16 +7,13 @@
 #include<yade/lib-multimethods/MultiMethodsExceptions.hpp>
 #include<boost/date_time/posix_time/posix_time.hpp>
 
+#include<yade/core/Omega.hpp>
+#include<yade/lib-pyutil/gil.hpp>
+
 #include"FileGenerator.hpp"
 
 CREATE_LOGGER(FileGenerator);
 
-FileGenerator::FileGenerator () : Serializable() 
-{
-	outputFileName = "./scene.xml";
-	serializationDynlib = "XMLFormatManager";
-}
-
 
 FileGenerator::~FileGenerator () 
 {
@@ -95,3 +92,16 @@
 	setReturnValue(st);
 };
 
+void FileGenerator::pyGenerate(const string& out){
+	setFileName(out);
+	bool ret=generateAndSave();
+	LOG_INFO((ret?"SUCCESS:\n":"FAILURE:\n")<<message);
+	if(ret==false) throw runtime_error(getClassName()+" reported error: "+message);
+}
+void FileGenerator::pyLoad(){
+	string xml(Omega::instance().tmpFilename()+".xml.bz2");
+	// LOG_DEBUG("Using temp file "<<xml);
+	pyGenerate(xml);
+	//this is ugly hack, yes...
+	pyRunString("yade.wrapper.Omega().load('"+xml+"')");
+}

=== modified file 'core/FileGenerator.hpp'
--- core/FileGenerator.hpp	2009-12-04 23:07:34 +0000
+++ core/FileGenerator.hpp	2010-02-02 12:26:33 +0000
@@ -20,10 +20,7 @@
 {
 	protected :
 		shared_ptr<Scene>	 rootBody;
-
-		string			 outputFileName
-					,serializationDynlib;
-	
+		string serializationDynlib;
 	public :
 		bool generateAndSave();
 		void setFileName(const string& fileName);
@@ -33,20 +30,23 @@
 		//! Describes the result in a user-readable form.
 		std::string message;
 		
-		FileGenerator ();
 		virtual ~FileGenerator ();
-		
 		virtual void singleAction();
-
 	protected :
 	//! Returns whether the generation was successful; message for user is in FileGenerator::message
 	virtual bool generate();
 
-	REGISTER_ATTRIBUTES(Serializable,(outputFileName)(serializationDynlib));
+	void pyGenerate(const string& out);
+	void pyLoad();
+
+	YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(FileGenerator,Serializable,"Base class for scene generators, preprocessors.",
+		((string,outputFileName,"./scene.xml","Filename to write resulting simulation to")),
+		/* ctor */ serializationDynlib="XMLFormatManager";,
+		.def("generate",&FileGenerator::pyGenerate,(python::arg("out")),"Generate scene, save to given file")
+		.def("load",&FileGenerator::pyLoad,"Generate scene, save to temporary file and load immediately");
+	);
 	DECLARE_LOGGER;
-	REGISTER_CLASS_AND_BASE(FileGenerator,Serializable);
 };
-
 REGISTER_SERIALIZABLE(FileGenerator);
 
 

=== modified file 'core/Omega.cpp'
--- core/Omega.cpp	2010-01-21 20:30:54 +0000
+++ core/Omega.cpp	2010-02-02 12:26:33 +0000
@@ -165,7 +165,7 @@
 	/* python classes must be registered such that base classes come before derived ones;
 	for now, just loop until we succeed; proper solution will be to build graphs of classes
 	and traverse it from the top. It will be done once all classes are pythonable. */
-	for(int i=0; i<100; i++){
+	for(int i=0; i<100 && pythonables.size()>0; i++){
 		if(getenv("YADE_DEBUG")) cerr<<endl<<"[[[ Round "<<i<<" ]]]: ";
 		std::list<string> done;
 		for(std::list<string>::iterator I=pythonables.begin(); I!=pythonables.end(); ){

=== modified file 'core/corePlugins.cpp'
--- core/corePlugins.cpp	2010-01-09 17:26:41 +0000
+++ core/corePlugins.cpp	2010-02-02 12:26:33 +0000
@@ -1,3 +1,3 @@
 #include<yade/lib-factory/ClassFactory.hpp>
 // make core classes known to the class factory
-YADE_PLUGIN((Body)(Bound)(Cell)(Collider)(DataRecorder)(Dispatcher)(Engine)(FileGenerator)(Functor)(GlobalEngine)(Interaction)(InteractionGeometry)(InteractionPhysics)(Material)(PartialEngine)(Shape)(State));
+YADE_PLUGIN((Body)(Bound)(Cell)(Collider)(DataRecorder)(Dispatcher)(Engine)(FileGenerator)(Functor)(GlobalEngine)(Interaction)(InteractionGeometry)(InteractionPhysics)(Material)(PartialEngine)(PeriodicEngine)(Shape)(State));

=== modified file 'core/main/main.py.in'
--- core/main/main.py.in	2010-02-02 08:51:30 +0000
+++ core/main/main.py.in	2010-02-02 12:26:33 +0000
@@ -21,8 +21,8 @@
 par.add_option('-j','--threads',help='Number of OpenMP threads to run; defaults to number of cores. Equivalent to setting OMP_NUM_THREADS environment variable.',dest='threads',type='int')
 par.add_option('--nice',help='Increase nice level (i.e. decrease priority) by given number.',dest='nice',type='int')
 par.add_option('-x',help='Exit when the script finishes',dest='exitAfter',action='store_true')
-if 'log4cxx' in features:
-	par.add_option('-v',help='Increase logging verbosity; first occurence sets default logging level to info, second to debug, third to trace.',action='count',dest='verbosity')
+par.add_option('-v',help='Increase logging verbosity; first occurence sets default logging level to info, second to debug, third to trace.'+
+	('' if 'log4cxx' in features else " (Since this build doesn't use log4cxx, this option will only have effect if repeated twice (-vv), equivalent to setting YADE_DEBUG environment variable)"),action='count',dest='verbosity')
 if debug:
 	par.add_option('--no-gdb',help='Do not show backtrace when yade crashes.',dest='noGdb',action='store_true',)
 

=== modified file 'lib/serialization/Serializable.hpp'
--- lib/serialization/Serializable.hpp	2010-01-24 16:27:40 +0000
+++ lib/serialization/Serializable.hpp	2010-02-02 12:26:33 +0000
@@ -102,7 +102,7 @@
 // attrDecl is (type,name,defaultValue,docString)
 #define YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(thisClass,baseClass,docString,attrDecls,ctor,extras) \
 	public: BOOST_PP_SEQ_FOR_EACH(_ATTR_DECL,~,attrDecls) /* attribute declarations */ \
-	thisClass(): BOOST_PP_SEQ_FOR_EACH_I(_ATTR_INI,BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(attrDecls)),attrDecls) { ctor ; } /* ctor, with initialization of defaults */ \
+	thisClass() BOOST_PP_IF(BOOST_PP_SEQ_SIZE(attrDecls),:,) BOOST_PP_SEQ_FOR_EACH_I(_ATTR_INI,BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(attrDecls)),attrDecls) { ctor ; } /* ctor, with initialization of defaults */ \
 	YADE_CLASS_BASE_DOC_ATTRS_PY(thisClass,baseClass,docString,BOOST_PP_SEQ_FOR_EACH(_STRIPDECL4,~,attrDecls),extras)
 
 #define YADE_CLASS_BASE_DOC_ATTRS(thisClass,baseClass,docString,attrs) \

=== modified file 'pkg/common/Engine/GlobalEngine/PeriodicEngines.hpp'
--- pkg/common/Engine/GlobalEngine/PeriodicEngines.hpp	2010-01-11 22:39:05 +0000
+++ pkg/common/Engine/GlobalEngine/PeriodicEngines.hpp	2010-02-02 12:26:33 +0000
@@ -4,51 +4,10 @@
 #include<time.h>
 #include<yade/core/GlobalEngine.hpp>
 #include<yade/core/Omega.hpp>
-/*!
-	Run Engine::action with given fixed periodicity real time (=wall clock time, computation time),
-	virtual time (simulation time), iteration number), by setting any of those criteria
-	(virtPeriod, realPeriod, iterPeriod) to a positive value. They are all negative (inactive)
-	by default.
-
-	The number of times this engine is activated can be limited by setting nDo>0. If the number of activations
-	will have been already reached, no action will be called even if an active period has elapsed.
-
-	If initRun is set (false by default), the engine will run when called for the first time; otherwise it will only
-	start counting period (realLast etc interal variables) from that point, but without actually running, and will run
-	only once a period has elapsed since the initial run.
-
-	This class should be used directly; rather, derive your own engine which you want to be run periodically.
-
-	Derived engines should override Engine::action(Scene*), which will be called periodically. If the derived engine
-	overrides also Engine::isActivated, it should also take in account return value from PeriodicEngine::isActivated,
-	since otherwise the periodicity will not be functional.
-
-
-	Example with PeriodicPythonRunner, which derives from PeriodicEngine; likely to be encountered in python scripts):
-
-		PeriodicPythonRunner(realPeriod=5,iterPeriod=10000,command="print O.iter")
-
-	will print iteration number every 10000 iterations or every 5 seconds of wall clock time, whiever comes first since it was
-	last run.
- */
+
 class PeriodicEngine:  public GlobalEngine {
 	public:
 		static Real getClock(){ timeval tp; gettimeofday(&tp,NULL); return tp.tv_sec+tp.tv_usec/1e6; }
-		//! Periodicity criterion using virtual (simulation) time (deactivated if <= 0, which is the default)
-		Real virtPeriod;
-		Real virtLast; // track virtual time we were executed last
-		//! Periodicity criterion using real (wall clock, computation, human) time (deactivated by default)
-		Real realPeriod;
-		Real realLast; // track real time we were executed last
-		//! Periodicity criterion using step number (deactivated by default)
-		long iterPeriod;
-		long iterLast; // track step number of last execution
-		//! Limit number of executions by this number (deactivated if negative, which is the default)
-		long nDo;
-		long nDone; // track number of executions (cummulative)
-		//! Run the first time we are called as well (false by default)
-		bool initRun;
-		PeriodicEngine(): virtPeriod(0),virtLast(0),realPeriod(0),realLast(0),iterPeriod(0),iterLast(0),nDo(-1),nDone(0),initRun(false) { realLast=getClock(); }
 		virtual bool isActivated(Scene*){
 			Real virtNow=Omega::instance().getSimulationTime();
 			Real realNow=getClock();
@@ -67,56 +26,82 @@
 			}
 			return false;
 		}
-	REGISTER_ATTRIBUTES(GlobalEngine,
-		(virtPeriod)
-		(realPeriod)
-		(iterPeriod)
-		(virtLast)
-		(realLast)
-		(iterLast)
-		(nDo)
-		(nDone)
-	)
-	REGISTER_CLASS_AND_BASE(PeriodicEngine,GlobalEngine);
+	YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(PeriodicEngine,GlobalEngine,
+		"Run Engine::action with given fixed periodicity real time (=wall clock time, computation time), \
+		virtual time (simulation time), iteration number), by setting any of those criteria \
+		(virtPeriod, realPeriod, iterPeriod) to a positive value. They are all negative (inactive)\
+		by default. \
+		\
+		The number of times this engine is activated can be limited by setting nDo>0. If the number of activations \
+		will have been already reached, no action will be called even if an active period has elapsed. \
+		\
+		If initRun is set (false by default), the engine will run when called for the first time; otherwise it will only \
+		start counting period (realLast etc interal variables) from that point, but without actually running, and will run \
+		only once a period has elapsed since the initial run. \
+		\
+		This class should be used directly; rather, derive your own engine which you want to be run periodically. \
+		\
+		Derived engines should override Engine::action(Scene*), which will be called periodically. If the derived Engine \
+		overrides also Engine::isActivated, it should also take in account return value from PeriodicEngine::isActivated, \
+		since otherwise the periodicity will not be functional. \
+		\
+		Example with PeriodicPythonRunner, which derives from PeriodicEngine; likely to be encountered in python scripts):: \
+		\
+			PeriodicPythonRunner(realPeriod=5,iterPeriod=10000,command='print O.iter')	\
+		\
+		will print iteration number every 10000 iterations or every 5 seconds of wall clock time, whiever comes first since it was \
+		last run.",
+		((Real,virtPeriod,((void)"deactivated",0),"Periodicity criterion using virtual (simulation) time (deactivated if <= 0)"))
+		((Real,realPeriod,((void)"deactivated",0),"Periodicity criterion using real (wall clock, computation, human) time (deactivated if <=0)"))
+		((long,iterPeriod,((void)"deactivated",0),"Periodicity criterion using step number (deactivated if <= 0)"))
+		((long,nDo,((void)"deactivated",-1),"Limit number of executions by this number (deactivated if negative)"))
+		((bool,initRun,false,"Run the first time we are called as well."))
+		((Real,virtLast,0,"Tracks virtual time of last run |yupdate|."))
+		((Real,realLast,0,"Tracks real time of last run |yupdate|."))
+		((long,iterLast,0,"Tracks step number of last run |yupdate|."))
+		((long,nDone,0,"Track number of executions (cummulative) |yupdate|.")),
+		/* this will be put inside the ctor */ realLast=getClock(),
+	);
 };
 REGISTER_SERIALIZABLE(PeriodicEngine);
 
-/*!
-	PeriodicEngine but with constraint that may be stretched by a given stretchFactor (default 2).
-	Limits for each periodicity criterion may be set and the mayStretch bool says whether the period
-	can be stretched (default: doubled) without active criteria getting off limits.
-
-	stretchFactor must be positive; if >1, period is stretched, for <1, it is shrunk.
-
-	Limit consistency (whether actual period is not over/below the limit) is checked: period is set to the 
-	limit value if we are off. If the limit is zero, however, and the period is non-zero, the limit is set
-	to the period value (therefore, if you initialize only iterPeriod, you will get what you expect: engine
-	running at iterPeriod).
-
-	Note: the logic here is probably too complicated to be practical, although it works. Chances are that
-	if unused, it will be removed from the codebase.
-*/
-class StretchPeriodicEngine: public PeriodicEngine{
-	public:
-	StretchPeriodicEngine(): PeriodicEngine(), realLim(0.), virtLim(0.), iterLim(0), stretchFactor(2.), mayStretch(false){}
-	Real realLim, virtLim; long iterLim;
-	Real stretchFactor;
-	bool mayStretch;
-	virtual bool isActivated(Scene* rootBody){
-		assert(stretchFactor>0);
-		if(iterLim==0 && iterPeriod!=0){iterLim=iterPeriod;} else if(iterLim!=0 && iterPeriod==0){iterPeriod=iterLim;}
-		if(realLim==0 && realPeriod!=0){realLim=realPeriod;} else if(realLim!=0 && realPeriod==0){realPeriod=realLim;}
-		if(virtLim==0 && virtPeriod!=0){virtLim=virtPeriod;} else if(virtLim!=0 && virtPeriod==0){virtPeriod=virtLim;}
-		if(stretchFactor>1){iterPeriod=min(iterPeriod,iterLim); realPeriod=min(realPeriod,realLim); virtPeriod=min(virtPeriod,virtLim);}
-		else {iterPeriod=max(iterPeriod,iterLim); realPeriod=max(realPeriod,realLim); virtPeriod=max(virtPeriod,virtLim);}
-		mayStretch=((virtPeriod<0 || (stretchFactor>1 ? stretchFactor*virtPeriod<=virtLim : stretchFactor*virtPeriod>=virtLim))
-		&& (realPeriod<0 || (stretchFactor>1 ? stretchFactor*realPeriod<=realLim : stretchFactor*realPeriod>=realLim))
-		&& (iterPeriod<0 || (stretchFactor>1 ? stretchFactor*iterPeriod<=iterLim : stretchFactor*iterPeriod>=iterLim)));
-		return PeriodicEngine::isActivated(rootBody);
-	}
-	REGISTER_ATTRIBUTES(PeriodicEngine,(realLim)(virtLim)(iterLim)(mayStretch)(stretchFactor));
-	REGISTER_CLASS_NAME(StretchPeriodicEngine);
-	REGISTER_BASE_CLASS_NAME(PeriodicEngine);
-};
-REGISTER_SERIALIZABLE(StretchPeriodicEngine);
-
+#if 0
+	/*!
+		PeriodicEngine but with constraint that may be stretched by a given stretchFactor (default 2).
+		Limits for each periodicity criterion may be set and the mayStretch bool says whether the period
+		can be stretched (default: doubled) without active criteria getting off limits.
+
+		stretchFactor must be positive; if >1, period is stretched, for <1, it is shrunk.
+
+		Limit consistency (whether actual period is not over/below the limit) is checked: period is set to the 
+		limit value if we are off. If the limit is zero, however, and the period is non-zero, the limit is set
+		to the period value (therefore, if you initialize only iterPeriod, you will get what you expect: engine
+		running at iterPeriod).
+
+		Note: the logic here is probably too complicated to be practical, although it works. Chances are that
+		if unused, it will be removed from the codebase.
+	*/
+	class StretchPeriodicEngine: public PeriodicEngine{
+		public:
+		StretchPeriodicEngine(): PeriodicEngine(), realLim(0.), virtLim(0.), iterLim(0), stretchFactor(2.), mayStretch(false){}
+		Real realLim, virtLim; long iterLim;
+		Real stretchFactor;
+		bool mayStretch;
+		virtual bool isActivated(Scene* rootBody){
+			assert(stretchFactor>0);
+			if(iterLim==0 && iterPeriod!=0){iterLim=iterPeriod;} else if(iterLim!=0 && iterPeriod==0){iterPeriod=iterLim;}
+			if(realLim==0 && realPeriod!=0){realLim=realPeriod;} else if(realLim!=0 && realPeriod==0){realPeriod=realLim;}
+			if(virtLim==0 && virtPeriod!=0){virtLim=virtPeriod;} else if(virtLim!=0 && virtPeriod==0){virtPeriod=virtLim;}
+			if(stretchFactor>1){iterPeriod=min(iterPeriod,iterLim); realPeriod=min(realPeriod,realLim); virtPeriod=min(virtPeriod,virtLim);}
+			else {iterPeriod=max(iterPeriod,iterLim); realPeriod=max(realPeriod,realLim); virtPeriod=max(virtPeriod,virtLim);}
+			mayStretch=((virtPeriod<0 || (stretchFactor>1 ? stretchFactor*virtPeriod<=virtLim : stretchFactor*virtPeriod>=virtLim))
+			&& (realPeriod<0 || (stretchFactor>1 ? stretchFactor*realPeriod<=realLim : stretchFactor*realPeriod>=realLim))
+			&& (iterPeriod<0 || (stretchFactor>1 ? stretchFactor*iterPeriod<=iterLim : stretchFactor*iterPeriod>=iterLim)));
+			return PeriodicEngine::isActivated(rootBody);
+		}
+		REGISTER_ATTRIBUTES(PeriodicEngine,(realLim)(virtLim)(iterLim)(mayStretch)(stretchFactor));
+		REGISTER_CLASS_NAME(StretchPeriodicEngine);
+		REGISTER_BASE_CLASS_NAME(PeriodicEngine);
+	};
+	REGISTER_SERIALIZABLE(StretchPeriodicEngine);
+#endif

=== modified file 'pkg/common/Engine/GlobalEngine/PeriodicPythonRunner.hpp'
--- pkg/common/Engine/GlobalEngine/PeriodicPythonRunner.hpp	2010-01-01 15:21:30 +0000
+++ pkg/common/Engine/GlobalEngine/PeriodicPythonRunner.hpp	2010-02-02 12:26:33 +0000
@@ -4,23 +4,16 @@
 #include<yade/core/Scene.hpp>
 #include<yade/pkg-common/PeriodicEngines.hpp>
 #include<yade/lib-pyutil/gil.hpp>
-/* Execute a python command (in addPlotDataCall) periodically, with defined (and adjustable) periodicity.
- *
- * Period constraints are iterInterval and timeInterval. When either of them is exceeded, the addPlotDataCall is run.
- *
- * Thie engine is primarily conceived for collecting data for yade.plot plots during simulations, hence the name.
- */
-class PeriodicPythonRunner: public StretchPeriodicEngine {
-	private:
-		string command;
+
+class PeriodicPythonRunner: public PeriodicEngine {
 	public :
-		PeriodicPythonRunner(): command("pass"){};
-		/* virtual bool isActivated: not overridden, StretchPeriodicEngine handles that */
-		virtual void action(Scene* b){ pyRunString(command); }
-	REGISTER_ATTRIBUTES(StretchPeriodicEngine,(command));
-	REGISTER_CLASS_NAME(PeriodicPythonRunner);
-	REGISTER_BASE_CLASS_NAME(StretchPeriodicEngine);
+		/* virtual bool isActivated: not overridden, PeriodicEngine handles that */
+		virtual void action(Scene* b){ if(command.size()>0) pyRunString(command); }
+	YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(PeriodicPythonRunner,PeriodicEngine,
+		"Execute a python command (in addPlotDataCall) periodically, with defined (and adjustable) periodicity. See :yref:`PeriodicEngine` documentation for details.",
+		((string,command,"","Command to be run by python interpreter. Not run if empty."))
+		,,
+	);
 };
-
 REGISTER_SERIALIZABLE(PeriodicPythonRunner);
 

=== modified file 'pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp'
--- pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp	2010-01-10 09:09:32 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp	2010-02-02 12:26:33 +0000
@@ -22,24 +22,6 @@
 YADE_REQUIRE_FEATURE(VTK)
 CREATE_LOGGER(VTKRecorder);
 
-VTKRecorder::VTKRecorder() 
-{ 
-	/* we always want to save the first state as well */ 
-	initRun=true; 
-	compress=false;
-	skipFacetIntr=true;
-	skipNondynamic=false;
-}
-
-VTKRecorder::~VTKRecorder()
-{
-	
-}
-
-void VTKRecorder::init(Scene* rootBody)
-{
-}
-
 void VTKRecorder::action(Scene* rootBody)
 {
 	vector<bool> recActive(REC_SENTINEL,false);

=== modified file 'pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp'
--- pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp	2009-12-07 08:07:20 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.hpp	2010-02-02 12:26:33 +0000
@@ -5,23 +5,16 @@
 class VTKRecorder: public PeriodicEngine {
 	public:
 		enum {REC_SPHERES=0,REC_FACETS,REC_COLORS,REC_CPM,REC_INTR,REC_VELOCITY,REC_IDS,REC_CLUMPIDS,REC_SENTINEL};
-		//! A stuff to record: spheres,facets,colors 
-		vector<string> recorders;
-		string fileName;
-		//! turn on compression of the output XML files
-		bool compress;
-		//! skip interactions with facets
-		bool skipFacetIntr;
-		//! skip non-dynamic spheres (not facets)
-		bool skipNondynamic;
-		VTKRecorder(); 
-		~VTKRecorder();
-		void init(Scene*);
 		virtual void action(Scene*);
-	private:
-		
-	REGISTER_ATTRIBUTES(PeriodicEngine,(recorders)(fileName)(compress)(skipNondynamic)(skipFacetIntr));
-	REGISTER_CLASS_AND_BASE(VTKRecorder,PeriodicEngine);
+	YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(VTKRecorder,PeriodicEngine,"Engine recording snapshots of simulation into series of *.vtu files, readable by VTK-based postprocessing programs such as Paraview. Both bodies (spheres and facets) and interactions can be recorded, with various vector/scalar quantities that are defined on them.",
+		((bool,compress,false,"Compress output XML files [experimental]."))
+		((bool,skipFacetIntr,true,"Skip interactions with facets, when saving interactions"))
+		((bool,skipNondynamic,false,"Skip non-dynamic spheres (but not facets)."))
+		((string,fileName,"","Base file name; it will be appended with {spheres,intrs,facets}-243100.vtu depending on active recorders and step number (243100 in this case). It can contain slashes, but the directory must exist already."))
+		((vector<string>,recorders,,"List of active recorders (as strings). Acceptable recorders are spheres, velocity, facets, colors, cpm, intr, ids, clumpids.")),
+		/*ctor*/ initRun=true;,
+		/*py*/
+	);
 	DECLARE_LOGGER;
 };
 REGISTER_SERIALIZABLE(VTKRecorder);

=== modified file 'pkg/dem/meta/RockPM.hpp'
--- pkg/dem/meta/RockPM.hpp	2010-01-27 14:17:05 +0000
+++ pkg/dem/meta/RockPM.hpp	2010-02-02 12:26:33 +0000
@@ -21,8 +21,7 @@
 		virtual void go(shared_ptr<InteractionGeometry>& _geom, shared_ptr<InteractionPhysics>& _phys, Interaction* I, Scene* rootBody);
 		FUNCTOR2D(Dem3DofGeom,RpmPhys);
 		
-	YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(Law2_Dem3DofGeom_RockPMPhys_Rpm,LawFunctor,"Constitutive law for the Rpm model",
-		((int,thisIsJustCap,0,"This is just a cap.")),,);
+	YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(Law2_Dem3DofGeom_RockPMPhys_Rpm,LawFunctor,"Constitutive law for the Rpm model",,,);
 	DECLARE_LOGGER;	
 };
 REGISTER_SERIALIZABLE(Law2_Dem3DofGeom_RockPMPhys_Rpm);

=== modified file 'py/plot.py'
--- py/plot.py	2010-01-24 16:27:40 +0000
+++ py/plot.py	2010-02-02 12:26:33 +0000
@@ -35,8 +35,9 @@
 plotDataCollector=None
 from yade import *
 
+# no longer used
 maxDataLen=1000
-
+## no longer used
 def reduceData(l):
 	"""If we have too much data, take every second value and double the step for DateGetterEngine. This will keep the samples equidistant.
 	"""
@@ -69,7 +70,7 @@
 	import numpy
 	if len(data)>0: numSamples=len(data[data.keys()[0]])
 	else: numSamples=0
-	reduceData(numSamples)
+	#reduceData(numSamples)
 	nan=float('nan')
 	d=(d_in[0] if len(d_in)>0 else {})
 	d.update(**kw)

=== modified file 'py/yadeWrapper/yadeWrapper.cpp'
--- py/yadeWrapper/yadeWrapper.cpp	2010-02-02 09:59:57 +0000
+++ py/yadeWrapper/yadeWrapper.cpp	2010-02-02 12:26:33 +0000
@@ -629,11 +629,11 @@
 	// expose indexable class, with access to the index
 	#define EXPOSE_CXX_CLASS_IX(className) EXPOSE_CXX_CLASS(className).add_property("dispIndex",&Indexable_getClassIndex<className>,"Return class index of this instance.").def("dispHierarchy",&Indexable_getClassIndices<className>,(python::arg("names")=true),"Return list of dispatch classes (from down upwards), starting with the class instance itself, top-level indexable at last. If names is true (default), return class names rather than numerical indices.")
 
-
+#if 0
 	EXPOSE_CXX_CLASS(FileGenerator)
 		.def("generate",&FileGenerator_generate,"Generate scene, save to file")
 		.def("load",&FileGenerator_load,"Generate scene, save to temporary file and load immediately");
-
+#endif
 	python::scope().attr("O")=pyOmega();
 }