Commit 7d5f9c8f authored by Berk Geveci's avatar Berk Geveci

Fixed bug in the XML structured data writer.

A bug was introduced when adding support for writing out
time values as field data. When writing appended data, the
actual data and offset information for the TimeValue array was
not written causing the whole file to be incorrect and unreadable.
Fixed.
parent 4656844e
......@@ -2,6 +2,7 @@ vtk_add_test_python(
TestCellArray.py,NO_DATA,NO_VALID,NO_RT
TestEmptyXML.py,NO_DATA,NO_VALID,NO_RT
TestXMLMultiBlock.py,NO_DATA,NO_VALID,NO_RT
TestXMLTimeInField.py,NO_DATA,NO_VALID,NO_RT
TestXMLImageDataIO.py
TestXMLPolyDataIO.py
TestXMLRectilinearGridIO.py
......
#!/usr/bin/env python
import os
import vtk
from vtk.util.misc import vtkGetDataRoot
from vtk.util.misc import vtkGetTempDir
VTK_DATA_ROOT = vtkGetDataRoot()
VTK_TEMP_DIR = vtkGetTempDir()
rt = vtk.vtkRTAnalyticSource()
rt.Update()
inp = rt.GetOutput()
inp.GetInformation().Set(vtk.vtkDataObject.DATA_TIME_STEP(), 11)
file_root = VTK_TEMP_DIR + '/testxmlfield'
file0 = file_root + ".vti"
w = vtk.vtkXMLImageDataWriter()
w.SetInputData(inp)
w.SetFileName(file0)
w.Write()
r = vtk.vtkXMLImageDataReader()
r.SetFileName(file0)
r.UpdateInformation()
assert(r.GetOutputInformation(0).Get(vtk.vtkStreamingDemandDrivenPipeline.TIME_STEPS(), 0) == 11.0)
os.remove(file0)
......@@ -205,7 +205,7 @@ int vtkXMLStructuredDataWriter::ProcessRequest(
this->UpdateFieldData(fieldDataCopy);
// Write the field data arrays.
this->WriteFieldDataAppendedData(this->GetInput()->GetFieldData(),
this->WriteFieldDataAppendedData(fieldDataCopy,
this->CurrentTimeIndex, this->FieldDataOM);
if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment