GridWriter

The class GridWriter is used to write the cell grid data to a grid group in a qdf file.

Code:

Public Methods

constructor

GridWriter(SCellGrid *pCG, stringmap *psm);

The constructor.

pCG

Pointer to the cell grid to be written.

psm

pointer to a string map containing grid speficic info to be written as attributes.

write

int write(hid_t hFile);

Writes the entire grid-related data to a grid group in an open qdf file.

hFile

HDF handle to the open file.

Returns 0 on success, -1 on failure.

writeToQDF

int writeToQDF(const std::string sFileName,   int iStep, float fStartTime,
               const std::string sInfoString, bool bNew);

Creates a new qdf file or opens an existing qdf file, creates a grid group and writes the grid data to it.

sFileName

Name of output file.

iStep

The current simulation step. This number is saved as an attribute in the output file’s root group.

fStartTime

The start time of the simulation (i.e. the ‘real’ time at step 0). This number is also saved as an attribute in the output file’s root group.

sInfoString

An arbitrary string which will be saved as an attribute in the output file’s root group.

bNew

If true a new file is created, otherwise the file with the specified name is opened for writing.

Returns 0 on success, -1 on failure.

Protected Methods

createCellDataType

hid_t createCellDataType();

Creates and returns a hdf data type for the cell data.

writeCellData

int writeCellData(hid_t hDataSpace, hid_t hDataSet, hid_t hCellType);

Writes the cell data to the open hdf data set.

hDataSpace

HDF handle to the data space for the grid data.

hDataSet

HDF handle to the data set for the grid data.

hCellType

HDF handle to the data type for the grid data.

Returns 0 on success, -1 on failure.

writeGridAttributes

int writeGridAttributes(hid_t hGridGroup);

Writes the attributes of the grid to the grid group in the qdf file.

hGridGroup

HDF handle of the grid group.

Returns 0 on success, -1 on failure.

0         1         2         3         4         5         6         7         8         9         0
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890