yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #02423
[Branch ~yade-dev/yade/trunk] Rev 1832: 1. Change prototype for InteractionGeometryMetaEngine to receive const State& instead of const Se...
------------------------------------------------------------
revno: 1832
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Tue 2009-12-01 12:02:55 +0100
message:
1. Change prototype for InteractionGeometryMetaEngine to receive const State& instead of const Se3r&. Add const Vector3r& shift2 for peroioditiy (ZERO by default).
modified:
core/main/pyboot.cpp
pkg/common/Engine/MetaEngine/InteractionDispatchers.cpp
pkg/common/Engine/MetaEngine/InteractionGeometryEngineUnit.hpp
pkg/common/Engine/MetaEngine/InteractionGeometryMetaEngine.cpp
pkg/common/Engine/MetaEngine/InteractionGeometryMetaEngine.hpp
pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.cpp
pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.hpp
pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp
pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.hpp
pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_WallSphere.cpp
pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_WallSphere.hpp
pkg/dem/Engine/EngineUnit/InteractingBox2InteractingSphere4SpheresContactGeometry.cpp
pkg/dem/Engine/EngineUnit/InteractingBox2InteractingSphere4SpheresContactGeometry.hpp
pkg/dem/Engine/EngineUnit/InteractingFacet2InteractingSphere4SpheresContactGeometry.cpp
pkg/dem/Engine/EngineUnit/InteractingFacet2InteractingSphere4SpheresContactGeometry.hpp
pkg/dem/Engine/EngineUnit/InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.hpp
pkg/dem/Engine/EngineUnit/InteractingSphere2InteractingSphere4SpheresContactGeometry.cpp
pkg/dem/Engine/EngineUnit/InteractingSphere2InteractingSphere4SpheresContactGeometry.hpp
pkg/dem/meta/Tetra.cpp
pkg/dem/meta/Tetra.hpp
pkg/snow/Engine/Ef2_BssSnowGrain_BssSnowGrain_makeIstSnowLayersContact.hpp
pkg/snow/Engine/Ef2_BssSnowGrain_BssSnowGrain_makeSpheresContactGeometry.hpp
pkg/snow/Engine/Ef2_InteractingBox_BssSnowGrain_makeIstSnowLayersContact.hpp
pkg/snow/Engine/Ef2_InteractingBox_BssSnowGrain_makeSpheresContactGeometry.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/main/pyboot.cpp'
--- core/main/pyboot.cpp 2009-11-30 08:48:32 +0000
+++ core/main/pyboot.cpp 2009-12-01 11:02:55 +0000
@@ -67,6 +67,7 @@
}
#endif
vector<string> dd2; for(int i=0; i<python::len(dd); i++) dd2.push_back(python::extract<string>(dd[i]));
+ //TODO: call Omega::instance().buildDynlibDatabase(dd2); and scan directories for plugins in the python boot part (gets rid of ugly Omega code once no c++ main exists)
Omega::instance().scanPlugins(dd2);
}
void yadeFinalize(){ Omega::instance().cleanupTemps(); }
=== modified file 'pkg/common/Engine/MetaEngine/InteractionDispatchers.cpp'
--- pkg/common/Engine/MetaEngine/InteractionDispatchers.cpp 2009-11-23 12:32:14 +0000
+++ pkg/common/Engine/MetaEngine/InteractionDispatchers.cpp 2009-12-01 11:02:55 +0000
@@ -81,10 +81,10 @@
assert(I->functorCache.geom);
bool wasReal=I->isReal();
bool geomCreated;
- if(!rootBody->isPeriodic) geomCreated=I->functorCache.geom->go(b1->interactingGeometry,b2->interactingGeometry,b1->state->se3, b2->state->se3,I);
+ if(!rootBody->isPeriodic) geomCreated=I->functorCache.geom->go(b1->interactingGeometry,b2->interactingGeometry, *b1->state, *b2->state, Vector3r::ZERO, I);
else{ // handle periodicity
- Se3r se32=b2->state->se3; se32.position+=Vector3r(I->cellDist[0]*cellSize[0],I->cellDist[1]*cellSize[1],I->cellDist[2]*cellSize[2]);
- geomCreated=I->functorCache.geom->go(b1->interactingGeometry,b2->interactingGeometry,b1->state->se3,se32,I);
+ Vector3r shift2(I->cellDist[0]*cellSize[0],I->cellDist[1]*cellSize[1],I->cellDist[2]*cellSize[2]);
+ geomCreated=I->functorCache.geom->go(b1->interactingGeometry,b2->interactingGeometry,*b1->state,*b2->state,shift2,I);
}
if(!geomCreated){
if(wasReal) rootBody->interactions->requestErase(I->getId1(),I->getId2()); // fully created interaction without geometry is reset and perhaps erased in the next step
@@ -126,7 +126,9 @@
bool wasReal=I->isReal();
bool geomCreated =
b1->interactingGeometry && b2->interactingGeometry && // some bodies do not have interactingGeometry
- geomDispatcher->operator()(b1->interactingGeometry, b2->interactingGeometry, b1->state->se3, b2->state->se3,I);
+ geomDispatcher->operator()(b1->interactingGeometry, b2->interactingGeometry, *b1->state, *b2->state, Vector3r::ZERO, I);
+ // FIXME: port from the part above
+ if(rootBody->isPeriodic) { LOG_FATAL(__FILE__ ": Periodicity not handled without DISPATCH_CACHE."); abort(); }
if(!geomCreated){
if(wasReal) *rootBody->interactions->requestErase(I->getId1(),I->getId2());
continue;
=== modified file 'pkg/common/Engine/MetaEngine/InteractionGeometryEngineUnit.hpp'
--- pkg/common/Engine/MetaEngine/InteractionGeometryEngineUnit.hpp 2009-11-18 13:34:36 +0000
+++ pkg/common/Engine/MetaEngine/InteractionGeometryEngineUnit.hpp 2009-12-01 11:02:55 +0000
@@ -12,6 +12,7 @@
#include<yade/lib-base/yadeWm3Extra.hpp>
#include<yade/core/Interaction.hpp>
#include<yade/core/EngineUnit.hpp>
+#include<yade/core/State.hpp>
#include <string>
@@ -20,13 +21,12 @@
This is a crucial EngineUnit used during runtime, when an interaction is detected and starts to exist between two
Body 'ies, a class Interaction to describe it must be created.
-
- Currently we can build: SpheresContactGeometry, ErrorTolerantContact, ClosestFeatures
- \param const shared_ptr<InteractingGeometry>& first interacting Body
- \param const shared_ptr<InteractingGeometry>& second interacting Body
- \param Se3r& first Body's 3d transformation (FIXME: should be removed)
- \param Se3r& second Body's 3d transformation (FIXME: should be removed)
+ \param const shared_ptr<InteractingGeometry>& first Body geometry
+ \param const shared_ptr<InteractingGeometry>& second Body geometry
+ \param State& first Body's State
+ \param State& second Body's State
+ \param Vector3r& second Body's relative shift (for periodicity)
\return shared_ptr<Interaction>& it returns the Interaction to be built (given as last argument to the function)
*/
@@ -34,10 +34,11 @@
class InteractionGeometryEngineUnit : public EngineUnit2D
<
bool ,
- TYPELIST_5( const shared_ptr<InteractingGeometry>&
+ TYPELIST_6( const shared_ptr<InteractingGeometry>&
, const shared_ptr<InteractingGeometry>&
- , const Se3r&
- , const Se3r&
+ , const State&
+ , const State&
+ , const Vector3r&
, const shared_ptr<Interaction>&
)
>
=== modified file 'pkg/common/Engine/MetaEngine/InteractionGeometryMetaEngine.cpp'
--- pkg/common/Engine/MetaEngine/InteractionGeometryMetaEngine.cpp 2009-11-23 12:32:14 +0000
+++ pkg/common/Engine/MetaEngine/InteractionGeometryMetaEngine.cpp 2009-12-01 11:02:55 +0000
@@ -20,6 +20,8 @@
* The caller is responsible for inserting the interaction into some interaction container.
*
* The EngineUnit must not fail (return false).
+ *
+ * \fixme: doesn't handle periodicity!
*/
shared_ptr<Interaction> InteractionGeometryMetaEngine::explicitAction(const shared_ptr<Body>& b1, const shared_ptr<Body>& b2){
@@ -38,7 +40,7 @@
// example if bodies don't have an interactionGeometry), returned
// interaction is non real, i.e. interaction->isReal==false. Sega.
shared_ptr<Interaction> interaction(new Interaction(b1->getId(),b2->getId()));
- b1->interactingGeometry && b2->interactingGeometry && operator()( b1->interactingGeometry , b2->interactingGeometry , b1->state->se3 , b2->state->se3 , interaction );
+ b1->interactingGeometry && b2->interactingGeometry && operator()( b1->interactingGeometry , b2->interactingGeometry , *b1->state , *b2->state , Vector3r::ZERO, interaction );
return interaction;
}
@@ -74,10 +76,10 @@
if (!b1->interactingGeometry || !b2->interactingGeometry) { assert(!wasReal); continue; } // some bodies do not have interactingGeometry
bool geomCreated;
if(!ncb->isPeriodic){
- geomCreated=operator()(b1->interactingGeometry, b2->interactingGeometry, b1->state->se3, b2->state->se3, I);
+ geomCreated=operator()(b1->interactingGeometry, b2->interactingGeometry, *b1->state, *b2->state, Vector3r::ZERO, I);
} else{
- Se3r se32=b2->state->se3; se32.position+=Vector3r(I->cellDist[0]*cellSize[0],I->cellDist[1]*cellSize[1],I->cellDist[2]*cellSize[2]); // add periodicity to the position of the 2nd body
- geomCreated=operator()(b1->interactingGeometry, b2->interactingGeometry, b1->state->se3, se32, I);
+ Vector3r shift2(I->cellDist[0]*cellSize[0],I->cellDist[1]*cellSize[1],I->cellDist[2]*cellSize[2]); // add periodicity to the position of the 2nd body
+ geomCreated=operator()(b1->interactingGeometry, b2->interactingGeometry, *b1->state, *b2->state, shift2, I);
}
// reset && erase interaction that existed but now has no geometry anymore
if(wasReal && !geomCreated){ ncb->interactions->requestErase(I->getId1(),I->getId2()); }
=== modified file 'pkg/common/Engine/MetaEngine/InteractionGeometryMetaEngine.hpp'
--- pkg/common/Engine/MetaEngine/InteractionGeometryMetaEngine.hpp 2009-11-18 13:34:36 +0000
+++ pkg/common/Engine/MetaEngine/InteractionGeometryMetaEngine.hpp 2009-12-01 11:02:55 +0000
@@ -25,10 +25,11 @@
InteractingGeometry, // base classe for dispatch
InteractionGeometryEngineUnit, // class that provides multivirtual call
bool , // return type
- TYPELIST_5( const shared_ptr<InteractingGeometry>& // arguments
+ TYPELIST_6( const shared_ptr<InteractingGeometry>& // arguments
, const shared_ptr<InteractingGeometry>&
- , const Se3r&
- , const Se3r&
+ , const State&
+ , const State&
+ , const Vector3r&
, const shared_ptr<Interaction>&
)
, false // disable auto symmetry handling
=== modified file 'pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.cpp'
--- pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.cpp 2009-11-21 16:46:58 +0000
+++ pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.cpp 2009-12-01 11:02:55 +0000
@@ -39,16 +39,17 @@
}
CREATE_LOGGER(ef2_Facet_Sphere_Dem3DofGeom);
-bool ef2_Facet_Sphere_Dem3DofGeom::go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c){
+bool ef2_Facet_Sphere_Dem3DofGeom::go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c){
InteractingFacet* facet=static_cast<InteractingFacet*>(cm1.get());
Real sphereRadius=static_cast<InteractingSphere*>(cm2.get())->radius;
+
#if 1
/* new code written from scratch, to make sure the algorithm is correct; it is about the same speed
as sega's algo below, but seems more readable to me.
The FACET_TOPO thing is still missing here but can be copied literally once it is tested */
// begin facet-local coordinates
- Vector3r cogLine=se31.orientation.Conjugate()*(se32.position-se31.position); // connect centers of gravity
+ Vector3r cogLine=state1.ori.Conjugate()*(state2.pos+shift2-state1.pos); // connect centers of gravity
//TRVAR4(se31.position,se31.orientation,se32.position,cogLine);
Vector3r normal=facet->nf;
Real planeDist=normal.Dot(cogLine);
@@ -80,7 +81,7 @@
#else
/* This code was mostly copied from InteractingFacet2InteractinSphere4SpheresContactGeometry */
// begin facet-local coordinates
- Vector3r contactLine=se31.orientation.Conjugate()*(se32.position-se31.position);
+ Vector3r contactLine=state1.ori.Conjugate()*(state2.pos+shift2-state1.pos);
Vector3r normal=facet->nf;
Real L=normal.Dot(contactLine); // height/depth of sphere's center from facet's plane
if(L<0){normal*=-1; L*=-1;}
@@ -138,7 +139,7 @@
if(penetrationDepth<0 && !c->isReal()) return false;
shared_ptr<Dem3DofGeom_FacetSphere> fs;
- Vector3r normalGlob=se31.orientation*normal;
+ Vector3r normalGlob=state1.ori*normal;
if(c->interactionGeometry) fs=YADE_PTR_CAST<Dem3DofGeom_FacetSphere>(c->interactionGeometry);
else {
fs=shared_ptr<Dem3DofGeom_FacetSphere>(new Dem3DofGeom_FacetSphere());
@@ -148,12 +149,12 @@
fs->refLength=fs->effR2;
fs->cp1pt=contactPt; // facet-local intial contact point
fs->localFacetNormal=facet->nf;
- fs->cp2rel.Align(Vector3r::UNIT_X,se32.orientation.Conjugate()*(-normalGlob)); // initial sphere-local center-contactPt orientation WRT +x
+ fs->cp2rel.Align(Vector3r::UNIT_X,state2.ori.Conjugate()*(-normalGlob)); // initial sphere-local center-contactPt orientation WRT +x
fs->cp2rel.Normalize();
}
- fs->se31=se31; fs->se32=se32;
+ fs->se31=state1.se3; fs->se32=state2.se3;
fs->normal=normalGlob;
- fs->contactPoint=se32.position+(-normalGlob)*(sphereRadius-penetrationDepth);
+ fs->contactPoint=state2.pos+shift2+(-normalGlob)*(sphereRadius-penetrationDepth);
return true;
}
=== modified file 'pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.hpp'
--- pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.hpp 2009-11-15 15:32:01 +0000
+++ pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.hpp 2009-12-01 11:02:55 +0000
@@ -61,9 +61,9 @@
return A+min(1.,max(0.,u))*BA;
}
public:
- virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c);
- virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c){
- c->swapOrder(); return go(cm2,cm1,se32,se31,c);
+ virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c);
+ virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c){
+ c->swapOrder(); return go(cm2,cm1,state2,state1,-shift2,c);
LOG_ERROR("!! goReverse maybe doesn't work in ef2_Facet_Sphere_Dem3DofGeom. InteractionGeometryMetaEngine should swap interaction members first and call go(...) afterwards.");
}
=== modified file 'pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp'
--- pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp 2009-11-21 12:46:54 +0000
+++ pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp 2009-12-01 11:02:55 +0000
@@ -149,9 +149,9 @@
CREATE_LOGGER(ef2_Sphere_Sphere_Dem3DofGeom);
#endif
-bool ef2_Sphere_Sphere_Dem3DofGeom::go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c){
+bool ef2_Sphere_Sphere_Dem3DofGeom::go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c){
InteractingSphere *s1=static_cast<InteractingSphere*>(cm1.get()), *s2=static_cast<InteractingSphere*>(cm2.get());
- Vector3r normal=se32.position-se31.position;
+ Vector3r normal=(state2.pos+shift2)-state1.pos;
Real penetrationDepthSq=pow((distFactor>0?distFactor:1.)*(s1->radius+s2->radius),2)-normal.SquaredLength();
if (penetrationDepthSq<0 && !c->isReal()){
return false;
@@ -171,15 +171,15 @@
if(Omega::instance().getCurrentIteration()<=10){
ss->effR1=s1->radius-.5*penetrationDepth; ss->effR2=s2->radius-.5*penetrationDepth;
} else {ss->effR1=s1->radius; ss->effR2=s2->radius;}
- // for bending only: ss->initRelOri12=se31.orientation.Conjugate()*se32.orientation;
+ // for bending only: ss->initRelOri12=state1.ori.Conjugate()*state2.ori;
// quasi-constants
- ss->cp1rel.Align(Vector3r::UNIT_X,se31.orientation.Conjugate()*normal);
- ss->cp2rel.Align(Vector3r::UNIT_X,se32.orientation.Conjugate()*(-normal));
+ ss->cp1rel.Align(Vector3r::UNIT_X,state1.ori.Conjugate()*normal);
+ ss->cp2rel.Align(Vector3r::UNIT_X,state2.ori.Conjugate()*(-normal));
ss->cp1rel.Normalize(); ss->cp2rel.Normalize();
}
ss->normal=normal;
- ss->contactPoint=se31.position+(ss->effR1-.5*(ss->refLength-dist))*ss->normal;
- ss->se31=se31; ss->se32=se32;
+ ss->contactPoint=state1.pos+(ss->effR1-.5*(ss->refLength-dist))*ss->normal;
+ ss->se31=state1.se3; ss->se32=state2.se3;
return true;
}
=== modified file 'pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.hpp'
--- pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.hpp 2009-08-22 18:21:25 +0000
+++ pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.hpp 2009-12-01 11:02:55 +0000
@@ -59,8 +59,8 @@
#include<yade/pkg-common/InteractionGeometryEngineUnit.hpp>
class ef2_Sphere_Sphere_Dem3DofGeom:public InteractionGeometryEngineUnit{
public:
- virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c);
- virtual bool goReverse( const shared_ptr<InteractingGeometry>&, const shared_ptr<InteractingGeometry>&, const Se3r&, const Se3r&, const shared_ptr<Interaction>&){throw runtime_error("goReverse on symmetric functor should never be called!");}
+ virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c);
+ virtual bool goReverse( const shared_ptr<InteractingGeometry>&, const shared_ptr<InteractingGeometry>&, const State&, const State&, const Vector3r& shift2, const shared_ptr<Interaction>&){throw runtime_error("goReverse on symmetric functor should never be called!");}
//! Factor of sphere radius such that sphere "touch" if their centers are not further than distFactor*(r1+r2);
//! if negative, equilibrium distance is the sum of the sphere's radii, which is the default.
Real distFactor;
=== modified file 'pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_WallSphere.cpp'
--- pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_WallSphere.cpp 2009-11-21 16:46:58 +0000
+++ pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_WallSphere.cpp 2009-12-01 11:02:55 +0000
@@ -39,15 +39,15 @@
}
CREATE_LOGGER(ef2_Wall_Sphere_Dem3DofGeom);
-bool ef2_Wall_Sphere_Dem3DofGeom::go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c){
+bool ef2_Wall_Sphere_Dem3DofGeom::go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c){
Wall* wall=static_cast<Wall*>(cm1.get());
Real sphereRadius=static_cast<InteractingSphere*>(cm2.get())->radius;
- Real dist=se32.position[wall->axis]-se31.position[wall->axis];
+ Real dist=(state2.pos+shift2)[wall->axis]-state1.pos[wall->axis];
if(!c->isReal() && abs(dist)>sphereRadius){ /*LOG_DEBUG("dist="<<dist<<", returning false");*/ return false; } // wall and sphere too far from each other
// contact point is sphere center projected onto the wall
- Vector3r contPt=se32.position; contPt[wall->axis]=se31.position[wall->axis];
+ Vector3r contPt=state2.pos; contPt[wall->axis]=state1.pos[wall->axis];
Vector3r normalGlob(0.,0.,0.);
// wall interacting from both sides: normal depends on sphere's position
assert(wall->sense==-1 || wall->sense==0 || wall->sense==1);
@@ -62,13 +62,13 @@
ws->effR2=abs(dist);
ws->refR1=-1; ws->refR2=sphereRadius;
ws->refLength=ws->effR2;
- ws->cp1pt=contPt-se31.position; // initial contact point relative to wall position (orientation is global, since it is coincident with local for a wall)
+ ws->cp1pt=contPt-state1.pos; // initial contact point relative to wall position (orientation is global, since it is coincident with local for a wall)
ws->cp2rel=Quaternionr::IDENTITY;
- ws->cp2rel.Align(Vector3r::UNIT_X,se32.orientation.Conjugate()*(-normalGlob)); // initial sphere-local center-contactPt orientation WRT +x
+ ws->cp2rel.Align(Vector3r::UNIT_X,state2.ori.Conjugate()*(-normalGlob)); // initial sphere-local center-contactPt orientation WRT +x
ws->cp2rel.Normalize();
//LOG_INFO(ws->cp1pt);
}
- ws->se31=se31; ws->se32=se32;
+ ws->se31=state1.se3; ws->se32=state2.se3;
ws->contactPoint=contPt;
ws->normal=normalGlob;
return true;
=== modified file 'pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_WallSphere.hpp'
--- pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_WallSphere.hpp 2009-11-15 15:32:01 +0000
+++ pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_WallSphere.hpp 2009-12-01 11:02:55 +0000
@@ -51,9 +51,9 @@
#include<yade/pkg-common/InteractionGeometryEngineUnit.hpp>
class ef2_Wall_Sphere_Dem3DofGeom:public InteractionGeometryEngineUnit{
public:
- virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c);
- virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c){
- c->swapOrder(); return go(cm2,cm1,se32,se31,c);
+ virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c);
+ virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c){
+ c->swapOrder(); return go(cm2,cm1,state2,state1,-shift2,c);
LOG_ERROR("!! goReverse might not work in ef2_Wall_Sphere_Dem3DofGeom. InteractionGeometryMetaEngine should swap interaction members first and call go(...) afterwards.");
}
ef2_Wall_Sphere_Dem3DofGeom(){}
=== modified file 'pkg/dem/Engine/EngineUnit/InteractingBox2InteractingSphere4SpheresContactGeometry.cpp'
--- pkg/dem/Engine/EngineUnit/InteractingBox2InteractingSphere4SpheresContactGeometry.cpp 2009-11-21 16:46:58 +0000
+++ pkg/dem/Engine/EngineUnit/InteractingBox2InteractingSphere4SpheresContactGeometry.cpp 2009-12-01 11:02:55 +0000
@@ -20,10 +20,13 @@
bool InteractingBox2InteractingSphere4SpheresContactGeometry::go(
const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1,
+ const State& state2,
+ const Vector3r& shift2,
const shared_ptr<Interaction>& c)
{
+ const Se3r& se31=state1.se3; const Se3r& se32=state2.se3;
+
bool inside=true;
Vector3r pt1,pt2,normal;
Real depth;
@@ -157,12 +160,13 @@
bool InteractingBox2InteractingSphere4SpheresContactGeometry::goReverse( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1,
+ const State& state2,
+ const Vector3r& shift2,
const shared_ptr<Interaction>& c)
{
c->swapOrder();
- return go(cm2,cm1,se32,se31,c);
+ return go(cm2,cm1,state2,state1,-shift2,c);
}
YADE_PLUGIN((InteractingBox2InteractingSphere4SpheresContactGeometry));
=== modified file 'pkg/dem/Engine/EngineUnit/InteractingBox2InteractingSphere4SpheresContactGeometry.hpp'
--- pkg/dem/Engine/EngineUnit/InteractingBox2InteractingSphere4SpheresContactGeometry.hpp 2009-01-27 02:19:40 +0000
+++ pkg/dem/Engine/EngineUnit/InteractingBox2InteractingSphere4SpheresContactGeometry.hpp 2009-12-01 11:02:55 +0000
@@ -17,14 +17,16 @@
public :
virtual bool go( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1,
+ const State& state2,
+ const Vector3r& shift2,
const shared_ptr<Interaction>& c);
virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1,
+ const State& state2,
+ const Vector3r& shift2,
const shared_ptr<Interaction>& c);
REGISTER_CLASS_NAME(InteractingBox2InteractingSphere4SpheresContactGeometry);
=== modified file 'pkg/dem/Engine/EngineUnit/InteractingFacet2InteractingSphere4SpheresContactGeometry.cpp'
--- pkg/dem/Engine/EngineUnit/InteractingFacet2InteractingSphere4SpheresContactGeometry.cpp 2009-11-22 15:37:49 +0000
+++ pkg/dem/Engine/EngineUnit/InteractingFacet2InteractingSphere4SpheresContactGeometry.cpp 2009-12-01 11:02:55 +0000
@@ -22,10 +22,12 @@
bool InteractingFacet2InteractingSphere4SpheresContactGeometry::go(const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1,
+ const State& state2,
+ const Vector3r& shift2,
const shared_ptr<Interaction>& c)
{
+ const Se3r& se31=state1.se3; const Se3r& se32=state2.se3;
InteractingFacet* facet = static_cast<InteractingFacet*>(cm1.get());
/* could be written as (needs to be tested):
* Vector3r cl=se31.orientation.Conjugate()*(se32.position-se31.position);
@@ -119,13 +121,14 @@
bool InteractingFacet2InteractingSphere4SpheresContactGeometry::goReverse( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1,
+ const State& state2,
+ const Vector3r& shift2,
const shared_ptr<Interaction>& c)
{
c->swapOrder();
//LOG_WARN("Swapped interaction order for "<<c->getId2()<<"&"<<c->getId1());
- return go(cm2,cm1,se32,se31,c);
+ return go(cm2,cm1,state2,state1,-shift2,c);
}
YADE_PLUGIN((InteractingFacet2InteractingSphere4SpheresContactGeometry));
=== modified file 'pkg/dem/Engine/EngineUnit/InteractingFacet2InteractingSphere4SpheresContactGeometry.hpp'
--- pkg/dem/Engine/EngineUnit/InteractingFacet2InteractingSphere4SpheresContactGeometry.hpp 2009-07-17 20:50:55 +0000
+++ pkg/dem/Engine/EngineUnit/InteractingFacet2InteractingSphere4SpheresContactGeometry.hpp 2009-12-01 11:02:55 +0000
@@ -16,13 +16,15 @@
public :
virtual bool go( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1,
+ const State& state2,
+ const Vector3r& shift2,
const shared_ptr<Interaction>& c);
virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1,
+ const State& state2,
+ const Vector3r& shift2,
const shared_ptr<Interaction>& c);
InteractingFacet2InteractingSphere4SpheresContactGeometry();
=== modified file 'pkg/dem/Engine/EngineUnit/InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.hpp'
--- pkg/dem/Engine/EngineUnit/InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.hpp 2009-01-27 02:19:40 +0000
+++ pkg/dem/Engine/EngineUnit/InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry.hpp 2009-12-01 11:02:55 +0000
@@ -15,14 +15,16 @@
public :
virtual bool go( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1,
+ const State& state2,
+ const Vector3r& shift2,
const shared_ptr<Interaction>& c);
virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1,
+ const State& state2,
+ const Vector3r& shift2,
const shared_ptr<Interaction>& c);
REGISTER_CLASS_NAME(InteractingSphere2BssSweptSphereLineSegment4SpheresContactGeometry);
=== modified file 'pkg/dem/Engine/EngineUnit/InteractingSphere2InteractingSphere4SpheresContactGeometry.cpp'
--- pkg/dem/Engine/EngineUnit/InteractingSphere2InteractingSphere4SpheresContactGeometry.cpp 2009-11-21 16:46:58 +0000
+++ pkg/dem/Engine/EngineUnit/InteractingSphere2InteractingSphere4SpheresContactGeometry.cpp 2009-12-01 11:02:55 +0000
@@ -18,12 +18,13 @@
bool InteractingSphere2InteractingSphere4SpheresContactGeometry::go( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1, const State& state2, const Vector3r& shift2,
const shared_ptr<Interaction>& c)
{
+ const Se3r& se31=state1.se3; const Se3r& se32=state2.se3;
+
InteractingSphere *s1=static_cast<InteractingSphere*>(cm1.get()), *s2=static_cast<InteractingSphere*>(cm2.get());
- Vector3r normal=se32.position-se31.position;
+ Vector3r normal=(se32.position+shift2)-se31.position;
Real penetrationDepthSq=pow(interactionDetectionFactor*(s1->radius+s2->radius),2) - normal.SquaredLength();
if (penetrationDepthSq>0 || c->isReal()){
shared_ptr<SpheresContactGeometry> scm;
@@ -53,11 +54,12 @@
bool InteractingSphere2InteractingSphere4SpheresContactGeometry::goReverse( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1,
+ const State& state2,
+ const Vector3r& shift2,
const shared_ptr<Interaction>& c)
{
- return go(cm1,cm2,se31,se32,c);
+ return go(cm1,cm2,state2,state1,-shift2,c);
}
YADE_PLUGIN((InteractingSphere2InteractingSphere4SpheresContactGeometry));
=== modified file 'pkg/dem/Engine/EngineUnit/InteractingSphere2InteractingSphere4SpheresContactGeometry.hpp'
--- pkg/dem/Engine/EngineUnit/InteractingSphere2InteractingSphere4SpheresContactGeometry.hpp 2009-05-05 04:15:26 +0000
+++ pkg/dem/Engine/EngineUnit/InteractingSphere2InteractingSphere4SpheresContactGeometry.hpp 2009-12-01 11:02:55 +0000
@@ -13,8 +13,8 @@
class InteractingSphere2InteractingSphere4SpheresContactGeometry : public InteractionGeometryEngineUnit
{
public :
- virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c);
- virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c);
+ virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& se32, const Vector3r& shift2, const shared_ptr<Interaction>& c);
+ virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& se32, const Vector3r& shift2, const shared_ptr<Interaction>& c);
InteractingSphere2InteractingSphere4SpheresContactGeometry();
=== modified file 'pkg/dem/meta/Tetra.cpp'
--- pkg/dem/meta/Tetra.cpp 2009-11-30 09:58:09 +0000
+++ pkg/dem/meta/Tetra.cpp 2009-12-01 11:02:55 +0000
@@ -43,7 +43,8 @@
* @todo thoroughly test this for numerical correctness.
*
*/
-bool Tetra2TetraBang::go(const shared_ptr<InteractingGeometry>& cm1,const shared_ptr<InteractingGeometry>& cm2,const Se3r& se31,const Se3r& se32,const shared_ptr<Interaction>& interaction){
+bool Tetra2TetraBang::go(const shared_ptr<InteractingGeometry>& cm1,const shared_ptr<InteractingGeometry>& cm2,const State& state1,const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& interaction){
+ const Se3r& se31=state1.se3; const Se3r& se32=state2.se3;
TetraMold* A = static_cast<TetraMold*>(cm1.get());
TetraMold* B = static_cast<TetraMold*>(cm2.get());
//return false;
@@ -90,7 +91,7 @@
// transform to global coordinates, build TetraMold objects
TetraMold tA(se31.orientation*A->v[0]+se31.position,se31.orientation*A->v[1]+se31.position,se31.orientation*A->v[2]+se31.position,se31.orientation*A->v[3]+se31.position);
- TetraMold tB(se32.orientation*B->v[0]+se32.position,se32.orientation*B->v[1]+se32.position,se32.orientation*B->v[2]+se32.position,se32.orientation*B->v[3]+se32.position);
+ TetraMold tB(se32.orientation*B->v[0]+se32.position+shift2,se32.orientation*B->v[1]+se32.position+shift2,se32.orientation*B->v[2]+se32.position+shift2,se32.orientation*B->v[3]+se32.position+shift2);
// calculate intersection
#if 0
tB=TetraMold(Vector3r(0,0,0),Vector3r(1.5,1,1),Vector3r(0.5,1,1),Vector3r(1,1,.5));
@@ -187,9 +188,9 @@
return true;
}
-bool Tetra2TetraBang::goReverse(const shared_ptr<InteractingGeometry>& cm1,const shared_ptr<InteractingGeometry>& cm2,const Se3r& se31,const Se3r& se32,const shared_ptr<Interaction>& interaction){
+bool Tetra2TetraBang::goReverse(const shared_ptr<InteractingGeometry>& cm1,const shared_ptr<InteractingGeometry>& cm2,const State& state1,const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& interaction){
// reverse only normal direction, otherwise use the inverse contact
- bool isInteracting=go(cm2,cm1,se32,se31,interaction);
+ bool isInteracting=go(cm2,cm1,state2,state1,-shift2,interaction);
if(isInteracting){
TetraBang* bang=static_cast<TetraBang*>(interaction->interactionGeometry.get());
bang->normal*=-1;
=== modified file 'pkg/dem/meta/Tetra.hpp'
--- pkg/dem/meta/Tetra.hpp 2009-11-30 09:58:09 +0000
+++ pkg/dem/meta/Tetra.hpp 2009-12-01 11:02:55 +0000
@@ -123,8 +123,8 @@
class Tetra2TetraBang: public InteractionGeometryEngineUnit
{
public:
- virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c);
- virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c);
+ virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c);
+ virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c);
FUNCTOR2D(TetraMold,TetraMold);
REGISTER_CLASS_NAME(Tetra2TetraBang);
=== modified file 'pkg/snow/Engine/Ef2_BssSnowGrain_BssSnowGrain_makeIstSnowLayersContact.hpp'
--- pkg/snow/Engine/Ef2_BssSnowGrain_BssSnowGrain_makeIstSnowLayersContact.hpp 2009-07-17 20:50:55 +0000
+++ pkg/snow/Engine/Ef2_BssSnowGrain_BssSnowGrain_makeIstSnowLayersContact.hpp 2009-12-01 11:02:55 +0000
@@ -18,8 +18,8 @@
//InteractingSphere2InteractingSphere4SpheresContactGeometry g;
Ef2_BssSnowGrain_BssSnowGrain_makeSpheresContactGeometry g;
- virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c);
- virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c);
+ virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c);
+ virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c);
Ef2_BssSnowGrain_BssSnowGrain_makeIstSnowLayersContact();
=== modified file 'pkg/snow/Engine/Ef2_BssSnowGrain_BssSnowGrain_makeSpheresContactGeometry.hpp'
--- pkg/snow/Engine/Ef2_BssSnowGrain_BssSnowGrain_makeSpheresContactGeometry.hpp 2009-07-17 20:50:55 +0000
+++ pkg/snow/Engine/Ef2_BssSnowGrain_BssSnowGrain_makeSpheresContactGeometry.hpp 2009-12-01 11:02:55 +0000
@@ -16,8 +16,8 @@
public :
InteractingSphere2InteractingSphere4SpheresContactGeometry g;
- virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c);
- virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c);
+ virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c);
+ virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const State& state1, const State& state2, const Vector3r& shift2, const shared_ptr<Interaction>& c);
bool assist;
Ef2_BssSnowGrain_BssSnowGrain_makeSpheresContactGeometry():assist(false){};
=== modified file 'pkg/snow/Engine/Ef2_InteractingBox_BssSnowGrain_makeIstSnowLayersContact.hpp'
--- pkg/snow/Engine/Ef2_InteractingBox_BssSnowGrain_makeIstSnowLayersContact.hpp 2009-03-22 14:01:25 +0000
+++ pkg/snow/Engine/Ef2_InteractingBox_BssSnowGrain_makeIstSnowLayersContact.hpp 2009-12-01 11:02:55 +0000
@@ -20,14 +20,12 @@
public :
virtual bool go( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1, const State state2, const Vector3r& shift2,
const shared_ptr<Interaction>& c);
virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1, const State state2, const Vector3r& shift2,
const shared_ptr<Interaction>& c);
DECLARE_LOGGER;
=== modified file 'pkg/snow/Engine/Ef2_InteractingBox_BssSnowGrain_makeSpheresContactGeometry.hpp'
--- pkg/snow/Engine/Ef2_InteractingBox_BssSnowGrain_makeSpheresContactGeometry.hpp 2009-03-01 01:41:37 +0000
+++ pkg/snow/Engine/Ef2_InteractingBox_BssSnowGrain_makeSpheresContactGeometry.hpp 2009-12-01 11:02:55 +0000
@@ -17,14 +17,12 @@
public :
virtual bool go( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1, const State state2, const Vector3r& shift2,
const shared_ptr<Interaction>& c);
virtual bool goReverse( const shared_ptr<InteractingGeometry>& cm1,
const shared_ptr<InteractingGeometry>& cm2,
- const Se3r& se31,
- const Se3r& se32,
+ const State& state1, const State state2, const Vector3r& shift2,
const shared_ptr<Interaction>& c);
bool assist;