The filter documentation says “This multiblock dataset contains a vtkUnstructuredGrid for each thresholded subset you request.”.
But the multiblock dataset contains a multiblock dataset that contains a vtkUnstructuredGrid.
To access the unstructured grid I would expect to do this:
mapper1->SetInputData(
vtkUnstructuredGrid::SafeDownCast(vtkMultiBlockDataSet::SafeDownCast(threshold->GetOutput()->GetBlock(0)));
Is the current API correct? It does not seem to be the way other multiblock datasets are accessed. If it is correct, I think the documentation should be changed to be more clear.
I originally wrote and used it in the LS-Dyna reader, which has changed significantly since then.
As far as why the unstructured grids aren’t in the top-level multiblock, I believe that is because the class allows you to output results from multiple clauses of the parse tree that the expression is decomposed in before execution; each clause has a multiblock in the top level multiblock. It has been a while since I looked at it… if you think there is a better interface, I am happy for ideas to improve it, especially if it gets used some more.
@lorensen That’s a pretty moo-ving example! I always wanted to write a vtkMultiClip filter as well to do webcuts of datasets.
I looked at the multi-threshold source and the nested multiblocks exist to handle parallel (multi-piece) data. The filter assumes the input data is split into pieces; each top-level output will be a multiblock with numPieces children and only the currently requested piece will be a non-empty grid. I am not sure this is the right way to do things but do recall that I had to do something when reading LS-Dyna files in parallel.