I’m suffering at the behest of the vtk xml format and would appreciate some advice regarding what format the data should be in.
So as an exercise I’m creating a vtp file that stores the coordinates of a 27 point, cube, spanning 0>2 in all dimensions. My coordinates each take the form of three 64 bit Reals.
The way I have interpreted information online regarding the structure of a vtk xml binary data array is that it takes the form:
Header | x1 y1 z1 x2 y2 z3 ... xn yn zn
Where the header is a single integer of form specified in header_type="UInt64"
and the individual data points are individually encoded into base 64.
So an array with one header and three data points would take the example form:
AAAAAAAAATY= | P/AAAAAAAAA= | P/AAAAAAAAA= | P/AAAAAAAAA=
310 1. 1. 1.
Without dividers.
Basically my question is is this correct? Or should all data be encoded together as one large b64 string?
So it would look like?
AAAAAAAAATY= | AAAAAAAAATYAAAAAAAABNgAAAAAAAAE2
Or even is the header meant to be in there as well?
It is worth noting that I’m doing this in Fortran and the good idea fairy decided to inflict upon me the idea that it would be worth writing my own base 64 converter so I’m not even particularly confident in the encoding here.
As a side note it is a cruel joke that there’s no support for raw binary in the inline xml format
(unless I’m misinformed and someone wants to save me from this base64 hell)
Below is an example of the kind of file I’m trying to produce atm, which paraview just hallucinates on. Oddly It gets the first x coordinate right.
<VTKFile type="PolyData" version="1.0" byte_order="BigEndian" header_type="UInt64" >
<PolyData>
<Piece NumberOfPoints="27" NumberOfVerts="0" NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="0">
<Points>
<DataArray type="Float64" NumberOfComponents="3" Name="Points" format="binary">AAAAAAAAA9g=P/AAAAAAAAA=P/AAAAAAAAA=P/AAAAAAAAA=P/AAAAAAAAA=P/AAAAAAAAA=QAAAAAAAAAA=P/AAAAAAAAA=QAAAAAAAAAA=P/AAAAAAAAA=QAAAAAAAAAA=P/AAAAAAAAA=P/AAAAAAAAA=P/AAAAAAAAA=QAAAAAAAAAA=QAAAAAAAAAA=QAAAAAAAAAA=P/AAAAAAAAA=QAAAAAAAAAA=QAAAAAAAAAA=QAAAAAAAAAA=P/AAAAAAAAA=QAAAAAAAAAA=QAAAAAAAAAA=QAAAAAAAAA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