← Back to team overview

yade-dev team mailing list archive

[svn] r1857 - in trunk: . gui/py pkg/common pkg/common/Engine/MetaEngine pkg/dem py py/yadeWrapper scripts/test

 

Author: eudoxos
Date: 2009-07-12 10:21:25 +0200 (Sun, 12 Jul 2009)
New Revision: 1857

Added:
   trunk/pkg/common/Engine/MetaEngine/EngineUnits.cpp
   trunk/scripts/test/pack-predicates.py
Modified:
   trunk/SConstruct
   trunk/gui/py/pyAttrUtils.hpp
   trunk/pkg/common/Engine/MetaEngine/BoundingVolumeEngineUnit.hpp
   trunk/pkg/common/Engine/MetaEngine/ConstitutiveLaw.hpp
   trunk/pkg/common/Engine/MetaEngine/GeometricalModelEngineUnit.hpp
   trunk/pkg/common/Engine/MetaEngine/InteractingGeometryEngineUnit.hpp
   trunk/pkg/common/Engine/MetaEngine/InteractionGeometryEngineUnit.hpp
   trunk/pkg/common/Engine/MetaEngine/InteractionPhysicsEngineUnit.hpp
   trunk/pkg/common/Engine/MetaEngine/PhysicalParametersEngineUnit.hpp
   trunk/pkg/common/SConscript
   trunk/pkg/dem/SConscript
   trunk/py/utils.py
   trunk/py/yadeWrapper/yadeWrapper.cpp
Log:
1. Add virtual destructors to all EngineUnits so that they can by dynamic_cast'ed to. This fixes possible crash from python, bug #398255
2. Rename updateExistingKeys to updateExistingAttrs, add updateAttrs.
3. Add forgotten script to demonstrate predicate operators
4. The default debug level is -ggdb2 (instead of -ggdb3). Libs are about 60% in size and still give the same debug information.


Modified: trunk/SConstruct
===================================================================
--- trunk/SConstruct	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/SConstruct	2009-07-12 08:21:25 UTC (rev 1857)
@@ -406,7 +406,7 @@
 if env['QUAD_PRECISION']: env.Append(CPPDEFINES='QUAD_PRECISION')
 
 ### COMPILER
-if env['debug']: env.Append(CXXFLAGS='-ggdb3',CPPDEFINES=['YADE_DEBUG'])
+if env['debug']: env.Append(CXXFLAGS='-ggdb2',CPPDEFINES=['YADE_DEBUG'])
 else: env.Append(CXXFLAGS='-O2')
 if env['openmp']: env.Append(CXXFLAGS='-fopenmp',LIBS='gomp',CPPDEFINES='YADE_OPENMP')
 if env['optimize']:

Modified: trunk/gui/py/pyAttrUtils.hpp
===================================================================
--- trunk/gui/py/pyAttrUtils.hpp	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/gui/py/pyAttrUtils.hpp	2009-07-12 08:21:25 UTC (rev 1857)
@@ -28,7 +28,8 @@
 	boost::python::list wrappedPyKeys(){ensureFunc(); return accessor->pyKeys();} \
 	boost::python::dict wrappedPyDict(){ensureFunc(); return accessor->pyDict();} \
 	bool wrappedPyHasKey(const std::string& key){ensureFunc(); return accessor->descriptors.find(key)!=accessor->descriptors.end();} \
-	python::list wrappedUpdateExisting(const python::dict& d){ python::list ret; ensureFunc(); python::list keys=d.keys(); size_t ll=python::len(keys); for(size_t i=0; i<ll; i++){ string key=python::extract<string>(keys[i]); if(wrappedPyHasKey(key)) accessor->pySet(key,d[keys[i]]); else ret.append(key); } return ret; }
+	python::list wrappedUpdateExistingAttrs(const python::dict& d){ python::list ret; ensureFunc(); python::list keys=d.keys(); size_t ll=python::len(keys); for(size_t i=0; i<ll; i++){ string key=python::extract<string>(keys[i]); if(wrappedPyHasKey(key)) accessor->pySet(key,d[keys[i]]); else ret.append(key); } return ret; } \
+	void wrappedUpdateAttrs(const python::dict& d){ ensureFunc(); python::list keys=d.keys(); size_t ll=python::len(keys); for(size_t i=0; i<ll; i++){ string key=python::extract<string>(keys[i]); accessor->pySet(key,d[keys[i]]); } }
 	
 	
 	//boost::python::object wrappedPyGet_throw(std::string key){ensureFunc(); if(wrappedPyHasKey(key)) return accessor->pyGet(key); PyErr_SetString(PyExc_AttributeError, "No such attribute."); boost::python::throw_error_already_set(); /* make compiler happy*/ return boost::python::object(); }
@@ -39,7 +40,7 @@
  * They define python special functions that support dictionary operations on this object and calls proxies for them. */
 #define ATTR_ACCESS_PY(cxxClass) \
 	def("__getitem__",&cxxClass::wrappedPyGet).def("__setitem__",&cxxClass::wrappedPySet).def("keys",&cxxClass::wrappedPyKeys).def("has_key",&cxxClass::wrappedPyHasKey).def("dict",&cxxClass::wrappedPyDict) \
-	.def("getRaw",&cxxClass::wrappedGetAttrStr).def("setRaw",&cxxClass::wrappedSetAttrStr).def("updateExistingKeys",&cxxClass::wrappedUpdateExisting,"Update attributes from given dictionary, but skpping attribues that do not exist in the wrapped class; return list of names of attributes that were not set.")
+	.def("getRaw",&cxxClass::wrappedGetAttrStr).def("setRaw",&cxxClass::wrappedSetAttrStr).def("updateExistingAttrs",&cxxClass::wrappedUpdateExistingAttrs,"Update attributes from given dictionary, but skpping attribues that do not exist in the wrapped class; return list of names of attributes that were not set.").def("updateAttrs",&cxxClass::wrappedUpdateAttrs,"Update attributes from given dictionary; all attributes must exist.")
 	//def("__getattr__",&cxxClass::wrappedPyGet).def("__setattr__",&cxxClass::wrappedPySet).def("attrs",&cxxClass::wrappedPyKeys)
 
 	//.def("__getattribute__",&cxxClass::wrappedPyGet_throw)

Modified: trunk/pkg/common/Engine/MetaEngine/BoundingVolumeEngineUnit.hpp
===================================================================
--- trunk/pkg/common/Engine/MetaEngine/BoundingVolumeEngineUnit.hpp	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/pkg/common/Engine/MetaEngine/BoundingVolumeEngineUnit.hpp	2009-07-12 08:21:25 UTC (rev 1857)
@@ -44,6 +44,7 @@
 			  			  )
 				>
 {	
+	public: virtual ~BoundingVolumeEngineUnit();
 	REGISTER_CLASS_AND_BASE(BoundingVolumeEngineUnit,EngineUnit2D);
 	REGISTER_ATTRIBUTES(EngineUnit,/* no attributes here */);
 };

