← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2939: Delete all corresponding iterations explicitely, when the body is erased

 

------------------------------------------------------------
revno: 2939
fixes bug: https://launchpad.net/bugs/780931
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: yade
timestamp: Thu 2011-10-20 09:09:36 +0200
message:
  Delete all corresponding iterations explicitely, when the body is erased
modified:
  core/BodyContainer.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 'core/BodyContainer.cpp'
--- core/BodyContainer.cpp	2010-11-30 13:51:41 +0000
+++ core/BodyContainer.cpp	2011-10-20 07:09:36 +0000
@@ -119,7 +119,15 @@
 			assert(body[id]->subDomId==Body::ID_NONE); // subDomId should never be defined for OpenMP-less builds
 		#endif 
 	#endif /* YADE_SUBDOMAINS */
+	
+	const shared_ptr<Scene>& scene=Omega::instance().getScene();
+	FOREACH(const shared_ptr<Interaction>& i, *scene->interactions){
+		if((i->getId1()==id or i->getId2()==id)) {
+			scene->interactions->requestErase(i->getId1(),i->getId2());
+		}
+	}
 	body[id]=shared_ptr<Body>();
+	
 	return true;
 }