<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>I ended up solving the problem by using a “PVD” file (<a href="http://www.paraview.org/Wiki/ParaView/Data_formats#PVD_File_Format">http://www.paraview.org/Wiki/ParaView/Data_formats#PVD_File_Format</a>).</div>
<div>Note, that in the link, the example file has “<?xml version=“1.0”?>” at the top, but it will work fine without it.</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Guillaume Jacquenot <<a href="mailto:guillaume.jacquenot@gmail.com">guillaume.jacquenot@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Monday, February 22, 2016 at 8:06 AM<br>
<span style="font-weight:bold">To: </span>"<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>" <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>>, Tim Meehan <<a href="mailto:meehanbt@nv.doe.gov">meehanbt@nv.doe.gov</a>><br>
<span style="font-weight:bold">Subject: </span>[vtkusers] Saving multiple time steps in a vtkXMLStructuredGrid file ...<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">
<pre>Hello everyone,<br><br>I am wondering if the post had any answer.<br><a href="http://www.itk.org/pipermail/vtkusers/2015-July/091641.html">http://www.itk.org/pipermail/vtkusers/2015-July/091641.html</a><br></pre>
<pre>I am facing the same problem, where :<br></pre>
<pre>- I can not set the timestep value in the exported XML file (All TimeStep values are 0)<br>- Paraview does not use the attribute TimeValues when reading XML VTK file<br> <StructuredGrid TimeValues="0.0 0.1 0.2" WholeExtent="0 9 0 9 0 9"><br></pre>
<pre><br></pre>
<pre>Below is the mail from Bernard Meehan, who reported this problem.</pre>
<pre><br><br><br>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" <<a href="http://public.kitware.com/mailman/listinfo/vtkusers">MEEHANBT at nv.doe.gov</a>> wrote:
><i>I was hoping to be able to write a scalar field that changed over time to
</i>><i>a vtkXMLStructuredGridFile, following the example on this thread:
</i>><i><a href="http://public.kitware.com/pipermail/vtkusers/2012-November/077262.html">http://public.kitware.com/pipermail/vtkusers/2012-November/077262.html</a></i>><i></i>><i>But when I examined my ³*vts² file, the scalar function wasn¹t written to
</i>><i>a different time step. I¹d be happy to turn this into an example on the
</i>><i>wiki if I could get it to work Š
</i>><i></i>><i>import vtk
</i>><i></i>><i>NX = 10
</i>><i>NY = 10
</i>><i>NZ = 10
</i>><i></i>><i>#-------------------------------Create your
</i>><i>Grid-------------------------------#
</i>><i>pts = vtk.vtkPoints()
</i>><i>for i in range(NX):
</i>><i> for j in range(NY):
</i>><i> for k in range(NZ):
</i>><i> pts.InsertNextPoint(i, j, k)
</i>><i></i>><i>sg = vtk.vtkStructuredGrid()
</i>><i>sg.SetDimensions(NX, NY, NZ)
</i>><i>sg.SetPoints(pts)
</i>><i></i>><i>f1 = vtk.vtkDoubleArray()
</i>><i>f1.SetName("Function 1")
</i>><i>for i in range(NX):
</i>><i> for j in range(NY):
</i>><i> for k in range(NZ):
</i>><i> f1.InsertNextValue(i+j+k)
</i>><i>sg.GetPointData().AddArray(f1)
</i>><i></i>><i>#----------------------------------Save
</i>><i>File-----------------------------------#
</i>><i>w = vtk.vtkXMLStructuredGridWriter()
</i>><i>w.SetFileName("test.vts")
</i>><i>w.SetInputData(sg)
</i>><i>w.SetDataModeToAscii()
</i>><i>w.SetCompressorTypeToNone()
</i>><i>w.SetNumberOfTimeSteps(3)
</i>><i></i>><i>w.Start()
</i>><i>w.WriteNextTime(0.0)
</i>><i>w.WriteNextTime(0.1)
</i>><i></i>><i># I wanted to see if I could change "Function 1" at the third time step,
</i>><i>but
</i>><i># when I look at the file that is written, the time step for this never
</i>><i>seems
</i>><i># to change?
</i>><i></i>><i>f1 = vtk.vtkDoubleArray()
</i>><i>f1.SetName("Function 1")
</i>><i>for i in range(NX):
</i>><i> for j in range(NY):
</i>><i> for k in range(NZ):
</i>><i> f1.InsertNextValue(-(i+j+k))
</i>><i>sg.GetPointData().AddArray(f1)
</i>><i>sg.Modified()
</i>><i></i>><i>w.WriteNextTime(0.2)
</i>><i>w.Stop()
</i>></pre>
</div>
</div>
</div>
</span>
</body>
</html>