[Paraview] [Catalyst] multi-block names are not written to file
Deij-van Rijswijk, Menno
M.Deij at marin.nl
Mon Aug 3 04:48:09 EDT 2015
Hi,
I’m trying to set up a co-processing pipeline by supplying it with a multi-block dataset, of which the individual unstructured grids have names.
TL;DR: the block names are not written to XML files when using a Python co-processing pipeline.
In detail:
The block names are supplied like so
///
vtkInformation* md =
multiBlockGrid->GetMetaData(static_cast<unsigned int>(0));
if (md)
{
md->Set(vtkCompositeDataSet::NAME(), "Interior");
}
///
The grid is added as a producer with the name "grid". Then, in the Python pipeline, I simply write the full grid using the following code:
///
grid = coprocessor.CreateProducer( datadescription, "grid" )
ParallelMultiBlockDataSetWriter1 = coprocessor.CreateWriter( XMLMultiBlockDataWriter, "fullgrid_%t.vtm", 100 )
///
This writes the fullgrid_0.vtm file, directory and each block in a separate vtu file. All is good, except that the block names that were set are not written in the file in the "name" attribute.
I have tried to write an XML file directly using XMLMultiBlockDataWriter, but that did not work due to the implementation of a mapped data array which has no implementation for NewIterator(). Weird - how does the Python pipeline write the file? I don't know, but it works.
To still check the names having been set, I emulate the first few steps of the XMLMultiBlockDataWriter, to see if the block names come through like so:
///
vtkSmartPointer<vtkDataObjectTreeIterator> iter;
iter.TakeReference(
vtkDataObjectTree::SafeDownCast(multiBlockGrid)->NewTreeIterator());
iter->VisitOnlyLeavesOff();
iter->TraverseSubTreeOff();
iter->SkipEmptyNodesOff();
int index = 0;
int RetVal = 0;
for (iter->InitTraversal(); !iter->IsDoneWithTraversal();
iter->GoToNextItem(), index++)
{
vtkDataObject* curDO = iter->GetCurrentDataObject();
const char *name = NULL;
if (iter->HasCurrentMetaData())
{
name = iter->GetCurrentMetaData()->Get(vtkCompositeDataSet::NAME());
cout << "Name found by pseudo-write code: " << (name ? name : "NULL") << endl;
}
else
{
cout << "No metadata found on iterator" << endl;
}
}
///
And this clearly shows that the names are found as they are written to stdout.
So, the question is: how can I get the Python co-processing pipeline to write the block names?
Thanks and best wishes,
Menno
dr. ir. Menno A. Deij-van Rijswijk
Researcher / Software Engineer
Maritime Simulation & Software Group
E mailto:M.Deij at marin.nl
T +31 317 49 35 06
MARIN
2, Haagsteeg, P.O. Box 28, 6700 AA Wageningen, The Netherlands
T +31 317 49 39 11, F +31 317 49 32 45, I www.marin.nl
More information about the ParaView
mailing list