← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 4043: Keep the values of sorted bounds in the [0, size] range in ISCollider.

 

------------------------------------------------------------
revno: 4043
committer: bchareyre <bruno.chareyre@xxxxxxxxxxxxxxx>
timestamp: Mon 2017-05-15 18:31:11 +0200
message:
  Keep the values of sorted bounds in the [0,size] range in ISCollider.
modified:
  pkg/common/InsertionSortCollider.cpp


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'pkg/common/InsertionSortCollider.cpp'
--- pkg/common/InsertionSortCollider.cpp	2017-05-15 16:31:11 +0000
+++ pkg/common/InsertionSortCollider.cpp	2017-05-15 16:31:11 +0000
@@ -455,6 +455,8 @@
 		}
 		v[v.norm(j+1)]=vi;
 	}
+	//Keep coord's in [0,cellDim] by clamping the largest values
+	for(long i=v.norm(loIdx-1); v[i].coord > v.cellDim; i= v.norm(--i)) {v[i].period+=1; v[i].coord-=v.cellDim; loIdx=i;}
 }
 
 // called by the insertion sort if 2 bodies swapped their bounds