[vtkusers] Generating Time Varying Data Sets

Andrew Crozier wacrozier at gmail.com
Fri Sep 23 13:54:59 EDT 2011


Hi all,

I'm trying to visualise a time varying field on a static geometry using vtk
in python. My code parses some files exported from a commercial system, and
I have successfully implemented code to create a vtkUnstructuredGrid and
visualise this field for single time points.

All the information I can find online about temporal data sets either
involves an example class where data is provided from an algorithm, or where
the time varying data is read using a .pvd file and the reader handles the
creation of the temporal data set in the background (from what I
understand). Obviously, I could write out my data as a stack of .vtu files
and read them back in, but this is a slow and inelegant solution.

My current code is:

testEsi = ensite()
testEsi.readVirtuals({'test': '/path/to/file.txt'})
mesh = testEsi.returnVtkMesh()  #Returns a vtkUnstructuredGrid

timeDataSet = vtkTemporalDataSet()
timeDataSet.SetNumberOfTimeSteps(3)
timeDataSet.SetTimeStep(0, mesh)
timeDataSet.SetTimeStep(1, mesh)
timeDataSet.SetTimeStep(2, mesh)

tempDataSetCache = vtkTemporalDataSetCache()
tempDataSetCache.SetInput(timeDataSet)

timeDataSet.UpdateInformation()

executive = tempDataSetCache.GetExecutive()
tempDataSetCache.UpdateInformation()

executive.SetUpdateTimeStep(0,0.0)
tempDataSetCache.Update()

When I run it, I get the error on executing the last line:
ERROR: In
/build/buildd/vtk-5.2.1/Filtering/vtkStreamingDemandDrivenPipeline.cxx, line
711
vtkCompositeDataPipeline (0x1e7a130): No time steps or time range been set
in the information for output port 0 on algorithm
vtkTemporalDataSetCache(0x3e875a0).

I get a similar error if I run timeDataSet.Update() . I assume that this is
due to my lack of knowledge of how these classes are supposed to interact.
If anyone could point me in the right direction of how to fix it or
correctly implement a time varying data set in vtk python, I would greatly
appreciate it.

Best wishes,

Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110923/c098b770/attachment.htm>


More information about the vtkusers mailing list