Transient data with vtkEnSightGoldBinaryReader() does not update time value
I am trying to read in transient data from a simulation using Ensight format using the Python wrappers. The data is extracted as a case file with the time steps specified and then a file for each timestamp and each data variable.
FWIW in advance: I can read in the dat into Paraview correctly.
My first try was quite simple
case_foam = 'filename.case'
reader_foam = vtk.vtkEnSightGoldBinaryReader()
reader_foam.SetCaseFileName(case_foam)
reader_foam.Update()
time_steps = vtk_to_numpy(reader_foam.GetTimeSets().GetItem(0))
transient_data = dict()
for tv in time_steps:
reader_foam.SetTimeValue(tv)
reader_foam.Update()
transient_data[tv] = reader_foam.GetOutput(0)
which results in the same data being read for all dict elements, e.g. a print of the dict yields (see memory location, plotting the data confirms the equality)
{30000.0: (vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet)0x15a412e20,
30000.1: (vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet)0x15a412e20,
30000.2: (vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet)0x15a412e20,
30000.3: (vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet)0x15a412e20,
30000.4: (vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet)0x15a412e20,
30000.5: (vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet)0x15a412e20,
30000.6: (vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet)0x15a412e20,
30000.7: (vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet)0x15a412e20,
30000.8: (vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet)0x15a412e20,
30000.9: (vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet)0x15a412e20,
30001.0: (vtkmodules.vtkCommonDataModel.vtkMultiBlockDataSet)0x15a412e20}
I did find the .UpdateTimeStep(double timeValue)
method which I tried before and after .Update()
to no avail.
for tv in time_steps:
reader_foam.SetTimeValue(tv)
# reader_foam.UpdateTimeStep(tv)
reader_foam.Update()
reader_foam.UpdateTimeStep(tv)
transient_data[tv] = reader_foam.GetOutput(0)
Can someone pinpoint me in the right direction here?
Best