[vtkusers] Temporal Pipeline Processing

Henry Lehmann henry.lehmann at informatik.tu-freiberg.de
Thu Nov 22 11:47:56 EST 2012


Hello all,

i am trying to use a vtk pipeline in a temporal fashion.
i am using the following code:
-----------------------------------------------------------------------------------------------
     vtkClientServerInterpreter* interp = nullptr;
     if (vtkClientServerInterpreterInitializer::GetInitializer())
     {
         interp = 
vtkClientServerInterpreterInitializer::GetInitializer()->GetGlobalInterpreter();
         interp->AddNewInstanceFunction(
             "vtkXMLStructuredGridReader",
             []() -> vtkObjectBase* { return 
vtkXMLStructuredGridReader::New(); });
         interp->AddNewInstanceFunction(
             "vtkXMLStructuredGridWriter",
              []() -> vtkObjectBase* { return 
vtkXMLStructuredGridWriter::New(); });
     }

     {
         vtkCompositeDataPipeline* exec = vtkCompositeDataPipeline::New();
         vtkAlgorithm::SetDefaultExecutivePrototype(exec);
         exec->Delete();
     }

     vtkNew<vtkXMLCollectionReader> reader;
     reader->SetFileName(infile.c_str());

     vtkNew<vtkPlane> plane;
     plane->SetOrigin(1.5, 1.5, 1.5);
     plane->SetNormal(0., 0., 1.);

     vtkNew<vtkCutter> cutter;
     cutter->SetCutFunction(plane.GetPointer());
     cutter->SetInputConnection(0, reader->GetOutputPort(0));

     vtkNew<vtkXMLMultiBlockDataWriter> writer;
     writer->SetInputConnection(cutter->GetOutputPort());
     writer->SetFileName(outfile.c_str());

     vtkStreamingDemandDrivenPipeline *sdd = 
vtkStreamingDemandDrivenPipeline::SafeDownCast(cutter->GetExecutive());
     sdd->UpdateInformation();

     writer->Update();
-----------------------------------------------------------------------------------------------

vtkXMLCollectionReader is part of VTKExtensions in paraview, it supports 
loading
of datasets and configures (temporal) information keys.

collection files have the following format:
-----------------------------------------------------------------------------------------------
<VTKFile type="Collection" version="0.1" byte_order="LittleEndian">
     <Collection>
         <DataSet timestep="0" group="" part="0" 
file="karman_vortex_street_vts/karman_vortex_street-000.vts"/>
         <DataSet timestep="1" group="" part="0" 
file="karman_vortex_street_vts/karman_vortex_street-001.vts"/>
         <DataSet timestep="2" group="" part="0" 
file="karman_vortex_street_vts/karman_vortex_street-002.vts"/>
...
-----------------------------------------------------------------------------------------------

invoking writer->Update() triggers the pipeline information and pipeline 
data passes.
this makes the reader load all data sets and  produce a multi-block data 
set with one block for each time step.

how to alter the above code to only produce output for one single timestep?

i tried to set sdd->SetUpdateTimeStep(0, 0) but that did not work.

Best regards,
Henry




More information about the vtkusers mailing list