Modified: trunk/pkg/common/Engine/MetaEngine/ConstitutiveLaw.hpp
===================================================================
--- trunk/pkg/common/Engine/MetaEngine/ConstitutiveLaw.hpp	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/pkg/common/Engine/MetaEngine/ConstitutiveLaw.hpp	2009-07-12 08:21:25 UTC (rev 1857)
@@ -9,6 +9,7 @@
 	>{
 	public:
 		ConstitutiveLaw(){}
+		virtual ~ConstitutiveLaw();
 	REGISTER_CLASS_AND_BASE(ConstitutiveLaw,EngineUnit2D);
 	/*! Convenience functions to get forces/torques quickly. */
 	void addForce (const body_id_t id, const Vector3r& f,MetaBody* rb){rb->bex.addForce (id,f);}

Added: trunk/pkg/common/Engine/MetaEngine/EngineUnits.cpp
===================================================================
--- trunk/pkg/common/Engine/MetaEngine/EngineUnits.cpp	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/pkg/common/Engine/MetaEngine/EngineUnits.cpp	2009-07-12 08:21:25 UTC (rev 1857)
@@ -0,0 +1,16 @@
+#include<yade/pkg-common/BoundingVolumeEngineUnit.hpp>
+#include<yade/pkg-common/GeometricalModelEngineUnit.hpp>
+#include<yade/pkg-common/InteractingGeometryEngineUnit.hpp>
+#include<yade/pkg-common/InteractionGeometryEngineUnit.hpp>
+#include<yade/pkg-common/InteractionPhysicsEngineUnit.hpp>
+#include<yade/pkg-common/PhysicalParametersEngineUnit.hpp>
+#include<yade/pkg-common/ConstitutiveLaw.hpp>
+
+BoundingVolumeEngineUnit::~BoundingVolumeEngineUnit(){};
+GeometricalModelEngineUnit::~GeometricalModelEngineUnit(){};
+InteractingGeometryEngineUnit::~InteractingGeometryEngineUnit(){};
+InteractionGeometryEngineUnit::~InteractionGeometryEngineUnit(){};
+InteractionPhysicsEngineUnit::~InteractionPhysicsEngineUnit(){};
+PhysicalParametersEngineUnit::~PhysicalParametersEngineUnit(){};
+ConstitutiveLaw::~ConstitutiveLaw(){};
+

Modified: trunk/pkg/common/Engine/MetaEngine/GeometricalModelEngineUnit.hpp
===================================================================
--- trunk/pkg/common/Engine/MetaEngine/GeometricalModelEngineUnit.hpp	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/pkg/common/Engine/MetaEngine/GeometricalModelEngineUnit.hpp	2009-07-12 08:21:25 UTC (rev 1857)
@@ -41,7 +41,8 @@
 								, const Body*
 			   				  )
 					>
-{	
+{
+	public: virtual ~GeometricalModelEngineUnit();	
 	REGISTER_CLASS_NAME(GeometricalModelEngineUnit);
 	REGISTER_BASE_CLASS_NAME(EngineUnit2D);
 };

Modified: trunk/pkg/common/Engine/MetaEngine/InteractingGeometryEngineUnit.hpp
===================================================================
--- trunk/pkg/common/Engine/MetaEngine/InteractingGeometryEngineUnit.hpp	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/pkg/common/Engine/MetaEngine/InteractingGeometryEngineUnit.hpp	2009-07-12 08:21:25 UTC (rev 1857)
@@ -39,7 +39,8 @@
 								, const Body* // with that - functors have all the data they may need
 			  				  )
 					>
-{	
+{
+	public: virtual ~InteractingGeometryEngineUnit();	
 	REGISTER_CLASS_AND_BASE(InteractingGeometryEngineUnit,EngineUnit2D);
 	REGISTER_ATTRIBUTES(EngineUnit,/* no attributes here */);
 };

Modified: trunk/pkg/common/Engine/MetaEngine/InteractionGeometryEngineUnit.hpp
===================================================================
--- trunk/pkg/common/Engine/MetaEngine/InteractionGeometryEngineUnit.hpp	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/pkg/common/Engine/MetaEngine/InteractionGeometryEngineUnit.hpp	2009-07-12 08:21:25 UTC (rev 1857)
@@ -42,6 +42,7 @@
 			  				  ) 
 					>
 {
+	public: virtual ~InteractionGeometryEngineUnit();
 	REGISTER_CLASS_AND_BASE(InteractionGeometryEngineUnit,EngineUnit2D);
 	REGISTER_ATTRIBUTES(EngineUnit,/* no attributes here */);
 };

