yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #07461
[Branch ~yade-dev/yade/trunk] Rev 2813: 1. Replace "subscribedBodies" to "ids" almost everywhere in the code.
------------------------------------------------------------
revno: 2813
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: yade
timestamp: Fri 2011-04-15 08:20:10 +0200
message:
1. Replace "subscribedBodies" to "ids" almost everywhere in the code.
2. Fix a couple of examples.
modified:
doc/sphinx/prog.rst
doc/sphinx/user.rst
examples/ring2d/ringCundallDamping.py
examples/ring2d/ringSimpleViscoelastic.py
scripts/Damping_HM.py
scripts/exact-rot-facet.py
scripts/test/helix.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 'doc/sphinx/prog.rst'
--- doc/sphinx/prog.rst 2011-04-12 22:06:51 +0000
+++ doc/sphinx/prog.rst 2011-04-15 06:20:10 +0000
@@ -1731,7 +1731,7 @@
Yade [1]: f1=ForceEngine()
- Yade [2]: f1.subscribedBodies=[0,4,5]
+ Yade [2]: f1.ids=[0,4,5]
Yade [2]: f1.force=Vector3(0,-1,-2)
=== modified file 'doc/sphinx/user.rst'
--- doc/sphinx/user.rst 2011-01-27 19:11:13 +0000
+++ doc/sphinx/user.rst 2011-04-15 06:20:10 +0000
@@ -667,7 +667,7 @@
Partial engines
---------------
-Engines deriving from :yref:`PartialEngine` define the :yref:`subscribedBodies<PartialEngine.subscribedBodies>` attribute determining bodies which will be affected. Several of them warrant explicit mention here:
+Engines deriving from :yref:`PartialEngine` define the :yref:`ids<PartialEngine.subscribedBodies>` attribute determining bodies which will be affected. Several of them warrant explicit mention here:
* :yref:`TranslationEngine` and :yref:`RotationEngine` for applying constant speed linear and rotational motion on subscribers.
* :yref:`ForceEngine` and :yref:`TorqueEngine` applying given values of force/torque on subscribed bodies at every step.
=== modified file 'examples/ring2d/ringCundallDamping.py'
--- examples/ring2d/ringCundallDamping.py 2010-12-26 15:42:43 +0000
+++ examples/ring2d/ringCundallDamping.py 2011-04-15 06:20:10 +0000
@@ -11,14 +11,15 @@
def fill_cylinder_with_spheres(sphereRadius,cylinderRadius,cylinderHeight,cylinderOrigin,cylinderSlope):
spheresCount=0
- for h in xrange(0,cylinderHeight/sphereRadius/2):
- for r in xrange(1,cylinderRadius/sphereRadius/2):
+ for h in xrange(0,int(cylinderHeight/sphereRadius/2)):
+ for r in xrange(1,int(cylinderRadius/sphereRadius/2)):
dfi = asin(0.5/r)*2
- for a in xrange(0,6.28/dfi):
+ for a in xrange(0,int(6.28/dfi)):
x = cylinderOrigin[0]+2*r*sphereRadius*cos(dfi*a)
y = cylinderOrigin[1]+2*r*sphereRadius*sin(dfi*a)
z = cylinderOrigin[2]+h*2*sphereRadius
- o.bodies.append(utils.sphere([x,y*cos(cylinderSlope)+z*sin(cylinderSlope),z*cos(cylinderSlope)-y*sin(cylinderSlope)],sphereRadius))
+ s=utils.sphere([x,y*cos(cylinderSlope)+z*sin(cylinderSlope),z*cos(cylinderSlope)-y*sin(cylinderSlope)],sphereRadius)
+ O.bodies.append(s)
spheresCount+=1
return spheresCount
@@ -28,7 +29,7 @@
print "Number of spheres: %d" % spheresCount
## Engines
-o.engines=[
+O.engines=[
## Resets forces and momenta the act on bodies
ForceResetter(),
@@ -50,15 +51,15 @@
## Apply kinematics to walls
## angularVelocity = 0.73 rad/sec = 7 rpm
- RotationEngine(subscribedBodies=walls,rotationAxis=[0,0,1],rotateAroundZero=True,angularVelocity=0.73)
+ RotationEngine(ids=walls,rotationAxis=[0,0,1],rotateAroundZero=True,angularVelocity=0.73)
]
-for b in o.bodies:
+for b in O.bodies:
if isinstance(b.shape,Sphere): b.state.blockedDOFs='z' # blocked movement along Z
-o.dt=0.02*utils.PWaveTimeStep()
+O.dt=0.02*utils.PWaveTimeStep()
-o.saveTmp('init');
+O.saveTmp('init');
from yade import qt
renderer=qt.Renderer()
=== modified file 'examples/ring2d/ringSimpleViscoelastic.py'
--- examples/ring2d/ringSimpleViscoelastic.py 2011-01-11 14:09:30 +0000
+++ examples/ring2d/ringSimpleViscoelastic.py 2011-04-15 06:20:10 +0000
@@ -24,10 +24,10 @@
def fill_cylinder_with_spheres(sphereRadius,cylinderRadius,cylinderHeight,cylinderOrigin,cylinderSlope):
spheresCount=0
- for h in xrange(0,cylinderHeight/sphereRadius/2):
- for r in xrange(1,cylinderRadius/sphereRadius/2):
+ for h in xrange(0,int(cylinderHeight/sphereRadius/2)):
+ for r in xrange(1,int(cylinderRadius/sphereRadius/2)):
dfi = asin(0.5/r)*2
- for a in xrange(0,6.28/dfi):
+ for a in xrange(0,int(6.28/dfi)):
x = cylinderOrigin[0]+2*r*sphereRadius*cos(dfi*a)
y = cylinderOrigin[1]+2*r*sphereRadius*sin(dfi*a)
z = cylinderOrigin[2]+h*2*sphereRadius
=== modified file 'scripts/Damping_HM.py'
--- scripts/Damping_HM.py 2010-09-27 17:47:59 +0000
+++ scripts/Damping_HM.py 2011-04-15 06:20:10 +0000
@@ -37,7 +37,7 @@
[Ip2_FrictMat_FrictMat_MindlinPhys(label='damping')],
[Law2_ScGeom_MindlinPhys_Mindlin(label='contactLaw')]
),
- ForceEngine(force=(-20,0,0),subscribedBodies=[1],label='force'),
+ ForceEngine(force=(-20,0,0),ids=[1],label='force'),
NewtonIntegrator(damping=0.0),
PyRunner(iterPeriod=1,command='myAddPlotData()'),
]
=== modified file 'scripts/exact-rot-facet.py'
--- scripts/exact-rot-facet.py 2010-09-30 18:00:41 +0000
+++ scripts/exact-rot-facet.py 2011-04-15 06:20:10 +0000
@@ -14,7 +14,7 @@
]),
IPhysDispatcher([Ip2_FrictMat_FrictMat_FrictPhys()]),
ElasticContactLaw(),
- RotationEngine(subscribedBodies=[1],rotationAxis=[1,0,0],angularVelocity=.01),
+ RotationEngine(ids=[1],rotationAxis=[1,0,0],angularVelocity=.01),
NewtonIntegrator(damping=0.2)
]
from yade import utils
=== modified file 'scripts/test/helix.py'
--- scripts/test/helix.py 2010-12-21 12:19:50 +0000
+++ scripts/test/helix.py 2011-04-15 06:20:10 +0000
@@ -1,7 +1,7 @@
# script for testing InterpolatingSpiralEngine: sphere going in a sphere-like motion around bar
O.bodies.append([utils.box([0,0,0],[.005,.005,1],dynamic=False),utils.sphere([0,.1,-1],.04,dynamic=False)])
O.engines=[
- InterpolatingSpiralEngine(subscribedBodies=[1],times=[10,20,30,40,50,60,70,80,90,100],angularVelocities=[1,2,3,4,5,3,1,-1,-3,0],axis=[0,0,1],axisPt=[0,0,0],wrap=True,slope=.003,label='spiral'),
+ InterpolatingSpiralEngine(ids=[1],times=[10,20,30,40,50,60,70,80,90,100],angularVelocities=[1,2,3,4,5,3,1,-1,-3,0],axis=[0,0,1],axisPt=[0,0,0],wrap=True,slope=.003,label='spiral'),
]
O.dt=4e-6
O.saveTmp('initial')