Hi, I am working on a ParaView plugin that currently reads grid and fields from a data source, then creates multiple vtkUnstructuredGrids which are added as blocks to a single vtkMultiBlockDataSet. This vtkMultiBlockDataSet is then passed as an output to ParaView.
My plugin structure is somewhat similar to the one here
with the difference that my plugin is using/inherits from vtkMultiBlockDataSetAlgorithm.
Shortened code structure of my plugin .cxx source file:
// my_plugin.cxx
int my_plugin::RequestData(vtkInformation *vtkNotUsed(request),
vtkInformationVector **vtkNotUsed(inputVector),
vtkInformationVector *outputVector)
{
// Get the info object
vtkInformation *outInfo = outputVector->GetInformationObject(0);
// MultiBlock object, to hold all vtkUnstructuredGrids
vtkSmartPointer<vtkMultiBlockDataSet> mainMB =
vtkSmartPointer<vtkMultiBlockDataSet>::New();
for(int i; i < num_blocks; ++i)
{
// Creating vtkUnstructuredGrid
vtkSmartPointer<vtkUnstructuredGrid> UG=
vtkSmartPointer<vtkUnstructuredGrid>::New();
... // filling the UG
// Adding UG as block to vtkMultiBlockDataSet
mainMB->SetBlock(i, UG);
}
// Set the output format
vtkMultiBlockDataSet *outputMB = vtkMultiBlockDataSet::SafeDownCast(
outInfo->Get(vtkMultiBlockDataSet::DATA_OBJECT()));
// Make shallow copy of the output
outputMB->ShallowCopy(mainMB);
return 1;
}
The plugin performs very nicely, however, in my data source the data is time dependant. Now I am able to read and set as output a single time slice (I am using IntVectorProperty to specify which one) as vtkMultiBlockDataSet.
At the moment I’ve included vtkXMLMultiBlockDataWriter withing the plugin code to write the .vtm (and belonging.vtu files) for each time slice locally on my PC which I then manually open them in ParaView. ParaView then enables me to use each .vtm as a frame and I can play a very nice animation-like overall display of the (2D) data . If possible I would like to reproduce the same thing within the plugin itself (getting data directly to ParaView, without VTM writer in-between).
Is there a way to set the plugin to output multiple vtkMultiBlockDataSets as if I opened a set of .vtm files?
I realize there is a SetNumberOfOutputPorts option but this doesn’t come into account for me as only after plugin execution it is known how many time slices are present in the data source I’m working with and so far I haven’t found out any way to dynamically set the number of output ports.
Any help in this regard is highly appreciated. Thanks in advance.