Currently, I’m combining some vtu files that belong to different time snapshots into one vtu file by using this function:
def Combiner(mainfiles,path):
data_to_write = vtk.vtkUnstructuredGrid()
writer = vtk.vtkXMLUnstructuredGridWriter()
writer.SetNumberOfTimeSteps(len(mainfiles))
writer.SetInputData(data_to_write)
writer.SetFileName(path)
writer.Start()
for i,filev in enumerate(mainfiles):
print "Writing Timestep: " + str(i)
data_to_write.ShallowCopy(vtkReader(filev))
writer.WriteNextTime(i)
writer.Stop()
ug = vtkReader(path)
os.remove(path)
return ug
As you can see I need to write the combined vtu file and load it again, which is pretty slow. Is there any way to get away with writing stuff into the disk?