← Back to team overview

yade-dev team mailing list archive

Re: [Branch ~yade-dev/yade/trunk] Rev 2809: Little changesinCpmStateUpdater

 

Hello,

when erasing bodies by function O.bodies.erase(id) I got errors (wrong memory access). So I added if(!interaction) continue; and if(!body) continue; to FOREACH loops in CpmStateUpdater, then it was OK. Is there some more generic fix?
thanks
Jan

______________________________________________________________
> Od: noreply@xxxxxxxxxxxxx
> Komu: Yade developers <yade-dev@xxxxxxxxxxxxxxxxxxx>
> Datum: 08.04.2011 08:33
> Předmět: [Yade-dev] [Branch ~yade-dev/yade/trunk] Rev 2809: Little changesinCpmStateUpdater
>
>------------------------------------------------------------
>revno: 2809
>committer: Jan Stransky <_honzik@xxxxxxxxxx>
>branch nick: yade
>timestamp: Fri 2011-04-08 08:31:21 +0200
>message:
>  Little changes in CpmStateUpdater
>modified:
>  pkg/dem/ConcretePM.cpp
>
>
>--
>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 'pkg/dem/ConcretePM.cpp'
>--- pkg/dem/ConcretePM.cpp	2010-12-21 12:19:50 +0000
>+++ pkg/dem/ConcretePM.cpp	2011-04-08 06:31:21 +0000
>@@ -394,6 +394,7 @@
> 	assert(bodyStats[0].nCohLinks==0); // should be initialized by dfault ctor
> 	avgRelResidual=0; Real nAvgRelResidual=0;
> 	FOREACH(const shared_ptr<Interaction>& I, *scene->interactions){
>+		if(!I) continue;
> 		if(!I->isReal()) continue;
> 		shared_ptr<CpmPhys> phys=dynamic_pointer_cast<CpmPhys>(I->phys);
> 		if(!phys) continue;
>@@ -421,6 +422,7 @@
> 		nAvgRelResidual+=1;
> 	}
> 	FOREACH(shared_ptr<Body> B, *scene->bodies){
>+		if (!B) continue;
> 		const Body::id_t& id=B->getId();
> 		// add damaged contacts that have already been deleted
> 		CpmState* state=dynamic_cast<CpmState*>(B->state.get());
>
>
>_______________________________________________
>Mailing list: https://launchpad.net/~yade-dev
>Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
>Unsubscribe : https://launchpad.net/~yade-dev
>More help   : https://help.launchpad.net/ListHelp
>
>



Follow ups

References