← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3754: Merge branch 'master' of github.com:yade/trunk

 

Merge authors:
  Anton Gladky (gladky-anton)
------------------------------------------------------------
revno: 3754 [merge]
committer: Klaus Thoeni <klaus.thoeni@xxxxxxxxx>
timestamp: Wed 2015-12-09 21:51:26 +1100
message:
  Merge branch 'master' of github.com:yade/trunk
modified:
  pkg/common/Collider.cpp
  pkg/common/Collider.hpp
  pkg/common/InsertionSortCollider.cpp
  pkg/common/InsertionSortCollider.hpp
  pkg/common/PersistentTriangulationCollider.cpp
  pkg/common/SpatialQuickSortCollider.cpp
  pkg/common/ZECollider.cpp
  pkg/dem/GeneralIntegratorInsertionSortCollider.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/Collider.cpp'
--- pkg/common/Collider.cpp	2015-06-10 11:04:02 +0000
+++ pkg/common/Collider.cpp	2015-12-09 07:35:43 +0000
@@ -40,14 +40,3 @@
 	FOREACH(shared_ptr<BoundFunctor> bf, vb) this->boundDispatcher->add(bf);
 	t=boost::python::tuple(); // empty the args
 }
-
-void Collider::findBoundDispatcherInEnginesIfNoFunctorsAndWarn(){
-	if(boundDispatcher->functors.size()>0) return;
-	shared_ptr<BoundDispatcher> bd;
-	FOREACH(shared_ptr<Engine>& e, scene->engines){ bd=YADE_PTR_DYN_CAST<BoundDispatcher>(e); if(bd) break; }
-	if(!bd) return;
-	LOG_WARN("Collider.boundDispatcher had no functors defined, while there was a BoundDispatcher found in O.engines. Since version 0.60 (r2396), Collider has boundDispatcher integrated in itself; separate BoundDispatcher should not be used anymore. For now, I will fix it for you, but change your script! Where it reads e.g.\n\n\tO.engines=[...,\n\t\tBoundDispatcher([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),\n\t\t"<<getClassName()<<"(),\n\t\t...\n\t]\n\nit should become\n\n\tO.engines=[...,\n\t\t"<<getClassName()<<"([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),\n\t\t...\n\t]\n\ninstead.")
-	boundDispatcher=bd;
-	boundDispatcher->activated=false; // deactivate in the engine loop, the collider will call it itself
-}
-

=== modified file 'pkg/common/Collider.hpp'
--- pkg/common/Collider.hpp	2014-10-15 06:44:01 +0000
+++ pkg/common/Collider.hpp	2015-12-09 07:35:43 +0000
@@ -33,9 +33,6 @@
 
 		// ctor with functors for the integrated BoundDispatcher
 		virtual void pyHandleCustomCtorArgs(boost::python::tuple& t, boost::python::dict& d);
-
-		// backwards-compatility func, can be removed later
-		void findBoundDispatcherInEnginesIfNoFunctorsAndWarn();
 		
 		int get_avoidSelfInteractionMask(){return avoidSelfInteractionMask;}
 		void set_avoidSelfInteractionMask(const int &v){avoidSelfInteractionMask = v;}
@@ -44,8 +41,6 @@
 		((shared_ptr<BoundDispatcher>,boundDispatcher,new BoundDispatcher,Attr::readonly,":yref:`BoundDispatcher` object that is used for creating :yref:`bounds <Body.bound>` on collider's request as necessary.")),
 		/*ctor*/,
 		.add_property("avoidSelfInteractionMask",&Collider::get_avoidSelfInteractionMask,&Collider::set_avoidSelfInteractionMask,"This mask is used to avoid the interactions inside a group of particles. To do so, the particles must have the same mask and this mask have to be compatible with this one.")
-	
-		
 	);
 };
 REGISTER_SERIALIZABLE(Collider);

=== modified file 'pkg/common/InsertionSortCollider.cpp'
--- pkg/common/InsertionSortCollider.cpp	2015-06-15 06:33:01 +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
@@ -230,9 +226,6 @@
 		assert(BB[0].axis==0); assert(BB[1].axis==1); assert(BB[2].axis==2);
 		if(periodic) for(int i=0; i<3; i++) BB[i].updatePeriodicity(scene);
 
-		// compatibility block, can be removed later
-		findBoundDispatcherInEnginesIfNoFunctorsAndWarn();
-
 		if(verletDist<0){
 			Real minR=std::numeric_limits<Real>::infinity();
 			FOREACH(const shared_ptr<Body>& b, *scene->bodies){
@@ -494,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
@@ -531,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;
 }
 
@@ -554,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;
 };

=== modified file 'pkg/common/PersistentTriangulationCollider.cpp'
--- pkg/common/PersistentTriangulationCollider.cpp	2014-10-15 06:44:01 +0000
+++ pkg/common/PersistentTriangulationCollider.cpp	2015-12-09 07:35:43 +0000
@@ -35,8 +35,6 @@
 
 void PersistentTriangulationCollider::action ()
 {
-	// compatibility func, can be removed later
-	findBoundDispatcherInEnginesIfNoFunctorsAndWarn();
 	// update bounds
 	boundDispatcher->scene=scene; boundDispatcher->action();
 

=== modified file 'pkg/common/SpatialQuickSortCollider.cpp'
--- pkg/common/SpatialQuickSortCollider.cpp	2015-04-30 16:53:30 +0000
+++ pkg/common/SpatialQuickSortCollider.cpp	2015-12-09 07:35:43 +0000
@@ -17,8 +17,6 @@
 {
 	if(scene->isPeriodic){ throw runtime_error("SpatialQuickSortCollider doesn't handle periodic boundaries."); }
 
-	// compatibility func, can be removed later
-	findBoundDispatcherInEnginesIfNoFunctorsAndWarn();
 	// update bounds
 	boundDispatcher->scene=scene; boundDispatcher->action();
 

=== modified file 'pkg/common/ZECollider.cpp'
--- pkg/common/ZECollider.cpp	2014-10-15 06:44:01 +0000
+++ pkg/common/ZECollider.cpp	2015-12-09 07:35:43 +0000
@@ -57,8 +57,6 @@
 		periodic=scene->isPeriodic;
 	}
 
-		findBoundDispatcherInEnginesIfNoFunctorsAndWarn();
-
 		if(verletDist<0){
 			Real minR=std::numeric_limits<Real>::infinity();
 			FOREACH(const shared_ptr<Body>& b, *scene->bodies){

=== modified file 'pkg/dem/GeneralIntegratorInsertionSortCollider.cpp'
--- pkg/dem/GeneralIntegratorInsertionSortCollider.cpp	2015-06-15 06:33:01 +0000
+++ pkg/dem/GeneralIntegratorInsertionSortCollider.cpp	2015-12-09 07:35:43 +0000
@@ -75,9 +75,6 @@
 		assert(BB[0].axis==0); assert(BB[1].axis==1); assert(BB[2].axis==2);
 		if(periodic) for(int i=0; i<3; i++) BB[i].updatePeriodicity(scene);
 
-		// compatibility block, can be removed later
-		findBoundDispatcherInEnginesIfNoFunctorsAndWarn();
-
 		if(verletDist<0){
 			Real minR=std::numeric_limits<Real>::infinity();
 			FOREACH(const shared_ptr<Body>& b, *scene->bodies){