← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1970: 1. Fix epydoc generation with python main (thansk Anton for th yade-cxx hint!)

 

------------------------------------------------------------
revno: 1970
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-01-15 10:21:57 +0100
message:
  1. Fix epydoc generation with python main (thansk Anton for th yade-cxx hint!)
  2. Expose O.tmpFilename returning unique filename in temporary dir that is deleted at exit
  3. Do not import yade.plot at startup, since it initialized matplotlib to TkAgg, which needs $DISPLAY (and fails later if no $DISPLAY exists, i.e. for headless simulations)
  4. Fix shear stress computation in CpmStateUpdater
modified:
  core/main/main.py.in
  doc/yade-epydoc.py
  pkg/dem/meta/ConcretePM.cpp
  py/utils.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 'core/main/main.py.in'
--- core/main/main.py.in	2010-01-09 17:26:41 +0000
+++ core/main/main.py.in	2010-01-15 09:21:57 +0000
@@ -39,7 +39,7 @@
 import yade.wrapper
 import yade.log
 import yade.system
-import yade.plot
+#import yade.plot
 
 # continue option processing
 

=== modified file 'doc/yade-epydoc.py'
--- doc/yade-epydoc.py	2009-12-11 07:27:29 +0000
+++ doc/yade-epydoc.py	2010-01-15 09:21:57 +0000
@@ -8,7 +8,8 @@
 
 import sys
 # add the configuration file
-sys.argv+=['--config=yade-epydoc.conf','-v'] # '-v'
+# fix command-line args (epydoc would choke receiving "yade-something yade-epydoc.py --config=...", which is the case for python main; this changes to "yade-something --config=...")
+sys.argv=[sys.argv[0]]+['--config=yade-epydoc.conf','-v'] # '-v'
 from epydoc.cli import cli
 cli()
 quit()

=== modified file 'pkg/dem/meta/ConcretePM.cpp'
--- pkg/dem/meta/ConcretePM.cpp	2010-01-03 20:30:24 +0000
+++ pkg/dem/meta/ConcretePM.cpp	2010-01-15 09:21:57 +0000
@@ -385,7 +385,7 @@
 		Vector3r shearStress;
 		for(int i=0; i<3; i++){
 			int ix1=(i+1)%3,ix2=(i+2)%3;
-			shearStress[i]=Mathr::Sign(geom->normal[ix1])*phys->shearForce[ix1]+Mathr::Sign(geom->normal[ix2])*phys->shearForce[ix2];
+			shearStress[i]=geom->normal[ix1]*phys->shearForce[ix1]+geom->normal[ix2]*phys->shearForce[ix2];
 			shearStress[i]/=phys->crossSection;
 		}
 		bodyStats[id1].tau+=shearStress;

=== modified file 'py/utils.py'
--- py/utils.py	2010-01-15 08:15:15 +0000
+++ py/utils.py	2010-01-15 09:21:57 +0000
@@ -460,7 +460,7 @@
 		`fps`:
 			Frames per second.
 	"""
-	import pygst,sys,gobject,os,tempfile,shutil
+	import pygst,sys,gobject,os,tempfile,shutil,os.path
 	pygst.require("0.10")
 	import gst
 	if renameNotOverwrite and os.path.exists(out):
@@ -471,7 +471,7 @@
 		# create a new common prefix, symlink given files to prefix-%05d.png in their order, adjust wildcard, go ahead.
 		tmpDir=tempfile.mkdtemp()
 		for no,frame in enumerate(frameSpec):
-			os.symlink(frame,os.path.join(tmpDir,'%07d'%no))
+			os.symlink(os.path.abspath(frame),os.path.join(tmpDir,'%07d'%no))
 		wildcard=os.path.join(tmpDir,'%07d')
 	else:
 		tmpDir=None; wildcard=frameSpec

=== modified file 'py/yadeWrapper/yadeWrapper.cpp'
--- py/yadeWrapper/yadeWrapper.cpp	2010-01-10 09:09:32 +0000
+++ py/yadeWrapper/yadeWrapper.cpp	2010-01-15 09:21:57 +0000
@@ -538,6 +538,7 @@
 		exit(status);
 	}
 	void runEngine(const shared_ptr<Engine>& e){ LOG_WARN("Omega().runEngine(): deprecated, use __call__ method of the engine instance directly instead; will be removed in the future."); e->scene=OMEGA.getScene().get(); e->action(OMEGA.getScene().get()); }
+	std::string tmpFilename(){ return OMEGA.tmpFilename(); }
 };
 
 class pySTLImporter : public STLImporter {};
@@ -700,6 +701,7 @@
 			.def("saveXML",&pyOmega::saveXML,"[EXPERIMENTAL] function saving to XML file using boost::serialization.")
 		#endif
 		.def("runEngine",&pyOmega::runEngine,"Run given engine exactly once; simulation time, step number etc. will not be incremented (use only if you know what you do).")
+		.def("tmpFilename",&pyOmega::tmpFilename,"Return unique name of file in temporary directory which will be deleted when yade exits.")
 		;
 	python::class_<pyTags>("TagsWrapper",python::init<pyTags&>())
 		.def("__getitem__",&pyTags::getItem)