← Back to team overview

yade-dev team mailing list archive

[svn] r1912 - in trunk: . lib/factory pkg/dem/DataClass/InteractionGeometry

 

Author: eudoxos
Date: 2009-08-03 17:25:05 +0200 (Mon, 03 Aug 2009)
New Revision: 1912

Modified:
   trunk/SConstruct
   trunk/lib/factory/ClassFactory.hpp
   trunk/pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp
   trunk/pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.hpp
Log:
1. Don't use __COUNTER__ to generate plugin registration function names, as they wre added in gcc 4.3 Use the name of the first plugin instead.
2. Dem3Dof_SphereSphere takes touching distance as equilibrium if distanceFactor is <=1. The initial position otherwise (was the default everytime until now)


Modified: trunk/SConstruct
===================================================================
--- trunk/SConstruct	2009-08-03 11:02:11 UTC (rev 1911)
+++ trunk/SConstruct	2009-08-03 15:25:05 UTC (rev 1912)
@@ -405,7 +405,7 @@
 
 ### COMPILER
 if env['debug']: env.Append(CXXFLAGS='-ggdb2',CPPDEFINES=['YADE_DEBUG'])
-else: env.Append(CXXFLAGS='-O2')
+else: env.Append(CXXFLAGS='-O3')
 if env['openmp']: env.Append(CXXFLAGS='-fopenmp',LIBS='gomp',CPPDEFINES='YADE_OPENMP')
 if env['optimize']:
 	env.Append(CXXFLAGS=Split('-O3 -march=%s'%env['march']),

Modified: trunk/lib/factory/ClassFactory.hpp
===================================================================
--- trunk/lib/factory/ClassFactory.hpp	2009-08-03 11:02:11 UTC (rev 1911)
+++ trunk/lib/factory/ClassFactory.hpp	2009-08-03 15:25:05 UTC (rev 1912)
@@ -177,9 +177,8 @@
 
 
 /*! Macro defining what classes can be found in this plugin -- must always be used in the respective .cpp file.
- *
- * Note: __COUNTER__ generates unique function name for each plugin. This avoids name clashes, even if multiple .cpp files
- * are compiled into one plugin.
+ * A function registerThisPluginClasses_FirstPluginName is generated at every occurence. The identifier should
+ * be unique and avoids use of __COUNTER__ which didn't appear in gcc until 4.3.
  */
 
 #ifdef YADE_BOOST_SERIALIZATION
@@ -189,7 +188,7 @@
 #endif
 
 #define _YADE_PLUGIN_REPEAT(x,y,z) BOOST_PP_STRINGIZE(z),
-#define YADE_PLUGIN(plugins) namespace{ __attribute__((constructor)) void BOOST_PP_CAT(registerThisPluginClasses,__COUNTER__) (void){ const char* info[]={__FILE__ , BOOST_PP_SEQ_FOR_EACH(_YADE_PLUGIN_REPEAT,~,plugins) NULL}; ClassFactory::instance().registerPluginClasses(info);} } BOOST_PP_SEQ_FOR_EACH(_YADE_PLUGIN_BOOST_REGISTER,~,plugins)
+#define YADE_PLUGIN(plugins) namespace{ __attribute__((constructor)) void BOOST_PP_CAT(registerThisPluginClasses_,BOOST_PP_SEQ_HEAD(plugins)) (void){ const char* info[]={__FILE__ , BOOST_PP_SEQ_FOR_EACH(_YADE_PLUGIN_REPEAT,~,plugins) NULL}; ClassFactory::instance().registerPluginClasses(info);} } BOOST_PP_SEQ_FOR_EACH(_YADE_PLUGIN_BOOST_REGISTER,~,plugins)
 //! Macro informing build file generator what features that particular file depends on. Has no effect at compile-time. Can be specified multiple times within a single (.cpp) file
 #define YADE_REQUIRE_FEATURE(feature)
 

Modified: trunk/pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp
===================================================================
--- trunk/pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp	2009-08-03 11:02:11 UTC (rev 1911)
+++ trunk/pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp	2009-08-03 15:25:05 UTC (rev 1912)
@@ -162,7 +162,8 @@
 		ss=shared_ptr<Dem3DofGeom_SphereSphere>(new Dem3DofGeom_SphereSphere());
 		c->interactionGeometry=ss;
 		// constants
-		ss->refLength=dist;
+		if(distanceFactor>1) ss->refLength=dist;
+		else ss->refLength=s1->radius+s2->radius;
 		ss->refR1=s1->radius; ss->refR2=s2->radius;
 		Real penetrationDepth=s1->radius+s2->radius-ss->refLength;
 		if(Omega::instance().getCurrentIteration()<=10){

Modified: trunk/pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.hpp
===================================================================
--- trunk/pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.hpp	2009-08-03 11:02:11 UTC (rev 1911)
+++ trunk/pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.hpp	2009-08-03 15:25:05 UTC (rev 1912)
@@ -61,6 +61,7 @@
 		virtual bool go(const shared_ptr<InteractingGeometry>& cm1, const shared_ptr<InteractingGeometry>& cm2, const Se3r& se31, const Se3r& se32, const shared_ptr<Interaction>& c);
 		virtual bool goReverse(	const shared_ptr<InteractingGeometry>&, const shared_ptr<InteractingGeometry>&, const Se3r&, const Se3r&, const shared_ptr<Interaction>&){throw runtime_error("goReverse on symmetric functor should never be called!");}
 		//! Factor of sphere radius such that sphere "touch" if their centers are not further than distanceFactor*(r1+r2); defaults to 1.
+		//! If >1, equilibrium distance is the one when spheres get into initial contact; it is the sum of their radii otherwise.
 		Real distanceFactor;
 		ef2_Sphere_Sphere_Dem3DofGeom(): distanceFactor(1.) {}
 	FUNCTOR2D(InteractingSphere,InteractingSphere);




Follow ups