First save the grid into a tmp.page file (context menu 'Save as a page').
Code: Select all
tar xvfpz tmp.page
The format of 'bin_data_1000' is given in the following table. Sizes and offsets are given in hexadecimal.
Code: Select all
Size Type Comments
---- ---- --------
22 string Tag "IrregularGrid2D" in UTF-16
first 4 bytes contains the size of the tag (30 bytes in this case)
4 int Number of cells along X axis (nx)
4 int Number of cells along Y axis (ny)
nx*8 double X coordinates of cell centers
nx*8 double Y coordinates of cell centers
nx*ny*8 double Grid values, v[ix][iy] is found at index ix+nx*iy
Code: Select all
#include <QTextStream>
#include <QFile>
#include <QDataStream>
int main()
{
QFile f("bin_data_1000");
if (!f.open(QIODevice::ReadOnly)) return 2;
QDataStream sb(&f);
QString tag;
int nx, ny;
sb >> tag >> nx >> ny;
double x[nx], y[ny], val[nx*ny];
sb.readRawData((char *)x, sizeof( double )* nx );
sb.readRawData((char *)y, sizeof( double )* ny );
sb.readRawData((char *)val, sizeof( double )* nx * ny );
QTextStream st(stdout);
st << "x y z" << endl;
double * valPtr = val;
for ( int iy = 0;iy < ny;iy++ ) {
for ( int ix = 0;ix < nx;ix++ )
st << x[ix] << " " << y[iy] << " " << *(valPtr++) << endl;
}
return 0;
}
Code: Select all
cd readgrid
qmake -project
qmake
make