← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2940: - fix https://bugs.launchpad.net/yade/+bug/693505

 

------------------------------------------------------------
revno: 2940
committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2011-10-21 19:43:08 +0200
message:
  - fix https://bugs.launchpad.net/yade/+bug/693505
  - don't crash the TSRecorder when bodies are removed
modified:
  pkg/dem/TesselationWrapper.cpp
  pkg/dem/TriaxialStateRecorder.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/TesselationWrapper.cpp'
--- pkg/dem/TesselationWrapper.cpp	2010-11-19 12:30:08 +0000
+++ pkg/dem/TesselationWrapper.cpp	2011-10-21 17:43:08 +0000
@@ -170,7 +170,7 @@
 // 	clock.top("Triangulation");
 }
 
-double TesselationWrapper::Volume(unsigned int id) {return Tes->Volume(id);}
+double TesselationWrapper::Volume(unsigned int id) {return (Tes->Max_id() > id) ? Tes->Volume(id) : 0;}
 
 bool TesselationWrapper::insert(double x, double y, double z, double rad, unsigned int id)
 {

=== modified file 'pkg/dem/TriaxialStateRecorder.cpp'
--- pkg/dem/TriaxialStateRecorder.cpp	2010-11-12 08:03:16 +0000
+++ pkg/dem/TriaxialStateRecorder.cpp	2011-10-21 17:43:08 +0000
@@ -48,7 +48,7 @@
 	BodyContainer::iterator bi = scene->bodies->begin();
 	BodyContainer::iterator biEnd = scene->bodies->end();
 	for ( ; bi!=biEnd; ++bi ){
-		if((*bi)->isClump()) continue;
+		if(!(*bi) || (*bi)->isClump()) continue;
 		const shared_ptr<Body>& b = *bi;
 		if ( b->isDynamic() ){
 			//Sorry, the next string was commented, because it gave a Warning "unused variable v". Anton Gladky