How can I create a time dependent vtkUnstructuredGrid object?

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?

You could certainly do this with a multi-block file, which you could just update to point to each of the sub-files. But I don’t know how to specify the time steps in that case. I do think that’s possible, though.

In ParaView, sequentially numbered files will be automatically read in as a time-series…

-Aron