yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #03281
[Branch ~yade-dev/yade/trunk] Rev 2004: 1. Fix python registration of CohesiveStateRPMRecorder (YADE_PLUGIN was missing for PeriodicEngin...
------------------------------------------------------------
revno: 2004
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-02-03 14:11:02 +0100
message:
1. Fix python registration of CohesiveStateRPMRecorder (YADE_PLUGIN was missing for PeriodicEngine and Recorder, it seems). Thanks Anton.
added:
pkg/common/Engine/GlobalEngine/PeriodicEngines.cpp
modified:
pkg/common/Engine/GlobalEngine/PeriodicEngines.hpp
pkg/common/Engine/GlobalEngine/Recorder.cpp
pkg/common/Engine/GlobalEngine/Recorder.hpp
pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.cpp
pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.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.
=== added file 'pkg/common/Engine/GlobalEngine/PeriodicEngines.cpp'
--- pkg/common/Engine/GlobalEngine/PeriodicEngines.cpp 1970-01-01 00:00:00 +0000
+++ pkg/common/Engine/GlobalEngine/PeriodicEngines.cpp 2010-02-03 13:11:02 +0000
@@ -0,0 +1,3 @@
+#include<yade/pkg-common/PeriodicEngines.hpp>
+YADE_PLUGIN((PeriodicEngine));
+PeriodicEngine::~PeriodicEngine(){};
=== modified file 'pkg/common/Engine/GlobalEngine/PeriodicEngines.hpp'
--- pkg/common/Engine/GlobalEngine/PeriodicEngines.hpp 2010-02-02 12:26:33 +0000
+++ pkg/common/Engine/GlobalEngine/PeriodicEngines.hpp 2010-02-03 13:11:02 +0000
@@ -8,6 +8,7 @@
class PeriodicEngine: public GlobalEngine {
public:
static Real getClock(){ timeval tp; gettimeofday(&tp,NULL); return tp.tv_sec+tp.tv_usec/1e6; }
+ virtual ~PeriodicEngine(); // vtable
virtual bool isActivated(Scene*){
Real virtNow=Omega::instance().getSimulationTime();
Real realNow=getClock();
=== modified file 'pkg/common/Engine/GlobalEngine/Recorder.cpp'
--- pkg/common/Engine/GlobalEngine/Recorder.cpp 2009-11-29 11:03:25 +0000
+++ pkg/common/Engine/GlobalEngine/Recorder.cpp 2010-02-03 13:11:02 +0000
@@ -1,5 +1,8 @@
// 2009 © Václav Šmilauer <eudoxos@xxxxxxxx>
#include<yade/pkg-common/Recorder.hpp>
+YADE_PLUGIN((Recorder));
+
+Recorder::~Recorder(){}
void Recorder::openAndCheck(){
assert(!out.is_open());
if(file.empty()) throw ios_base::failure(__FILE__ ": Empty filename.");
=== modified file 'pkg/common/Engine/GlobalEngine/Recorder.hpp'
--- pkg/common/Engine/GlobalEngine/Recorder.hpp 2010-01-28 14:22:42 +0000
+++ pkg/common/Engine/GlobalEngine/Recorder.hpp 2010-02-03 13:11:02 +0000
@@ -9,15 +9,18 @@
//! stream object that derived engines should write to
std::ofstream out;
public:
+ virtual ~Recorder(); // vtable
virtual bool isActivated(Scene* rb){
if(PeriodicEngine::isActivated(rb)){
if(!out.is_open()) openAndCheck();
- return true;}
+ return true;
+ }
return false;
}
- YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(Recorder,PeriodicEngine,"Engine periodically storing some data to (one) external file. In addition PeriodicEngine, it handles opening the file as needed. See PeriodicEngine for controlling periodiciy",
+ YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(Recorder,PeriodicEngine,"Engine periodically storing some data to (one) external file. In addition PeriodicEngine, it handles opening the file as needed. See :yref:`PeriodicEngine` for controlling periodicity.",
((std::string,file,,"Name of file to save to; must not be empty."))
((bool,truncate,false,"Whether to delete current file contents, if any, when opening (false by default)"))
- ,,);
+ ,,
+ );
};
REGISTER_SERIALIZABLE(Recorder);
=== modified file 'pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.cpp'
--- pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.cpp 2009-12-04 23:07:34 +0000
+++ pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.cpp 2010-02-03 13:11:02 +0000
@@ -3,17 +3,6 @@
YADE_PLUGIN((CohesiveStateRPMRecorder));
CREATE_LOGGER(CohesiveStateRPMRecorder);
-CohesiveStateRPMRecorder::CohesiveStateRPMRecorder():Recorder(){
- initRun=true; //We want to save the data in the beginning
- numberCohesiveContacts=0;
-}
-
-CohesiveStateRPMRecorder::~CohesiveStateRPMRecorder() {
-}
-
-void CohesiveStateRPMRecorder::init(Scene* rootBody) {
-}
-
void CohesiveStateRPMRecorder::action(Scene* rootBody) {
numberCohesiveContacts=0;
//Check all interactions
=== modified file 'pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.hpp'
--- pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.hpp 2010-02-03 12:16:33 +0000
+++ pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.hpp 2010-02-03 13:11:02 +0000
@@ -6,26 +6,14 @@
#include <yade/pkg-common/InteractionPhysicsFunctor.hpp>
#include <yade/pkg-dem/RockPM.hpp>
-
class CohesiveStateRPMRecorder: public Recorder {
+ std::ofstream outFile;
public:
- int numberCohesiveContacts;
- CohesiveStateRPMRecorder();
- ~CohesiveStateRPMRecorder();
- void init(Scene*);
virtual void action(Scene*);
-
- private:
- std::ofstream outFile;
-
- REGISTER_ATTRIBUTES(Recorder,(numberCohesiveContacts));
- REGISTER_CLASS_AND_BASE(CohesiveStateRPMRecorder,Recorder);
+ YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(CohesiveStateRPMRecorder,Recorder,
+ "Store number of cohesive contacts in RPM model to file.",
+ ((int,numberCohesiveContacts,0,"Number of cohesive contacts found at last run. [-]")),
+ initRun=true;,);
DECLARE_LOGGER;
};
REGISTER_SERIALIZABLE(CohesiveStateRPMRecorder);
-
- /*
- YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(CohesiveStateRPMRecorder,Recorder,"This class is for storing the number of a cohesive contacts in RPM model to file. Class derived from Recorder",
- (( int,numberCohesiveContacts,0,"The number of cohesive contacts [-]")),
- initRun=true;,);
- */
Follow ups