I'm having trouble with a VTK
file I've created not being loaded by ParaView. The file looks ok and I can't seen any obvious errors but ParaView throws the following warnings when trying to view the data.
ERROR: In C:\glr\builds\paraview\paraview-ci\build\superbuild\paraview\src\VTK\Common\Core\vtkPoints.cxx, line 166
vtkPoints (0000019324F41DF0): Number of components is different...can't set data
ERROR: In C:\glr\builds\paraview\paraview-ci\build\superbuild\paraview\src\VTK\IO\XML\vtkXMLReader.cxx, line 922
vtkXMLUnstructuredGridReader (0000019325100BE0): Array has 0 allocated elements, but 60 were requested to be read
ERROR: In C:\glr\builds\paraview\paraview-ci\build\superbuild\paraview\src\VTK\IO\XML\vtkXMLUnstructuredDataReader.cxx, line 504
vtkXMLUnstructuredGridReader (0000019325100BE0): Cannot read points array from Points in piece 0. The data array in the element may be too short.
Here's my simple test file for an unstructured grid with 20 points and some associated scalars. Hopefully someone can spot the problem.
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="1.0" byte_order="LittleEndian" header_type="UInt64">
<UnstructuredGrid>
<Piece NumberOfCells="20" NumberOfPoints="20">
<Points>
<DataArray Name="points" type="Float64" format="ascii" NumberofComponents="3">
0.9191090317991818 0.4523130130592968 0.9191090317991818 0.6421955999238554 0.1757747380313244 0.6421955999238554
0.7537122297291767 0.0493769993144870 0.7537122297291767 0.1393145681027350 0.2924753386949548 0.1393145681027350
0.0873195479896001 0.0667991310914613 0.0873195479896001 0.7880020580364918 0.7511564859911245 0.7880020580364918
0.3261509370344888 0.0637715240806562 0.3261509370344888 0.5410678214759677 0.4319083194117714 0.5410678214759677
0.2402351758680060 0.3641724134430167 0.2402351758680060 0.5454229255759049 0.1519715256925609 0.5454229255759049
0.4005545036798892 0.5467103397159158 0.4005545036798892 0.7151918872797569 0.4432930376023336 0.7151918872797569
0.8366799410811948 0.0360613100029110 0.8366799410811948 0.5884811425466829 0.8228931912295053 0.5884811425466829
0.2961545640333596 0.2732926831299841 0.2961545640333596 0.2810176906539642 0.1689852192728417 0.2810176906539642
0.7055972446574292 0.6443697547109174 0.7055972446574292 0.4225964301897521 0.1075410788025926 0.4225964301897521
0.0573159852472062 0.3532450981171027 0.0573159852472062 0.7470273067071216 0.3857036581156064 0.7470273067071216
</DataArray>
</Points>
<Cells>
<DataArray Name="connectivity" type="Int32" format="ascii" NumberofComponents="1">
0 1 2 3 4 5
6 7 8 9 10 11
12 13 14 15 16 17
18 19
</DataArray>
<DataArray Name="offsets" type="Int32" format="ascii" NumberofComponents="1">
0 1 2 3 4 5
6 7 8 9 10 11
12 13 14 15 16 17
18 19
</DataArray>
<DataArray Name="types" type="UInt8" format="ascii" NumberofComponents="1">
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1
</DataArray>
</Cells>
<PointData Scalars="1_temp">
<DataArray Name="1_temp" type="Float64" format="ascii" NumberofComponents="1">
0.4204270035661765 0.9490145030363609 0.7864711816566549 0.4815468959885630 0.0119215535827562 0.0597207807092479
0.8257177483439162 0.4046369872739349 0.0531531123171690 0.2596390482071086 0.2811506610562717 0.9433030410624577
0.8936293596271191 0.2022892694899581 0.1003608087345019 0.5730430655359530 0.7453773741488717 0.6007604785160442
0.9092395428890321 0.9385777624120453
</DataArray>
<DataArray Name="2_pressure" type="Float64" format="ascii" NumberofComponents="1">
0.5890720970505128 0.3268986086578718 0.1448144482177102 0.2576384903723663 0.8574458883976873 0.6839737520406283
0.9986326035811655 0.3194556656082242 0.4534082266242594 0.8676221777748950 0.6385221808378060 0.3318923019829476
0.5419776327479333 0.1123238088406830 0.8165234436255825 0.2209316463478144 0.5149742681090496 0.5260877679247680
0.2770886884732112 0.9044206316605501
</DataArray>
</PointData>
</Piece>
</UnstructuredGrid>
</VTKFile>
The answer for anyone who may come across this is rather trivial - the <DataArray>
attribute
should be NumberOfComponents
. Note the capitalisation!