yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #02176
[Branch ~yade-dev/yade/trunk] Rev 1774: 1. Remove VTKINCDIR (duplicates already existing CPPPATH)
------------------------------------------------------------
revno: 1774
committer: Václav Šmilauer <vaclav@falx>
branch nick: trunk
timestamp: Sat 2009-10-17 08:36:21 +0200
message:
1. Remove VTKINCDIR (duplicates already existing CPPPATH)
2. Fix handling of QTDIR (hopefully?)
3. Yade multi now displays total time at the end, takes --jobs (long option for -j), and the http server keeps running as long as the summary page is requested if run with --http-wait
4. Fix computation of sxx, syy, szz in cpm
modified:
SConstruct
gui/py/yade-multi
pkg/dem/Engine/StandAloneEngine/VTKRecorder.cpp
pkg/dem/Engine/StandAloneEngine/VTKRecorder.hpp
pkg/dem/meta/ConcretePM.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-10-16 06:33:55 +0000
+++ SConstruct 2009-10-17 06:36:21 +0000
@@ -148,7 +148,6 @@
('LIBPATH','Additional paths for the linker (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'],None,colonSplit),
('PATH','Path (not imported automatically from the shell) (colon-separated)',None,None,colonSplit),
- ('VTKINCDIR','Directories where to look for VTK headers',['/usr/include/vtk','/usr/include/vtk-5.0'],None,colonSplit),
('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),
@@ -246,6 +245,7 @@
"Attempts to localize qt3 installation in given qtdirs. Sets necessary variables if found and returns True; otherwise returns False."
# make sure they exist and save them for restoring if a test fails
origs={'LIBS':context.env['LIBS'],'LIBPATH':context.env['LIBPATH'],'CPPPATH':context.env['CPPPATH']}
+ qtdirs=qtdirs[0].split()
for qtdir in qtdirs:
context.Message( 'Checking for qt-mt in '+qtdir+'... ' )
context.env['QTDIR']=qtdir
@@ -328,15 +328,15 @@
if not ok:
print "\nOne of the essential libraries above was not found, unable to continue.\n\nCheck `%s' for possible causes, note that there are options that you may need to customize:\n\n"%(buildDir+'/config.log')+opts.GenerateHelpText(env)
Exit(1)
- def featureNotOK(featureName):
+ def featureNotOK(featureName,note=None):
print "\nERROR: Unable to compile with optional feature `%s'.\n\nIf you are sure, remove it from features (scons features=featureOne,featureTwo for example) and build again."%featureName
+ if note: print "Note:",note
Exit(1)
# check "optional" libs
if 'vtk' in env['features']:
- conf.env.Append(CPPPATH=env['VTKINCDIR'])
ok=conf.CheckLibWithHeader(['vtkCommon'],'vtkInstantiator.h','c++','vtkInstantiator::New();',autoadd=1)
env.Append(LIBS='vtkHybrid')
- if not ok: featureNotOK('vtk')
+ if not ok: featureNotOK('vtk',note="You might have to add VTK header directory (e.g. /usr/include/vtk-5.4) to CPPPATH.")
if 'opengl' in env['features']:
ok=conf.CheckLibWithHeader('glut','GL/glut.h','c++','glutGetModifiers();',autoadd=1)
# TODO ok=True for darwin platform where openGL (and glut) is native
@@ -350,6 +350,9 @@
print "\nQt3 interface can only be used if opengl is enabled.\nEither add opengl to 'features' or add qt3 to 'exclude'."
Exit(1)
ok&=conf.CheckQt(env['QTDIR'])
+ if not ok:
+ print "ERROR: Qt3 library not found. Add qt3 to the 'exclude' list (opengl will be skipped as well)"
+ Exit(1)
env.Tool('qt'); env.Replace(QT_LIB='qt-mt')
env['QGLVIEWER_LIB']='yade-QGLViewer';
=== modified file 'gui/py/yade-multi'
--- gui/py/yade-multi 2009-08-22 18:21:25 +0000
+++ gui/py/yade-multi 2009-10-17 06:36:21 +0000
@@ -37,7 +37,13 @@
def globalHtmlStats():
t0=min([j.started for j in jobs if j.started!=None])
- ret='<p>Running %s, since %s.</p>'%(t2hhmmss(time.time()-t0),time.ctime(t0))
+ unfinished=len([j for j in jobs if j.status!='DONE'])
+ if unfinished:
+ ret='<p>Running for %s, since %s.</p>'%(t2hhmmss(time.time()-t0),time.ctime(t0))
+ else:
+ failed=len([j for j in jobs if j.exitStatus!=0])
+ lastFinished=max([j.finished for j in jobs])
+ ret='<p><span style="background-color:%s">Finished</span>, idle for %s, running time %s since %s'%('red' if failed else 'green',t2hhmmss(time.time()-lastFinished),t2hhmmss(sum([j.finished-j.started for j in jobs if j.started is not None])),time.ctime(t0))
ret+='<h3>Jobs</h3>'
nFailed=len([j for j in jobs if j.status=='DONE' and j.exitStatus!=0])
ret+='<p><b>%d</b> total, <b>%d</b> <span style="background-color:yellow">running</span>, <b>%d</b> <span style="background-color:green">done</span>%s</p>'%(len(jobs),len([j for j in jobs if j.status=='RUNNING']), len([j for j in jobs if j.status=='DONE']),' (<b>%d <span style="background-color:red"><b>failed</b></span>)'%nFailed if nFailed>0 else '')
@@ -57,6 +63,8 @@
for j in jobs:
self.wfile.write(j.htmlStats())
self.wfile.write('</TABLE></BODY></HTML>')
+ global httpLastServe
+ httpLastServe=time.time()
return
def log_request(self,req): pass
def runHttpStatsServer():
@@ -103,15 +111,16 @@
def getNumCores(): return len([l for l in open('/proc/cpuinfo','r') if l.find('processor')==0])
parser=optparse.OptionParser(usage='%prog [options] TABLE SIMULATION.py\n\n %prog runs yade simulation multiple times with different parameters.\n See http://yade.wikia.com/wiki/ScriptParametricStudy for details.')
-parser.add_option('-j',dest='maxJobs',type='int',help="Maximum number of simultaneous jobs to run (default: number of cores, i.e. %d)"%getNumCores(),metavar='NUM',default=getNumCores())
+parser.add_option('-j','--jobs',dest='maxJobs',type='int',help="Maximum number of simultaneous jobs to run (default: number of cores, i.e. %d)"%getNumCores(),metavar='NUM',default=getNumCores())
parser.add_option('--log',dest='logFormat',help='Format of log files -- must contain a % or @, which will be replaced by line number or by description column respectively (default: SIMULATION.@.log)',metavar='FORMAT')
parser.add_option('-l','--lines',dest='lineList',help='Lines of TABLE to use, in the format 2,3-5,8,11-13 (default: all available lines in TABLE)',metavar='LIST')
parser.add_option('--nice',dest='nice',type='int',help='Nice value of spawned jobs (default: 10)',default=10)
parser.add_option('--executable',dest='executable',help='Name of the program to run (default: %s)'%sys.argv[0][:-6],default=sys.argv[0][:-6],metavar='FILE') ## strip the '-multi' extension
parser.add_option('--gnuplot',dest='gnuplotOut',help='Gnuplot file where gnuplot from all jobs should be put together',default=None,metavar='FILE')
parser.add_option('--dry-run',action='store_true',dest='dryRun',help='Do not actually run (useful for getting gnuplot only, for instance)',default=False)
+parser.add_option('--http-wait',action='store_true',dest='httpWait',help='Do not quit if still serving overview over http repeatedly',default=False)
opts,args=parser.parse_args()
-logFormat,lineList,maxJobs,nice,executable,gnuplotOut,dryRun=opts.logFormat,opts.lineList,opts.maxJobs,opts.nice,opts.executable,opts.gnuplotOut,opts.dryRun
+logFormat,lineList,maxJobs,nice,executable,gnuplotOut,dryRun,httpWait=opts.logFormat,opts.lineList,opts.maxJobs,opts.nice,opts.executable,opts.gnuplotOut,opts.dryRun,opts.httpWait
if len(args)!=2:
#print "Exactly two non-option arguments must be specified -- parameter table and script to be run.\n"
@@ -196,12 +205,13 @@
for job in jobs:
print ' #%d (%s%s):'%(job.num,job.id,'' if job.nSlots==1 else '/%d'%job.nSlots),job.command
+httpLastServe=0
runHttpStatsServer()
# OK, go now
if not dryRun: runJobs(jobs,maxJobs)
-print 'All jobs finished.'
+print 'All jobs finished, total time ',t2hhmmss(sum([j.finished-j.started for j in jobs if j.started is not None]))
# for easy grepping in logfiles:
print 'Log files:'
@@ -239,3 +249,7 @@
gp.write('plot '+','.join(plots))
print "gnuplot",gnuplotOut
print "Plot written, bye."
+if httpWait and time.time()-httpLastServe<10:
+ print "(continue serving http until no longer requested as per --http-wait)"
+ while time.time()-httpLastServe<10:
+ time.sleep(1)
=== modified file 'pkg/dem/Engine/StandAloneEngine/VTKRecorder.cpp'
--- pkg/dem/Engine/StandAloneEngine/VTKRecorder.cpp 2009-10-16 06:33:55 +0000
+++ pkg/dem/Engine/StandAloneEngine/VTKRecorder.cpp 2009-10-17 06:36:21 +0000
@@ -28,6 +28,7 @@
initRun=true;
compress=false;
skipFacetIntr=true;
+ skipNondynamic=false;
}
VTKRecorder::~VTKRecorder()
@@ -120,6 +121,7 @@
const Sphere* sphere = dynamic_cast<Sphere*>(b->geometricalModel.get());
if (sphere)
{
+ if(skipNondynamic && !b->isDynamic) continue;
vtkIdType pid[1];
const Vector3r& pos = b->physicalParameters->se3.position;
pid[0] = spheresPos->InsertNextPoint(pos[0], pos[1], pos[2]);
=== modified file 'pkg/dem/Engine/StandAloneEngine/VTKRecorder.hpp'
--- pkg/dem/Engine/StandAloneEngine/VTKRecorder.hpp 2009-10-16 06:33:55 +0000
+++ pkg/dem/Engine/StandAloneEngine/VTKRecorder.hpp 2009-10-17 06:36:21 +0000
@@ -12,6 +12,8 @@
bool compress;
//! skip interactions with facets
bool skipFacetIntr;
+ //! skip non-dynamic spheres (not facets)
+ bool skipNondynamic;
VTKRecorder();
~VTKRecorder();
void init(MetaBody*);
=== modified file 'pkg/dem/meta/ConcretePM.cpp'
--- pkg/dem/meta/ConcretePM.cpp 2009-10-16 06:33:55 +0000
+++ pkg/dem/meta/ConcretePM.cpp 2009-10-17 06:36:21 +0000
@@ -355,7 +355,7 @@
const body_id_t id1=I->getId1(), id2=I->getId2();
Dem3DofGeom* geom=YADE_CAST<Dem3DofGeom*>(I->interactionGeometry.get());
- Vector3r stress=(1./phys->crossSection)*phys->normalForce;
+ Vector3r stress=(1./phys->crossSection)*(phys->normalForce+phys->shearForce);
const Vector3r& p1(geom->se31.position); const Vector3r& cp(geom->contactPoint);
for(int i=0; i<3; i++){
stress[i]*=cp[i]>p1[i] ? 1. : -1.;
@@ -374,7 +374,7 @@
// add damaged contacts that have already been deleted
CpmMat* bpp=dynamic_cast<CpmMat*>(B->physicalParameters.get());
if(!bpp) continue;
- bpp->avgStress=bodyStats[id].avgStress/bodyStats[id].nLinks;
+ bpp->avgStress=bodyStats[id].avgStress; // /bodyStats[id].nLinks;
int cohLinksWhenever=bodyStats[id].nCohLinks+bpp->numBrokenCohesive;
if(cohLinksWhenever>0){
bpp->normDmg=(bodyStats[id].dmgSum+bpp->numBrokenCohesive)/cohLinksWhenever;