Modified: trunk/pkg/common/Engine/MetaEngine/InteractionPhysicsEngineUnit.hpp
===================================================================
--- trunk/pkg/common/Engine/MetaEngine/InteractionPhysicsEngineUnit.hpp	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/pkg/common/Engine/MetaEngine/InteractionPhysicsEngineUnit.hpp	2009-07-12 08:21:25 UTC (rev 1857)
@@ -36,6 +36,7 @@
 			   				  ) 
 					>
 {
+	public: virtual ~InteractionPhysicsEngineUnit();
 	REGISTER_CLASS_AND_BASE(InteractionPhysicsEngineUnit,EngineUnit2D);
 	REGISTER_ATTRIBUTES(EngineUnit, /* no attributes here */ );
 };

Modified: trunk/pkg/common/Engine/MetaEngine/PhysicalParametersEngineUnit.hpp
===================================================================
--- trunk/pkg/common/Engine/MetaEngine/PhysicalParametersEngineUnit.hpp	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/pkg/common/Engine/MetaEngine/PhysicalParametersEngineUnit.hpp	2009-07-12 08:21:25 UTC (rev 1857)
@@ -30,7 +30,8 @@
 								, Body*, BexContainer&
 			   				  )
 					>
-{	
+{
+	public: virtual ~PhysicalParametersEngineUnit();	
 	REGISTER_CLASS_NAME(PhysicalParametersEngineUnit);
 	REGISTER_BASE_CLASS_NAME(EngineUnit1D);
 };

Modified: trunk/pkg/common/SConscript
===================================================================
--- trunk/pkg/common/SConscript	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/pkg/common/SConscript	2009-07-12 08:21:25 UTC (rev 1857)
@@ -12,7 +12,7 @@
 
 	env.SharedLibrary('ParallelEngine',
 		['Engine/ParallelEngine.cpp']),
-
+	env.SharedLibrary('EngineUnits',['Engine/MetaEngine/EngineUnits.cpp']),
 	env.SharedLibrary('AABB',['DataClass/BoundingVolume/AABB.cpp']),
 	env.SharedLibrary('BoundingSphere',['DataClass/BoundingVolume/BoundingSphere.cpp']),
 	env.SharedLibrary('InteractingBox',['DataClass/InteractingGeometry/InteractingBox.cpp'],),
@@ -97,37 +97,37 @@
 		LIBS=env['LIBS']+['FilterEngine','ColorScale']),
 	env.SharedLibrary('ColorizedTimeFilter',['Engine/FilterEngine/ColorizedTimeFilter.cpp'],
 		LIBS=env['LIBS']+['FilterEngine','ColorScale']),
