Python 玛亚维TVTK数据集更新点(无冲洗管线)

Python 玛亚维TVTK数据集更新点(无冲洗管线),python,visualization,vtk,mayavi,Python,Visualization,Vtk,Mayavi,我想使用MayaVI对大型模拟数据进行可视化,保存为VTKUnstructuredGrid或TVTK非结构化网格。加载网格后,我希望使用numpy数组快速更新网格点,而不更改模型中的任何其他内容 到目前为止,我更新了这些点,然后调用修改后的方法,这会刷新整个管道,从而大大降低可视化速度。我现在的问题是:是否有机会在不重新加载整个管道的情况下更新VTKDataset中的点 我正在使用特征进行可视化;简化我的代码如下所示: import numpy as np from enthought.tra

我想使用MayaVI对大型模拟数据进行可视化,保存为VTKUnstructuredGrid或TVTK非结构化网格。加载网格后,我希望使用numpy数组快速更新网格点,而不更改模型中的任何其他内容

到目前为止,我更新了这些点,然后调用修改后的方法,这会刷新整个管道,从而大大降低可视化速度。我现在的问题是:是否有机会在不重新加载整个管道的情况下更新VTKDataset中的点

我正在使用特征进行可视化;简化我的代码如下所示:

import numpy as np

from enthought.traits.api import HasTraits, Range, Instance, on_trait_change
from enthought.traits.ui.api import View, Item, HGroup, HSplit, VSplit
from enthought.tvtk.pyface.scene_editor import SceneEditor
from enthought.mayavi.tools.mlab_scene_model import MlabSceneModel
from enthought.mayavi.core.ui.mayavi_scene import MayaviScene
from enthought.mayavi import mlab
from enthought.tvtk.api import tvtk
from enthought.mayavi.modules.surface import Surface
from enthought.tvtk.pyface.scene_editor import SceneEditor
class Visu(HasTraits):

  timestep = Range(50,100,50)
  pts = tvtk.Points()
  ugrid = tvtk.UnstructuredGrid()
  scene = Instance(MlabSceneModel, ())
  view = View(Item('scene', editor=SceneEditor(scene_class=MayaviScene), height=250, width=300, show_label=True),HGroup('_', 'timestep'), resizable=True )

  @on_trait_change('scene.activated')
  def ini(self):
    filename = 'original3dplot'
    reader = tvtk.LSDynaReader(file_name = filename)
    reader.update()
    self.ugrid = reader.get_output()
    self.surface = self.scene.mlab.pipeline.surface(self.ugrid)

  @on_trait_change('timestep')
  def update_visu(self):
    update_coord = np.loadtxt('newcoordinates'+str(self.timestep))
    self.pts.from_array(update_coord)
    self.ugrid.points = self.pts
    self.ugrid.modified()

visualization = Visu()
visualization.configure_traits()