[vtkusers] EnsightReader and vtkXMLMultiBlockDataWriter

Claude Gouédard claude.gouedard at polytechnique.fr
Mon Jan 10 12:50:26 EST 2011


Hi all,

I am reading a Multiblock Time Series through EnsightReader in a  
python script:

================================
import vtk

reader = vtk.vtkGenericEnSightReader ()
reader.SetCaseFileName(InputCase)

cdp =  vtk.vtkCompositeDataPipeline()
reader.SetDefaultExecutivePrototype(cdp)
reader.ReadAllVariablesOn()

reader.Update()
[tmin,tmax]=reader.GetTimeSets().GetItem(0).GetRange()
nt=reader.GetTimeSets().GetItem(0).GetSize()
================================

and write back XML Blocks:

================================
writer=vtk.vtkXMLMultiBlockDataWriter()
writer.SetNumberOfTimeSteps (nt)

for n in range(nt):
		filename="Result%02d.%s" %( n, writer.GetDefaultFileExtension ())
		writer.SetFileName(filename)
		reader.SetTimeValue(ts.GetValue(n))
		writer.SetInputConnection( reader.Output.GetProducerPort() )
		writer.SetTimeStep (n)
		writer.Write()
================================

My question:

Is there a better  way to loop over TimeSets, perhaps over  
InputArrayToProcess too ,
without using explicit for-loops.

Is it possible to setup Time-Multiblocks of individual  
Spatial-Multiblocks, writable in one shot ?

Many thanks in advance.

Claude Gouedard


----------------------------------------------------------------
This message was sent using X-WebMail




More information about the vtkusers mailing list