MultiBlockDataSet field data inaccessible from outer layer

Hello there,

Before submitting a bug report, I am looking for your input on an issue I am facing.

I have a MultiBlockDataSet (let’s call it mbds0) with several blocks . Some field data (testArray0 and testArray1) has been appended to it, but it is not part of any block. At this stage I can access that data just fine.

print mbds0.GetFieldData().GetNumberOfArrays()

outputs 2 as expected.



Now, let’s say that I need to set mbds0 as the first block of a larger MultiBlockDataSet (that we’ll call mbds1) like so:

I can see the arrays in ParaView but I can’t access them at all.

print mbds1.GetBlock(0).GetFieldData().GetNumberOfArrays()

outputs 0.
I can’t manage to access my field data.



Here’s how to reproduce it, since I can’t upload my pvsm.

Programmable Source (mbds0)

import vtk

output = self.GetOutputDataObject(0)

strarray0 = vtk.vtkStringArray()
strarray0.SetName(‘testArray0’)
strarray0.InsertNextValue(‘testVal0’)
strarray0.InsertNextValue(‘testVal1’)

strarray1 = vtk.vtkStringArray()
strarray1.SetName(‘testArray1’)
strarray1.InsertNextValue(‘testVal2’)
strarray1.InsertNextValue(‘testVal3’)

pd0 = vtk.vtkPolyData()
pd1 = vtk.vtkPolyData()
mbds0 = vtk.vtkMultiBlockDataSet()
mbds0.SetBlock(0, pd0)
mbds0.SetBlock(1, pd1)
mbds0.GetFieldData().AddArray(strarray0)
mbds0.GetFieldData().AddArray(strarray1)

output.DeepCopy(mbds0)

Programmable filter to wrap mbds0 in mbds1

import vtk

input = self.GetInputDataObject(0, 0)
output = self.GetOutputDataObject(0)

mbds1 = vtk.vtkMultiBlockDataSet()
mbds1.SetBlock(0, input)

output.DeepCopy(mbds1)

Also tried using PassData but still no luck.



Finally, extracting mdbs0 from mdbs1 results in the Field Data being gone completely and not showing in ParaView at all.

import vtk

input = self.GetInputDataObject(0, 0)
output = self.GetOutputDataObject(0)

output.DeepCopy(input.GetBlock(0))

Thanks a lot :slight_smile:

Afaik, Field Data should be added on the leaf block.

Thank you Mathieu, I’ll do that.

Is it worth reporting?