yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #05952
[Branch ~yade-dev/yade/trunk] Rev 2507: Added a throw condition if two spheres have zero distance. Works in #ifdef YADE_DEBUG only.
------------------------------------------------------------
revno: 2507
committer: Janek Kozicki <cosurgi@xxxxxxxxxx>
branch nick: yade
timestamp: Wed 2010-10-20 19:46:55 +0200
message:
Added a throw condition if two spheres have zero distance. Works in #ifdef YADE_DEBUG only.
modified:
pkg/dem/Ig2_Sphere_Sphere_ScGeom.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/dem/Ig2_Sphere_Sphere_ScGeom.cpp'
--- pkg/dem/Ig2_Sphere_Sphere_ScGeom.cpp 2010-10-20 11:31:49 +0000
+++ pkg/dem/Ig2_Sphere_Sphere_ScGeom.cpp 2010-10-20 17:46:55 +0000
@@ -32,6 +32,9 @@
else { scm=shared_ptr<ScGeom>(new ScGeom()); c->geom=scm; }
Real norm=normal.norm(); normal/=norm; // normal is unit vector now
+#ifdef YADE_DEBUG
+ if(norm==0) throw runtime_error(("Zero distance between spheres #"+lexical_cast<string>(c->getId1())+" and #"+lexical_cast<string>(c->getId2())+".").c_str());
+#endif
Real penetrationDepth=s1->radius+s2->radius-norm;
scm->contactPoint=se31.position+(s1->radius-0.5*penetrationDepth)*normal;//0.5*(pt1+pt2);
scm->penetrationDepth=penetrationDepth;