MfixReader User Guide

3. Managing and Opening Instances

These four routines create and destroy instances of the reader, and open and close datasets. Note that most parameters that affect how a dataset is opened (see section 4, Setting Parameters) must be set after an instance is created but before it is opened.

3.1 Create An Instance

int MfixReaderCreate(
 int *handle
)

Create an instance. The integer pointed to by handle will be set to a semi-random number. This handle must be used in all future references to this instance.

3.2 Destroy An Instance

int MfixReaderDestroy(
 int *handle
)

Eliminates an instance and frees associated memory. The handle is set to 0.

3.3 Open An Instance

int MfixReaderOpen(
 int handle
)

Opens the dataset referenced by the handle and gathers metadata. This includes reading the restart file and reading just enough of the data files to discover the number of time steps in each.

Most of the parameters that affect how a dataset is read must be set before this routine is used.

A modest number of memory arrays are also allocated for passing data back to the application. Later, if needed, additional memory arrays may be created.

3.4 Close An Instance

int MfixReaderClose(
 int handle
)

Closes the dataset and frees associated memory. The memory freed here includes the potentially large arrays used to return data to the application.