← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1714: 1. Skip more stuff in doxygen, a few warnings

 

------------------------------------------------------------
revno: 1714
committer: Václav Šmilauer <vaclav@flux>
branch nick: trunk
timestamp: Fri 2009-08-21 12:06:00 +0200
message:
  1. Skip more stuff in doxygen, a few warnings
  2. Add debugging code to DynLibDispatcher (disabled)
removed:
  extra/tetra/
modified:
  core/MetaEngine1D.hpp
  core/MetaEngine2D.hpp
  doc/Doxyfile
  gui/qt3/GLSimulationPlayerViewer.cpp
  gui/qt3/QtFileGenerator.cpp
  lib/multimethods/DynLibDispatcher.hpp
  pkg/common/Engine/MetaEngine/InteractionDispatchers.cpp
  pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.hpp
  pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.hpp
  pkg/dem/DataClass/InteractionGeometry/DemXDofGeom.cpp
  pkg/dem/DataClass/InteractionGeometry/DemXDofGeom.hpp
  py/yadeWrapper/yadeWrapper.cpp
  scripts/test-sphere-facet.py
  scripts/test/facet-sphere.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/MetaEngine1D.hpp'
--- core/MetaEngine1D.hpp	2009-02-08 22:57:07 +0000
+++ core/MetaEngine1D.hpp	2009-08-21 10:06:00 +0000
@@ -30,6 +30,7 @@
 {
 
 	public :
+		void dump(){ DynLibDispatcher<TYPELIST_1(baseClass),EngineUnitType,EngineUnitReturnType,EngineUnitArguments,autoSymmetry>::dumpDispatchMatrix1D(std::cerr); }
 		virtual void add(EngineUnitType* eu){ add(shared_ptr<EngineUnitType>(eu)); }
 		virtual void add(shared_ptr<EngineUnitType> eu){
 			storeFunctorName(eu->get1DFunctorType1(),eu->getClassName(),eu);

=== modified file 'core/MetaEngine2D.hpp'
--- core/MetaEngine2D.hpp	2009-05-29 13:35:22 +0000
+++ core/MetaEngine2D.hpp	2009-08-21 10:06:00 +0000
@@ -31,6 +31,7 @@
 				>
 {
 	public :
+		void dump(){ DynLibDispatcher<TYPELIST_2(baseClass1,baseClass2),EngineUnitType,EngineUnitReturnType,EngineUnitArguments,autoSymmetry>::dumpDispatchMatrix2D(std::cerr); }
 		/* add functor by pointer: this is convenience for calls like foo->add(new SomeFunctor); */
 		virtual void add(EngineUnitType* eu){ add(shared_ptr<EngineUnitType>(eu)); }
 		/* add functor by shared pointer */

=== modified file 'doc/Doxyfile'
--- doc/Doxyfile	2009-08-20 18:35:05 +0000
+++ doc/Doxyfile	2009-08-21 10:06:00 +0000
@@ -574,11 +574,7 @@
 # directories like "/usr/src/myproject". Separate the files or directories 
 # with spaces.
 
-INPUT                  = ../core/ \
-                         ../extra/ \
-                         ../gui/ \
-                         ../pkg/ \
-                         ../py/
+INPUT                  = ../core/ ../gui/ ../pkg/ ../py/ ../extra/
 
 # This tag can be used to specify the character encoding of the source files 
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
@@ -662,14 +658,7 @@
 # against the file with absolute path, so to exclude all test directories 
 # for example use the pattern */test/*
 
-EXCLUDE_PATTERNS       = */yade-flat/* \
-                         */include/* \
-                         */.* \
-                         */miniWm3/* \
-                         */multimethods/* \
-                         */loki/* \
-                         */QGLViewer/* \
-			 */3rd-party/*
+EXCLUDE_PATTERNS = */.* */3rd-party/* */mgpost/* */SpherePadder/* */*.py
 
 # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
 # (namespaces, classes, functions, etc.) that should be excluded from the 
@@ -677,7 +666,7 @@
 # wildcard * is used, a substring. Examples: ANamespace, AClass, 
 # AClass::ANamespace, ANamespace::*Test
 
-EXCLUDE_SYMBOLS        = 
+EXCLUDE_SYMBOLS        = pyplusplus custom_* boost::* MetaEngine1D* MetaEngine2D* std::* EngineUnit1D* EngineUnit2D* try_mutex Serializable Indexable Factorable
 
 # The EXAMPLE_PATH tag can be used to specify one or more files or 
 # directories that contain example code fragments that are included (see 

=== removed directory 'extra/tetra'
=== modified file 'gui/qt3/GLSimulationPlayerViewer.cpp'
--- gui/qt3/GLSimulationPlayerViewer.cpp	2009-07-10 08:49:09 +0000
+++ gui/qt3/GLSimulationPlayerViewer.cpp	2009-08-21 10:06:00 +0000
@@ -98,7 +98,7 @@
 	updateGL();
 }
 
-void GLSimulationPlayerViewer::load(const string& fileName, bool fromFile)
+void GLSimulationPlayerViewer::load(const std::string& fileName, bool fromFile)
 {
 	frameNumber=0;
 	setSnapshotCounter(0);

=== modified file 'gui/qt3/QtFileGenerator.cpp'
--- gui/qt3/QtFileGenerator.cpp	2009-02-23 21:25:32 +0000
+++ gui/qt3/QtFileGenerator.cpp	2009-08-21 10:06:00 +0000
@@ -68,7 +68,7 @@
 }
 
 
-void QtFileGenerator::setGeneratorName(string n)
+void QtFileGenerator::setGeneratorName(std::string n)
 {
 	for(int i=0 ; i<cbGeneratorName->count() ; ++i)
 	{

=== modified file 'lib/multimethods/DynLibDispatcher.hpp'
--- lib/multimethods/DynLibDispatcher.hpp	2009-08-13 08:01:41 +0000
+++ lib/multimethods/DynLibDispatcher.hpp	2009-08-21 10:06:00 +0000
@@ -21,9 +21,10 @@
 #include<yade/lib-loki/NullType.hpp>
 
 
-#include <vector>
-#include <list>
-#include <string>
+#include<vector>
+#include<list>
+#include<string>
+#include<ostream>
 
 
 using namespace std;
@@ -456,6 +457,21 @@
 		}
 	
 	
+		std::ostream& dumpDispatchMatrix2D(std::ostream& out){
+			for(size_t i=0; i<callBacks.size(); i++){
+				for(size_t j=0; j<callBacks.size(); j++){
+					if(callBacks[i][j]) out<<i<<"+"<<j<<" -> "<<callBacks[i][j]->getClassName()<<std::endl;
+				}
+			}
+			return out;
+		}
+		std::ostream& dumpDispatchMatrix1D(std::ostream& out){
+			for(size_t i=0; i<callBacks.size(); i++){
+					if(callBacks[i]) out<<i<<" -> "<<callBacks[i]->getClassName()<<std::endl;
+			}
+			return out;
+		}
+
 		bool locateMultivirtualFunctor2D(int& index1, int& index2, shared_ptr<BaseClass1>& base1,shared_ptr<BaseClass2>& base2)
 		  {
 			index1 = base1->getClassIndex();
@@ -468,59 +484,59 @@
 			#endif
 			assert((unsigned int)( index1 ) < callBacks.size());
 			assert((unsigned int)( index2 ) < callBacks[index1].size());
+			//#define _DISP_TRACE(msg) cerr<<"@DT@"<<__LINE__<<" "<<a<<endl;
+			#define _DISP_TRACE(msg)
+			_DISP_TRACE("arg1: "<<base1->getClassName()<<"="<<index1<<"; arg2: "<<base2->getClassName()<<"="<<index2)
 				
-			if(callBacks[index1][index2])
+			if(callBacks[index1][index2]){
+				_DISP_TRACE("Direct hit at ["<<index1<<"]["<<index2<<"] → "<<callBacks[index1][index2]->getClassName());
 				return true;
+			}
 
-			int depth1=1;
-			int depth2=1;
-			int index1_tmp = base1->getBaseClassIndex(depth1);
-			int index2_tmp = base2->getBaseClassIndex(depth2);
-			
-			if( index1_tmp == -1 )
-			{
-				while(1)
-				{
-					if(index2_tmp == -1)
-						return false;
-					else
-					{	if(callBacks[index1][index2_tmp]) // FIXME - this is not working, when index1 or index2 is out-of-boundary. I have to resize callBacks and callBacksInfo tables.  - this should be a separate function to resize stuff
-						{ 
-							callBacksInfo[index1][index2] = callBacksInfo[index1][index2_tmp];
-							callBacks    [index1][index2] = callBacks    [index1][index2_tmp];
-//							index2 = index2_tmp;
-							return true;
-						}
-						else
-							index2_tmp = base2->getBaseClassIndex(++depth2);
-					}
-				}
-			}
-			else if( index2_tmp == -1 )
-			{
-				while(1)
-				{
-					if(index1_tmp == -1)
-						return false;
-					else
-					{
-						if(callBacks[index1_tmp][index2    ])
-						{
-							callBacksInfo[index1][index2] = callBacksInfo[index1_tmp][index2];
-							callBacks    [index1][index2] = callBacks    [index1_tmp][index2];
-//							index1 = index1_tmp;
-							return true;
-						}
-						else
-							index1_tmp = base1->getBaseClassIndex(++depth1);
-					}
-				}
-			}
-			else if( index1_tmp != -1 && index2_tmp != -1 )
-				throw std::runtime_error("DynLibDispatcher: ambiguous or undefined dispatch for 2d multivirtual function, classes: "+base1->getClassName()+" "+base2->getClassName());
-			
-			return false;
-		  };
+			int depth1=1, depth2=1;
+			int index1_tmp=base1->getBaseClassIndex(depth1), index2_tmp = base2->getBaseClassIndex(depth2);
+			_DISP_TRACE("base classes: "<<base1->getBaseClassName()<<"="<<index1_tmp<<", "<<base2->getBaseClassName()<<"="<<index2_tmp);
+			if(index1_tmp == -1) {
+				while(1){
+					if(index2_tmp == -1){
+						_DISP_TRACE("Returning FALSE");
+						return false;
+					}
+					if(callBacks[index1][index2_tmp]){ // FIXME - this is not working, when index1 or index2 is out-of-boundary. I have to resize callBacks and callBacksInfo tables.  - this should be a separate function to resize stuff
+						callBacksInfo[index1][index2] = callBacksInfo[index1][index2_tmp];
+						callBacks    [index1][index2] = callBacks    [index1][index2_tmp];
+//						index2 = index2_tmp;
+						_DISP_TRACE("Found callback ["<<index1<<"]["<<index2_tmp<<"] → "<<callBacks[index1][index2_tmp]->getClassName());
+						return true;
+					}
+					index2_tmp = base2->getBaseClassIndex(++depth2);
+					_DISP_TRACE("index2_tmp="<<index2_tmp<<" (pushed up)");
+				}
+			}
+			else if(index2_tmp == -1) {
+				while(1){
+					if(index1_tmp == -1){
+						_DISP_TRACE("Returning FALSE");
+						 return false;
+					}
+					if(callBacks[index1_tmp][index2]){
+						callBacksInfo[index1][index2] = callBacksInfo[index1_tmp][index2];
+						callBacks    [index1][index2] = callBacks    [index1_tmp][index2];
+//						index1 = index1_tmp;
+						_DISP_TRACE("Found callback ["<<index1_tmp<<"]["<<index2<<"] → "<<callBacks[index1_tmp][index2]->getClassName());
+						return true;
+					}
+					index1_tmp = base1->getBaseClassIndex(++depth1);
+					_DISP_TRACE("index1_tmp="<<index1_tmp<<" (pushed up)");
+				}
+			}
+			//else if( index1_tmp != -1 && index2_tmp != -1 )
+			_DISP_TRACE("UNDEFINED/AMBIGUOUS, dumping dispatch matrix");
+			dumpDispatchMatrix2D(cerr);
+			_DISP_TRACE("end matrix dump.")
+			throw std::runtime_error("DynLibDispatcher: ambiguous or undefined dispatch for 2d multivirtual function, classes: "+base1->getClassName()+" "+base2->getClassName());
+			//return false;
+		};
 
 		
 // add multivirtual function to 3D

=== modified file 'pkg/common/Engine/MetaEngine/InteractionDispatchers.cpp'
--- pkg/common/Engine/MetaEngine/InteractionDispatchers.cpp	2009-08-07 09:27:49 +0000
+++ pkg/common/Engine/MetaEngine/InteractionDispatchers.cpp	2009-08-21 10:06:00 +0000
@@ -101,6 +101,11 @@
 			// would not have interactionGeometry and interactionPhysics yet.
 			if(!I->functorCache.constLaw){
 				I->functorCache.constLaw=constLawDispatcher->getFunctor2D(I->interactionGeometry,I->interactionPhysics,swap);
+				if(!I->functorCache.constLaw){
+					LOG_FATAL("getFunctor2D returned empty functor for  #"<<I->getId1()<<"+"<<I->getId2()<<", types "<<I->interactionGeometry->getClassName()<<"="<<I->interactionGeometry->getClassIndex()<<" and "<<I->interactionPhysics->getClassName()<<"="<<I->interactionPhysics->getClassIndex());
+					//abort();
+					exit(1);
+				}
 				assert(!swap); // reverse call would make no sense, as the arguments are of different types
 			}
 		  	assert(I->functorCache.constLaw);

=== modified file 'pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.hpp'
--- pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.hpp	2009-06-04 14:50:18 +0000
+++ pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.hpp	2009-08-21 10:06:00 +0000
@@ -11,7 +11,7 @@
 	Vector3r contPtInTgPlane2() const { return Dem3DofGeom_SphereSphere::unrollSpherePtToPlane(se32.orientation*cp2rel,effR2,-normal);}
 
 	public:
-		Dem3DofGeom_FacetSphere(){createIndex();}
+		Dem3DofGeom_FacetSphere(){ createIndex();}
 		virtual ~Dem3DofGeom_FacetSphere();
 		/******* API ********/
 		virtual Real displacementN(){ return (se32.position-contactPoint).Length()-refLength;}
@@ -32,6 +32,7 @@
 	Real effR2;
 	REGISTER_ATTRIBUTES(Dem3DofGeom,(cp1pt)(cp2rel)(localFacetNormal)(effR2) );
 	REGISTER_CLASS_AND_BASE(Dem3DofGeom_FacetSphere,Dem3DofGeom);
+	REGISTER_CLASS_INDEX(Dem3DofGeom_FacetSphere,Dem3DofGeom);
 	DECLARE_LOGGER;
 	friend class GLDraw_Dem3DofGeom_FacetSphere;
 	friend class ef2_Facet_Sphere_Dem3DofGeom;

=== modified file 'pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.hpp'
--- pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.hpp	2009-08-03 14:25:05 +0000
+++ pkg/dem/DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.hpp	2009-08-21 10:06:00 +0000
@@ -17,8 +17,8 @@
 		Quaternionr cp1rel, cp2rel;
 		//! shorthands
 		const Vector3r &pos1; const Quaternionr &ori1; const Vector3r &pos2; const Quaternionr &ori2;
-		Dem3DofGeom_SphereSphere(): pos1(se31.position), ori1(se31.orientation), pos2(se32.position), ori2(se32.orientation){createIndex();}
-		~Dem3DofGeom_SphereSphere();
+		Dem3DofGeom_SphereSphere(): pos1(se31.position), ori1(se31.orientation), pos2(se32.position), ori2(se32.orientation){ createIndex(); }
+		virtual ~Dem3DofGeom_SphereSphere();
 		//! effective radii of spheres for this interaction; can be smaller/larger than actual radii, but quasi-constant throughout the interaction life
 		Real effR1, effR2;
 		
@@ -37,6 +37,7 @@
 
 	REGISTER_ATTRIBUTES(Dem3DofGeom,(effR1)(effR2)(cp1rel)(cp2rel));
 	REGISTER_CLASS_AND_BASE(Dem3DofGeom_SphereSphere,Dem3DofGeom);
+	REGISTER_CLASS_INDEX(Dem3DofGeom_SphereSphere,Dem3DofGeom);
 	friend class GLDraw_Dem3DofGeom_SphereSphere;
 	friend class ef2_Sphere_Sphere_Dem3DofGeom;
 };

=== modified file 'pkg/dem/DataClass/InteractionGeometry/DemXDofGeom.cpp'
--- pkg/dem/DataClass/InteractionGeometry/DemXDofGeom.cpp	2009-08-10 11:11:49 +0000
+++ pkg/dem/DataClass/InteractionGeometry/DemXDofGeom.cpp	2009-08-21 10:06:00 +0000
@@ -1,5 +1,6 @@
 #include"DemXDofGeom.hpp"
 YADE_PLUGIN((Dem3DofGeom));
 Real Dem3DofGeom::displacementN(){throw;}
+Dem3DofGeom::~Dem3DofGeom(){}
 GenericSpheresContact::~GenericSpheresContact(){}
 

=== modified file 'pkg/dem/DataClass/InteractionGeometry/DemXDofGeom.hpp'
--- pkg/dem/DataClass/InteractionGeometry/DemXDofGeom.hpp	2009-08-13 08:01:41 +0000
+++ pkg/dem/DataClass/InteractionGeometry/DemXDofGeom.hpp	2009-08-21 10:06:00 +0000
@@ -33,6 +33,7 @@
 		Real &refR1, &refR2;
 
 		Dem3DofGeom(): normal(GenericSpheresContact::normal), refR1(GenericSpheresContact::refR1), refR2(GenericSpheresContact::refR2) { createIndex(); }
+		virtual ~Dem3DofGeom();
 
 		// API that needs to be implemented in derived classes
 		virtual Real displacementN();

=== modified file 'py/yadeWrapper/yadeWrapper.cpp'
--- py/yadeWrapper/yadeWrapper.cpp	2009-08-20 09:38:22 +0000
+++ py/yadeWrapper/yadeWrapper.cpp	2009-08-21 10:06:00 +0000
@@ -548,6 +548,10 @@
 	FOREACH(shared_ptr<ConstitutiveLaw> cf, cff) instance->constLawDispatcher->add(cf);
 	return instance;
 }
