← Back to team overview

yade-dev team mailing list archive

[svn] r1940 - in trunk: lib/multimethods pkg/dem/DataClass/InteractionGeometry pkg/dem/meta

 

Author: eudoxos
Date: 2009-08-13 11:01:41 +0200 (Thu, 13 Aug 2009)
New Revision: 1940

Modified:
   trunk/lib/multimethods/DynLibDispatcher.hpp
   trunk/pkg/dem/DataClass/InteractionGeometry/DemXDofGeom.hpp
   trunk/pkg/dem/meta/ConcretePM.hpp
   trunk/pkg/dem/meta/RockPM.hpp
Log:
1. Fix assertion is 2d dispatch code, add indices to RpmPhys, RpmMat, CpmPhys, CpmMat (would break dispatching if using more classes derived from the same base in the dispatch matrix)


Modified: trunk/lib/multimethods/DynLibDispatcher.hpp
===================================================================
--- trunk/lib/multimethods/DynLibDispatcher.hpp	2009-08-12 21:12:21 UTC (rev 1939)
+++ trunk/lib/multimethods/DynLibDispatcher.hpp	2009-08-13 09:01:41 UTC (rev 1940)
@@ -462,8 +462,12 @@
 			index2 = base2->getClassIndex();
 			assert( index1 >= 0 ); 
 			assert( index2 >= 0 ); 
+			#if 0 
+				if((unsigned)index1>=callBacks.size()) cerr<<__FILE__<<":"<<__LINE__<<" FATAL: Index out of range for class "<<base1->getClassName()<<" (index=="<<index1<<", callBacks.size()=="<<callBacks.size()<<endl;
+				if((unsigned)index2>=callBacks[index2].size()) cerr<<__FILE__<<":"<<__LINE__<<" FATAL: Index out of range for class "<<base2->getClassName()<<" (index=="<<index2<<", callBacks[index1].size()=="<<callBacks[index1].size()<<endl;
+			#endif
 			assert((unsigned int)( index1 ) < callBacks.size());
-			assert((unsigned int)( index2 ) < callBacks.size());
+			assert((unsigned int)( index2 ) < callBacks[index1].size());
 				
 			if(callBacks[index1][index2])
 				return true;

Modified: trunk/pkg/dem/DataClass/InteractionGeometry/DemXDofGeom.hpp
===================================================================
--- trunk/pkg/dem/DataClass/InteractionGeometry/DemXDofGeom.hpp	2009-08-12 21:12:21 UTC (rev 1939)
+++ trunk/pkg/dem/DataClass/InteractionGeometry/DemXDofGeom.hpp	2009-08-13 09:01:41 UTC (rev 1940)
@@ -32,7 +32,7 @@
 		//! reference radii of particles (for initial contact stiffness computation)
 		Real &refR1, &refR2;
 
-		Dem3DofGeom(): normal(GenericSpheresContact::normal), refR1(GenericSpheresContact::refR1), refR2(GenericSpheresContact::refR2) {}
+		Dem3DofGeom(): normal(GenericSpheresContact::normal), refR1(GenericSpheresContact::refR1), refR2(GenericSpheresContact::refR2) { createIndex(); }
 
 		// API that needs to be implemented in derived classes
 		virtual Real displacementN();
@@ -50,6 +50,7 @@
 		Real slipToStrainTMax(Real strainTMax){return slipToDisplacementTMax(strainTMax*refLength)/refLength;}
 
 		REGISTER_CLASS_AND_BASE(Dem3DofGeom,InteractionGeometry);
+		REGISTER_CLASS_INDEX(Dem3DofGeom,InteractionGeometry);
 		REGISTER_ATTRIBUTES(InteractionGeometry,(refLength)(normal)(contactPoint)(se31)(se32)(refR1)(refR2));
 };
 REGISTER_SERIALIZABLE(Dem3DofGeom);

Modified: trunk/pkg/dem/meta/ConcretePM.hpp
===================================================================
--- trunk/pkg/dem/meta/ConcretePM.hpp	2009-08-12 21:12:21 UTC (rev 1939)
+++ trunk/pkg/dem/meta/ConcretePM.hpp	2009-08-13 09:01:41 UTC (rev 1940)
@@ -72,6 +72,7 @@
 		CpmMat(): epsVolumetric(0.), numBrokenCohesive(0), numContacts(0), normDmg(0.), epsPlBroken(0.), normEpsPl(0.) {createIndex();};
 		REGISTER_ATTRIBUTES(BodyMacroParameters, (epsVolumetric) (numBrokenCohesive) (numContacts) (normDmg) (epsPlBroken) (normEpsPl));
 		REGISTER_CLASS_AND_BASE(CpmMat,BodyMacroParameters);
+		REGISTER_CLASS_INDEX(CpmMat,BodyMacroParameters);
 };
 REGISTER_SERIALIZABLE(CpmMat);
 
@@ -185,6 +186,7 @@
 		);
 	REGISTER_CLASS_AND_BASE(CpmPhys,NormalShearInteraction);
 	DECLARE_LOGGER;
+	REGISTER_CLASS_INDEX(CpmPhys,NormalShearInteraction);
 };
 REGISTER_SERIALIZABLE(CpmPhys);
 

Modified: trunk/pkg/dem/meta/RockPM.hpp
===================================================================
--- trunk/pkg/dem/meta/RockPM.hpp	2009-08-12 21:12:21 UTC (rev 1939)
+++ trunk/pkg/dem/meta/RockPM.hpp	2009-08-13 09:01:41 UTC (rev 1940)
@@ -65,6 +65,7 @@
 			(Brittleness)
 			(G_over_E));
 		REGISTER_CLASS_AND_BASE(RpmMat,BodyMacroParameters);
+		REGISTER_CLASS_INDEX(RpmMat,BodyMacroParameters);
 };
 REGISTER_SERIALIZABLE(RpmMat);
 
@@ -119,5 +120,6 @@
 			(lengthMaxTension)
 		);
 	REGISTER_CLASS_AND_BASE(RpmPhys,NormalShearInteraction);
+	REGISTER_CLASS_INDEX(RpmPhys,NormalShearInteraction);
 };
 REGISTER_SERIALIZABLE(RpmPhys);