← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3752: Remove PISC_DEBUG.

 

------------------------------------------------------------
revno: 3752
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Wed 2015-12-09 08:35:43 +0100
message:
  Remove PISC_DEBUG.
modified:
  pkg/common/InsertionSortCollider.cpp
  pkg/common/InsertionSortCollider.hpp


--
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	2015-12-09 07:35:43 +0000
+++ pkg/common/InsertionSortCollider.cpp	2015-12-09 07:35:43 +0000
@@ -35,10 +35,6 @@
 
 		while(j>=0 && v[j]>viInit){
 			v[j+1]=v[j];
-			#ifdef PISC_DEBUG
-				if(watchIds(v[j].id,viInit.id)) cerr<<"Swapping #"<<v[j].id<<"  with #"<<viInit.id<<" ("<<setprecision(80)<<v[j].coord<<">"<<setprecision(80)<<viInit.coord<<" along axis "<<v.axis<<")"<<endl;
-				if(v[j].id==viInit.id){ cerr<<"Inversion of body #"<<v[j].id<<" with itself, "<<v[j].flags.isMin<<" & "<<viInit.flags.isMin<<", isGreater "<<(v[j]>viInit)<<", "<<(v[j].coord>viInit.coord)<<endl; j--; continue; }
-			#endif
 			// no collisions without bounding boxes
 			// also, do not collide body with itself; it sometimes happens for facets aligned perpendicular to an axis, for reasons that are not very clear
 			// see https://bugs.launchpad.net/yade/+bug/669095
@@ -491,23 +487,9 @@
 		// find body of which minimum when taken as period start will make the gap smaller
 		Real m1=minima[3*id1+axis],m2=minima[3*id2+axis];
 		Real wMn=(cellWrapRel(m1,m2,m2+dim)<cellWrapRel(m2,m1,m1+dim)) ? m2 : m1;
-		#ifdef PISC_DEBUG
-		if(watchIds(id1,id2)){
-			TRVAR4(id1,id2,axis,dim);
-			TRVAR4(minima[3*id1+axis],maxima[3*id1+axis],minima[3*id2+axis],maxima[3*id2+axis]);
-			TRVAR2(cellWrapRel(m1,m2,m2+dim),cellWrapRel(m2,m1,m1+dim));
-			TRVAR3(m1,m2,wMn);
-		}
-		#endif
 		int pmn1,pmx1,pmn2,pmx2;
 		Real mn1=cellWrap(m1,wMn,wMn+dim,pmn1), mx1=cellWrap(maxima[3*id1+axis],wMn,wMn+dim,pmx1);
 		Real mn2=cellWrap(m2,wMn,wMn+dim,pmn2), mx2=cellWrap(maxima[3*id2+axis],wMn,wMn+dim,pmx2);
-		#ifdef PISC_DEBUG
-			if(watchIds(id1,id2)){
-				TRVAR4(mn1,mx1,mn2,mx2);
-				TRVAR4(pmn1,pmx1,pmn2,pmx2);
-			}
-		#endif
 		if((pmn1!=pmx1) || (pmn2!=pmx2)){
 			if (allowBiggerThanPeriod) {
 				// If both bodies are bigger, we place them in the (0,0,0) period
@@ -528,9 +510,6 @@
 			periods[axis]=(int)(pmn1-pmn2);
 			if(!(mn1<=mx2 && mx1 >= mn2)) return false;}
 	}
-	#ifdef PISC_DEBUG
-		if(watchIds(id1,id2)) LOG_DEBUG("Overlap #"<<id1<<"+#"<<id2<<", periods "<<periods);
-	#endif
 	return true;
 }
 
@@ -551,3 +530,9 @@
 	}
 	return boost::python::make_tuple(bl[0],bl[1],bl[2]);
 }
+
+void InsertionSortCollider::VecBounds::updatePeriodicity(Scene* scene) {
+	assert(scene->isPeriodic);
+	assert(axis>=0 && axis <=2);
+	cellDim=scene->cell->getSize()[axis];
+}

