yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #05522
[Branch ~yade-dev/yade/trunk] Rev 2399: 1. Integrate BoundDispatcher into Collider, its python ctor takes list of BoundFunctors now
------------------------------------------------------------
revno: 2399
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Sun 2010-08-15 18:30:00 +0200
message:
1. Integrate BoundDispatcher into Collider, its python ctor takes list of BoundFunctors now
2. Warning and help if BoundDispatcher is used directly (more precisely: if Collider has no BoundFunctors defined and there is BoundDispatcher in O.engines)
3. Remove Body(id,mask) ctor as it bypasses default value initializers
4. Adjust preprocessors to the previous item
renamed:
core/Collider.cpp => pkg/common/Engine/GlobalEngine/Collider.cpp
core/Collider.hpp => pkg/common/Engine/GlobalEngine/Collider.hpp
modified:
core/Body.cpp
core/Body.hpp
core/Bound.hpp
core/SConscript
core/Shape.hpp
core/corePlugins.cpp
examples/simple-scene/simple-scene.py
gui/SConscript
pkg/common/Engine/Dispatcher/InteractionDispatchers.hpp
pkg/common/Engine/GlobalEngine/InsertionSortCollider.cpp
pkg/common/Engine/GlobalEngine/InsertionSortCollider.hpp
pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.cpp
pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.hpp
pkg/common/Engine/GlobalEngine/ResetRandomPosition.hpp
pkg/common/Engine/GlobalEngine/SpatialQuickSortCollider.cpp
pkg/common/Engine/GlobalEngine/SpatialQuickSortCollider.hpp
pkg/common/Engine/GlobalEngine/SpheresFactory.cpp
pkg/common/Engine/GlobalEngine/SpheresFactory.hpp
pkg/common/Engine/PartialEngine/ForceEngine.cpp
pkg/common/RenderingEngine/Gl1_Aabb.cpp
pkg/dem/Engine/GlobalEngine/FlatGridCollider.hpp
pkg/dem/PreProcessor/CapillaryTriaxialTest.cpp
pkg/dem/PreProcessor/CohesiveTriaxialTest.cpp
pkg/dem/PreProcessor/STLImporter.cpp
pkg/dem/PreProcessor/STLImporterTest.cpp
pkg/dem/PreProcessor/SimpleShear.cpp
pkg/dem/PreProcessor/TriaxialTest.cpp
py/utils.py
py/wrapper/yadeWrapper.cpp
pkg/common/Engine/GlobalEngine/Collider.cpp
pkg/common/Engine/GlobalEngine/Collider.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/Body.cpp'
--- core/Body.cpp 2010-08-15 05:27:53 +0000
+++ core/Body.cpp 2010-08-15 16:30:00 +0000
@@ -20,5 +20,4 @@
const shared_ptr<Body>& Body::byId(Body::id_t _id, Scene* rb){return (*((rb?rb:Omega::instance().getScene().get())->bodies))[_id];}
const shared_ptr<Body>& Body::byId(Body::id_t _id, shared_ptr<Scene> rb){return (*(rb->bodies))[_id];}
-Body::Body(Body::id_t newId, int newGroup): id(newId), groupMask(newGroup), state(shared_ptr<State>(new State)), clumpId(ID_NONE){}
=== modified file 'core/Body.hpp'
--- core/Body.hpp 2010-08-15 12:48:54 +0000
+++ core/Body.hpp 2010-08-15 16:30:00 +0000
@@ -62,14 +62,11 @@
// only BodyContainer can set the id of a body
friend class BodyContainer;
- // Constructor/Destructor
- Body (Body::id_t newId, int newGroup);
-
YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(Body,Serializable,"A particle, basic element of simulation; interacts with other bodies.",
((Body::id_t,id,Body::ID_NONE,"[will be overridden]"))
((int,groupMask,1,"Bitmask for determining interactions."))
- ((int,flags,FLAG_DYNAMIC | FLAG_BOUNDED,"DO NOT ACCESS DIRECTLY; documented below"))
+ ((int,flags,FLAG_DYNAMIC|FLAG_BOUNDED,"DO NOT ACCESS DIRECTLY; documented below"))
((shared_ptr<Material>,material,,":yref:`Material` instance associated with this body."))
((shared_ptr<State>,state,new State,"Physical :yref:`state<State>`."))
=== modified file 'core/Bound.hpp'
--- core/Bound.hpp 2010-04-25 13:18:11 +0000
+++ core/Bound.hpp 2010-08-15 16:30:00 +0000
@@ -22,8 +22,10 @@
class Bound: public Serializable, public Indexable{
public:
Vector3r min,max;
- YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(Bound,Serializable,"Object bounding part of space taken by associated body; might be larger, used to optimalize collision detection",
- ((Vector3r,diffuseColor,Vector3r(1,1,1),"Color for rendering this object")),
+ YADE_CLASS_BASE_DOC_ATTRS_DEPREC_INIT_CTOR_PY(Bound,Serializable,"Object bounding part of space taken by associated body; might be larger, used to optimalize collision detection",
+ ((Vector3r,color,Vector3r(1,1,1),"Color for rendering this object")),
+ /*deprec*/ ((diffuseColor,color,"For consistency with Shape.color")),
+ /* init */,
/* ctor*/ min=max=Vector3r::Zero(),
/*py*/
YADE_PY_TOPINDEXABLE(Bound)
=== modified file 'core/SConscript'
--- core/SConscript 2010-07-24 18:10:24 +0000
+++ core/SConscript 2010-08-15 16:30:00 +0000
@@ -31,7 +31,6 @@
'BodyContainer.cpp',
'Bound.cpp',
'Cell.cpp',
- 'Collider.cpp',
'PartialEngine.cpp',
'Engine.cpp',
'FileGenerator.cpp',
=== modified file 'core/Shape.hpp'
--- core/Shape.hpp 2010-03-27 22:18:10 +0000
+++ core/Shape.hpp 2010-08-15 16:30:00 +0000
@@ -16,20 +16,17 @@
class BoundFunctor;
-class Shape : public Serializable, public Indexable
-{
- public :
+class Shape: public Serializable, public Indexable {
+ public:
~Shape(); // vtable
#ifdef BV_FUNCTOR_CACHE
shared_ptr<BoundFunctor> boundFunctor;
#endif
- YADE_CLASS_BASE_DOC_ATTRS_DEPREC_INIT_CTOR_PY(Shape,Serializable,"Geometry of a body",
+ YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(Shape,Serializable,"Geometry of a body",
((Vector3r,color,Vector3r(1,1,1),"Color for rendering (normalized RGB)."))
((bool,wire,false,"Whether this Shape is rendered using color surfaces, or only wireframe (can still be overridden by global config of the renderer)."))
((bool,highlight,false,"Whether this Shape will be highlighted when rendered.")),
- /*deprec*/((diffuseColor,color,"The old name was too long.")),
- /*init*/,
/*ctor*/,
/*py*/ YADE_PY_TOPINDEXABLE(Shape)
);
=== modified file 'core/corePlugins.cpp'
--- core/corePlugins.cpp 2010-03-22 12:32:38 +0000
+++ core/corePlugins.cpp 2010-08-15 16:30:00 +0000
@@ -3,7 +3,6 @@
#include<yade/core/Body.hpp>
#include<yade/core/Bound.hpp>
#include<yade/core/Cell.hpp>
-#include<yade/core/Collider.hpp>
#include<yade/core/Dispatcher.hpp>
#include<yade/core/Engine.hpp>
#include<yade/core/FileGenerator.hpp>
@@ -17,4 +16,4 @@
#include<yade/core/Shape.hpp>
#include<yade/core/State.hpp>
#include<yade/core/TimeStepper.hpp>
-YADE_PLUGIN((Body)(Bound)(Cell)(Collider)(Dispatcher)(Engine)(FileGenerator)(Functor)(GlobalEngine)(Interaction)(InteractionGeometry)(InteractionPhysics)(Material)(PartialEngine)(Shape)(State)(TimeStepper));
+YADE_PLUGIN((Body)(Bound)(Cell)(Dispatcher)(Engine)(FileGenerator)(Functor)(GlobalEngine)(Interaction)(InteractionGeometry)(InteractionPhysics)(Material)(PartialEngine)(Shape)(State)(TimeStepper));
=== modified file 'examples/simple-scene/simple-scene.py'
--- examples/simple-scene/simple-scene.py 2010-07-16 10:25:03 +0000
+++ examples/simple-scene/simple-scene.py 2010-08-15 16:30:00 +0000
@@ -96,14 +96,14 @@
# set the isDynamic body attribute
b.dynamic=False
# Assign geometrical model (shape) to the body: a box of given size
- b.shape=Box(extents=[.5,.5,.5],diffuseColor=[1,0,0])
+ b.shape=Box(extents=[.5,.5,.5],color=[1,0,0])
# physical parameters:
# store mass to a temporary
mass=8*.5*.5*.5*2400
# * se3 (position & orientation) as 3 position coordinates, then 3 direction axis coordinates and rotation angle
b.phys=BodyMacroParameters(se3=[0,0,0,1,0,0,0],mass=mass,inertia=[mass*4*(.5**2+.5**2),mass*4*(.5**2+.5**2),mass*4*(.5**2+.5**2)],young=30e9,poisson=.3)
# other information about Aabb will be updated during simulation by relevant BoundDispatcher
- b.bound=Aabb(diffuseColor=[0,1,0])
+ b.bound=Aabb(color=[0,1,0])
# add the body to the simulation
o.bodies.append(b)
=== modified file 'gui/SConscript'
--- gui/SConscript 2010-08-15 04:19:57 +0000
+++ gui/SConscript 2010-08-15 16:30:00 +0000
@@ -6,7 +6,6 @@
env.Install('$PREFIX/lib/yade$SUFFIX/py/yade/qt',[
env.File('qt4/img_rc.py'),
env.File('qt4/ui_controller.py'),
- env.File('qt4/ui_SeqSerializable.py'),
env.File('qt4/SerializableEditor.py'),
env.File('qt4/Inspector.py'),
env.File('qt4/__init__.py'),
=== modified file 'pkg/common/Engine/Dispatcher/InteractionDispatchers.hpp'
--- pkg/common/Engine/Dispatcher/InteractionDispatchers.hpp 2010-08-15 05:27:53 +0000
+++ pkg/common/Engine/Dispatcher/InteractionDispatchers.hpp 2010-08-15 16:30:00 +0000
@@ -33,9 +33,9 @@
#endif
,
/*py*/
- .def_readonly("geomDispatcher",&InteractionDispatchers::geomDispatcher,"InteractionGeometryDispatcher object that is used for dispatch.")
- .def_readonly("physDispatcher",&InteractionDispatchers::physDispatcher,"InteractionPhysicsDispatcher object used for dispatch.")
- .def_readonly("lawDispatcher",&InteractionDispatchers::lawDispatcher,"LawDispatcher object used for dispatch.");
+ .def_readonly("geomDispatcher",&InteractionDispatchers::geomDispatcher,":yref:`InteractionGeometryDispatcher` object that is used for dispatch.")
+ .def_readonly("physDispatcher",&InteractionDispatchers::physDispatcher,":yref:`InteractionPhysicsDispatcher` object used for dispatch.")
+ .def_readonly("lawDispatcher",&InteractionDispatchers::lawDispatcher,":yref:`LawDispatcher` object used for dispatch.");
);
DECLARE_LOGGER;
};
=== renamed file 'core/Collider.cpp' => 'pkg/common/Engine/GlobalEngine/Collider.cpp'
--- core/Collider.cpp 2010-05-14 10:01:37 +0000
+++ pkg/common/Engine/GlobalEngine/Collider.cpp 2010-08-15 16:30:00 +0000
@@ -6,9 +6,9 @@
* GNU General Public License v2 or later. See file LICENSE for details. *
*************************************************************************/
-#include "Collider.hpp"
+#include<yade/pkg-common/Collider.hpp>
-Collider::~Collider(){}
+YADE_PLUGIN((Collider));
bool Collider::mayCollide(const Body* b1, const Body* b2){
return
@@ -24,3 +24,22 @@
}
+void Collider::pyHandleCustomCtorArgs(python::tuple& t, python::dict& d){
+ if(python::len(t)==0) return; // nothing to do
+ if(python::len(t)!=1) throw invalid_argument(("Collider optionally takes exactly one list of BoundFunctor's as non-keyword argument for constructor ("+lexical_cast<string>(python::len(t))+" non-keyword ards given instead)").c_str());
+ typedef std::vector<shared_ptr<BoundFunctor> > vecBound;
+ vecBound vb=python::extract<vecBound>(t[0])();
+ FOREACH(shared_ptr<BoundFunctor> bf, vb) this->boundDispatcher->add(bf);
+ t=python::tuple(); // empty the args
+}
+
+void Collider::findBoundDispatcherInEnginesIfNoFunctorsAndWarn(){
+ if(boundDispatcher->functors.size()>0) return;
+ shared_ptr<BoundDispatcher> bd;
+ FOREACH(shared_ptr<Engine>& e, scene->engines){ bd=dynamic_pointer_cast<BoundDispatcher>(e); if(bd) break; }
+ if(!bd) return;
+ LOG_WARN("Collider.boundDispatcher had no functors defined, while there was a BoundDispatcher found in O.engines. Since version 0.60 (r2396), Collider has boundDispatcher integrated in itself; separate BoundDispatcher should not be used anymore. For now, I will fix it for you, but change your script! Where it reads e.g.\n\n\tO.engines=[...,\n\t\tBoundDispatcher([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),\n\t\t"<<getClassName()<<"(),\n\t\t...\n\t]\n\nit should become\n\n\tO.engines=[...,\n\t\t"<<getClassName()<<"([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),\n\t\t...\n\t]\n\ninstead.")
+ boundDispatcher=bd;
+ boundDispatcher->activated=false; // deactivate in the engine loop, the collider will call it itself
+}
+
=== renamed file 'core/Collider.hpp' => 'pkg/common/Engine/GlobalEngine/Collider.hpp'
--- core/Collider.hpp 2010-08-15 05:27:53 +0000
+++ pkg/common/Engine/GlobalEngine/Collider.hpp 2010-08-15 16:30:00 +0000
@@ -12,29 +12,36 @@
#include<yade/core/Interaction.hpp>
#include<yade/core/GlobalEngine.hpp>
-class Collider : public GlobalEngine
-{
- public :
- virtual ~Collider();
- /*! To probe the Bound on a bodies presense.
- *
- * returns list of body ids with which there is potential overlap.
- */
+#include<yade/pkg-common/Dispatching.hpp>
+
+class Collider: public GlobalEngine {
+ public:
+ /*! Probe the Bound on a bodies presense. Returns list of body ids with which there is potential overlap. */
virtual vector<Body::id_t> probeBoundingVolume(const Bound&){throw;}
/*! Tell whether given bodies may interact, for other than spatial reasons.
*
* Concrete collider implementations should call this function if
- * the bodies are in potential interaction geometrically.
- */
+ * the bodies are in potential interaction geometrically. */
bool mayCollide(const Body*, const Body*);
-
/*! Invalidate all persistent data (if the collider has any), forcing reinitialization at next run.
The default implementation does nothing, colliders should override it if it is applicable.
Currently used from Shop::flipCell, which changes cell information for bodies.
*/
virtual void invalidatePersistentData(){}
- YADE_CLASS_BASE_DOC(Collider,GlobalEngine,"Abstract class for finding spatial collisions between bodies.");
+
+ // ctor with functors for the integrated BoundDispatcher
+ virtual void pyHandleCustomCtorArgs(python::tuple& t, python::dict& d);
+
+ // backwards-compatility func, can be removed later
+ void findBoundDispatcherInEnginesIfNoFunctorsAndWarn();
+
+
+ YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(Collider,GlobalEngine,"Abstract class for finding spatial collisions between bodies. \n\n.. admonition:: Special constructor\n\n\tDerived colliders (unless they override ``pyHandleCustomCtorArgs``) can be given list of :yref:`BoundFunctors <BoundFunctor>` which is used to initialize the internal :yref:`boundDispatcher <Collider.boundDispatcher>` instance.",
+ ((shared_ptr<BoundDispatcher>,boundDispatcher,new BoundDispatcher,"[overridden below to be read-only]")),
+ /*ctor*/,
+ .def_readonly("boundDispatcher",&Collider::boundDispatcher,":yref:`BoundDispatcher` object that is used for creating :yref:`bounds <Body.bound>` on collider's request as necessary.")
+ );
};
REGISTER_SERIALIZABLE(Collider);
=== modified file 'pkg/common/Engine/GlobalEngine/InsertionSortCollider.cpp'
--- pkg/common/Engine/GlobalEngine/InsertionSortCollider.cpp 2010-08-15 05:27:53 +0000
+++ pkg/common/Engine/GlobalEngine/InsertionSortCollider.cpp 2010-08-15 16:30:00 +0000
@@ -66,7 +66,7 @@
}
vector<Body::id_t> InsertionSortCollider::probeBoundingVolume(const Bound& bv){
- if(periodic){ LOG_FATAL("Probing with periodic boundary not implemented."); abort(); }
+ if(periodic){ throw invalid_argument("InsertionSortCollider::probeBoundingVolume: handling periodic boundary not implemented."); }
vector<Body::id_t> ret;
for( vector<Bounds>::iterator
it=BB[0].vec.begin(),et=BB[0].vec.end(); it < et; ++it)
@@ -146,7 +146,14 @@
// update periodicity
assert(BB[0].axis==0); assert(BB[1].axis==1); assert(BB[2].axis==2);
- if(periodic) for(int i=0; i<3; i++) BB[i].updatePeriodicity(scene);
+ if(periodic) for(int i=0; i<3; i++) BB[i].updatePeriodicity(scene);
+
+ // compatibility block, can be removed later
+ findBoundDispatcherInEnginesIfNoFunctorsAndWarn();
+
+ // update bounds via boundDispatcher
+ boundDispatcher->scene=scene;
+ boundDispatcher->action();
// STRIDE
@@ -154,7 +161,7 @@
// get NewtonIntegrator, to ask for the maximum velocity value
if(!newton){
FOREACH(shared_ptr<Engine>& e, scene->engines){ newton=dynamic_pointer_cast<NewtonIntegrator>(e); if(newton) break; }
- if(!newton){ LOG_FATAL("Unable to locate NewtonIntegrator within engines, aborting."); abort(); }
+ if(!newton){ throw runtime_error("InsertionSortCollider.sweepLength>0, but unable to locate NewtonIntegrator within O.engines."); }
}
}
ISC_CHECKPOINT("init");
@@ -166,16 +173,6 @@
}
if(strideActive){
assert(sweepLength>0);
- // get the BoundDispatcher and turn it off; we will call it ourselves
- if(!boundDispatcher){
- FOREACH(shared_ptr<Engine>& e, scene->engines){ boundDispatcher=dynamic_pointer_cast<BoundDispatcher>(e); if(boundDispatcher) break; }
- if(!boundDispatcher){ LOG_FATAL("Unable to locate BoundDispatcher within engines, aborting."); abort(); }
- boundDispatcher->activated=false; // deactive the engine, we will call it ourselves from now (just when needed)
- } else {
- // if we just hijacked it, it was already called in this step; only call it explicitly if we already had it
- boundDispatcher->scene=scene;
- boundDispatcher->action();
- }
if(nBins<=0){
// reset bins, in case they were active but are not anymore
if(newton->velocityBins) newton->velocityBins=shared_ptr<VelocityBins>(); if(boundDispatcher->velocityBins) boundDispatcher->velocityBins=shared_ptr<VelocityBins>();
@@ -199,14 +196,7 @@
newton->velocityBins->setBins(scene,newton->maxVelocitySq,sweepLength);
}
} else { /* !strideActive */
- if(boundDispatcher){
- // stride was active (since we own boundDispatcher) but is not now anymore
- // was not yet run in this step, do it now
- boundDispatcher->scene=scene;
- boundDispatcher->action();
- // release boundDispatcher and let it do its work by itself from now on
- boundDispatcher->activated=true;
- }
+ boundDispatcher->sweepDist=0;
}
ISC_CHECKPOINT("bound");
=== modified file 'pkg/common/Engine/GlobalEngine/InsertionSortCollider.hpp'
--- pkg/common/Engine/GlobalEngine/InsertionSortCollider.hpp 2010-08-15 05:27:53 +0000
+++ pkg/common/Engine/GlobalEngine/InsertionSortCollider.hpp 2010-08-15 16:30:00 +0000
@@ -1,7 +1,7 @@
// 2009 © Václav Šmilauer <eudoxos@xxxxxxxx>
#pragma once
-#include<yade/core/Collider.hpp>
+#include<yade/pkg-common/Collider.hpp>
#include<yade/core/Scene.hpp>
class InteractionContainer;
@@ -81,7 +81,6 @@
#define ISC_CHECKPOINT(cpt)
#endif
-class BoundDispatcher;
class NewtonIntegrator;
class InsertionSortCollider: public Collider{
@@ -110,8 +109,6 @@
int watch1, watch2;
bool watchIds(Body::id_t id1,Body::id_t id2) const { return (watch1<0 &&(watch2==id1||watch2==id2))||(watch2<0 && (watch1==id1||watch1==id2))||(watch1==id1 && watch2==id2)||(watch1==id2 && watch2==id1); }
#endif
- // keep this dispatcher and call it ourselves as needed
- shared_ptr<BoundDispatcher> boundDispatcher;
// we need this to find out about current maxVelocitySq
shared_ptr<NewtonIntegrator> newton;
// if False, no type of striding is used
=== modified file 'pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.cpp'
--- pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.cpp 2010-08-15 05:27:53 +0000
+++ pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.cpp 2010-08-15 16:30:00 +0000
@@ -40,6 +40,11 @@
void PersistentTriangulationCollider::action ()
{
+ // compatibility func, can be removed later
+ findBoundDispatcherInEnginesIfNoFunctorsAndWarn();
+ // update bounds
+ boundDispatcher->scene=scene; boundDispatcher->action();
+
shared_ptr<BodyContainer> bodies=scene->bodies;
bool triangulationIteration = false;
=== modified file 'pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.hpp'
--- pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.hpp 2010-04-18 17:40:36 +0000
+++ pkg/common/Engine/GlobalEngine/PersistentTriangulationCollider.hpp 2010-08-15 16:30:00 +0000
@@ -7,7 +7,7 @@
*************************************************************************/
#pragma once
-#include<yade/core/Collider.hpp>
+#include<yade/pkg-common/Collider.hpp>
#include<yade/core/InteractionContainer.hpp>
#include <list>
#include <set>
=== modified file 'pkg/common/Engine/GlobalEngine/ResetRandomPosition.hpp'
--- pkg/common/Engine/GlobalEngine/ResetRandomPosition.hpp 2010-08-15 05:27:53 +0000
+++ pkg/common/Engine/GlobalEngine/ResetRandomPosition.hpp 2010-08-15 16:30:00 +0000
@@ -9,7 +9,7 @@
#include <yade/pkg-common/PeriodicEngines.hpp>
#include <yade/pkg-common/Dispatching.hpp>
-#include <yade/core/Collider.hpp>
+#include <yade/pkg-common/Collider.hpp>
#include <yade/core/Scene.hpp>
#include <vector>
#include <string>
=== modified file 'pkg/common/Engine/GlobalEngine/SpatialQuickSortCollider.cpp'
--- pkg/common/Engine/GlobalEngine/SpatialQuickSortCollider.cpp 2010-08-15 05:27:53 +0000
+++ pkg/common/Engine/GlobalEngine/SpatialQuickSortCollider.cpp 2010-08-15 16:30:00 +0000
@@ -16,6 +16,12 @@
void SpatialQuickSortCollider::action()
{
if(scene->isPeriodic){ throw runtime_error("SpatialQuickSortCollider doesn't handle periodic boundaries."); }
+
+ // compatibility func, can be removed later
+ findBoundDispatcherInEnginesIfNoFunctorsAndWarn();
+ // update bounds
+ boundDispatcher->scene=scene; boundDispatcher->action();
+
const shared_ptr<BodyContainer>& bodies = scene->bodies;
// This collider traverses all interactions at every step, therefore all interactions
=== modified file 'pkg/common/Engine/GlobalEngine/SpatialQuickSortCollider.hpp'
--- pkg/common/Engine/GlobalEngine/SpatialQuickSortCollider.hpp 2010-03-20 12:40:44 +0000
+++ pkg/common/Engine/GlobalEngine/SpatialQuickSortCollider.hpp 2010-08-15 16:30:00 +0000
@@ -7,7 +7,7 @@
*************************************************************************/
#pragma once
-#include <yade/core/Collider.hpp>
+#include <yade/pkg-common/Collider.hpp>
#include <yade/core/InteractionContainer.hpp>
#include <vector>
=== modified file 'pkg/common/Engine/GlobalEngine/SpheresFactory.cpp'
--- pkg/common/Engine/GlobalEngine/SpheresFactory.cpp 2010-08-15 05:27:53 +0000
+++ pkg/common/Engine/GlobalEngine/SpheresFactory.cpp 2010-08-15 16:30:00 +0000
@@ -138,7 +138,7 @@
}
void SpheresFactory::createSphere(shared_ptr<Body>& body, const Vector3r& position, Real r)
{
- body = shared_ptr<Body>(new Body(Body::id_t(0),1));
+ body = shared_ptr<Body>(new Body); body->groupMask=1;
shared_ptr<BodyMacroParameters> physics(new BodyMacroParameters);
shared_ptr<Aabb> aabb(new Aabb);
shared_ptr<Sphere> iSphere(new Sphere);
@@ -163,10 +163,10 @@
if (poisson) physics->poisson = poisson;
if (frictionAngle) physics->frictionAngle = frictionAngle;
- aabb->diffuseColor = Vector3r(0,1,0);
+ aabb->color = Vector3r(0,1,0);
iSphere->radius = r;
- iSphere->diffuseColor = Vector3r(0.8,0.3,0.3);
+ iSphere->color = Vector3r(0.8,0.3,0.3);
body->shape = iSphere;
body->bound = aabb;
=== modified file 'pkg/common/Engine/GlobalEngine/SpheresFactory.hpp'
--- pkg/common/Engine/GlobalEngine/SpheresFactory.hpp 2010-08-15 05:27:53 +0000
+++ pkg/common/Engine/GlobalEngine/SpheresFactory.hpp 2010-08-15 16:30:00 +0000
@@ -9,7 +9,7 @@
#include <yade/pkg-common/PeriodicEngines.hpp>
#include <yade/pkg-common/Dispatching.hpp>
-#include <yade/core/Collider.hpp>
+#include <yade/pkg-common/Collider.hpp>
#include <yade/core/Scene.hpp>
#include <vector>
#include <string>
=== modified file 'pkg/common/Engine/PartialEngine/ForceEngine.cpp'
--- pkg/common/Engine/PartialEngine/ForceEngine.cpp 2010-08-15 05:27:53 +0000
+++ pkg/common/Engine/PartialEngine/ForceEngine.cpp 2010-08-15 16:30:00 +0000
@@ -7,6 +7,9 @@
#include<yade/pkg-common/LinearInterpolate.hpp>
#include<yade/pkg-dem/Shop.hpp>
+#include<yade/core/InteractionGeometry.hpp>
+#include<yade/core/InteractionPhysics.hpp>
+
YADE_PLUGIN((ForceEngine)(InterpolatingDirectedForceEngine));
void ForceEngine::action(){
=== modified file 'pkg/common/RenderingEngine/Gl1_Aabb.cpp'
--- pkg/common/RenderingEngine/Gl1_Aabb.cpp 2010-05-04 13:56:05 +0000
+++ pkg/common/RenderingEngine/Gl1_Aabb.cpp 2010-08-15 16:30:00 +0000
@@ -13,7 +13,7 @@
void Gl1_Aabb::go(const shared_ptr<Bound>& bv, Scene* scene){
Aabb* aabb = static_cast<Aabb*>(bv.get());
- glColor3v(bv->diffuseColor);
+ glColor3v(bv->color);
// glDisable(GL_LIGHTING);
if(!scene->isPeriodic){
glTranslatev(Vector3r(.5*(aabb->min+aabb->max)));
=== modified file 'pkg/dem/Engine/GlobalEngine/FlatGridCollider.hpp'
--- pkg/dem/Engine/GlobalEngine/FlatGridCollider.hpp 2010-08-15 05:27:53 +0000
+++ pkg/dem/Engine/GlobalEngine/FlatGridCollider.hpp 2010-08-15 16:30:00 +0000
@@ -1,6 +1,6 @@
// 2009 © Václav Šmilauer <eudoxos@xxxxxxxx>
#include<vector>
-#include<yade/core/Collider.hpp>
+#include<yade/pkg-common/Collider.hpp>
class NewtonIntegrator;
class FlatGridCollider: public Collider{
struct Grid{
=== modified file 'pkg/dem/PreProcessor/CapillaryTriaxialTest.cpp'
--- pkg/dem/PreProcessor/CapillaryTriaxialTest.cpp 2010-08-15 05:27:53 +0000
+++ pkg/dem/PreProcessor/CapillaryTriaxialTest.cpp 2010-08-15 16:30:00 +0000
@@ -289,7 +289,7 @@
void CapillaryTriaxialTest::createSphere(shared_ptr<Body>& body, Vector3r position, Real radius, bool big, bool dynamic )
{
- body = shared_ptr<Body>(new Body(Body::id_t(0),2));
+ body = shared_ptr<Body>(new Body); body->groupMask=2;
shared_ptr<FrictMat> physics(new FrictMat);
shared_ptr<Aabb> aabb(new Aabb);
@@ -320,7 +320,7 @@
physics->frictionAngle = boxFrictionDeg * Mathr::PI/180.0;
}
- aabb->diffuseColor = Vector3r(0,1,0);
+ aabb->color = Vector3r(0,1,0);
iSphere->radius = radius;
iSphere->color = Vector3r(Mathr::UnitRandom(),Mathr::UnitRandom(),Mathr::UnitRandom());
@@ -334,7 +334,7 @@
void CapillaryTriaxialTest::createBox(shared_ptr<Body>& body, Vector3r position, Vector3r extents, bool wire)
{
- body = shared_ptr<Body>(new Body(Body::id_t(0),2));
+ body = shared_ptr<Body>(new Body); body->groupMask=2;
shared_ptr<FrictMat> physics(new FrictMat);
shared_ptr<Aabb> aabb(new Aabb);
shared_ptr<Box> iBox(new Box);
@@ -358,7 +358,7 @@
physics->poisson = boxKsDivKn;
physics->frictionAngle = boxFrictionDeg * Mathr::PI/180.0;
- aabb->diffuseColor = Vector3r(1,0,0);
+ aabb->color = Vector3r(1,0,0);
iBox->extents = extents;
iBox->color = Vector3r(1,1,1);
=== modified file 'pkg/dem/PreProcessor/CohesiveTriaxialTest.cpp'
--- pkg/dem/PreProcessor/CohesiveTriaxialTest.cpp 2010-08-15 05:27:53 +0000
+++ pkg/dem/PreProcessor/CohesiveTriaxialTest.cpp 2010-08-15 16:30:00 +0000
@@ -203,7 +203,7 @@
void CohesiveTriaxialTest::createSphere(shared_ptr<Body>& body, Vector3r position, Real radius, bool dynamic )
{
- body = shared_ptr<Body>(new Body(Body::id_t(0),2));
+ body = shared_ptr<Body>(new Body); body->groupMask=2;
shared_ptr<CohFrictMat> physics(new CohFrictMat);
shared_ptr<Aabb> aabb(new Aabb);
shared_ptr<Sphere> iSphere(new Sphere);
@@ -232,7 +232,7 @@
physics->frictionAngle = boxFrictionDeg * Mathr::PI/180.0;
}
- aabb->diffuseColor = Vector3r(0,1,0);
+ aabb->color = Vector3r(0,1,0);
iSphere->radius = radius;
iSphere->color = Vector3r(Mathr::UnitRandom(),Mathr::UnitRandom(),Mathr::UnitRandom());
@@ -246,7 +246,7 @@
void CohesiveTriaxialTest::createBox(shared_ptr<Body>& body, Vector3r position, Vector3r extents, bool wire)
{
- body = shared_ptr<Body>(new Body(Body::id_t(0),2));
+ body = shared_ptr<Body>(new Body); body->groupMask=2;
shared_ptr<CohFrictMat> physics(new CohFrictMat);
shared_ptr<Aabb> aabb(new Aabb);
@@ -271,7 +271,7 @@
physics->poisson = boxKsDivKn;
physics->frictionAngle = boxFrictionDeg * Mathr::PI/180.0;
- aabb->diffuseColor = Vector3r(1,0,0);
+ aabb->color = Vector3r(1,0,0);
iBox->extents = extents;
iBox->color = Vector3r(1,1,1);
@@ -356,7 +356,7 @@
void CohesiveTriaxialTest::positionRootBody(shared_ptr<Scene>& rootBody)
{
shared_ptr<Aabb> aabb(new Aabb);
- aabb->diffuseColor = Vector3r(0,0,1);
+ aabb->color = Vector3r(0,0,1);
}
=== modified file 'pkg/dem/PreProcessor/STLImporter.cpp'
--- pkg/dem/PreProcessor/STLImporter.cpp 2010-05-06 10:11:20 +0000
+++ pkg/dem/PreProcessor/STLImporter.cpp 2010-08-15 16:30:00 +0000
@@ -39,7 +39,7 @@
iFacet->vertices[j]=v[j]-icc;
}
//iFacet->postProcessAttributes(true); //postProcessAttributes is protected
- shared_ptr<Body> b(new Body());
+ shared_ptr<Body> b(new Body);
b->state->pos=b->state->refPos=icc;
b->state->ori=b->state->refOri=Quaternionr::Identity();
b->shape = iFacet;
=== modified file 'pkg/dem/PreProcessor/STLImporterTest.cpp'
--- pkg/dem/PreProcessor/STLImporterTest.cpp 2010-08-15 05:27:53 +0000
+++ pkg/dem/PreProcessor/STLImporterTest.cpp 2010-08-15 16:30:00 +0000
@@ -90,7 +90,7 @@
// create bodies
for(int i=0,e=imp.number_of_facets;i<e;++i)
{
- shared_ptr<Body> b(new Body(Body::id_t(0),1));
+ shared_ptr<Body> b(new Body); b->groupMask=1;
b->setDynamic(false);
@@ -107,7 +107,7 @@
// bounding box
shared_ptr<Aabb> aabb(new Aabb);
- aabb->diffuseColor = Vector3r(0,1,0);
+ aabb->color = Vector3r(0,1,0);
b->bound = aabb;
rootBody->bodies->insert(b);
@@ -143,7 +143,7 @@
void STLImporterTest::createSphere(shared_ptr<Body>& body, int i, int j, int k)
{
- body = shared_ptr<Body>(new Body(Body::id_t(0),1));
+ body = shared_ptr<Body>(new Body); body->groupMask(1);
shared_ptr<BodyMacroParameters> physics(new BodyMacroParameters);
shared_ptr<Aabb> aabb(new Aabb);
shared_ptr<Sphere> iSphere(new Sphere);
@@ -167,10 +167,10 @@
physics->poisson = spherePoissonRatio;
physics->frictionAngle = sphereFrictionDeg * Mathr::PI/180.0;
- aabb->diffuseColor = Vector3r(0,1,0);
+ aabb->color = Vector3r(0,1,0);
iSphere->radius = radius;
- iSphere->diffuseColor = Vector3r(0.8,0.3,0.3);
+ iSphere->color = Vector3r(0.8,0.3,0.3);
body->shape = iSphere;
body->bound = aabb;
@@ -257,7 +257,7 @@
physics->acceleration = Vector3r::Zero();
shared_ptr<Aabb> aabb(new Aabb);
- aabb->diffuseColor = Vector3r(0,0,1);
+ aabb->color = Vector3r(0,0,1);
rootBody->bound = YADE_PTR_CAST<Bound>(aabb);
rootBody->physicalParameters = physics;
=== modified file 'pkg/dem/PreProcessor/SimpleShear.cpp'
--- pkg/dem/PreProcessor/SimpleShear.cpp 2010-07-27 12:37:10 +0000
+++ pkg/dem/PreProcessor/SimpleShear.cpp 2010-08-15 16:30:00 +0000
@@ -113,7 +113,7 @@
void SimpleShear::createSphere(shared_ptr<Body>& body, Vector3r position, Real radius)
{
- body = shared_ptr<Body>(new Body(0,1));
+ body = shared_ptr<Body>(new Body); body->groupMask=1;
shared_ptr<NormalInelasticMat> mat(new NormalInelasticMat);
shared_ptr<Aabb> aabb(new Aabb);
// shared_ptr<SphereModel> gSphere(new SphereModel);
@@ -134,12 +134,12 @@
mat->frictionAngle = sphereFrictionDeg * Mathr::PI/180.0;
body->material = mat;
- aabb->diffuseColor = Vector3r(0,1,0);
+ aabb->color = Vector3r(0,1,0);
/* gSphere->radius = radius;
// de quoi avoir des bandes (huit en largeur) de couleur differentes :
- gSphere->diffuseColor = ((int)(Mathr::Floor(8*position.X()/length)))%2?Vector3r(0.7,0.7,0.7):Vector3r(0.45,0.45,0.45);
+ gSphere->color = ((int)(Mathr::Floor(8*position.X()/length)))%2?Vector3r(0.7,0.7,0.7):Vector3r(0.45,0.45,0.45);
gSphere->wire = false;
gSphere->shadowCaster = true;*/
@@ -154,7 +154,7 @@
void SimpleShear::createBox(shared_ptr<Body>& body, Vector3r position, Vector3r extents)
{
- body = shared_ptr<Body>(new Body(0,1));
+ body = shared_ptr<Body>(new Body); body->groupMask=1;
shared_ptr<NormalInelasticMat> mat(new NormalInelasticMat);
shared_ptr<Aabb> aabb(new Aabb);
// shared_ptr<BoxModel> gBox(new BoxModel);
@@ -173,10 +173,10 @@
mat->frictionAngle = 0.0; //default value, modified after for w2 and w4 to have good values of phi(sphere-walls)
body->material = mat;
- aabb->diffuseColor = Vector3r(1,0,0);
+ aabb->color = Vector3r(1,0,0);
/* gBox->extents = extents;
- gBox->diffuseColor = Vector3r(1,0,0);
+ gBox->color = Vector3r(1,0,0);
gBox->wire = true;
gBox->shadowCaster = false;*/
=== modified file 'pkg/dem/PreProcessor/TriaxialTest.cpp'
--- pkg/dem/PreProcessor/TriaxialTest.cpp 2010-08-15 05:27:53 +0000
+++ pkg/dem/PreProcessor/TriaxialTest.cpp 2010-08-15 16:30:00 +0000
@@ -222,8 +222,7 @@
void TriaxialTest::createSphere(shared_ptr<Body>& body, Vector3r position, Real radius, bool big, bool dynamic )
{
- body = shared_ptr<Body>(new Body(Body::id_t(0),2));
- //shared_ptr<BodyMacroParameters> physics(new BodyMacroParameters);
+ body = shared_ptr<Body>(new Body); body->groupMask=2;
shared_ptr<Aabb> aabb(new Aabb);
shared_ptr<Sphere> iSphere(new Sphere);
@@ -237,9 +236,9 @@
mat->young = sphereYoungModulus;
mat->poisson = sphereKsDivKn;
mat->frictionAngle = compactionFrictionDeg * Mathr::PI/180.0;
- aabb->diffuseColor = Vector3r(0,1,0);
+ aabb->color = Vector3r(0,1,0);
iSphere->radius = radius;
- //iSphere->diffuseColor = Vector3r(0.4,0.1,0.1);
+ //iSphere->color = Vector3r(0.4,0.1,0.1);
iSphere->color = Vector3r(Mathr::UnitRandom(),Mathr::UnitRandom(),Mathr::UnitRandom());
body->shape = iSphere;
body->bound = aabb;
@@ -249,10 +248,10 @@
void TriaxialTest::createBox(shared_ptr<Body>& body, Vector3r position, Vector3r extents, bool wire)
{
- body = shared_ptr<Body>(new Body(Body::id_t(0),2));
+ body = shared_ptr<Body>(new Body); body->groupMask=2;
body->setDynamic(false);
shared_ptr<Aabb> aabb(new Aabb);
- aabb->diffuseColor = Vector3r(1,0,0);
+ aabb->color = Vector3r(1,0,0);
body->bound = aabb;
body->state->pos=position;
shared_ptr<FrictMat> mat(new FrictMat);
=== modified file 'py/utils.py'
--- py/utils.py 2010-08-15 12:48:54 +0000
+++ py/utils.py 2010-08-15 16:30:00 +0000
@@ -240,7 +240,7 @@
b.state.pos=b.state.refPos=begin
b.dynamic=dynamic
b.mask=mask
- b.bound=Aabb(diffuseColor=[0,1,0])
+ b.bound=Aabb(color=[0,1,0])
b.state.ori=b.state.ori.setFromTwoVectors(Vector3(0.,0.,1.),segment)
return b
=== modified file 'py/wrapper/yadeWrapper.cpp'
--- py/wrapper/yadeWrapper.cpp 2010-08-15 05:27:53 +0000
+++ py/wrapper/yadeWrapper.cpp 2010-08-15 16:30:00 +0000
@@ -482,9 +482,6 @@
class pySTLImporter : public STLImporter {};
-shared_ptr<Shape> Body_shape_deprec_get(const shared_ptr<Body>& b){ LOG_WARN("Body().mold and Body().geom attributes are deprecated, use 'shape' instead."); return b->shape; }
-void Body_shape_deprec_set(const shared_ptr<Body>& b, shared_ptr<Shape> ig){ LOG_WARN("Body().mold and Body().geom attributes are deprecated, use 'shape' instead."); b->shape=ig; }
-
void FileGenerator_generate(const shared_ptr<FileGenerator>& fg, string outFile){ fg->setFileName(outFile);
bool ret=fg->generateAndSave(); LOG_INFO((ret?"SUCCESS:\n":"FAILURE:\n")<<fg->message); if(ret==false) throw runtime_error("Generator reported error: "+fg->message);
};