3.4.10. Variable Routines

These routines access the variable data defined on the current zone as defined by cfxExportZoneSet. For details, see cfxExportZoneSet. The variable data arrays are not loaded into memory until either cfxExportVariableList or cfxExportVariableGet are called, and remain in memory until cfxExportVariableFree is called. For details, see:

3.4.10.1. cfxExportVariableCount

int cfxExportVariableCount(int usr_level)

Query the number of variables at interest level usr_level or below. If usr_level is 0, then the total number of variables is returned.

3.4.10.2. cfxExportVariableSize

int cfxExportVariableSize (int varnum, int *dimension, int *length, int *bdnflag)

Query the dimension, dimension, and length, length, for the variable identified by varnum, which should be from 1 to the number of variables, returned by cfxExportVariableCount (cfxExportVariableCount). The length, length, will either be 1 or the same as the number of nodes returned by cfxExportNodeCount (see cfxExportNodeCount). If 1, then the variable has meaningful values only at the boundary nodes, with a constant value in the interior.

The function also returns bdnflag, which indicates if the variable contains corrected boundary node values (1) or not (0).

The function returns varnum if successful, or 0 if the variable number is out of range.

3.4.10.3. cfxExportVariableName

char *cfxExportVariableName (int varnum, int alias)

Query the name of the variable identified by varnum.

The return value of the function is NULL if the variable number is out of range or the name of the variable.

The pointer returned points to static storage, which will be overwritten by the next call to cfxExportVariableName.

The argument alias indicates whether the short name (alias=0) or long name (alias=1) should be returned. For example, the short and long names for the total temperature variable are TEMPTOT and Total Temperature, respectively.

3.4.10.4. cfxExportVariableList

float *cfxExportVariableList (int varnum, int correct)

Query the results data for a variable identified by varnum.

Returns NULL if the variable number is out of range or the variable data if successful.

The flag correct indicates whether to correct boundary node data (correct=1) or not (correct=0), assuming that it exists.

The data is in the same order as the nodes returned from cfxExportNodeList (see cfxExportNodeList).

For multidimensional variables, the data is stored with dimension consecutive values for each node.

The storage for the data is created by the Export API when this function is called. When the data is no longer required a call to cfxExportVariableFree (see cfxExportVariableFree) should be made by the calling function.

3.4.10.5. cfxExportVariableGet

int cfxExportVariableGet (int varnum, int correct, int index, float *value)

Request the values of the variable identified by varnum at the location given by index, which should be from 1 to the length of the variable, inclusively.

The flag correct indicates whether to correct boundary node data (correct=1) or not (correct=0), assuming that it exists.

The function returns index, or 0 if the location is out of range.

3.4.10.6. cfxExportVariableFree

void cfxExportVariableFree (int varnum)

Deallocate the internal data storage for the variable identified by varnum for the current zone.

3.4.10.7. cfxExportVariableQuantityDimensions

const float* cfxExportVariableQuantityDimensions(const int varnum)

Take an argument that is the index of the variable in cfxExportVariableList, and return an array of floats of size cfxNUM_QUANTITIES. Each entry will be 0 if that indexed quantity does not apply to this variable, or will otherwise be the power to which the unit associated with the indexed quantity is raised.

3.4.10.8. cfxExportVariableUnitsString

const char* cfxExportVariableUnitsString(const int varnum)

Take an argument that is the index of the variable in cfxExportVariableList and return a combined units string. You can use this function to avoid having to process the dimensions using the cfxExportVariableQuantityDimensions function.