[Paraview] vtu file format

Brad King brad.king at kitware.com
Thu Jan 5 11:46:23 EST 2006


Thierry Dubuis wrote:
> No, sorry I did't find any information about that.
> There are information about XML part, binary datas must be encryted with 
> Base64 algorithm and they could be compressed or not,
> but no information about datas organization.

They layout of the binary data chunks is somewhat complicated in order 
to support random access at the same time as base64 encoding and 
compression.  The best way to write it is to link VTK into your program 
and either convert to a VTK type directly and use the 
vtkXMLUnstructuredGridWriter or use the C-interface provided by 
vtkXMLWriterC.h.

If you really want to write it yourself then you should use the inline 
binary format with no compression:

<DataArray type="Float32" Name="Scalars" format="binary">
   NNNN........
</DataArray>

The first four bytes (NNNN) is the number of bytes in the rest of the 
binary block.  The rest of the data should be stored contiguously.  Note 
that everything including the first four bytes should then be base64 
encoded but the size should be before the encoding.

The data can be in either endian-ness.  Just specify in the VTKData 
element which one is used.  Also be sure not to specify a compressor in 
the top element because no compression is used:

<VTKFile type="UnstructuredGrid"
          version="0.1"
          byte_order="LittleEndian">
  ...everything else here...
</VTKFile>

-Brad


More information about the ParaView mailing list