errors occurs using vtk package
I am a beginner of esys-particle, and when i changed to vtk model, and also changed the offscreen to false and interactive to true. errors occurs, blew the code following. Could you help me fix it, many thanks.
#bingle_vis.py: A two-particle collision simulation
#
#with visualisation using povray
# Author: D. Weatherley
# Date: 15 May 2007
# Organisation: ESSCC, University of Queensland
# (C) All rights reserved, 2007.
#
#
#import the appropriate ESyS-Particle modules:
from esys.lsm import *
from esys.lsm.util import Vec3, BoundingBox
# from esys.lsm.vis import povray
from esys.lsm.vis import vtk
def snapshot(
#pkg = povray
pkg=vtk
scene = pkg.Scene()
for pp in particles:
povsphere = pkg.Sphere(
povsphere.
scene.
camera = scene.getCamera()
camera.
camera.
camera.
scene.render(
offScreen=False,
interactive=True,
fileName=
size=[800,600]
)
return
#instantiate a simulation object
#and initialise the neighbour search algorithm:
sim = LsmMpi(
sim.initNeighbo
particleType=
gridSpacing=2.5,
verletDist=0.5
)
#specify the spatial domain for the simulation:
domain = BoundingBox(
sim.setSpatialD
#add the first particle to the domain:
particle=
particle.
sim.createParti
#add the second particle to the domain:
particle=
particle.
sim.createParti
#specify the type of interactions between colliding particles:
sim.createInter
NRotElasticPrms(
name = "elasticSpheres",
normalK = 10000.0
)
)
#set the number of timesteps and timestep increment:
sim.setNumTimeS
sim.setTimeStep
#compute the specified number of timesteps:
N_max = sim.getNumTimeS
n=0
while (n < N_max):
#compute a single timestep:
sim.runTimeStep()
# print the particle position to stdout every 100 timesteps:
if (n%100==0):
particles = sim.getParticle
snapshot(
# update the total number of timesteps computed (n):
n += 1
#Exit the simulation.
sim.exit()
error message:
CSubLatticeCont
Traceback (most recent call last):
File "bingle_vis2.py", line 14, in <module>
from esys.lsm.vis import vtk
ImportError: cannot import name vtk
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- guo
- Solved:
- Last query:
- Last reply: