[Paraview] VTK XML binary file format

Peter Bastian Peter.Bastian at iwr.uni-heidelberg.de
Wed Jan 11 12:16:10 EST 2006


Thanks for answering so fast!

Dominik Szczerba schrieb:
> is there any particular reason you write xml files yourself?
I understood that I have to use XML to do parallel visualization.
Furthermore I don't want to install VTK on every machine where I compute
my results, therefore it should be "stand-alone".

> I take an easier way out writing binary legacy files and post-converting
> them once written.
Hmmm, that adds another conversion step. Not good with TBytes of data.
You do that in parallel?

> PS/ and I do confirm strange things happening with xml files
:-(

-- Peter

> --dsz
> 
> 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
>>
>>
>>
>>------------------------------------------------------------------------
>>
>><?xml version="1.0"?>
>><VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
>>  <UnstructuredGrid>
>>    <Piece NumberOfPoints="25" NumberOfCells="16">
>>      <PointData Scalars="exact">
>><DataArray type="Float32" Name="exact" format="ascii">
>>0 0 0 0.0625 0 0.125 0 0.1875 0 0.25 0 0.125 
>>0.25 0.375 0.5 0 0.1875 0.375 0.5625 0.75 0 0.25 0.5 0.75 
>>1 
>></DataArray>
>>      </PointData>
>>      <CellData Scalars="exact">
>><DataArray type="Float32" Name="exact" format="ascii">
>>0.015625 0.046875 0.078125 0.109375 0.046875 0.140625 0.234375 0.328125 0.078125 0.234375 0.390625 0.546875 
>>0.109375 0.328125 0.546875 0.765625 
>></DataArray>
>>      </CellData>
>>      <Points>
>><DataArray type="Float32" Name="Coordinates" NumberOfComponents="3" format="ascii">
>>0 0 0 0.25 0 0 0 0.25 0 0.25 0.25 0 
>>0.5 0 0 0.5 0.25 0 0.75 0 0 0.75 0.25 0 
>>1 0 0 1 0.25 0 0 0.5 0 0.25 0.5 0 
>>0.5 0.5 0 0.75 0.5 0 1 0.5 0 0 0.75 0 
>>0.25 0.75 0 0.5 0.75 0 0.75 0.75 0 1 0.75 0 
>>0 1 0 0.25 1 0 0.5 1 0 0.75 1 0 
>>1 1 0 
>></DataArray>
>>      </Points>
>>      <Cells>
>><DataArray type="Int32" Name="connectivity" format="ascii">
>>0 1 3 2 1 4 5 3 4 6 7 5 
>>6 8 9 7 2 3 11 10 3 5 12 11 
>>5 7 13 12 7 9 14 13 10 11 16 15 
>>11 12 17 16 12 13 18 17 13 14 19 18 
>>15 16 21 20 16 17 22 21 17 18 23 22 
>>18 19 24 23 
>></DataArray>
>><DataArray type="Int32" Name="offsets" format="ascii">
>>4 8 12 16 20 24 28 32 36 40 44 48 
>>52 56 60 64 
>></DataArray>
>><DataArray type="UInt8" Name="types" format="ascii">
>>9 9 9 9 9 9 9 9 9 9 9 9 
>>9 9 9 9 
>></DataArray>
>>      </Cells>
>>    </Piece>
>>  </UnstructuredGrid>
>></VTKFile>
>>
>>
>>------------------------------------------------------------------------
>>
>><?xml version="1.0"?>
>><VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
>>  <UnstructuredGrid>
>>    <Piece NumberOfPoints="25" NumberOfCells="16">
>>      <PointData Scalars="exact">
>><DataArray type="Float32" Name="exact" format="binary">
>>ZAAAAAAAAAAAAAAAAAAAAAAAgD0AAAAAAAAAPgAAAAAAAEA+AAAAAAAAgD4AAAAAAAAAPgAA
>>gD4AAMA+AAAAPwAAAAAAAEA+AADAPgAAED8AAEA/AAAAAAAAgD4AAAA/AABAPwAAgD8=
>></DataArray>
>>      </PointData>
>>      <CellData Scalars="exact">
>><DataArray type="Float32" Name="exact" format="binary">
>>QAAAAAAAgDwAAEA9AACgPQAA4D0AAEA9AAAQPgAAcD4AAKg+AACgPQAAcD4AAMg+AAAMPwAA
>>4D0AAKg+AAAMPwAARD8=
>></DataArray>
>>      </CellData>
>>      <Points>
>><DataArray type="Float32" Name="Coordinates" NumberOfComponents="3" format="binary">
>>LAEAAAAAAAAAAAAAAAAAAAAAgD4AAAAAAAAAAAAAAAAAAIA+AAAAAAAAgD4AAIA+AAAAAAAA
>>AD8AAAAAAAAAAAAAAD8AAIA+AAAAAAAAQD8AAAAAAAAAAAAAQD8AAIA+AAAAAAAAgD8AAAAA
>>AAAAAAAAgD8AAIA+AAAAAAAAAAAAAAA/AAAAAAAAgD4AAAA/AAAAAAAAAD8AAAA/AAAAAAAA
>>QD8AAAA/AAAAAAAAgD8AAAA/AAAAAAAAAAAAAEA/AAAAAAAAgD4AAEA/AAAAAAAAAD8AAEA/
>>AAAAAAAAQD8AAEA/AAAAAAAAgD8AAEA/AAAAAAAAAAAAAIA/AAAAAAAAgD4AAIA/AAAAAAAA
>>AD8AAIA/AAAAAAAAQD8AAIA/AAAAAAAAgD8AAIA/AAAAAA==
>></DataArray>
>>      </Points>
>>      <Cells>
>><DataArray type="Int32" Name="connectivity" format="binary">
>>AAEAAAAAAAABAAAAAwAAAAIAAAABAAAABAAAAAUAAAADAAAABAAAAAYAAAAHAAAABQAAAAYA
>>AAAIAAAACQAAAAcAAAACAAAAAwAAAAsAAAAKAAAAAwAAAAUAAAAMAAAACwAAAAUAAAAHAAAA
>>DQAAAAwAAAAHAAAACQAAAA4AAAANAAAACgAAAAsAAAAQAAAADwAAAAsAAAAMAAAAEQAAABAA
>>AAAMAAAADQAAABIAAAARAAAADQAAAA4AAAATAAAAEgAAAA8AAAAQAAAAFQAAABQAAAAQAAAA
>>EQAAABYAAAAVAAAAEQAAABIAAAAXAAAAFgAAABIAAAATAAAAGAAAABcAAAA=
>></DataArray>
>><DataArray type="Int32" Name="offsets" format="binary">
>>QAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQA
>>AAA4AAAAPAAAAEAAAAA=
>></DataArray>
>><DataArray type="UInt8" Name="types" format="binary">
>>EAAAAAkJCQkJCQkJCQkJCQkJCQk=
>></DataArray>
>>      </Cells>
>>    </Piece>
>>  </UnstructuredGrid>
>></VTKFile>
>>
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>ParaView mailing list
>>ParaView at paraview.org
>>http://www.paraview.org/mailman/listinfo/paraview
> 
> 

-- 
------------------------------------------------------------------
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



More information about the ParaView mailing list