← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1850: 1. Fix assertion failure in NewtonsDampedLaw triggered by clumps in debug mode (typo)

 

------------------------------------------------------------
revno: 1850
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Fri 2009-12-04 05:53:02 +0100
message:
  1. Fix assertion failure in NewtonsDampedLaw triggered by clumps in debug mode (typo)
  2. Fix periodicity for Dem3Dof classes
  3. Don't put things to __builtins__ in python, from yade import * will import wrappers as necessary into current global scope instead.
  4. Expose Omega as yade.wrapper.O instance in the c++ code directly.
modified:
  core/main/main.py.in
  gui/py/PythonUI_rc.py
  pkg/common/Engine/StandAloneEngine/InsertionSortCollider.cpp
  pkg/common/Engine/StandAloneEngine/InsertionSortCollider.hpp
  pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.cpp
  pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp
  pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_WallSphere.cpp
  pkg/dem/Engine/StandAloneEngine/NewtonsDampedLaw.cpp
  py/__init__.py.in
  py/pack.py
  py/system.py
  py/timing.py
  py/utils.py
  py/yadeWrapper/yadeWrapper.cpp
  scripts/test/periodic-simple.py


--
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 'core/main/main.py.in'
--- core/main/main.py.in	2009-12-03 20:57:11 +0000
+++ core/main/main.py.in	2009-12-04 04:53:02 +0000
@@ -41,8 +41,8 @@
 except ImportError: pass
 
 # be nice to users
+from yade import *
 from math import *
-from miniWm3Wrap import *
 
 # something to run?
 if len(args)>0:

=== modified file 'gui/py/PythonUI_rc.py'
--- gui/py/PythonUI_rc.py	2009-12-03 20:57:11 +0000
+++ gui/py/PythonUI_rc.py	2009-12-04 04:53:02 +0000
@@ -8,6 +8,7 @@
 from miniWm3Wrap import *
 from yade.wrapper import *
 from yade._customConverters import *
+from yade import * # types
 from yade import runtime
 from yade import utils
 

=== modified file 'pkg/common/Engine/StandAloneEngine/InsertionSortCollider.cpp'
--- pkg/common/Engine/StandAloneEngine/InsertionSortCollider.cpp	2009-12-01 14:56:39 +0000
+++ pkg/common/Engine/StandAloneEngine/InsertionSortCollider.cpp	2009-12-04 04:53:02 +0000
@@ -357,7 +357,7 @@
 	const shared_ptr<Interaction>& I=interactions->find(id1,id2);
 	bool hasInter=(bool)I;
 	#ifdef PISC_DEBUG
-		if(watchIds(id1,id2)) LOG_INFO("Inversion #"<<id1<<"+#"<<id2<<", overlap=="<<overlap<<", hasInter=="<<hasInter);
+		if(watchIds(id1,id2)) LOG_DEBUG("Inversion #"<<id1<<"+#"<<id2<<", overlap=="<<overlap<<", hasInter=="<<hasInter);
 	#endif
 	// interaction doesn't exist and shouldn't, or it exists and should
 	if(!overlap && !hasInter) return;
@@ -365,14 +365,14 @@
 	// create interaction if not yet existing
 	if(overlap && !hasInter){ // second condition only for readability
 		#ifdef PISC_DEBUG
-			if(watchIds(id1,id2)) LOG_INFO("Attemtping collision of #"<<id1<<"+#"<<id2);
+			if(watchIds(id1,id2)) LOG_DEBUG("Attemtping collision of #"<<id1<<"+#"<<id2);
 		#endif
 		if(!Collider::mayCollide(Body::byId(id1,rb).get(),Body::byId(id2,rb).get())) return;
 		// LOG_TRACE("Creating new interaction #"<<id1<<"+#"<<id2);
 		shared_ptr<Interaction> newI=shared_ptr<Interaction>(new Interaction(id1,id2));
 		newI->cellDist=periods;
 		#ifdef PISC_DEBUG
-			if(watchIds(id1,id2)) LOG_INFO("Created intr #"<<id1<<"+#"<<id2<<", periods="<<periods);
+			if(watchIds(id1,id2)) LOG_DEBUG("Created intr #"<<id1<<"+#"<<id2<<", periods="<<periods);
 		#endif
 		interactions->insert(newI);
 		return;
@@ -430,8 +430,13 @@
 		if(!(mn1<=mx2 && mx1 >= mn2)) return false;
 	}
 	#ifdef PISC_DEBUG
