[Paraview] How to calculate offsets in <AppendedData>
David Ingram
David.Ingram at ed.ac.uk
Fri May 26 07:10:56 EDT 2006
Dear All,
I've been trying to write out XML formatted data files from a Fortran
flow solver for use in Paraview, I have now reached the point where
the file can be read, provided only one variable is contained in the
appended data (written in the raw format) and the offset is 0. I
have tried calculating offsets based on
1) distance into the 1D array, counting in bytes
2) distance into the 1D array, counting in 4 byte words
neither seems to work.
I've looked at .vti files saved by Paraview itself and the offsets
don't seem to make sense (for a 10x3 grid, containing cell data the
first variable is offset at 0 and the second at 48). If anyone can
offer assistance I'd be grateful, the file-formats.pdf just describes
offset as an offset!
I apologise if this is a naive question, but any help would be much
appreciated
For you information the XML file is as follows
<VTKFile type="ImageData" version="0.1" byte_order="BigEndian">
<ImageData WholeExtent="0 10 0 3 0 0"
Origin="0.0000E+00 0.0000E+00 0.0000E+00"
Spacing="0.5000E+00 0.3333E+00 0.1000E+01">
<Piece Extent="0 10 0 3 0 0">
<CellData Scalars="Pressure">
<DataArray Name="Isolid" type="Int32" format="ascii">
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 -1 -1 -1 -1
-1 -1
-1 -1 -1 -1 -1
</DataArray>
<DataArray Name="Velocity" type="Float32" format="append"
offset="0"
NumberOfComponents="2" />
<DataArray Name="Pressure" type="Float32" format="append"
offset="60" />
</CellData>
</Piece>
</ImageData>
<AppendedData encoding="raw">
_?????...
</AppendedData>
</VTKFile>
looking at the Appended data using bin2hex shows (8 byte groups)
00704: 22 72 61 77 22 3e 0a 5f 3f 80 00 00 00 00 00 00
"raw">._ ?.......
00720: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00736: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00752: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00768: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00784: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00800: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00816: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00832: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00848: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00864: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00880: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00896: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00912: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00928: 3f 80 00 00 00 00 00 00 3f 80 00 00 00 00 00
00 ?....... ?.......
00944: 3f 80 00 00 00 00 00 00 3f 80 00 00 3f 80 00
00 ?....... ?...?...
00960: 3f 80 00 00 3f 80 00 00 3f 80 00 00 3f 80 00
00 ?...?... ?...?...
00976: 3f 80 00 00 3f 80 00 00 3f 80 00 00 3f 80 00
00 ?...?... ?...?...
00992: 3f 80 00 00 3f 80 00 00 3f 80 00 00 3f 80 00
00 ?...?... ?...?...
01008: 3f 80 00 00 3f 80 00 00 3f 80 00 00 3f 80 00
00 ?...?... ?...?...
01024: 3f 80 00 00 3f 80 00 00 3f 80 00 00 3f 80 00
00 ?...?... ?...?...
01040: 3f 80 00 00 3f 80 00 00 3f 80 00 00 3f 80 00
00 ?...?... ?...?...
01056: 3f 80 00 00 3f 80 00 00 3f 80 00 00 3f 80 00
00 ?...?... ?...?...
In this case the 2D velocity vector is (1.0, 0.0) and the pressure is
1.0, the data is big endian.
Thanks in advance
David
Dr David M Ingram
Reader
Institute of Energy Systems
School of Engineering and Electronics
The University of Edinburgh
Kings Buildings
Mayfield Road
Edinburgh
David.Ingram at ed.ac.uk
More information about the ParaView
mailing list