[Paraview] VTK XML binary file format

Olivier Magotte olivier.magotte at cenaero.be
Wed Jan 11 11:35:48 EST 2006


Peter Bastian wrote:

>Hi all,
>
>I am trying to write VTK XML unstructured grid files (.vtu) by myself
>(i.e. without using vtkXMLUnstructuredGridWriter). Ascii works fine but
>binary makes problems. I followed the instructions given previously on
>this list, i.e. I use inline DataArrays, put the size of the data in
>front of the block and encode everything base64.
>
>Now there are two problems:
>
>1) The "offsets" array causes an error when reading:
>
>peter at cray:~/FE/dune-dd$ paraview
>ErrorMessage
># Error or warning: There was a VTK Error in file:
>/home/amy/ParaViewReleaseRoot/paraview-2.4.1/VTK/IO/vtkXMLUnstructuredDataReader.cxx
>(592)
> vtkXMLUnstructuredGridReader (0x8dfacb0): Cannot read cell connectivity
>from Cells in piece 0 because the "offsets" array is not monotonically
>increasing or starts with a value less than 1.
>ErrorMessage end
>
>When I write only the offsets array in ascii, the file is read without
>error message. This is curious because all the writing is done by one
>class in my code. I also checked the encoded binary data and it looks OK.
>
>2) Loading the file with all in binary except the "offsets" array, the
>point data as well as the cell data and the point positions are not correct.
>
>Now my question:
>
>Is there some further undocumented magic (like the size in bytes at the
>beginning) that I have to consider?
>
>I would prefer to write VTK files without linking in VTK itself.
>In the attachment I append binary and ascii versions of my file.
>
>Thanks for any response.
>
>-- Peter
>------------------------------------------------------------------
>Peter Bastian, IWR,Uni Heidelberg, INF 348,R 020, 69120 Heidelberg
>email: Peter.Bastian at iwr.uni-heidelberg.de   Tel: +49 6221 54 4984
>WWW: http://www.iwr.uni-heidelberg.de/~Peter.Bastian Fax: ... 8860
>  
>
I suggest to encode the data array size (4 bytes) first and then encode 
the array (two '=' character must appear after the first 6 characters). 
It works for me.

Useful information can also be found here: 
http://public.kitware.com/pipermail/paraview/2005-April/001391.html

Olivier

-- 
--------------------------------------------------------------------------------
Ir. Olivier Magotte                                 |       CENAERO
Research Scientist - Virtual Manufacturing          |    www.cenaero.be
--------------------------------------------------------------------------------




More information about the ParaView mailing list