-	env.SharedLibrary('BoundingVolumeMetaEngine',['Engine/MetaEngine/BoundingVolumeMetaEngine.cpp'],LIBS=env['LIBS']+['RigidBodyParameters','AABB']),
-	env.SharedLibrary('GeometricalModelMetaEngine',['Engine/MetaEngine/GeometricalModelMetaEngine.cpp']),
-	env.SharedLibrary('InteractingGeometryMetaEngine',['Engine/MetaEngine/InteractingGeometryMetaEngine.cpp']),
-	env.SharedLibrary('PhysicalParametersMetaEngine',['Engine/MetaEngine/PhysicalParametersMetaEngine.cpp']),
-	env.SharedLibrary('InteractionGeometryMetaEngine',['Engine/MetaEngine/InteractionGeometryMetaEngine.cpp']),
-	env.SharedLibrary('InteractionPhysicsMetaEngine',['Engine/MetaEngine/InteractionPhysicsMetaEngine.cpp']),
-	env.SharedLibrary('PhysicalActionApplier',['Engine/MetaEngine/PhysicalActionApplier.cpp']),
-	env.SharedLibrary('PhysicalActionDamper',['Engine/MetaEngine/PhysicalActionDamper.cpp']),
-	env.SharedLibrary('ConstitutiveLawDispatcher',['Engine/MetaEngine/ConstitutiveLawDispatcher.cpp']),
-	env.SharedLibrary('InteractionDispatchers',['Engine/MetaEngine/InteractionDispatchers.cpp'],LIBS=env['LIBS']+['InteractionGeometryMetaEngine','InteractionPhysicsMetaEngine','ConstitutiveLawDispatcher']),
+	env.SharedLibrary('BoundingVolumeMetaEngine',['Engine/MetaEngine/BoundingVolumeMetaEngine.cpp'],LIBS=env['LIBS']+['RigidBodyParameters','AABB','EngineUnits']),
+	env.SharedLibrary('GeometricalModelMetaEngine',['Engine/MetaEngine/GeometricalModelMetaEngine.cpp'],LIBS=env['LIBS']+['EngineUnits']),
+	env.SharedLibrary('InteractingGeometryMetaEngine',['Engine/MetaEngine/InteractingGeometryMetaEngine.cpp'],LIBS=env['LIBS']+['EngineUnits']),
+	env.SharedLibrary('PhysicalParametersMetaEngine',['Engine/MetaEngine/PhysicalParametersMetaEngine.cpp'],LIBS=env['LIBS']+['EngineUnits']),
+	env.SharedLibrary('InteractionGeometryMetaEngine',['Engine/MetaEngine/InteractionGeometryMetaEngine.cpp'],LIBS=env['LIBS']+['EngineUnits']),
+	env.SharedLibrary('InteractionPhysicsMetaEngine',['Engine/MetaEngine/InteractionPhysicsMetaEngine.cpp'],LIBS=env['LIBS']+['EngineUnits']),
+	env.SharedLibrary('PhysicalActionApplier',['Engine/MetaEngine/PhysicalActionApplier.cpp'],LIBS=env['LIBS']+['EngineUnits']),
+	env.SharedLibrary('PhysicalActionDamper',['Engine/MetaEngine/PhysicalActionDamper.cpp'],LIBS=env['LIBS']+['EngineUnits']),
+	env.SharedLibrary('ConstitutiveLawDispatcher',['Engine/MetaEngine/ConstitutiveLawDispatcher.cpp'],LIBS=env['LIBS']+['EngineUnits']),
+	env.SharedLibrary('InteractionDispatchers',['Engine/MetaEngine/InteractionDispatchers.cpp'],LIBS=env['LIBS']+['InteractionGeometryMetaEngine','InteractionPhysicsMetaEngine','ConstitutiveLawDispatcher','EngineUnits']),
 	env.SharedLibrary('InteractingBox2AABB',['Engine/EngineUnit/InteractingBox2AABB.cpp'],
-		LIBS=env['LIBS']+['BoundingVolumeMetaEngine','InteractingBox','AABB','Box',]),
+		LIBS=env['LIBS']+['BoundingVolumeMetaEngine','InteractingBox','AABB','Box','EngineUnits']),
 	env.SharedLibrary('MetaInteractingGeometry2AABB',['Engine/EngineUnit/MetaInteractingGeometry2AABB.cpp'],
-		LIBS=env['LIBS']+['BoundingVolumeMetaEngine','MetaInteractingGeometry','AABB']),
+		LIBS=env['LIBS']+['BoundingVolumeMetaEngine','MetaInteractingGeometry','AABB','EngineUnits']),
 	env.SharedLibrary('InteractingFacet2AABB',['Engine/EngineUnit/InteractingFacet2AABB.cpp'],
-		LIBS=env['LIBS']+['AABB','InteractingFacet']),
+		LIBS=env['LIBS']+['AABB','InteractingFacet','EngineUnits']),
 	env.SharedLibrary('LeapFrogOrientationIntegrator',['Engine/EngineUnit/LeapFrogOrientationIntegrator.cpp'],
-		LIBS=env['LIBS']+['PhysicalParametersMetaEngine','ParticleParameters','RigidBodyParameters']),
+		LIBS=env['LIBS']+['PhysicalParametersMetaEngine','ParticleParameters','RigidBodyParameters','EngineUnits']),
 	env.SharedLibrary('LeapFrogPositionIntegrator',['Engine/EngineUnit/LeapFrogPositionIntegrator.cpp'],
-		LIBS=env['LIBS']+['PhysicalParametersMetaEngine','ParticleParameters','RigidBodyParameters']),
+		LIBS=env['LIBS']+['PhysicalParametersMetaEngine','ParticleParameters','RigidBodyParameters','EngineUnits']),
 	env.SharedLibrary('NewtonsForceLaw',['Engine/EngineUnit/NewtonsForceLaw.cpp'],
-		LIBS=env['LIBS']+['PhysicalActionApplier','ParticleParameters','RigidBodyParameters']),
+		LIBS=env['LIBS']+['PhysicalActionApplier','ParticleParameters','RigidBodyParameters','EngineUnits']),
 	env.SharedLibrary('NewtonsMomentumLaw',['Engine/EngineUnit/NewtonsMomentumLaw.cpp'],
-		LIBS=env['LIBS']+['PhysicalActionApplier','RigidBodyParameters',]),
+		LIBS=env['LIBS']+['PhysicalActionApplier','RigidBodyParameters','EngineUnits']),
 	env.SharedLibrary('InteractingSphere2AABB',['Engine/EngineUnit/InteractingSphere2AABB.cpp'],
-		LIBS=env['LIBS']+['BoundingVolumeMetaEngine','InteractingSphere','AABB']),
+		LIBS=env['LIBS']+['BoundingVolumeMetaEngine','InteractingSphere','AABB','EngineUnits']),
 	env.SharedLibrary('CundallNonViscousDamping',
 		['Engine/EngineUnit/CundallNonViscousDamping.cpp'],
-		LIBS=env['LIBS']+['PhysicalActionDamper','ParticleParameters','RigidBodyParameters']),
+		LIBS=env['LIBS']+['PhysicalActionDamper','ParticleParameters','RigidBodyParameters','EngineUnits']),
 	env.SharedLibrary('ElasticBodySimpleRelationship',['Engine/EngineUnit/ElasticBodySimpleRelationship.cpp'],
-		LIBS=env['LIBS']+['ElasticBodyParameters','RigidBodyParameters','ParticleParameters','InteractionPhysicsMetaEngine','NormalShearInteractions']),
+		LIBS=env['LIBS']+['ElasticBodyParameters','RigidBodyParameters','ParticleParameters','InteractionPhysicsMetaEngine','NormalShearInteractions','EngineUnits']),
 	env.SharedLibrary('NormalShearInteractions',['DataClass/InteractionPhysics/NormalShearInteractions.cpp']),
 
 	#env.SharedLibrary('VelocityDamping',
