[vtkusers] Saving multiple time steps in a vtkXMLStructuredGrid file ...

Meehan, Bernard MEEHANBT at nv.doe.gov
Mon Feb 22 11:48:27 EST 2016


I ended up solving the problem by using a “PVD” file (http://www.paraview.org/Wiki/ParaView/Data_formats#PVD_File_Format).
Note, that in the link, the example file has “<?xml version=“1.0”?>” at the top, but it will work fine without it.

From: Guillaume Jacquenot <guillaume.jacquenot at gmail.com<mailto:guillaume.jacquenot at gmail.com>>
Date: Monday, February 22, 2016 at 8:06 AM
To: "vtkusers at vtk.org<mailto:vtkusers at vtk.org>" <vtkusers at vtk.org<mailto:vtkusers at vtk.org>>, Tim Meehan <meehanbt at nv.doe.gov<mailto:meehanbt at nv.doe.gov>>
Subject: [vtkusers] Saving multiple time steps in a vtkXMLStructuredGrid file ...


Hello everyone,

I am wondering if the post had any answer.
http://www.itk.org/pipermail/vtkusers/2015-July/091641.html

I am facing the same problem, where :

- I can not set the timestep value in the exported XML file (All TimeStep values are 0)
- Paraview does not use the attribute TimeValues when reading XML VTK file
  <StructuredGrid  TimeValues="0.0 0.1 0.2" WholeExtent="0 9 0 9 0 9">


Below is the mail from Bernard Meehan, who reported this problem.



I’ve looked all over the wiki, and all of the books that I have, and I
just can’t figure this out. Was vtkXMLStructuredGrid just plain not
designed to handle time?

In the vts file, I can see that the time steps are saved: 0.0, 0.1, 0.2,
just like I wrote them, but when I load them into ParaView, they show up
as 0, 1, 2.

In the file it seems to record three separate time steps, but it calls
them all TimeStep=“0”

I get the feeling that I am leaving something simple out, any help would
be appreciated.

On 7/8/15, 8:02 AM, "Meehan, Bernard" <MEEHANBT at nv.doe.gov<http://public.kitware.com/mailman/listinfo/vtkusers>> wrote:

>I was hoping to be able to write a scalar field that changed over time to
>a vtkXMLStructuredGridFile, following the example on this thread:
>http://public.kitware.com/pipermail/vtkusers/2012-November/077262.html>>But when I examined my ³*vts² file, the scalar function wasn¹t written to
>a different time step. I¹d be happy to turn this into an example on the
>wiki if I could get it to work Š
>>import vtk
>>NX = 10
>NY = 10
>NZ = 10
>>#-------------------------------Create your
>Grid-------------------------------#
>pts = vtk.vtkPoints()
>for i in range(NX):
>  for j in range(NY):
>    for k in range(NZ):
>      pts.InsertNextPoint(i, j, k)
>>sg = vtk.vtkStructuredGrid()
>sg.SetDimensions(NX, NY, NZ)
>sg.SetPoints(pts)
>>f1 = vtk.vtkDoubleArray()
>f1.SetName("Function 1")
>for i in range(NX):
>  for j in range(NY):
>    for k in range(NZ):
>      f1.InsertNextValue(i+j+k)
>sg.GetPointData().AddArray(f1)
>>#----------------------------------Save
>File-----------------------------------#
>w = vtk.vtkXMLStructuredGridWriter()
>w.SetFileName("test.vts")
>w.SetInputData(sg)
>w.SetDataModeToAscii()
>w.SetCompressorTypeToNone()
>w.SetNumberOfTimeSteps(3)
>>w.Start()
>w.WriteNextTime(0.0)
>w.WriteNextTime(0.1)
>># I wanted to see if I could change "Function 1" at the third time step,
>but
># when I look at the file that is written, the time step for this never
>seems
># to change?
>>f1 = vtk.vtkDoubleArray()
>f1.SetName("Function 1")
>for i in range(NX):
>  for j in range(NY):
>    for k in range(NZ):
>      f1.InsertNextValue(-(i+j+k))
>sg.GetPointData().AddArray(f1)
>sg.Modified()
>>w.WriteNextTime(0.2)
>w.Stop()
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160222/16962c77/attachment.html>


More information about the vtkusers mailing list