yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #02309
[Branch ~yade-dev/yade/trunk] Rev 1815: 1. Make the optimized build default (as per Sega's suggestion); it also sets linkStrategy to mono...
------------------------------------------------------------
revno: 1815
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Mon 2009-11-23 17:09:25 +0100
message:
1. Make the optimized build default (as per Sega's suggestion); it also sets linkStrategy to monolithic (is that OK?)
2. Add some vtk dirs to default CPPPATH
3. Fix periodic boundaries in OpenGL & remove some YADE_SHAPE stuff from there.
4. Fix some warnings
5. Fix pack.randomDensePack **kw
6. Adapt examples/concrete/uniax.py to shared materials
modified:
SConstruct
core/MetaBody.cpp
examples/concrete/uniax.py
pkg/common/RenderingEngine/OpenGLRenderingEngine.cpp
pkg/common/RenderingEngine/OpenGLRenderingEngine.hpp
py/pack.py
py/yadeWrapper/yadeWrapper.cpp
--
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 'SConstruct'
--- SConstruct 2009-11-21 16:46:58 +0000
+++ SConstruct 2009-11-23 16:09:25 +0000
@@ -74,7 +74,7 @@
profileFile='scons.current-profile'
profOpts=Variables(profileFile)
-profOpts.Add(('profile','Config profile to use (predefined: default or "", opt); append ! to use it but not save for next build (in scons.current-profile)','default'))
+profOpts.Add(('profile','Config profile to use (predefined: default or "", dbg); append ! to use it but not save for next build (in scons.current-profile)','default'))
profOpts.Update(env)
# multiple profiles - run them all at the same time
# take care not to save current profile for those parallel builds
@@ -109,9 +109,9 @@
print '@@@ Using profile',profile,'('+optsFile+') @@@'
# defaults for various profiles
-if profile=='default': defOptions={'debug':1,'variant':'','optimize':0}
-elif profile=='opt': defOptions={'debug':0,'variant':'-opt','optimize':1}
-else: defOptions={'debug':0,'optimize':0,'variant':'-'+profile}
+if profile=='default': defOptions={'debug':0,'variant':'','optimize':1,'linkStrategy':'monolithic'}
+elif profile=='dbg': defOptions={'debug':1,'variant':'-dbg','optimize':0,'linkStrategy':'per-class'}
+else: defOptions={'debug':0,'optimize':0,'variant':'-'+profile,'linkStrategy':'per-class'}
opts=Variables(optsFile)
@@ -142,12 +142,12 @@
('jobs','Number of jobs to run at the same time (same as -j, but saved)',4,None,int),
#('extraModules', 'Extra directories with their own SConscript files (must be in-tree) (whitespace separated)',None,None,Split),
('buildPrefix','Where to create build-[version][variant] directory for intermediary files','..'),
- EnumVariable('linkStrategy','How to link plugins together','per-class',['per-class','per-pkg[broken]','monolithic','static[broken]']),
+ EnumVariable('linkStrategy','How to link plugins together',defOptions['linkStrategy'],['per-class','per-pkg[broken]','monolithic','static[broken]']),
('version','Yade version (if not specified, guess will be attempted)',None),
- ('CPPPATH', 'Additional paths for the C preprocessor (colon-separated)',None),
+ ('CPPPATH', 'Additional paths for the C preprocessor (colon-separated)','/usr/include/vtk-5.2:/usr/include/vtk-5.4'),
('LIBPATH','Additional paths for the linker (colon-separated)',None),
- ('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,colonSplit),
- ('PATH','Path (not imported automatically from the shell) (colon-separated)',None,None,colonSplit),
+ ('QTDIR','Directories where to look for qt3','/usr/share/qt3:/usr/lib/qt:/usr/lib/qt3:/usr/qt/3:/usr/lib/qt-3.3'),
+ ('PATH','Path (not imported automatically from the shell) (colon-separated)',None),
('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),
@@ -160,10 +160,10 @@
)
opts.Update(env)
opts.Save(optsFile,env)
-if env.has_key('CPPPATH'):
- env['CPPPATH']=colonSplit(env['CPPPATH'])
-if env.has_key('LIBPATH'):
- env['LIBPATH']=colonSplit(env['LIBPATH'])
+# handle colon-separated lists:
+for k in ('CPPPATH','LIBPATH','QTDIR','PATH'):
+ if env.has_key(k):
+ env[k]=colonSplit(env[k])
# do not propagate PATH from outside, to ensure identical builds on different machines
#env.Append(ENV={'PATH':['/usr/local/bin','/bin','/usr/bin']})
=== modified file 'core/MetaBody.cpp'
--- core/MetaBody.cpp 2009-11-23 14:56:10 +0000
+++ core/MetaBody.cpp 2009-11-23 16:09:25 +0000
@@ -70,10 +70,9 @@
void MetaBody::postProcessAttributes(bool deserializing){
/* since yade::serialization doesn't properly handle shared pointers, iterate over all bodies and make materials shared again, if id>=0 */
- int numMaterials=materials.size();
FOREACH(const shared_ptr<Body>& b, *bodies){
if(b->material->id<0) continue; // not a shared material
- assert(b->material->id < numMaterials);
+ assert(b->material->id < materials.size());
b->material=materials[b->material->id];
}
}
=== modified file 'examples/concrete/uniax.py'
--- examples/concrete/uniax.py 2009-11-21 23:50:06 +0000
+++ examples/concrete/uniax.py 2009-11-23 16:09:25 +0000
@@ -64,7 +64,8 @@
# make geom; the dimensions are hard-coded here; could be in param table if desired
# z-oriented hyperboloid, length 20cm, diameter 10cm, skirt 8cm
# using spheres 7mm of diameter
-spheres=pack.randomDensePack(pack.inHyperboloid((0,0,-.5*specimenLength),(0,0,.5*specimenLength),.25*specimenLength,.2*specimenLength),spheresInCell=2000,radius=sphereRadius,memoizeDb='/tmp/triaxPackCache.sqlite',young=young,poisson=poisson,frictionAngle=frictionAngle,materialClass='CpmMat')
+concreteId=O.materials.append(CpmMat(young=young,frictionAngle=frictionAngle,poisson=poisson,density=1))
+spheres=pack.randomDensePack(pack.inHyperboloid((0,0,-.5*specimenLength),(0,0,.5*specimenLength),.25*specimenLength,.2*specimenLength),spheresInCell=2000,radius=sphereRadius,memoizeDb='/tmp/triaxPackCache.sqlite',material=concreteId)
O.bodies.append(spheres)
bb=utils.uniaxialTestFeatures()
negIds,posIds,axis,crossSectionArea=bb['negIds'],bb['posIds'],bb['axis'],bb['area']
=== modified file 'pkg/common/RenderingEngine/OpenGLRenderingEngine.cpp'
--- pkg/common/RenderingEngine/OpenGLRenderingEngine.cpp 2009-11-23 14:56:10 +0000
+++ pkg/common/RenderingEngine/OpenGLRenderingEngine.cpp 2009-11-23 16:09:25 +0000
@@ -28,12 +28,6 @@
Show_ID = false;
Body_state = false;
Body_bounding_volume = false;
- #ifdef YADE_SHAPE
- Body_geometrical_model = false;
- Cast_shadows = false;
- Shadow_volumes = false;
- Fast_shadow_volume = true;
- #endif
Body_interacting_geom = true;
Body_wire = false;
Interaction_wire = false;
@@ -55,10 +49,6 @@
if (Omega::instance().isInheritingFrom((*di).first,"GLDrawStateFunctor")) addStateFunctor((*di).first);
if (Omega::instance().isInheritingFrom((*di).first,"GLDrawBoundingVolumeFunctor")) addBoundingVolumeFunctor((*di).first);
if (Omega::instance().isInheritingFrom((*di).first,"GLDrawInteractingGeometryFunctor")) addInteractingGeometryFunctor((*di).first);
- #ifdef YADE_SHAPE
- if (Omega::instance().isInheritingFrom((*di).first,"GLDrawGeometricalModelFunctor")) addGeometricalModelFunctor((*di).first);
- if (Omega::instance().isInheritingFrom((*di).first,"GLDrawShadowVolumeFunctor")) addShadowVolumeFunctor((*di).first);
- #endif
if (Omega::instance().isInheritingFrom((*di).first,"GLDrawInteractionGeometryFunctor")) addInteractionGeometryFunctor((*di).first);
if (Omega::instance().isInheritingFrom((*di).first,"GLDrawInteractionPhysicsFunctor")) addInteractionPhysicsFunctor((*di).first);
}
@@ -88,10 +78,6 @@
(static_pointer_cast<GLDrawBoundingVolumeFunctor>(ClassFactory::instance().createShared(s[1])))->initgl();
BOOST_FOREACH(vector<string>& s,interactingGeometryFunctorNames)
(static_pointer_cast<GLDrawInteractingGeometryFunctor>(ClassFactory::instance().createShared(s[1])))->initgl();
- #ifdef YADE_SHAPE
- BOOST_FOREACH(vector<string>& s,geometricalModelFunctorNames)
- (static_pointer_cast<GLDrawGeometricalModelFunctor>(ClassFactory::instance().createShared(s[1])))->initgl();
- #endif
BOOST_FOREACH(vector<string>& s,interactionGeometryFunctorNames)
(static_pointer_cast<GLDrawInteractionGeometryFunctor>(ClassFactory::instance().createShared(s[1])))->initgl();
BOOST_FOREACH(vector<string>& s,interactionPhysicsFunctorNames)
@@ -268,52 +254,6 @@
if(rootBody->interactingGeometry) interactingGeometryDispatcher(rootBody->interactingGeometry,rootBody->state,Body_wire);
}
-#ifdef YADE_SHAPE
-void OpenGLRenderingEngine::renderGeometricalModel(const shared_ptr<MetaBody>& rootBody){
- const GLfloat ambientColorSelected[4]={10.0,0.0,0.0,1.0};
- const GLfloat ambientColorUnselected[4]={0.5,0.5,0.5,1.0};
- if(rootBody->geometricalModel) geometricalModelDispatcher(rootBody->geometricalModel,rootBody->physicalParameters,Body_wire);
- if(!Draw_inside) return;
- FOREACH(const shared_ptr<Body> b, *rootBody->bodies){
- if(!b) continue;
- if(!b->geometricalModel || (!((b->getGroupMask() & Draw_mask) || b->getGroupMask()==0))) continue;
- if(b->physicalParameters && !b->physicalParameters->isDisplayed) continue;
- const Se3r& se3=b->physicalParameters->dispSe3;
- glPushMatrix();
- Real angle; Vector3r axis; se3.orientation.ToAxisAngle(axis,angle);
- glTranslatef(se3.position[0],se3.position[1],se3.position[2]);
- glRotatef(angle*Mathr::RAD_TO_DEG,axis[0],axis[1],axis[2]);
- if(current_selection==b->getId() || b->geometricalModel->highlight){
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambientColorSelected);
- glColorMaterial(GL_FRONT_AND_BACK,GL_EMISSION);
- const Vector3r& h(current_selection==b->getId() ? highlightEmission0 : highlightEmission1);
- glColor4(h[0],h[1],h[2],.2);
- glColorMaterial(GL_FRONT_AND_BACK,GL_DIFFUSE);
-
- geometricalModelDispatcher(b->geometricalModel,b->physicalParameters,Body_wire);
-
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambientColorUnselected);
- glColorMaterial(GL_FRONT_AND_BACK,GL_EMISSION);
- glColor3v(Vector3r::ZERO);
- glColorMaterial(GL_FRONT_AND_BACK,GL_DIFFUSE);
- } else {
- geometricalModelDispatcher(b->geometricalModel,b->physicalParameters,Body_wire);
- }
- glPopMatrix();
- if(current_selection==b->getId() || b->geometricalModel->highlight){
- if(!b->boundingVolume || Body_wire || b->geometricalModel->wire) GLUtils::GLDrawInt(b->getId(),se3.position);
- else {
- // move the label towards the camera by the bounding box so that it is not hidden inside the body
- const Vector3r& mn=b->boundingVolume->min; const Vector3r& mx=b->boundingVolume->max; const Vector3r& p=se3.position;
- Vector3r ext(viewDirection[0]>0?p[0]-mn[0]:p[0]-mx[0],viewDirection[1]>0?p[1]-mn[1]:p[1]-mx[1],viewDirection[2]>0?p[2]-mn[2]:p[2]-mx[2]); // signed extents towards the camera
- Vector3r dr=-1.01*(viewDirection.Dot(ext)*viewDirection);
- GLUtils::GLDrawInt(b->getId(),se3.position+dr,Vector3r::ONE);
- }
- }
- }
-}
-#endif
-
void OpenGLRenderingEngine::renderInteractionGeometry(const shared_ptr<MetaBody>& rootBody){
{
boost::mutex::scoped_lock lock(rootBody->interactions->drawloopmutex);
@@ -382,95 +322,59 @@
if(!bodyDisp[b->getId()].isDisplayed) continue;
Vector3r pos=bodyDisp[b->getId()].pos;
Quaternionr ori=bodyDisp[b->getId()].ori;
- if(b->interactingGeometry && ((b->getGroupMask()&Draw_mask) || b->getGroupMask()==0)){
- glPushMatrix();
- Real angle; Vector3r axis; ori.ToAxisAngle(axis,angle);
- glTranslatef(pos[0],pos[1],pos[2]);
- glRotatef(angle*Mathr::RAD_TO_DEG,axis[0],axis[1],axis[2]);
- if(current_selection==b->getId() || b->interactingGeometry->highlight){
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambientColorSelected);
- glColorMaterial(GL_FRONT_AND_BACK,GL_EMISSION);
- const Vector3r& h(current_selection==b->getId() ? highlightEmission0 : highlightEmission1);
- glColor4(h[0],h[1],h[2],.2);
- glColorMaterial(GL_FRONT_AND_BACK,GL_DIFFUSE);
- ///
- interactingGeometryDispatcher(b->interactingGeometry,b->state,Body_wire || b->interactingGeometry->wire,viewInfo);
- ///
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambientColorUnselected);
- glColorMaterial(GL_FRONT_AND_BACK,GL_EMISSION);
- glColor3v(Vector3r::ZERO);
- glColorMaterial(GL_FRONT_AND_BACK,GL_DIFFUSE);
- } else {
- interactingGeometryDispatcher(b->interactingGeometry,b->state,Body_wire || b->interactingGeometry->wire,viewInfo);
- }
- glPopMatrix();
+ if(!b->interactingGeometry || !((b->getGroupMask()&Draw_mask) || b->getGroupMask()==0)) continue;
+ glPushMatrix();
+ Real angle; Vector3r axis; ori.ToAxisAngle(axis,angle);
+ glTranslatef(pos[0],pos[1],pos[2]);
+ glRotatef(angle*Mathr::RAD_TO_DEG,axis[0],axis[1],axis[2]);
if(current_selection==b->getId() || b->interactingGeometry->highlight){
- if(!b->boundingVolume || Body_wire || b->interactingGeometry->wire) GLUtils::GLDrawInt(b->getId(),pos);
- else {
- // move the label towards the camera by the bounding box so that it is not hidden inside the body
- const Vector3r& mn=b->boundingVolume->min; const Vector3r& mx=b->boundingVolume->max; const Vector3r& p=pos;
- Vector3r ext(viewDirection[0]>0?p[0]-mn[0]:p[0]-mx[0],viewDirection[1]>0?p[1]-mn[1]:p[1]-mx[1],viewDirection[2]>0?p[2]-mn[2]:p[2]-mx[2]); // signed extents towards the camera
- Vector3r dr=-1.01*(viewDirection.Dot(ext)*viewDirection);
- GLUtils::GLDrawInt(b->getId(),pos+dr,Vector3r::ONE);
- }
- }
- // if the body goes over the cell margin, draw it in all other positions with wire
- // this could be done in a nicer way perhaps...
- if(b->boundingVolume && rootBody->isPeriodic){
- const Vector3r& cellMin(rootBody->cellMin); const Vector3r& cellMax(rootBody->cellMax); Vector3r cellSize=cellMax-cellMin;
- // traverse all periodic cells around the body, to see if any of them touches
- Vector3<int> bodyPer,minPer,maxPer;
- for(int i=0; i<3; i++){
- bodyPer[i]=(int)floor((pos[i]-cellMin[i])/cellSize[i]); // period of the center
- minPer[i]=(int)floor((b->boundingVolume->min[i]-cellMin[i])/cellSize[i]); // period of the minimum point
- maxPer[i]=(int)floor((b->boundingVolume->max[i]-cellMin[i])/cellSize[i]); // period of the maximum point
- }
- if (minPer[0]!=maxPer[0] || minPer[1]!=maxPer[1] || minPer[2]!=maxPer[2]){ // crosses cell boundary?
- Vector3<int> i;
- for(i[0]=-1; i[0]<=1; i[0]++) for(i[1]=-1;i[1]<=1; i[1]++) for(i[2]=-1; i[2]<=1; i[2]++){
- if(i[0]==0 && i[1]==0 && i[2]==0) continue; // middle; already rendered above
- if((i[0]==0 && minPer[0]==maxPer[0]) || (i[1]==0 && minPer[0]==maxPer[0]) || (i[2]==0 && minPer[0]==maxPer[0])) continue;
- if((i[0]<=0 && i[1]<=0 && i[2]<=0 && minPer[0]==bodyPer[0]+i[0] && minPer[1]==bodyPer[1]+i[1] && minPer[2]==bodyPer[2]+i[2]) ||
- (i[0]>=0 && i[1]>=0 && i[2]>=0 && maxPer[0]==bodyPer[0]+i[0] && maxPer[1]==bodyPer[1]+i[1] && maxPer[2]==bodyPer[2]+i[2])){
- Vector3r pt(pos[0]+cellSize[0]*i[0],pos[1]+cellSize[1]*i[1],pos[2]+cellSize[2]*i[2]);
- glPushMatrix();
- glTranslatev(pt);
- glRotatef(angle*Mathr::RAD_TO_DEG,axis[0],axis[1],axis[2]);
- interactingGeometryDispatcher(b->interactingGeometry,b->state,/*Body_wire*/ true, viewInfo);
- glPopMatrix();
- }
- }
- }
- #if 0
- Vector3<int> bodyPer,minPer,maxPer;
- for(int i=0; i<3; i++){
- bodyPer[i]=(int)floor((b->state->pos[i]-cellMin[i])/cellSize[i]); // period of the center
- minPer[i]=(int)floor((b->boundingVolume->min[i]-cellMin[i])/cellSize[i]); // period of the minimum point
- maxPer[i]=(int)floor((b->boundingVolume->max[i]-cellMin[i])/cellSize[i]); // period of the maximum point
- //assert(bodyPer[i]<=maxPer[i]); assert(bodyPer[i]>=minPer[i]);
- }
-
- /* m is bitmask from 3 couples (0â¦64=2^6) */
- for(int m=0; m<64; m++){
- // any mask containing 00 couple is invalid
- if((!(m&1) && (!(m&2))) || (!(m&4) && (!(m&8))) || (!(m&16) && (!(m&32)))) continue;
- Vector3r pt(se3.position);
- bool isInside=false;
- for(int j=0; j<3; j++){
- if(m&(1<<(2*j))) {
- if(m&(1<<(2*j+1))) { if(bodyPer[j]>=maxPer[j]) {isInside=true; break; } pt[j]-=cellSize[j]; }
- else { if(bodyPer[j]<=minPer[j]){ isInside=true; break; } pt[j]+=cellSize[j]; }
- }
- }
- if(!isInside) continue;
- if(pt==se3.position) continue; // shouldn't happen, but it happens :-(
- glPushMatrix();
- glTranslatev(pt);
- glRotatef(angle*Mathr::RAD_TO_DEG,axis[0],axis[1],axis[2]);
- interactingGeometryDispatcher(b->interactingGeometry,b->state,/*Body_wire*/ true, viewInfo);
- glPopMatrix();
- }
- #endif
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambientColorSelected);
+ glColorMaterial(GL_FRONT_AND_BACK,GL_EMISSION);
+ const Vector3r& h(current_selection==b->getId() ? highlightEmission0 : highlightEmission1);
+ glColor4(h[0],h[1],h[2],.2);
+ glColorMaterial(GL_FRONT_AND_BACK,GL_DIFFUSE);
+ ///
+ interactingGeometryDispatcher(b->interactingGeometry,b->state,Body_wire || b->interactingGeometry->wire,viewInfo);
+ ///
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambientColorUnselected);
+ glColorMaterial(GL_FRONT_AND_BACK,GL_EMISSION);
+ glColor3v(Vector3r::ZERO);
+ glColorMaterial(GL_FRONT_AND_BACK,GL_DIFFUSE);
+ } else {
+ interactingGeometryDispatcher(b->interactingGeometry,b->state,Body_wire || b->interactingGeometry->wire,viewInfo);
+ }
+ glPopMatrix();
+ if(current_selection==b->getId() || b->interactingGeometry->highlight){
+ if(!b->boundingVolume || Body_wire || b->interactingGeometry->wire) GLUtils::GLDrawInt(b->getId(),pos);
+ else {
+ // move the label towards the camera by the bounding box so that it is not hidden inside the body
+ const Vector3r& mn=b->boundingVolume->min; const Vector3r& mx=b->boundingVolume->max; const Vector3r& p=pos;
+ Vector3r ext(viewDirection[0]>0?p[0]-mn[0]:p[0]-mx[0],viewDirection[1]>0?p[1]-mn[1]:p[1]-mx[1],viewDirection[2]>0?p[2]-mn[2]:p[2]-mx[2]); // signed extents towards the camera
+ Vector3r dr=-1.01*(viewDirection.Dot(ext)*viewDirection);
+ GLUtils::GLDrawInt(b->getId(),pos+dr,Vector3r::ONE);
+ }
+ }
+ // if the body goes over the cell margin, draw it in positions where the bbox overlaps with the cell in wire
+ // precondition: pos is inside the cell.
+ if(b->boundingVolume && rootBody->isPeriodic){
+ const Vector3r& cellMin(rootBody->cellMin); const Vector3r& cellMax(rootBody->cellMax); Vector3r cellSize=cellMax-cellMin;
+ // traverse all periodic cells around the body, to see if any of them touches
+ Vector3r halfSize=b->boundingVolume->max-b->boundingVolume->min; halfSize*=.5;
+ Vector3r pmin,pmax;
+ Vector3<int> i;
+ for(i[0]=-1; i[0]<=1; i[0]++) for(i[1]=-1;i[1]<=1; i[1]++) for(i[2]=-1; i[2]<=1; i[2]++){
+ if(i[0]==0 && i[1]==0 && i[2]==0) continue; // middle; already rendered above
+ Vector3r pt=pos+Vector3r(cellSize[0]*i[0],cellSize[1]*i[1],cellSize[2]*i[2]);
+ pmin=pt-halfSize; pmax=pt+halfSize;
+ if(pmin[0]<=cellMax[0] && pmax[0]>=cellMin[0] &&
+ pmin[1]<=cellMax[1] && pmax[1]>=cellMin[1] &&
+ pmin[2]<=cellMax[2] && pmax[2]>=cellMin[2]) {
+ glPushMatrix();
+ glTranslatev(pt);
+ glRotatef(angle*Mathr::RAD_TO_DEG,axis[0],axis[1],axis[2]);
+ interactingGeometryDispatcher(b->interactingGeometry,b->state,/*Body_wire*/ true, viewInfo);
+ glPopMatrix();
+ }
}
}
}
@@ -486,10 +390,6 @@
#endif
for(unsigned int i=0;i<boundingVolumeFunctorNames.size();i++) boundingVolumeDispatcher.add1DEntry(boundingVolumeFunctorNames[i][0],boundingVolumeFunctorNames[i][1]);
for(unsigned int i=0;i<interactingGeometryFunctorNames.size();i++) interactingGeometryDispatcher.add1DEntry(interactingGeometryFunctorNames[i][0],interactingGeometryFunctorNames[i][1]);
- #ifdef YADE_SHAPE
- for(unsigned int i=0;i<geometricalModelFunctorNames.size();i++) geometricalModelDispatcher.add1DEntry(geometricalModelFunctorNames[i][0],geometricalModelFunctorNames[i][1]);
- for(unsigned int i=0;i<shadowVolumeFunctorNames.size();i++) shadowVolumeDispatcher.add1DEntry(shadowVolumeFunctorNames[i][0],shadowVolumeFunctorNames[i][1]);
- #endif
for(unsigned int i=0;i<interactionGeometryFunctorNames.size();i++) interactionGeometryDispatcher.add1DEntry(interactionGeometryFunctorNames[i][0],interactionGeometryFunctorNames[i][1]);
for(unsigned int i=0;i<interactionPhysicsFunctorNames.size();i++) interactionPhysicsDispatcher.add1DEntry(interactionPhysicsFunctorNames[i][0],interactionPhysicsFunctorNames[i][1]);
}
@@ -513,13 +413,3 @@
string str1 = (static_pointer_cast<GLDrawInteractingGeometryFunctor>(ClassFactory::instance().createShared(str2)))->renders();
vector<string> v; v.push_back(str1); v.push_back(str2); interactingGeometryFunctorNames.push_back(v);
}
-#ifdef YADE_SHAPE
-void OpenGLRenderingEngine::addGeometricalModelFunctor(const string& str2){
- string str1 = (static_pointer_cast<GLDrawGeometricalModelFunctor>(ClassFactory::instance().createShared(str2)))->renders();
- vector<string> v; v.push_back(str1); v.push_back(str2); geometricalModelFunctorNames.push_back(v);
-}
-void OpenGLRenderingEngine::addShadowVolumeFunctor(const string& str2){
- string str1 = (static_pointer_cast<GLDrawShadowVolumeFunctor>(ClassFactory::instance().createShared(str2)))->renders();
- vector<string> v; v.push_back(str1); v.push_back(str2); shadowVolumeFunctorNames.push_back(v);
-}
-#endif
=== modified file 'pkg/common/RenderingEngine/OpenGLRenderingEngine.hpp'
--- pkg/common/RenderingEngine/OpenGLRenderingEngine.hpp 2009-11-23 14:56:10 +0000
+++ pkg/common/RenderingEngine/OpenGLRenderingEngine.hpp 2009-11-23 16:09:25 +0000
@@ -15,9 +15,6 @@
public :
Vector3r Light_position,Background_color;
bool Show_DOF,Show_ID,Body_state,Body_bounding_volume,Body_interacting_geom,
- #ifdef YADE_SHAPE
- Body_geometrical_model,Shadow_volumes,Fast_shadow_volume,Cast_shadows,
- #endif
Body_wire,Interaction_wire,Draw_inside,Interaction_geometry,Interaction_physics;
body_id_t current_selection;
int Draw_mask;
@@ -55,7 +52,7 @@
Quaternionr ori;
bool isDisplayed;
};
-
+ //! display data for individual bodies
vector<BodyDisp> bodyDisp;
@@ -66,20 +63,11 @@
DynLibDispatcher< State , GLDrawStateFunctor, void , TYPELIST_1(const shared_ptr<State>&) > stateDispatcher;
DynLibDispatcher< BoundingVolume , GLDrawBoundingVolumeFunctor, void , TYPELIST_1(const shared_ptr<BoundingVolume>&) > boundingVolumeDispatcher;
DynLibDispatcher< InteractingGeometry , GLDrawInteractingGeometryFunctor, void , TYPELIST_4(const shared_ptr<InteractingGeometry>&, const shared_ptr<State>&,bool,const GLViewInfo&) > interactingGeometryDispatcher;
- #ifdef YADE_SHAPE
- // FIXME - in fact it is a 1D dispatcher
- DynLibDispatcher< GeometricalModel , GLDrawGeometricalModelFunctor, void , TYPELIST_3(const shared_ptr<GeometricalModel>&, const shared_ptr<State>&, bool) > geometricalModelDispatcher;
- DynLibDispatcher< GeometricalModel , GLDrawShadowVolumeFunctor, void , TYPELIST_3(const shared_ptr<GeometricalModel>&, const shared_ptr<State>&, const Vector3r& ) > shadowVolumeDispatcher;
- #endif
vector<vector<string> >
stateFunctorNames,
boundingVolumeFunctorNames,
interactingGeometryFunctorNames,
- #ifdef YADE_SHAPE
- geometricalModelFunctorNames,
- shadowVolumeFunctorNames,
- #endif
interactionGeometryFunctorNames,
interactionPhysicsFunctorNames;
@@ -89,10 +77,6 @@
void addStateFunctor(const string& str);
void addBoundingVolumeFunctor(const string& str);
void addInteractingGeometryFunctor(const string& str);
- #ifdef YADE_SHAPE
- void addGeometricalModelFunctor(const string& str);
- void addShadowVolumeFunctor(const string& str);
- #endif
void addInteractionGeometryFunctor(const string& str);
void addInteractionPhysicsFunctor(const string& str);
@@ -106,9 +90,6 @@
private :
void renderDOF_ID(const shared_ptr<MetaBody>& rootBody);
- #ifdef YADE_SHAPE
- void renderGeometricalModel(const shared_ptr<MetaBody>& rootBody);
- #endif
void renderInteractionPhysics(const shared_ptr<MetaBody>& rootBody);
void renderInteractionGeometry(const shared_ptr<MetaBody>& rootBody);
#ifdef YADE_PHYSPAR
@@ -116,18 +97,10 @@
#endif
void renderBoundingVolume(const shared_ptr<MetaBody>& rootBody);
void renderInteractingGeometry(const shared_ptr<MetaBody>& rootBody);
- #ifdef YADE_SHAPE
- void renderShadowVolumes(const shared_ptr<MetaBody>& rootBody,Vector3r Light_position);
- void renderSceneUsingShadowVolumes(const shared_ptr<MetaBody>& rootBody,Vector3r Light_position);
- void renderSceneUsingFastShadowVolumes(const shared_ptr<MetaBody>& rootBody,Vector3r Light_position);
- #endif
protected :
void postProcessAttributes(bool deserializing);
REGISTER_ATTRIBUTES(Serializable,(scaleDisplacements)(displacementScale)(scaleRotations)(rotationScale)(Light_position)(Background_color)(Body_wire)(Show_DOF)(Show_ID)(Body_state)(Body_bounding_volume)(Body_interacting_geom)
- #ifdef YADE_SHAPE
- (Body_geometrical_model)(Cast_shadows)(Shadow_volumes)(Fast_shadow_volume)
- #endif
(Interaction_wire)(Interaction_geometry)(Interaction_physics)(Draw_mask)(Draw_inside)(clipPlaneSe3)(clipPlaneActive)(selectBodyLimit));
REGISTER_CLASS_AND_BASE(OpenGLRenderingEngine,RenderingEngine);
};
=== modified file 'py/pack.py'
--- py/pack.py 2009-11-23 14:56:10 +0000
+++ py/pack.py 2009-11-23 16:09:25 +0000
@@ -215,7 +215,7 @@
if predicate(s[0],s[1]): ret+=[utils.sphere(s[0],radius=s[1],**kw)]
return ret
-def randomDensePack(predicate,radius,dim=None,cropLayers=0,rRelFuzz=0.,spheresInCell=0,memoizeDb=None,useOBB=True,memoDbg=False,**kw):
+def randomDensePack(predicate,radius,material=0,dim=None,cropLayers=0,rRelFuzz=0.,spheresInCell=0,memoizeDb=None,useOBB=True,memoDbg=False):
"""Generator of random dense packing with given geometry properties, using TriaxialTest (aperiodic)
or PeriIsoCompressor (periodic). The priodicity depens on whether the spheresInCell parameter is given.
@@ -297,7 +297,7 @@
sp.cellSize=(X,Y,Z); sp.cellFill(Vector3(fullDim[0],fullDim[1],fullDim[2])); sp.cellSize=(0,0,0) # resetting cellSize avoids warning when rotating
sp.scale(scale);
if orientation: sp.rotate(*orientation.ToAxisAngle())
- return filterSpherePack(predicate,sp,**kw)
+ return filterSpherePack(predicate,sp,material=material)
print "No suitable packing in database found, running",'PERIODIC compression' if wantPeri else 'triaxial'
sys.stdout.flush()
O.switchWorld(); O.resetThisWorld() ### !!
@@ -347,7 +347,7 @@
if orientation:
sp.cellSize=(0,0,0); # reset periodicity to avoid warning when rotating periodic packing
sp.rotate(*orientation.ToAxisAngle())
- return filterSpherePack(predicate,sp,**kw)
+ return filterSpherePack(predicate,sp,material=material)
# compatibility with the deprecated name, can be removed in the future
def triaxialPack(*args,**kw):
=== modified file 'py/yadeWrapper/yadeWrapper.cpp'
--- py/yadeWrapper/yadeWrapper.cpp 2009-11-23 12:32:14 +0000
+++ py/yadeWrapper/yadeWrapper.cpp 2009-11-23 16:09:25 +0000
@@ -284,7 +284,7 @@
shared_ptr<Material> getitem_label(string label){
// translate runtime_error to KeyError (instead of RuntimeError) if the material doesn't exist
try { return Material::byLabel(label,rb); }
- catch (std::runtime_error& e){ PyErr_SetString(PyExc_KeyError,e.what()); python::throw_error_already_set(); }
+ catch (std::runtime_error& e){ PyErr_SetString(PyExc_KeyError,e.what()); python::throw_error_already_set(); /* never reached; avoids warning */ throw; }
}
int append(shared_ptr<Material>& m){ rb->materials.push_back(m); m->id=rb->materials.size()-1; return m->id; }
vector<int> appendList(vector<shared_ptr<Material> > mm){ vector<int> ret; FOREACH(shared_ptr<Material>& m, mm) ret.push_back(append(m)); return ret; }
Follow ups