+
+template<typename someIndexable>
+int Indexable_getClassIndex(const shared_ptr<someIndexable> i){return i->getClassIndex();}
+
 // ParallelEngine
 void ParallelEngine_slaves_set(shared_ptr<ParallelEngine> self, const python::list& slaves){
 	int len=python::len(slaves);
@@ -730,7 +734,7 @@
 		.def("__init__",python::make_constructor(ParallelEngine_ctor_list))
 		.add_property("slaves",&ParallelEngine_slaves_get,&ParallelEngine_slaves_set);
 
-	#define EXPOSE_DISPATCHER(DispatcherT,functorT) python::class_<DispatcherT, shared_ptr<DispatcherT>, python::bases<MetaEngine>, noncopyable >(#DispatcherT).def("__init__",python::make_constructor(Dispatcher_ctor_list<DispatcherT,functorT>)).add_property("functors",&Dispatcher_functors_get<DispatcherT,functorT>);
+	#define EXPOSE_DISPATCHER(DispatcherT,functorT) python::class_<DispatcherT, shared_ptr<DispatcherT>, python::bases<MetaEngine>, noncopyable >(#DispatcherT).def("__init__",python::make_constructor(Dispatcher_ctor_list<DispatcherT,functorT>)).add_property("functors",&Dispatcher_functors_get<DispatcherT,functorT>).def("dump",&DispatcherT::dump);
 		EXPOSE_DISPATCHER(BoundingVolumeMetaEngine,BoundingVolumeEngineUnit)
 		EXPOSE_DISPATCHER(GeometricalModelMetaEngine,GeometricalModelEngineUnit)
 		EXPOSE_DISPATCHER(InteractingGeometryMetaEngine,InteractingGeometryEngineUnit)
@@ -788,8 +792,8 @@
 		.add_property("id2",&Interaction_getId2)
 		.add_property("isReal",&Interaction::isReal)
 		.add_property("cellDist",&Interaction_getCellDist);
-	EXPOSE_CXX_CLASS(InteractionPhysics);
-	EXPOSE_CXX_CLASS(InteractionGeometry);
+	EXPOSE_CXX_CLASS(InteractionPhysics).add_property("classIndex",&Indexable_getClassIndex<InteractionPhysics>);
+	EXPOSE_CXX_CLASS(InteractionGeometry).add_property("classIndex",&Indexable_getClassIndex<InteractionGeometry>);
 	EXPOSE_CXX_CLASS(FileGenerator)
 		.def("generate",&FileGenerator_generate)
 		.def("load",&FileGenerator_load);

=== modified file 'scripts/test-sphere-facet.py'
--- scripts/test-sphere-facet.py	2009-08-03 17:53:26 +0000
+++ scripts/test-sphere-facet.py	2009-08-21 10:06:00 +0000
@@ -42,6 +42,11 @@
 O.saveTmp()
 O.dt=1e-4
 
+O.engines[3].constLawDispatcher.dump()
+#print Dem3DofGeom_SphereSphere().classIndex
+#print Dem3DofGeom_FacetSphere().classIndex
+#print Dem3DofGeom().classIndex
+
 def setGravity():
 	gz=gravitator["gravity"][2]
 	gravitator["gravity"]=[0,0,1.05*gz]

=== modified file 'scripts/test/facet-sphere.py'
--- scripts/test/facet-sphere.py	2009-08-03 17:53:26 +0000
+++ scripts/test/facet-sphere.py	2009-08-21 10:06:00 +0000
@@ -5,7 +5,7 @@
 O.engines=[
 	BexResetter(),
 	BoundingVolumeMetaEngine([InteractingSphere2AABB(),InteractingFacet2AABB()]),
-	PersistentSAPCollider(),
+	InsertionSortCollider(),
 	InteractionDispatchers(
 		[ef2_Facet_Sphere_Dem3DofGeom()],
 		[SimpleElasticRelationships()],
@@ -24,17 +24,17 @@
 
 O.miscParams=[GLDrawSphere(glutUse=True)]
 O.dt=1e-4
+O.run()
 O.saveTmp('init')
 
-
 from yade import log
 #log.setLevel("ef2_Facet_Sphere_Dem3DofGeom",log.TRACE)
-try:
+if 0:
 	from yade import qt
 	renderer=qt.Renderer()
 	renderer['Interaction_geometry']=True
 	qt.Controller()
-except ImportError: pass
+#except ImportError: pass
 
 
 if 1: