yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #11164
[Branch ~yade-pkg/yade/git-trunk] Rev 4130: make growParticles fatser for clumps
------------------------------------------------------------
revno: 4130
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
timestamp: Fri 2014-08-01 19:25:38 +0200
message:
make growParticles fatser for clumps
modified:
pkg/dem/Shop.hpp
pkg/dem/Shop_02.cpp
py/_utils.cpp
--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'pkg/dem/Shop.hpp'
--- pkg/dem/Shop.hpp 2014-07-03 17:20:40 +0000
+++ pkg/dem/Shop.hpp 2014-08-01 17:25:38 +0000
@@ -139,7 +139,8 @@
static void setContactFriction(Real angleRad);
//! Homothetic change of sizes of spheres and clumps
- static void growParticles(Real multiplier, bool updateMass, bool dynamicOnly, unsigned int discretization);
+ static void growParticles(Real multiplier, bool updateMass, bool dynamicOnly);
//! Change of size of a single sphere or a clump
+ // DEPREC, update wrt growParticles()
static void growParticle(Body::id_t bodyID, Real multiplier, bool updateMass);
};
=== modified file 'pkg/dem/Shop_02.cpp'
--- pkg/dem/Shop_02.cpp 2014-07-25 16:12:46 +0000
+++ pkg/dem/Shop_02.cpp 2014-08-01 17:25:38 +0000
@@ -456,32 +456,31 @@
}
}
-void Shop::growParticles(Real multiplier, bool updateMass, bool dynamicOnly, unsigned int discretization)
+void Shop::growParticles(Real multiplier, bool updateMass, bool dynamicOnly)
{
Scene* scene = Omega::instance().getScene().get();
+ const int sphereIdx = Sphere::getClassIndexStatic();
FOREACH(const shared_ptr<Body>& b,*scene->bodies){
if (dynamicOnly && !b->isDynamic()) continue;
- int ci=b->shape->getClassIndex();
- if(b->isClump() || ci==GridNode::getClassIndexStatic() || ci==GridConnection::getClassIndexStatic()) continue;
- if (updateMass) {b->state->mass*=pow(multiplier,3); b->state->inertia*=pow(multiplier,5);}
- (YADE_CAST<Sphere*> (b->shape.get()))->radius *= multiplier;
- // Clump volume variation with homothetic displacement from its center
- if (b->isClumpMember()) b->state->pos += (multiplier-1) * (b->state->pos - Body::byId(b->clumpId, scene)->state->pos);
- }
- FOREACH(const shared_ptr<Body>& b,*scene->bodies){
- if(b->isClump()){
- Clump* clumpSt = YADE_CAST<Clump*>(b->shape.get());
- clumpSt->updateProperties(b, discretization);
+ //We grow only spheres and clumps
+ if(b->isClump() or sphereIdx == b->shape->getClassIndex()){
+ if (updateMass) {b->state->mass*=pow(multiplier,3); b->state->inertia*=pow(multiplier,5);}
+ // for clumps we updated inertia, nothing else to do
+ if (b->isClump()) continue;
+ // for spheres, we update radius
+ (YADE_CAST<Sphere*> (b->shape.get()))->radius *= multiplier;
+ // and if they are clump members,clump volume variation with homothetic displacement of all members
+ if (b->isClumpMember()) b->state->pos += (multiplier-1) * (b->state->pos - Body::byId(b->clumpId, scene)->state->pos);
}
}
FOREACH(const shared_ptr<Interaction>& ii, *scene->interactions){
- int ci=(*(scene->bodies))[ii->getId1()]->shape->getClassIndex();
- if(ci==GridNode::getClassIndexStatic() || ci==GridConnection::getClassIndexStatic()) continue;
+ int ci1=(*(scene->bodies))[ii->getId1()]->shape->getClassIndex();
+ int ci2=(*(scene->bodies))[ii->getId2()]->shape->getClassIndex();
if (ii->isReal()) {
GenericSpheresContact* contact = YADE_CAST<GenericSpheresContact*>(ii->geom.get());
- if (!dynamicOnly || (*(scene->bodies))[ii->getId1()]->isDynamic())
+ if ((!dynamicOnly || (*(scene->bodies))[ii->getId1()]->isDynamic()) && ci1==sphereIdx)
contact->refR1 = YADE_CAST<Sphere*>((* (scene->bodies))[ii->getId1()]->shape.get())->radius;
- if (!dynamicOnly || (*(scene->bodies))[ii->getId2()]->isDynamic())
+ if ((!dynamicOnly || (*(scene->bodies))[ii->getId2()]->isDynamic()) && ci2==sphereIdx)
contact->refR2 = YADE_CAST<Sphere*>((* (scene->bodies))[ii->getId2()]->shape.get())->radius;
const shared_ptr<FrictPhys>& contactPhysics = YADE_PTR_CAST<FrictPhys>(ii->phys);
contactPhysics->kn*=multiplier; contactPhysics->ks*=multiplier;
=== modified file 'py/_utils.cpp'
--- py/_utils.cpp 2014-07-03 17:20:40 +0000
+++ py/_utils.cpp 2014-08-01 17:25:38 +0000
@@ -495,7 +495,7 @@
py::def("calm",Shop__calm,(py::arg("mask")=-1),"Set translational and rotational velocities of bodies to zero. Applied to all bodies by default. To calm only some bodies, use mask parameter, it will calm only bodies with groupMask compatible to given value");
py::def("setNewVerticesOfFacet",setNewVerticesOfFacet,(py::arg("b"),py::arg("v1"),py::arg("v2"),py::arg("v3")),"Sets new vertices (in global coordinates) to given facet.");
py::def("setContactFriction",Shop::setContactFriction,py::arg("angleRad"),"Modify the friction angle (in radians) inside the material classes and existing contacts. The friction for non-dynamic bodies is not modified.");
- py::def("growParticles",Shop::growParticles,(py::args("multiplier"), py::args("updateMass")=true, py::args("dynamicOnly")=true, py::args("discretization")=0), "Change the size of spheres and sphere clumps by the multiplier. If updateMass=True, then the mass is updated. dynamicOnly=True is mandatory in many cases since in current implementation the function would crash on the non-spherical and non-dynamic bodies (e.g. facets, boxes, etc.). For clumps the masses and inertias are adapted automatically when discretization>0 (for details of inertia tensor integration scheme see :yref:`clump()<BodyContainer.clump>`).");
+ py::def("growParticles",Shop::growParticles,(py::args("multiplier"), py::args("updateMass")=true, py::args("dynamicOnly")=true), "Change the size of spheres and sphere clumps by the multiplier. If updateMass=True, then the mass and inertia are updated. dynamicOnly=True will select dynamic bodies.");
py::def("growParticle",Shop::growParticle,(py::args("bodyID"),py::args("multiplier"), py::args("updateMass")=true), "Change the size of a single sphere (to be implemented: single clump). If updateMass=True, then the mass is updated.");
py::def("intrsOfEachBody",intrsOfEachBody,"returns list of lists of interactions of each body");
py::def("numIntrsOfEachBody",numIntrsOfEachBody,"returns list of number of interactions of each body");