@@ -157,10 +157,10 @@
                 LIBS=env['LIBS']+['SimpleViscoelasticBodyParameters']),
         env.SharedLibrary('ef2_BshTube_BssSweptSphereLineSegment_makeBssSweptSphereLineSegment',
                         ['Engine/EngineUnit/ef2_BshTube_BssSweptSphereLineSegment_makeBssSweptSphereLineSegment.cpp'],
-                LIBS=env['LIBS']+['BoundingVolumeMetaEngine','InteractingBox','AABB','Box','BshTube','BcpConnection','BssSweptSphereLineSegment']),
+                LIBS=env['LIBS']+['BoundingVolumeMetaEngine','InteractingBox','AABB','Box','BshTube','BcpConnection','BssSweptSphereLineSegment','EngineUnits']),
         env.SharedLibrary('ef2_BssSweptSphereLineSegment_AABB_makeAABB',
                         ['Engine/EngineUnit/ef2_BssSweptSphereLineSegment_AABB_makeAABB.cpp'],
-                LIBS=env['LIBS']+['BoundingVolumeMetaEngine','AABB','BssSweptSphereLineSegment']),
+                LIBS=env['LIBS']+['BoundingVolumeMetaEngine','AABB','BssSweptSphereLineSegment','EngineUnits']),
         
                 
 ])

