← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2749: fix bug #721107

 

------------------------------------------------------------
revno: 2749
committer: Sergei D. <sega@think>
branch nick: yade
timestamp: Sat 2011-02-19 22:12:33 +0300
message:
  fix bug #721107
modified:
  pkg/common/Dispatching.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/common/Dispatching.cpp'
--- pkg/common/Dispatching.cpp	2011-01-21 20:42:22 +0000
+++ pkg/common/Dispatching.cpp	2011-02-19 19:12:33 +0000
@@ -19,7 +19,7 @@
 	updateScenePtr();
 	shared_ptr<BodyContainer>& bodies = scene->bodies;
 	const long numBodies=(long)bodies->size();
-	bool haveBins=(bool)velocityBins;
+	const long haveBins=((bool)velocityBins)?velocityBins->bodyBins.size():0;
 	if(sweepDist!=0 && haveBins){ LOG_FATAL("Only one of sweepDist or velocityBins can used!"); abort(); }
 	//#pragma omp parallel for
 	for(int id=0; id<numBodies; id++){
@@ -43,7 +43,7 @@
 		}
 		if(haveBins){
 			Aabb* aabb=YADE_CAST<Aabb*>(b->bound.get());
-			Real sweep=velocityBins->bins[velocityBins->bodyBins[b->getId()]].maxDist;
+			Real sweep=(b->getId()<haveBins)?velocityBins->bins[velocityBins->bodyBins[b->getId()]].maxDist:0;
 			aabb->min-=Vector3r(sweep,sweep,sweep);
 			aabb->max+=Vector3r(sweep,sweep,sweep);
 		}