VTK file with DataArray with 10 components or more will not be read

Hi,
I’m working with VTK files that contain fields with 57 components [1]. The DataArray has following form:

<DataArray NumberOfComponents="57"  ..
 ComponentName0="wal_environment/vS" ComponentName1="wal_environment/vT" ...     
 ComponentName56="razumova/P_C_SR"

When I read this file using vtkXMLReader only the first 10 component names are parsed. This behaviour can clearly be seen in the code [2].
When opened in ParaView only the first 10 components have names [3]. It would be much nicer, if all components would be identifiable by their name.

Is there a good reason to only read the first 10 components? Could you just omit the condition or would something else break?

Regards,
Benjamin

(Edit: link to correct code line)

[1]

[2]

[3]

While 10 is arbitrary, the number of components is meant to support things like vector or small matrix components. It looks like your components, owever, correspond to different scalar fields. Usually, a data file would split these scalar fields into separate VTK arrays.

Is the organization of scalar fields something you can control in the program that produces these files?

Thanks for the quick reply. Yes, I have control over the scalar fields in the program.

As an explanation, we parse equations from various “CellML” models, a XML-based description of ODE or DAE systems. The components are simply all entries of the state vector.

The reason I use a single field for all is that we solve numerous instances of the same ODE systems at different points in space and it makes sense to have the values internally in a “struct-of-array” memory ordering to allow vectorization. And it’s all generic, independent of the actually loaded CellML model. That’s why its not really an option to construct multiple scalar field data structures.

But I see the point that from the visualization point of view it should be separate fields. Actually, they are somehow grouped from their names already.

So, I should better split them up after computation, prior to VTK output? Or would it cost anything to drop the “components<10” condition?

I can’t think of a good reason not to lift the limit from 10 to an arbitrary number. I have a change under review here: https://gitlab.kitware.com/vtk/vtk/-/merge_requests/6930

1 Like

The change is now in VTK master and will be available in version 9.1.