Can't write multiblock with empty leaf
If a multiblock contains an empty leaf, the vtkXMLMultiBlockDataWriter
trigger an exception when calling the Write()
method.
Sample code to reproduce with vtkpython:
from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet
from vtkmodules.vtkIOXML import vtkXMLMultiBlockDataWriter
mbds = vtkMultiBlockDataSet()
mbds.SetBlock(0, vtkMultiBlockDataSet())
writer = vtkXMLMultiBlockDataWriter()
writer.SetInputData(mbds)
writer.SetFileName("test.vtm")
writer.SetInputData(mbds)
writer.Write()
Then it triggers this output:
( 91.595s) [main thread ] vtkExecutive.cxx:729 ERR| vtkCompositeDataPipeline (0x555555649a10): Algorithm vtkXMLMultiBlockDataWriter (0x555555754f80) returned failure for request: vtkInformation (0x5555557571c0)
Debug: Off
Modified Time: 163
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA
FROM_OUTPUT_PORT: -1
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
The issue seem to be in vtkXMLMultiBlockDataWriter::WriteComposite
which returns 0 (the error code) when there is nothing to write.
Having an empty leaf in a multiblock seems a valid case (VTK multiblock reader handles it nicely), so returning a valid return code would makes sense. A MR should follow shortly.
Edited by Francois Mazen