Modified: trunk/pkg/dem/SConscript
===================================================================
--- trunk/pkg/dem/SConscript	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/pkg/dem/SConscript	2009-07-12 08:21:25 UTC (rev 1857)
@@ -34,8 +34,8 @@
 	
 	env.SharedLibrary('RockPM',['RockPM.cpp'],LIBS=env['LIBS']+['ElasticContactInteraction','Dem3DofGeom_SphereSphere','ElasticContactLaw']),
 	env.SharedLibrary('DemXDofGeom',['DataClass/InteractionGeometry/DemXDofGeom.cpp']),
-	env.SharedLibrary('Dem3DofGeom_SphereSphere',['DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp'],LIBS=env['LIBS']+['RigidBodyParameters','InteractingSphere','DemXDofGeom','yade-opengl' if 'YADE_OPENGL' in env['CPPDEFINES'] else '']),
-	env.SharedLibrary('Dem3DofGeom_FacetSphere',['DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.cpp'],LIBS=env['LIBS']+['RigidBodyParameters','InteractingSphere','InteractingFacet','Dem3DofGeom_SphereSphere','DemXDofGeom','yade-opengl' if 'YADE_OPENGL' in env['CPPDEFINES'] else '']),
+	env.SharedLibrary('Dem3DofGeom_SphereSphere',['DataClass/InteractionGeometry/Dem3DofGeom_SphereSphere.cpp'],LIBS=env['LIBS']+['EngineUnits','RigidBodyParameters','InteractingSphere','DemXDofGeom','yade-opengl' if 'YADE_OPENGL' in env['CPPDEFINES'] else '']),
+	env.SharedLibrary('Dem3DofGeom_FacetSphere',['DataClass/InteractionGeometry/Dem3DofGeom_FacetSphere.cpp'],LIBS=env['LIBS']+['EngineUnits','RigidBodyParameters','InteractingSphere','InteractingFacet','Dem3DofGeom_SphereSphere','DemXDofGeom','yade-opengl' if 'YADE_OPENGL' in env['CPPDEFINES'] else '']),
 
 	env.SharedLibrary('FacetTopologyAnalyzer',['Engine/StandAloneEngine/FacetTopologyAnalyzer.cpp'],LIBS=env['LIBS']+['InteractingFacet']),
 