-		if(watchIds(id1,id2)) LOG_INFO("Overlap #"<<id1<<"+#"<<id2<<", periods "<<periods);
+		if(watchIds(id1,id2)) LOG_DEBUG("Overlap #"<<id1<<"+#"<<id2<<", periods "<<periods);
 	#endif
 	return true;
 }
 
+#ifdef PISC_DEBUG
+	bool InsertionSortCollider::watchIds(body_id_t id1, body_id_t id2) const{
+		return true; //id1==1 || id2==1;
+	}
+#endif

=== modified file 'pkg/common/Engine/StandAloneEngine/InsertionSortCollider.hpp'
--- pkg/common/Engine/StandAloneEngine/InsertionSortCollider.hpp	2009-12-01 14:56:39 +0000
+++ pkg/common/Engine/StandAloneEngine/InsertionSortCollider.hpp	2009-12-04 04:53:02 +0000
@@ -118,6 +118,9 @@
 			return coord>b.coord;
 		}
 	};
+	#ifdef PISC_DEBUG
+		bool watchIds(body_id_t id1,body_id_t id2) const;
+	#endif
 	#ifdef COLLIDE_STRIDED
 		// keep this dispatcher and call it ourselves as needed
 		shared_ptr<BoundingVolumeDispatcher> boundDispatcher;

=== modified file 'pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.cpp'
--- pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.cpp	2009-12-01 11:02:55 +0000
+++ pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.cpp	2009-12-04 04:53:02 +0000
@@ -152,7 +152,7 @@
 		fs->cp2rel.Align(Vector3r::UNIT_X,state2.ori.Conjugate()*(-normalGlob)); // initial sphere-local center-contactPt orientation WRT +x
 		fs->cp2rel.Normalize();
 	}
-	fs->se31=state1.se3; fs->se32=state2.se3;
+	fs->se31=state1.se3; fs->se32=state2.se3; fs->se32.position+=shift2;
 	fs->normal=normalGlob;
 	fs->contactPoint=state2.pos+shift2+(-normalGlob)*(sphereRadius-penetrationDepth);
 	return true;

=== modified file 'pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp'
--- pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp	2009-12-01 11:02:55 +0000
+++ pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp	2009-12-04 04:53:02 +0000
@@ -179,7 +179,7 @@
 	}
 	ss->normal=normal;
 	ss->contactPoint=state1.pos+(ss->effR1-.5*(ss->refLength-dist))*ss->normal;
-	ss->se31=state1.se3; ss->se32=state2.se3;
+	ss->se31=state1.se3; ss->se32=state2.se3; ss->se32.position+=shift2;
 	return true;
 }
 

=== modified file 'pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_WallSphere.cpp'
--- pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_WallSphere.cpp	2009-12-01 11:02:55 +0000
+++ pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_WallSphere.cpp	2009-12-04 04:53:02 +0000
@@ -68,7 +68,7 @@
 		ws->cp2rel.Normalize();
 		//LOG_INFO(ws->cp1pt);
 	}
-	ws->se31=state1.se3; ws->se32=state2.se3;
+	ws->se31=state1.se3; ws->se32=state2.se3; ws->se32.position+=shift2;
 	ws->contactPoint=contPt;
 	ws->normal=normalGlob;
 	return true;

