The two dimensional data is a matrix of dimension NX x NY which has been compressed to save disk space. The copmression method leaves out the zeros of the matrix and retains only the non-zero data.
Each data row is encoded as
Here NZ and ND values are written as 16-bit values while the data-words are
written as either 16-bit or 32-bit values depending upon the option
Single Word or Double Word selected in Setup.
NZ1, ND1, [ND1 data-words]; NZ2, ND2, [ND2 data-words]; ...
This sequence is repeated for each of the NY rows
To make things clear, here is how a (hypothetical) 8x8 matix would be
encoded.
Punctuation marks (comma, semi-colon and brackets) are shown
for readabilty - they are not in the data stream.
NZ values are shown in red, ND values in blue
and data-words in green:
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Double Word: 256 bytes |
Double Word: 130 bytes |
Example programs (in FORTRAN and C) showing how to read and write 2d files are included in DemoProgs.tgz which can be downloaded from the LAMPS website.