@@ -978,6 +978,7 @@
 		,LIBS=env['LIBS']+['SimpleViscoelasticBodyParameters'
 		    ,'ViscoelasticInteraction'
 		    ,'SpheresContactGeometry'
+			 ,'EngineUnits',
 		    ])
 
 	,env.SharedLibrary('ContactLaw1',

Modified: trunk/py/utils.py
===================================================================
--- trunk/py/utils.py	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/py/utils.py	2009-07-12 08:21:25 UTC (rev 1857)
@@ -78,7 +78,7 @@
 	inert=(2./5.)*V*density*radius**2
 	pp.update({'se3':[center[0],center[1],center[2],1,0,0,0],'refSe3':[center[0],center[1],center[2],1,0,0,0],'mass':V*density,'inertia':[inert,inert,inert]})
 	s.phys=PhysicalParameters(physParamsClass)
-	s.phys.updateExistingKeys(pp)
+	s.phys.updateExistingAttrs(pp)
 	s.bound=BoundingVolume('AABB',{'diffuseColor':[0,1,0]})
 	s['isDynamic']=dynamic
 	return s
@@ -94,7 +94,7 @@
 	V=extents[0]*extents[1]*extents[2]
 	pp.update({'se3':[center[0],center[1],center[2],orientation[0],orientation[1],orientation[2],orientation[3]],'refSe3':[center[0],center[1],center[2],orientation[0],orientation[1],orientation[2],orientation[3]],'mass':V*density,'inertia':[mass*4*(extents[1]**2+extents[2]**2),mass*4*(extents[0]**2+extents[2]**2),mass*4*(extents[0]**2+extents[1]**2)]})
 	b.phys=PhysicalParameters(physParamsClass)
-	b.phys.updateExistingKeys(pp)
+	b.phys.updateExistingAttrs(pp)
 	b.bound=BoundingVolume('AABB',{'diffuseColor':[0,1,0]})
 	b['isDynamic']=dynamic
 	return b
@@ -113,7 +113,7 @@
 	b.mold.setRaw('vertices',vStr)
 	pp.update({'se3':[center[0],center[1],center[2],1,0,0,0],'refSe3':[center[0],center[1],center[2],1,0,0,0],'inertia':[0,0,0]})
 	b.phys=PhysicalParameters(physParamsClass)
-	b.phys.updateExistingKeys(pp)
+	b.phys.updateExistingAttrs(pp)
 	b.bound=BoundingVolume('AABB',{'diffuseColor':[0,1,0]})
 	b['isDynamic']=dynamic
 	b.mold.postProcessAttributes()
@@ -291,7 +291,7 @@
 		pp={'se3':[0,0,0,1,0,0,0],'young':young,'poisson':poisson,'frictionAngle':frictionAngle}
 		pp.update(physParamsAttr)
 		b.phys=PhysicalParameters(physParamsClass)
-		b.phys.updateExistingKeys(pp)
+		b.phys.updateExistingAttrs(pp)
 		if not noBoundingVolume:
 			b.bound=BoundingVolume('AABB',{'diffuseColor':[0,1,0]})
 		o.bodies.append(b)

Modified: trunk/py/yadeWrapper/yadeWrapper.cpp
===================================================================
--- trunk/py/yadeWrapper/yadeWrapper.cpp	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/py/yadeWrapper/yadeWrapper.cpp	2009-07-12 08:21:25 UTC (rev 1857)
@@ -262,7 +262,8 @@
 				bool ok=false;
 				/* FIXME: casting engine unit to the right type via dynamic_cast doesn't work (always unusuccessful),
 				 * do static_cast and if the EngineUnit is of wrong type, it will crash badly immediately. */
-				#define TRY_ADD_FUNCTOR(P,Q) {shared_ptr<P> p(dynamic_pointer_cast<P>(me)); shared_ptr<EngineUnit> eu(euEx().proxee); if(p&&eu){p->add(static_pointer_cast<Q>(eu)); ok=true; }}
+				// #define TRY_ADD_FUNCTOR(P,Q) {shared_ptr<P> p(dynamic_pointer_cast<P>(me)); shared_ptr<EngineUnit> eu(euEx().proxee); if(p&&eu){p->add(static_pointer_cast<Q>(eu)); ok=true; }}
+				#define TRY_ADD_FUNCTOR(P,Q) {shared_ptr<P> p(dynamic_pointer_cast<P>(me)); shared_ptr<Q> eu(dynamic_pointer_cast<Q>(euEx().proxee)); if(p&&eu){p->add(eu); ok=true; }}
 				// shared_ptr<Q> q(dynamic_pointer_cast<Q>(eu)); cerr<<#P<<" "<<#Q<<":"<<(bool)p<<" "<<(bool)q<<endl;
 				TRY_ADD_FUNCTOR(BoundingVolumeMetaEngine,BoundingVolumeEngineUnit);
 				TRY_ADD_FUNCTOR(GeometricalModelMetaEngine,GeometricalModelEngineUnit);

Added: trunk/scripts/test/pack-predicates.py
===================================================================
--- trunk/scripts/test/pack-predicates.py	2009-07-11 20:25:33 UTC (rev 1856)
+++ trunk/scripts/test/pack-predicates.py	2009-07-12 08:21:25 UTC (rev 1857)
@@ -0,0 +1,12 @@
+from yade.pack import *
+s1=inSphere((0,0,0),1)
+s2=inSphere((0,0,1),1)
+# construct using explicit composition
+s12=PredicateUnion(s1,s2)
+print s12.aabb(), s12((0,0,.5),0)
+# constuct the same predicate with operators
+print (s1|s2).aabb(), (s1|s2)((0,0,.5),0)
+# predicate difference: points in s1 and not in s2
+print (s1-s2).aabb()
+print (s1-s2)((0,0,1.5),0)
+print (s1-s2)((0,0,-0.5),0)