=== modified file 'pkg/dem/Engine/StandAloneEngine/NewtonsDampedLaw.cpp'
--- pkg/dem/Engine/StandAloneEngine/NewtonsDampedLaw.cpp	2009-12-02 09:26:16 +0000
+++ pkg/dem/Engine/StandAloneEngine/NewtonsDampedLaw.cpp	2009-12-04 04:53:02 +0000
@@ -129,7 +129,7 @@
 					state->angAccel+=dAngAccel;
 					FOREACH(Clump::memberMap::value_type mm, static_cast<Clump*>(b.get())->members){
 						const body_id_t& memberId=mm.first;
-						const shared_ptr<Body>& member=Body::byId(memberId,ncb); assert(b->isClumpMember());
+						const shared_ptr<Body>& member=Body::byId(memberId,ncb); assert(member->isClumpMember());
 						State* memberState=member->state.get();
 						handleClumpMemberAccel(ncb,memberId,memberState,state);
 						handleClumpMemberAngAccel(ncb,memberId,memberState,state);

=== modified file 'py/__init__.py.in'
--- py/__init__.py.in	2009-12-03 20:57:11 +0000
+++ py/__init__.py.in	2009-12-04 04:53:02 +0000
@@ -46,10 +46,19 @@
 	
 
 # c++ initialization code
-import boot,system,wrapper
+import boot,system
 boot.initialize(plugins)
+system.setExitHandlers() # avoid backtrace if crash at finalization (log4cxx)
+
 # create types
-__builtins__.update(system.cxxCtorsDict())
-__builtins__['O']=wrapper.Omega()
-system.setExitHandlers() # avoid backtrace if crash at finalization (log4cxx)
+yadeTypes=system.cxxCtorsDict()
+# insert those in the module namespace
+globals().update(yadeTypes)
+# declare what should be imported for "from yade import *"
+__all__=yadeTypes.keys()+['O']
+# fake miniWm3 and wrapper being in yade itself
+import miniWm3Wrap,wrapper
+from miniWm3Wrap import *
+from wrapper import *
+__all__+=dir(miniWm3Wrap)+dir(wrapper)
 

=== modified file 'py/pack.py'
--- py/pack.py	2009-11-25 21:34:43 +0000
+++ py/pack.py	2009-12-04 04:53:02 +0000
@@ -19,7 +19,7 @@
 from yade import utils
 
 from miniWm3Wrap import *
-from yade.wrapper import *
+from yade import *
 
 ## compatibility hack for python 2.5 (21/8/2009)
 ## can be safely removed at some point

=== modified file 'py/system.py'
--- py/system.py	2009-12-03 20:57:11 +0000
+++ py/system.py	2009-12-04 04:53:02 +0000
@@ -92,7 +92,7 @@
 		def _quit(): import sys; sys.exit(0)
 		__builtins__['quit']=_quit
 	# avoid backtrace at regular exit, even if we crash
-	sys.exit=O.exitNoBacktrace
+	sys.exit=wrapper.Omega().exitNoBacktrace
 	#sys.excepthook=sys.__excepthook__ # apport on ubuntu overrides this, we don't need it
 
 def runServers():

=== modified file 'py/timing.py'
--- py/timing.py	2009-11-13 11:27:22 +0000
+++ py/timing.py	2009-12-04 04:53:02 +0000
@@ -4,6 +4,8 @@
 See https://yade.hmg.inpg.fr/index.php/Speed_profiling_using_TimingInfo_and_TimingDeltas_classes
 for more details on usage."""
 
+from yade import *
+
 
 def _resetEngine(e):
 	if e.timingDeltas: e.timingDeltas.reset()

=== modified file 'py/utils.py'
--- py/utils.py	2009-11-26 15:57:19 +0000
+++ py/utils.py	2009-12-04 04:53:02 +0000
@@ -10,6 +10,7 @@
 """
 
 import math,random
+from yade import *
 from yade.wrapper import *
 from miniWm3Wrap import *
 try: # use psyco if available

=== modified file 'py/yadeWrapper/yadeWrapper.cpp'
--- py/yadeWrapper/yadeWrapper.cpp	2009-12-03 20:57:11 +0000
+++ py/yadeWrapper/yadeWrapper.cpp	2009-12-04 04:53:02 +0000
@@ -898,5 +898,6 @@
 	EXPOSE_CXX_CLASS(FileGenerator)
 		.def("generate",&FileGenerator_generate)
 		.def("load",&FileGenerator_load);
+	python::scope().attr("O")=pyOmega();
 }
 

=== modified file 'scripts/test/periodic-simple.py'
--- scripts/test/periodic-simple.py	2009-11-25 21:21:17 +0000
+++ scripts/test/periodic-simple.py	2009-12-04 04:53:02 +0000
@@ -5,7 +5,7 @@
 
 from yade import log,timing
 
-#log.setLevel("PeriodicInsertionSortCollider",log.TRACE)
+#log.setLevel("InsertionSortCollider",log.DEBUG)
 O.engines=[
 	BexResetter(),
 	BoundingVolumeMetaEngine([InteractingSphere2AABB(),MetaInteractingGeometry2AABB()]),