ExodusII  6.05
ex_get_variable_names.c File Reference
#include <stdio.h>
#include "exodusII.h"
#include "exodusII_int.h"
#include "netcdf.h"

Functions

int ex_get_variable_names (int exoid, ex_entity_type obj_type, int num_vars, char *var_names[])

Function Documentation

int ex_get_variable_names ( int  exoid,
ex_entity_type  obj_type,
int  num_vars,
char *  var_names[] 
)

The function ex_get_variable_names() reads the names of the results variables from the database. Memory must be allocated for the name array before this function is invoked. The names are MAX_STR_LENGTH-characters in length.

Returns:
In case of an error, ex_get_variable_names() returns a negative number; a warning will return a positive number. Possible causes of errors include:
  • data file not properly opened with call to ex_create() or ex_open()
  • invalid variable type specified.
  • a warning value is returned if no variables of the specified type are stored in the file.
Parameters:
[in]exoidexodus file ID returned from a previous call to ex_create() or ex_open().
[in]obj_typeVariable indicating the type of variable which is described. Use one of the options in the table below.
[in]num_varsThe number of var_type variables that will be read from the database.
[out]var_namesReturned array of pointers to num_vars variable names.
EX_GLOBAL} Global entity type
EX_NODAL} Nodal entity type
EX_NODE_SET Node Set entity type
EX_EDGE_BLOCK Edge Block entity type
EX_EDGE_SET Edge Set entity type
EX_FACE_BLOCK Face Block entity type
EX_FACE_SET Face Set entity type
EX_ELEM_BLOCK Element Block entity type
EX_ELEM_SET Element Set entity type
EX_SIDE_SET Side Set entity type

As an example, the following code segment will read the names of the nodal variables stored in the data file:

int error, exoid, num_nod_vars;
char *var_names[10];

\comment{read nodal variables parameters and names}
error = ex_get_variable_param(exoid, EX_NODAL, &num_nod_vars);
for (i=0; i < num_nod_vars; i++) {
   var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
}
error = ex_get_variable_names(exoid, EX_NODAL, num_nod_vars, var_names);
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines