------------------------------------------------------------ revno: 1857 committer: Václav Šmilauer <[email protected]> branch nick: trunk timestamp: Sat 2009-12-05 11:57:58 +0100 message: 1. Fix the plot example. renamed: scripts/simple-scene-graph.py => scripts/simple-scene-plot.py modified: pkg/dem/DataClass/Clump.cpp py/plot.py scripts/simple-scene-plot.py
-- 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 'pkg/dem/DataClass/Clump.cpp' --- pkg/dem/DataClass/Clump.cpp 2009-12-04 23:46:45 +0000 +++ pkg/dem/DataClass/Clump.cpp 2009-12-05 10:57:58 +0000 @@ -236,7 +236,8 @@ Ic_orientG(1,0)=Ic_orientG(0,1); Ic_orientG(2,0)=Ic_orientG(0,2); Ic_orientG(2,1)=Ic_orientG(1,2); // symmetrize //TRWM3MAT(Ic_orientG); Ic_orientG.EigenDecomposition(R_g2c,Ic); - /*! @bug: eigendecomposition is wrong. see http://article.gmane.org/gmane.science.physics.yade.devel/99 for message. */ + /*! @bug eigendecomposition might be wrong. see http://article.gmane.org/gmane.science.physics.yade.devel/99 for message. It is worked around below, however. + */ // has NaNs for identity matrix! TRWM3MAT(R_g2c); === modified file 'py/plot.py' --- py/plot.py 2009-10-21 15:22:14 +0000 +++ py/plot.py 2009-12-05 10:57:58 +0000 @@ -33,8 +33,7 @@ plotDataCollector=None -import yade.wrapper -o=yade.wrapper.Omega() +from yade import * maxDataLen=1000 === renamed file 'scripts/simple-scene-graph.py' => 'scripts/simple-scene-plot.py' --- scripts/simple-scene-graph.py 2009-12-04 23:27:26 +0000 +++ scripts/simple-scene-plot.py 2009-12-05 10:57:58 +0000 @@ -25,11 +25,11 @@ ### ### The engine _must_ be labeled 'plotDataCollector', so that the reducer may find it and adjust its periods if necessary. ### - PeriodicPythonRunner(iterPeriod=200,command='myAddPlotData()',label='plotDataCollector') + PeriodicPythonRunner(iterPeriod=20,command='myAddPlotData()',label='plotDataCollector') ] from yade import utils -O.bodies.append(utils.box(center=[0,0,0],extents=[.5,.5,.5],dynamic=False,color=[1,0,0],young=30e9,poisson=.3,density=2400)) -O.bodies.append(utils.sphere([0,0,2],1,color=[0,1,0],young=30e9,poisson=.3,density=2400)) +O.bodies.append(utils.box(center=[0,0,0],extents=[.5,.5,.5],dynamic=False,color=[1,0,0])) +O.bodies.append(utils.sphere([0,0,2],1,color=[0,1,0])) O.dt=.2*utils.PWaveTimeStep() @@ -38,11 +38,11 @@ ############################################ from math import * -import yade.plot +from yade import plot ## we will have 2 plots: ## 1. t as function of i (joke test function) ## 2. i as function of t on left y-axis ('|||' makes the separation) and z_sph, v_sph (as green circles connected with line) and z_sph_half again as function of t -yade.plot.plots={'i':('t'),'t':('z_sph','|||',('v_sph','go-'),'z_sph_half')} +plot.plots={'i':('t'),'t':('z_sph','|||',('v_sph','go-'),'z_sph_half')} ## this function is called by plotDataCollector ## it should add data with the labels that we will plot @@ -50,14 +50,9 @@ def myAddPlotData(): ## store some numbers under some labels sph=O.bodies[1] - yade.plot.addData(t=O.time,i=O.iter,z_sph=sph.phys.pos[2],z_sph_half=.5*sph.phys.pos[2],v_sph=sqrt(sum([v**2 for v in sph.phys['velocity']]))) + plot.addData(t=O.time,i=O.iter,z_sph=sph.state.pos[2],z_sph_half=.5*sph.state.pos[2],v_sph=sqrt(sum([v**2 for v in sph.state['vel']]))) O.run(int(2./O.dt),True); -print """Now, you can say - - yade.plot.plot() - -to see figures. -""" -import yade.plot as yp -yp.saveGnuplot('/tmp/a') +print "Now calling plot.plot() to show the figures (close them to continue)." +plot.plot() +plot.saveGnuplot('/tmp/a')
_______________________________________________ Mailing list: https://launchpad.net/~yade-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp

