AW: [Paraview] VTU File Format wih raw Data

Sören Freudiger muffmolch at
Fri Oct 19 07:30:23 EDT 2007

We really tried to do it. But it still doesn't work. And we cannot find the problem.
It looks quite easy to me. But something  with the offsets must be tricky.
Our ascii-vtu file works fine (without appended data).
But the appended version with "raw" data couldn't be opened.

Attached there's a small program to show the problem.
It's very simple and justs buts one or two octants with some node data into a vtu-file.
If we only have one cell it seems to work. It can be opened with paraview 2.6.x and 3.x.
But the two cell version always ends with the error message:

" ERROR: In ..\..\..\ParaView3\VTK\IO\vtkXMLUnstructuredDataReader.cxx, line 646
vtkXMLUnstructuredGridReader (051948A0): Cannot read cell connectivity from Cells in piece 0 because the "connectivity" array is not long enough. "

But I cannot find an error at the connectivities (I just wrote it to ASCII and the connectivity for each Oct was 8 and the datalength was #cells*4(byte) ).

The type sizes are correct. Float32=4bytes, Int32=4 bytes...

Every data-block is something like that:
[data-size in byte][data]
[data-size in byte] = Int32
[data] = #data * specified type
The blocks are stored continuously  after the "_"

The offsets seems to be correct
offset[0] = 0
offset[1] = offset[0] + 4 + bytes of dataset[0]
offset[2] = offset[1] + 4 + bytes of dataset[1]
offset[3] = offset[2] + 4 + bytes of dataset[3]

I don't get it. Has anybody a clue?


Tel.: +49 531/391-7595,
Mobil: +49 176/210 17 444

email1: muffmolch at
email2: muffmolch at
email3: SirAnnTheMan at

-----Ursprüngliche Nachricht-----
Von: Brad King [mailto:brad.king at] 
Gesendet: Donnerstag, 18. Oktober 2007 15:13
An: Sören Freudiger
Cc: paraview at
Betreff: Re: [Paraview] VTU File Format wih raw Data

Sören Freudiger wrote:
> Is it possible to use “raw” data inside the VTU files?


> Something like:
> <VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
>   <UnstructuredGrid>
>     <Piece NumberOfPoints="6" NumberOfCells="1">
>       <Points>
>         <DataArray type = " Float32" NumberOfComponents="3" format="appended" offset=”0” />
>       </Points>
>       <Cells>
>         <DataArray type="Int32" Name="connectivity" format="appended" offset=”123” />
>         <DataArray type="Int32" Name="offsets" format="appended" offset=”234” />          
>         <DataArray type="UInt8" Name="types" format="appended" offset=”345” />
>       </Cells>
>       <PointData>
>         <DataArray type="float" Name="stress" format="appended" offset=”567” />
>       </PointData>
>     </Piece>
>   </UnstructuredGrid>
>   <AppendedData encoding="raw">
> _...  
>   </AppendedData>
> </VTKFile>
> I cannot find a concrete example. 
> Is is right that I the raw data is organized somehow like that
> _(size=#points*3*sizeof(Float32()(data of array)(size of array1)(size=8(oct)*#cells*sizeof(Int32()(connectivity array)…
> If so, has the length to be stored in same format as Data (Int32,Float32, etc.).
> Is it possible to mix data types or do they all have to be in same format (e.g. Float32)

The format is

 ^         ^         ^
 1         2         3

where each "NNNN" is an unsigned 32-bit integer, and <data> consists of
a number of bytes equal to the preceding NNNN value.  The corresponding
DataArray elements must have format="appended" and offset attributes
equal to the following:

1.) offset="0"
2.) offset="(4+NNNN1)"
3.) offset="(4+NNNN1+4+NNNN2)"

These blocks may be in any order as long as the corresponding offset
elements point to the right spot.  Each array can have its own type
specified in its DataArray element.  The byte order of all values (both
in the NNNN header and in the data) is that specified by the byte_order
attribute at the top of the file.


More information about the ParaView mailing list