Author: eudoxos
Date: 2009-02-04 21:47:43 +0100 (Wed, 04 Feb 2009)
New Revision: 1655
Modified:
trunk/SConstruct
trunk/core/GroupRelationData.cpp
trunk/extra/Brefcom.cpp
trunk/gui/py/utils.py
trunk/gui/qt3/GLViewer.cpp
trunk/pkg/dem/Engine/EngineUnit/InteractingFacet2InteractingSphere4SpheresContactGeometry.cpp
trunk/scripts/simple-scene.py
Log:
1. Contact sphere-facet must be deleted by the constitutive law once created.
Let me know if that is a problem -- I think it is the way it should be in the
future everywhere, though.
2. Fixes for boost 1.37 (boost::thread not fully compatible)
3. utils.basidDEMEngines (not tested yet)
4. Fix warning in?\194?\160GroupRelationData
5. add march switch to scons ('native' is default, but not supported by older
compilers)
6. Prepend default CXXFLAGS so that user-defined ones (like warning
suppression) come after the default ones and override those.
Modified: trunk/SConstruct
===================================================================
--- trunk/SConstruct 2009-02-02 16:25:12 UTC (rev 1654)
+++ trunk/SConstruct 2009-02-04 20:47:43 UTC (rev 1655)
@@ -137,6 +137,7 @@
('QTDIR','Directories where to look for
qt3',['/usr/share/qt3','/usr/lib/qt','/usr/lib/qt3','/usr/qt/3','/usr/lib/qt-3.3'],None,Split),
('CXX','The c++ compiler','g++'),
('CXXFLAGS','Additional compiler flags for compilation (like
-march=core2).',None,None,Split),
+ ('march','Architecture to use with -march=... when
optimizing','native',None,None),
#('SHLINK','Linker for shared objects','g++'),
('SHCCFLAGS','Additional compiler flags for linking (for
plugins).',None,None,Split),
BoolOption('QUAD_PRECISION','typedef Real as long double (=quad)',0),
@@ -391,7 +392,7 @@
else: env.Append(CXXFLAGS='-O2')
if env['openmp']: env.Append(CXXFLAGS='-fopenmp',LIBS='gomp')
if env['optimize']:
- env.Append(CXXFLAGS=Split('-O3 -ffast-math -march=native'),
+ env.Append(CXXFLAGS=Split('-O3 -ffast-math -march=%s'%env['march']),
CPPDEFINES=[('YADE_CAST','static_cast'),('YADE_PTR_CAST','static_pointer_cast'),'NDEBUG'])
# NDEBUG is used in /usr/include/assert.h: when defined, asserts() are
no-ops
@@ -411,7 +412,7 @@
env.Append(CPPDEFINES=[('YADE_CAST','dynamic_cast'),('YADE_PTR_CAST','dynamic_pointer_cast')])
if env['gprof']:
env.Append(CXXFLAGS=['-pg'],LINKFLAGS=['-pg'],SHLINKFLAGS=['-pg'])
-env.Append(CXXFLAGS=['-pipe','-Wall'])
+env.Prepend(CXXFLAGS=['-pipe','-Wall'])
if env['arcs']=='gen':
env.Append(CXXFLAGS=['-fprofile-generate'],LINKFLAGS=['-fprofile-generate'])
if env['arcs']=='use':
env.Append(CXXFLAGS=['-fprofile-use'],LINKFLAGS=['-fprofile-use'])
Modified: trunk/core/GroupRelationData.cpp
===================================================================
--- trunk/core/GroupRelationData.cpp 2009-02-02 16:25:12 UTC (rev 1654)
+++ trunk/core/GroupRelationData.cpp 2009-02-04 20:47:43 UTC (rev 1655)
@@ -8,12 +8,12 @@
#include "GroupRelationData.hpp"
-GroupRelationData::GroupRelationData() : npar_(0), ngrp_(2)
+GroupRelationData::GroupRelationData() : ngrp_(2), npar_(0)
{
initActivator();
}
-GroupRelationData::GroupRelationData(unsigned int ngrp) : npar_(0), ngrp_(ngrp)
+GroupRelationData::GroupRelationData(unsigned int ngrp) : ngrp_(ngrp), npar_(0)
{
initActivator();
}
Modified: trunk/extra/Brefcom.cpp
===================================================================
--- trunk/extra/Brefcom.cpp 2009-02-02 16:25:12 UTC (rev 1654)
+++ trunk/extra/Brefcom.cpp 2009-02-04 20:47:43 UTC (rev 1655)
@@ -156,13 +156,14 @@
epsN=contGeom->epsN();
epsT=contGeom->epsT();
+ contGeom->relocateContactPoints(); // allow very large mutual
rotations
+
if(logStrain && epsN<0){
Real epsN0=epsN;
epsN=log(epsN0+1);
epsT*=epsN/epsN0;
}
-
#ifdef BREFCOM_MATERIAL_MODEL
BREFCOM_MATERIAL_MODEL
#else
Modified: trunk/gui/py/utils.py
===================================================================
--- trunk/gui/py/utils.py 2009-02-02 16:25:12 UTC (rev 1654)
+++ trunk/gui/py/utils.py 2009-02-04 20:47:43 UTC (rev 1655)
@@ -338,3 +338,42 @@
dictParams.update(dictDefaults); saveVars('table',**dictParams)
return len(tagsParams)
+
+def
basicDEMEngines(interPhysics='SimpleElasticRelationships',constitutiveLaw='ElasticContactLaw',gravity=None,damping=.4):
+ """Set basic set of DEM engines and initializers.
+
+ interPhysics and constitutiveLaw specify class of respective engines to
use instead of defaults.
+
+ Gravity can be list or tuple to specify numeric value, it can also be
an object that will be inserted into
+ engines, however. By default, no gravity is applied.
+ """
+ O.initializers=[
+ StandAloneEngine('PhysicalActionContainerInitializer'),
+
MetaEngine('BoundingVolumeMetaEngine',[EngineUnit('InteractingSphere2AABB'),EngineUnit('InteractingBox2AABB'),EngineUnit('InteractingFacet2AABB'),EngineUnit('MetaInteractingGeometry2AABB')])
+ ]
+ O.engines=[
+ StandAloneEngine('PhysicalActionContainerReseter'),
+ MetaEngine('BoundingVolumeMetaEngine',[
+ EngineUnit('InteractingSphere2AABB'),
+ EngineUnit('InteractingBox2AABB'),
+ EngineUnit('InteractingFacet2AABB'),
+ EngineUnit('MetaInteractingGeometry2AABB')
+ ]),
+ StandAloneEngine('PersistentSAPCollider'),
+ MetaEngine('InteractionGeometryMetaEngine',[
+
EngineUnit('InteractingSphere2InteractingSphere4SpheresContactGeometry'),
+
EngineUnit('InteractingFacet2InteractingSphere4SpheresContactGeometry'),
+
EngineUnit('InteractingBox2InteractingSphere4SpheresContactGeometry')
+ ]),
+
MetaEngine('InteractionPhysicsMetaEngine',[EngineUnit('SimpleElasticRelationships')]),
+ StandAloneEngine('ElasticContactLaw'),
+ ]
+ if gravity:
+ if islist(gravity) or istuple(gravity):
+
O.engines=O.engines+[DeusExMachina('GravityEngine',{'gravity':gravity}),]
+ else:
+ O.engines=O.engines+[gravity]
+
O.engines=O.engines+[DeusExMachina('NewtonsDampedLaw',{'damping':damping}),]
+
+
+
Modified: trunk/gui/qt3/GLViewer.cpp
===================================================================
--- trunk/gui/qt3/GLViewer.cpp 2009-02-02 16:25:12 UTC (rev 1654)
+++ trunk/gui/qt3/GLViewer.cpp 2009-02-04 20:47:43 UTC (rev 1655)
@@ -18,11 +18,21 @@
#include<yade/core/Body.hpp>
#include<yade/core/Interaction.hpp>
#include<boost/filesystem/operations.hpp>
+#include<boost/version.hpp>
CREATE_LOGGER(GLViewer);
+GLLock::GLLock(GLViewer* _glv):
-GLLock::GLLock(GLViewer* _glv):
boost::try_mutex::scoped_try_lock(YadeQtMainWindow::self->glMutex,true),
glv(_glv){
- if(locked()) glv->makeCurrent(); }
+#if BOOST_VERSION<103500
+
boost::try_mutex::scoped_try_lock(YadeQtMainWindow::self->glMutex,true),
glv(_glv){
+ if(locked()) glv->makeCurrent();
+ }
+#else
+ boost::try_mutex::scoped_try_lock(YadeQtMainWindow::self->glMutex),
glv(_glv){
+ if(owns_lock()) glv->makeCurrent();
+ }
+#endif
+
GLLock::~GLLock(){ /*glv->doneCurrent();*/}
void GLViewer::updateGL(void){/*GLLock lock(this); */QGLViewer::updateGL();}
@@ -30,10 +40,15 @@
void GLViewer::paintGL(void){
/* paintGL encapsulated preDraw, draw and postDraw within QGLViewer. If
the mutex cannot be locked,
* we just return without repainting */
- boost::try_mutex::scoped_try_lock lock(YadeQtMainWindow::self->glMutex);
- if(lock.locked()){
- this->makeCurrent(); // not sure if this is needed
- QGLViewer::paintGL();
+ #if BOOST_VERSION<103500
+ boost::try_mutex::scoped_try_lock
lock(YadeQtMainWindow::self->glMutex);
+ if(lock.locked()){
+ #else
+ boost::try_mutex::scoped_try_lock
lock(YadeQtMainWindow::self->glMutex,boost::defer_lock);
+ if(lock.owns_lock()){
+ #endif
+ this->makeCurrent(); // not sure if this is needed
+ QGLViewer::paintGL();
}
//this->doneCurrent();
}
Modified:
trunk/pkg/dem/Engine/EngineUnit/InteractingFacet2InteractingSphere4SpheresContactGeometry.cpp
===================================================================
---
trunk/pkg/dem/Engine/EngineUnit/InteractingFacet2InteractingSphere4SpheresContactGeometry.cpp
2009-02-02 16:25:12 UTC (rev 1654)
+++
trunk/pkg/dem/Engine/EngineUnit/InteractingFacet2InteractingSphere4SpheresContactGeometry.cpp
2009-02-04 20:47:43 UTC (rev 1655)
@@ -51,6 +51,7 @@
Real L = normal.Dot(cl);
int contactFace=0; // temp to save what will be maybe needed for new
contact
+
assert((c->interactionGeometry&&c->isReal)||(!c->interactionGeometry&&!c->isReal));
if(c->interactionGeometry){ // contact already exists, use old data here
contactFace=YADE_CAST<SpheresContactGeometry*>(c->interactionGeometry.get())->facetContactFace;
// determinate contact on negative side: reverse quantities
@@ -65,7 +66,7 @@
}
Real sphereRadius = static_cast<InteractingSphere*>(cm2.get())->radius;
- if (L > sphereRadius) return false; // no contact
+ if (L>sphereRadius && !c->isReal) return false; // no contact, but
only if there was no previous contact; ortherwise, the constitutive law is
responsible for setting Interaction::isReal=false
Vector3r cp = cl - L*normal;
const Vector3r* ne = facet->ne;
@@ -117,7 +118,7 @@
// END everything in facet-local coordinates
//
- if (penetrationDepth>0)
+ if (penetrationDepth>0 || c->isReal)
{
shared_ptr<SpheresContactGeometry> scm;
if (c->interactionGeometry)
Modified: trunk/scripts/simple-scene.py
===================================================================
--- trunk/scripts/simple-scene.py 2009-02-02 16:25:12 UTC (rev 1654)
+++ trunk/scripts/simple-scene.py 2009-02-04 20:47:43 UTC (rev 1655)
@@ -57,21 +57,21 @@
## This MetaEngine acts on all PhysicalActions and selects the right
EngineUnit base on type of the PhysicalAction.
#
# note that following 4 engines (till the end) can be replaced by an
optimized monolithic version:
- # DeusExMachina('NewtonsDampedLaw',{'damping':0.2}),
+ DeusExMachina('NewtonsDampedLaw',{'damping':0.0}),
#
- MetaEngine('PhysicalActionDamper',[
- EngineUnit('CundallNonViscousForceDamping',{'damping':0.2}),
- EngineUnit('CundallNonViscousMomentumDamping',{'damping':0.2})
- ]),
+# MetaEngine('PhysicalActionDamper',[
+# EngineUnit('CundallNonViscousForceDamping',{'damping':0.2}),
+# EngineUnit('CundallNonViscousMomentumDamping',{'damping':0.2})
+# ]),
## Now we have forces and momenta acting on bodies. Newton's law
calculates acceleration that corresponds to them.
- MetaEngine('PhysicalActionApplier',[
- EngineUnit('NewtonsForceLaw'),
- EngineUnit('NewtonsMomentumLaw'),
- ]),
+# MetaEngine('PhysicalActionApplier',[
+# EngineUnit('NewtonsForceLaw'),
+# EngineUnit('NewtonsMomentumLaw'),
+# ]),
## Acceleration results in velocity change. Integrating the velocity
over dt, position of the body will change.
-
MetaEngine('PhysicalParametersMetaEngine',[EngineUnit('LeapFrogPositionIntegrator')]),
+#
MetaEngine('PhysicalParametersMetaEngine',[EngineUnit('LeapFrogPositionIntegrator')]),
## Angular acceleration changes angular velocity, resulting in position
and/or orientation change of the body.
-
MetaEngine('PhysicalParametersMetaEngine',[EngineUnit('LeapFrogOrientationIntegrator')]),
+#
MetaEngine('PhysicalParametersMetaEngine',[EngineUnit('LeapFrogOrientationIntegrator')]),
]
_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help : https://help.launchpad.net/ListHelp