yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #00358
Particle displacement during a simulation
Here is the code to delete a discrete element :
***************************************************************************
ElementDestroyer::ElementDestroyer() : StandAloneEngine()
{
ballId = 1;
iterDestroy = 0;
}
ElementDestroyer::~ElementDestroyer()
{
}
void ElementDestroyer::registerAttributes()
{
StandAloneEngine::registerAttributes();
REGISTER_ATTRIBUTE(ballId);
REGISTER_ATTRIBUTE(iterDestroy);
}
bool ElementDestroyer::isActivated()
{
return ( Omega::instance().getCurrentIteration() == iterDestroy);
}
void ElementDestroyer::action(Body * body)
{
MetaBody * ncb = dynamic_cast<MetaBody*>(body);
BodyContainer::iterator bi = ncb->bodies->begin();
BodyContainer::iterator biEnd = ncb->bodies->end();
for( ; bi!=biEnd ; ++bi )
{
shared_ptr<Body> body = *bi;
if (body->getId() == ballId)
ncb->bodies->erase(body->getId());
}
}
***************************************************************************
Have a good day
Lionel Favier
_______________________________________________
Yade-users mailing list
Yade-users@xxxxxxxxxxxxxxxx
https://lists.berlios.de/mailman/listinfo/yade-users
Follow ups