=== modified file 'pkg/common/InsertionSortCollider.hpp'
--- pkg/common/InsertionSortCollider.hpp	2015-06-15 06:33:01 +0000
+++ pkg/common/InsertionSortCollider.hpp	2015-12-09 07:35:43 +0000
@@ -65,11 +65,6 @@
 // #define this macro to enable timing within this engine
 // #define ISC_TIMING
 
-// #define to turn on some tracing information for the periodic part
-// all code under this can be probably removed at some point, when the collider will have been tested thoroughly
-// #define PISC_DEBUG
-
-
 #ifdef ISC_TIMING
 	#define ISC_CHECKPOINT(cpt) timingDeltas->checkpoint(cpt)
 #else
@@ -107,10 +102,6 @@
 			return coord>b.coord;
 		}
 	};
-	#ifdef PISC_DEBUG
-		int watch1, watch2;
-		bool watchIds(Body::id_t id1,Body::id_t id2) const { return (watch1<0 &&(watch2==id1||watch2==id2))||(watch2<0 && (watch1==id1||watch1==id2))||(watch1==id1 && watch2==id2)||(watch1==id2 && watch2==id1); }
-	#endif
 		// we need this to find out about current maxVelocitySq
 		shared_ptr<NewtonIntegrator> newton;
 		// if False, no type of striding is used
@@ -128,11 +119,7 @@
 		Bounds& operator[](long idx){ assert(idx<size && idx>=0); return vec[idx]; }
 		const Bounds& operator[](long idx) const { assert(idx<size && idx>=0); return vec[idx]; }
 		// update number of bodies, periodic properties and size from Scene
-		void updatePeriodicity(Scene* scene){
-			assert(scene->isPeriodic);
-			assert(axis>=0 && axis <=2);
-			cellDim=scene->cell->getSize()[axis];
-		}
+		void updatePeriodicity(Scene* );
 		// normalize given index to the right range (wraps around)
 		long norm(long i) const { if(i<0) i+=size; long ret=i%size; assert(ret>=0 && ret<size); return ret;}
 		VecBounds(): axis(-1), size(0), loIdx(0){}
@@ -155,7 +142,6 @@
 	void insertionSort(VecBounds& v,InteractionContainer*,Scene*,bool doCollide=true);
 	void insertionSortParallel(VecBounds& v,InteractionContainer*,Scene*,bool doCollide=true);
 	void handleBoundInversion(Body::id_t,Body::id_t,InteractionContainer*,Scene*);
-// 	bool spatialOverlap(Body::id_t,Body::id_t) const;
 
 	// periodic variants
 	void insertionSortPeri(VecBounds& v,InteractionContainer*,Scene*,bool doCollide=true);
@@ -224,9 +210,6 @@
 			#ifdef ISC_TIMING
 				timingDeltas=shared_ptr<TimingDeltas>(new TimingDeltas);
 			#endif 
-			#ifdef PISC_DEBUG
-				watch1=watch2=-1; // disable watching
-			#endif
 			for(int i=0; i<3; i++) BB[i].axis=i;
 			periodic=false;
 			strideActive=false;
@@ -235,10 +218,6 @@
 		.def_readonly("strideActive",&InsertionSortCollider::strideActive,"Whether striding is active (read-only; for debugging). |yupdate|")
 		.def_readonly("periodic",&InsertionSortCollider::periodic,"Whether the collider is in periodic mode (read-only; for debugging) |yupdate|")
 		.def("dumpBounds",&InsertionSortCollider::dumpBounds,"Return representation of the internal sort data. The format is ``([...],[...],[...])`` for 3 axes, where each ``...`` is a list of entries (bounds). The entry is a tuple with the fllowing items:\n\n* coordinate (float)\n* body id (int), but negated for negative bounds\n* period numer (int), if the collider is in the periodic regime.")
-		#ifdef PISC_DEBUG
-			.def_readwrite("watch1",&InsertionSortCollider::watch1,"debugging only: watched body Id.")
-			.def_readwrite("watch2",&InsertionSortCollider::watch2,"debugging only: watched body Id.")
-		#endif
 	);
 	DECLARE_LOGGER;
 };