yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #03726
[Branch ~yade-dev/yade/trunk] Rev 2113: Fix compile error ifndef YADE_OPENPM.
------------------------------------------------------------
revno: 2113
committer: Bruno Chareyre <bchareyre@r1arduina>
branch nick: trunk
timestamp: Mon 2010-03-29 16:23:42 +0200
message:
Fix compile error ifndef YADE_OPENPM.
modified:
pkg/dem/Engine/Callback/UnbalancedForceCallbacks.cpp
pkg/dem/Engine/Callback/UnbalancedForceCallbacks.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/Callback/UnbalancedForceCallbacks.cpp'
--- pkg/dem/Engine/Callback/UnbalancedForceCallbacks.cpp 2010-03-20 12:40:44 +0000
+++ pkg/dem/Engine/Callback/UnbalancedForceCallbacks.cpp 2010-03-29 14:23:42 +0000
@@ -14,7 +14,11 @@
cerr<<"("<<(Real)force<<","<<(int)numIntr<<")";
// reset accumulators
+#ifdef YADE_OPENMP
force.reset(); numIntr.reset();
+#else
+ force.reset(0);numIntr.reset(0);
+#endif
// return function pointer
return &SumIntrForcesCb::go;
}
@@ -32,13 +36,19 @@
BodyCallback::FuncPtr SumBodyForcesCb::stepInit(){
cerr<<"{"<<(Real)force<<","<<(int)numBodies<<",this="<<this<<",scene="<<scene<<",forces="<<&(scene->forces)<<"}";
+#ifdef YADE_OPENMP
force.reset(); numBodies.reset(); // reset accumulators
+#else
+ force.reset(0);numBodies.reset(0);
+#endif
return &SumBodyForcesCb::go;
}
void SumBodyForcesCb::go(BodyCallback* _self, Body* b){
if(!b->isDynamic) return;
SumBodyForcesCb* self=static_cast<SumBodyForcesCb*>(_self);
+#ifdef YADE_OPENMP
cerr<<"["<<omp_get_thread_num()<<",#"<<b->id<<",scene="<<self->scene<<"]";
+#endif
cerr<<"[force="<<self->scene->forces.getForce(b->id)<<"]";
self->numBodies+=1;
//self->scene->forces.sync();
=== modified file 'pkg/dem/Engine/Callback/UnbalancedForceCallbacks.hpp'
--- pkg/dem/Engine/Callback/UnbalancedForceCallbacks.hpp 2010-03-16 15:34:25 +0000
+++ pkg/dem/Engine/Callback/UnbalancedForceCallbacks.hpp 2010-03-29 14:23:42 +0000
@@ -8,9 +8,13 @@
// zero values, so that we can pass pointers to them to OpenMPAccumulator
static int int0;
static Real Real0;
-
+#ifdef YADE_OPENMP
OpenMPAccumulator<int,&SumIntrForcesCb::int0> numIntr;
OpenMPAccumulator<Real,&SumIntrForcesCb::Real0> force;
+#else
+ OpenMPAccumulator<int> numIntr;
+ OpenMPAccumulator<Real> force;
+#endif
static void go(IntrCallback*,Interaction*);
virtual IntrCallback::FuncPtr stepInit();
YADE_CLASS_BASE_DOC(SumIntrForcesCb,IntrCallback,"Callback summing magnitudes of forces over all interactions. :yref:`InteractionPhysics` of interactions must derive from :yref:`NormShearPhys` (responsability fo the user).");
@@ -20,8 +24,13 @@
class SumBodyForcesCb: public BodyCallback{
Scene* scene;
public:
+#ifdef YADE_OPENMP
OpenMPAccumulator<int,&SumIntrForcesCb::int0> numBodies;
OpenMPAccumulator<Real,&SumIntrForcesCb::Real0> force;
+#else
+ OpenMPAccumulator<int> numBodies;
+ OpenMPAccumulator<Real> force;
+#endif
static void go(BodyCallback*,Body*);
virtual BodyCallback::FuncPtr stepInit();
YADE_CLASS_BASE_DOC(SumBodyForcesCb,BodyCallback,"Callback summing magnitudes of resultant forces over :yref:`dynamic<Body::isDynamic>` bodies.");
Follow ups