yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #00435
Re: how to erase a discrete element during a simulation ?
And the precise problem is (according to Lionel) that the
physicalActionApplier will try to apply actions on bodies that don't
exist. Because corresponding actions are still in the container.
Bruno
Lionel Favier a écrit :
>Hi Janeck,
>
>I'm still on my worry about how to erase an element during a simulation :o)
>
>When I use the following code, I can check that elements under the deletion condition ( pos[1]< -0.1 here ) disappear from BodyContainer (initially 3 elements, after deletion 2 elements), but after this I have the traditionnal message after breaking Yade : "segmentation fault".
>Apparently the problem comes from "PhysicalActionContainer.hpp" where the element deleted from BodyContainer is not effectively deleted. So I tried to do a "ncb->actionParameters->erase(*itv)", but there is not any erase() among "PhysicalActionContainer.hpp" instances.
>
>--------------------------------------------------------------------------
>
>*void ElementDestroyer::action(Body * body)
>{
> futureDeletes.clear();
>
> Vector3r pos;
> bool testX;
>
> 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->isDynamic )
> {
> pos = body->physicalParameters->se3.position;
>
> testX = ( pos[1]< -0.1 );
>
> if (testX)
> {
> futureDeletes.push_back(body->getId());
> }
> }
> }
> vector<unsigned int>::iterator itv;
>
> for(itv=futureDeletes.begin();itv!=futureDeletes.end();++itv)
> ncb->bodies->erase(*itv);
>}
>
>*--------------------------------------------------------------------------
>
>
>Could you help me, because I don't know how to solve that ...
>
>thanks
>
>
>lionel
>
>_______________________________________________
>Yade-users mailing list
>Yade-users@xxxxxxxxxxxxxxxx
>https://lists.berlios.de/mailman/listinfo/yade-users
>
>
>
--
_______________
Chareyre Bruno
Maître de conférence
Institut National Polytechnique de Grenoble
Laboratoire 3S (Soils Solids Structures) - bureau I08
BP 53 - 38041, Grenoble cedex 9 - France
Tél : 04.56.52.86.21
________________
_______________________________________________
Yade-users mailing list
Yade-users@xxxxxxxxxxxxxxxx
https://lists.berlios.de/mailman/listinfo/yade-users
References