An instance of the StoredColumns class provides access to a set of data columns stored in a file using the binary SKIRT stored columns format (which is simular to the SKIRT stored table format implemented by StoredTable). Stored columns files are intended as a much faster replacement for large regular text column data files, without the benefit of being human readable. The format does not support non-leaf rows, so it cannot be used for representing adaptive mesh data.
Stored columns file format
A stored columns file includes the names and units of the quantities in each column, in addition to the tabulated data values. All values are stored as binary data in the form of 64-bit floating-point numbers. More specifically, a stored columns file is essentially a sequence of 8-byte data items. A data item can have one of three types:
- string: 1 to 8 printable and non-whitespace 7-bit ASCII characters, padded with spaces
to fill 8 bytes if needed;
- unsigned integer: 64-bit integer in little-endian byte order;
- floating point: 64-bit double (IEEE 754) in little-endian byte order.
The overall layout is as follows:
- SKIRT name/version tag
- Endianness tag
- 0 (to differentiate from stored table format, which stores the nr of axes here)
- numRows
- numColumns
- columnName (x numColumns)
- columnUnit (x numColumns)
- value (x numColumns x numRows)
- end-of-file tag
The values are ordered so that the column values for a particular row are next to each other.
The default constructor creates an invalid stored columns instance. The alternate constructor and the open() function associate a particular stored columns file with the stored columns instance. The close() function and the destructor automatically release the file association and any related resources. It is allowed to call open() again after close().
The columnNames() and columnUnits() functions return informaton about the columns, and the readRow() function returns the rows one by one, from the start to the end of the file.