yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #22466
[Question #689176]: How to read user defined list from O.save('sample.yade.gz')
New question #689176 on Yade:
https://answers.launchpad.net/yade/+question/689176
Hi,
I define a list in script1.py, and save as sample.yade.gz.
And then I use script2.py to read the sample.yade.gz. In script2.py, I can not read the list defined in script1.py.
Is there any idea to make it?
Here is a MWE:
#######script1.py#####
O.bodies.append([
sphere(center=(0,0,0),radius=.5,fixed=True),
sphere((0,0,2),.5)
])
sandIds=[] ###this is an example list which I can not read from script2.py
for i in O.bodies:
sandIds.append(i.id)
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.1)
]
O.dt=.5e-4*PWaveTimeStep()
O.save('sample.yade.gz')
################
#########script2.py#########
O.load('sample.yade.gz')
print len(sandIds) ##yade version 2018.02b
##################
In script2, I can see all the particles, but I cannot get the sandIds list.
Is there any idea about how to pass these user defined lists (and other user defined variables) to another script?
Thanks,
Leonard
--
You received this question notification because your team yade-users is
an answer contact for Yade.