ExodusII 4.96
expvpax.c File Reference
#include <stdlib.h>
#include "exodusII.h"
#include "exodusII_int.h"
#include <ctype.h>
Include dependency graph for expvpax.c:

Defines

#define EX_GET_IDS_STATUS(TNAME, NUMVAR, DNAME, DID, DVAL, VIDS, EIDS, VSTAT, VSTATVAL)
#define EX_DEFINE_VARS(TID, STNAME, TNAME, NUMVAR, DNAME, DID1, DID2, DVAL, VIDS, VNOV, VTV, VSTATVAL, VTABVAL, VTABVAR)

Functions

static void * safe_free (void *array)
static int define_dimension (int exoid, const char *DIMENSION, int count, const char *label, int *dimid)
static int define_variable_name_variable (int exoid, const char *VARIABLE, int dimension, const char *label)
static int * get_status_array (int exoid, int count, const char *VARIABLE, const char *label)
static int put_truth_table (int exoid, int varid, int *table, const char *label)
static int define_truth_table (ex_entity_type obj_type, int exoid, int num_ent, int num_var, int *var_tab, int *status, int *ids, const char *label)
int ex_put_all_var_param_ext (int exoid, const ex_var_params *vp)

Define Documentation

#define EX_DEFINE_VARS (   TID,
  STNAME,
  TNAME,
  NUMVAR,
  DNAME,
  DID1,
  DID2,
  DVAL,
  VIDS,
  VNOV,
  VTV,
  VSTATVAL,
  VTABVAL,
  VTABVAR 
)
Value:
if (NUMVAR > 0) {                                                       \
    status = define_dimension(exoid, DNAME, NUMVAR, STNAME, &DID2);     \
    if (status != NC_NOERR) goto error_ret;                             \
                                                                        \
    /* Now define STNAME variable name variable */                      \
    if (define_variable_name_variable(exoid, VNOV, DID2, STNAME) != NC_NOERR) \
      goto error_ret;                                                   \
                                                                        \
    if (define_truth_table(TID, exoid, DVAL, NUMVAR, VTABVAL, VSTATVAL, VIDS, TNAME) != NC_NOERR) \
      goto error_ret;                                                   \
                                                                        \
    VSTATVAL = safe_free (VSTATVAL);                                    \
    VIDS  = safe_free (VIDS);                                           \
                                                                        \
    /* create a variable array in which to store the STNAME variable truth \
     * table                                                            \
     */                                                                 \
                                                                        \
    dims[0] = DID1;                                                     \
    dims[1] = DID2;                                                     \
                                                                        \
    if ((status = nc_def_var(exoid, VTV, NC_INT, 2, dims, &VTABVAR)) != NC_NOERR) { \
      exerrval = status;                                                \
      sprintf(errmsg,                                                   \
              "Error: failed to define " STNAME " variable truth table in file id %d", \
              exoid);                                                   \
      ex_err("ex_put_all_var_param_ext",errmsg,exerrval);               \
      goto error_ret;          /* exit define mode and return */        \
    }                                                                   \
  }

Referenced by ex_put_all_var_param_ext().

#define EX_GET_IDS_STATUS (   TNAME,
  NUMVAR,
  DNAME,
  DID,
  DVAL,
  VIDS,
  EIDS,
  VSTAT,
  VSTATVAL 
)
Value:
if (NUMVAR > 0) {                                                       \
    status = ex_get_dimension(exoid, DNAME, TNAME "s", &DVAL, &DID, routine); \
    if (status != NC_NOERR)                                             \
      goto error_ret;                                                   \
                                                                        \
    /* get element block IDs */                                         \
    if (!(VIDS = malloc(DVAL*sizeof(int)))) {                           \
      exerrval = EX_MEMFAIL;                                            \
      sprintf(errmsg,                                                   \
              "Error: failed to allocate memory for " TNAME " id array for file id %d", \
              exoid);                                                   \
      ex_err("ex_put_all_var_param_ext",errmsg,exerrval);               \
      goto error_ret;                                                   \
    }                                                                   \
    ex_get_ids (exoid, EIDS, VIDS);                                     \
                                                                        \
    /* Get element block status array for later use (allocates memory) */ \
    VSTATVAL = get_status_array(exoid, DVAL, VSTAT, TNAME);             \
    if (VSTATVAL == NULL) {                                             \
      goto error_ret;                                                   \
    }                                                                   \
  }

Referenced by ex_put_all_var_param_ext().


Function Documentation

int define_dimension ( int  exoid,
const char *  DIMENSION,
int  count,
const char *  label,
int *  dimid 
) [static]
int define_truth_table ( ex_entity_type  obj_type,
int  exoid,
int  num_ent,
int  num_var,
int *  var_tab,
int *  status,
int *  ids,
const char *  label 
) [static]
int define_variable_name_variable ( int  exoid,
const char *  VARIABLE,
int  dimension,
const char *  label 
) [static]
int ex_put_all_var_param_ext ( int  exoid,
const ex_var_params vp 
)

writes the number of global, nodal, element, nodeset, and sideset variables that will be written to the database

Parameters:
exoidexodus file id
*vppointer to variable parameter info

References define_dimension(), define_variable_name_variable(), DIM_NUM_ED_BLK, DIM_NUM_EDG_VAR, DIM_NUM_EL_BLK, DIM_NUM_ELE_VAR, DIM_NUM_ELS, DIM_NUM_ELSET_VAR, DIM_NUM_ES, DIM_NUM_ESET_VAR, DIM_NUM_FA_BLK, DIM_NUM_FAC_VAR, DIM_NUM_FS, DIM_NUM_FSET_VAR, DIM_NUM_GLO_VAR, DIM_NUM_NOD_VAR, DIM_NUM_NODES, DIM_NUM_NS, DIM_NUM_NSET_VAR, DIM_NUM_SS, DIM_NUM_SSET_VAR, DIM_STR, DIM_TIME, ex_var_params::edge_var_tab, ex_var_params::elem_var_tab, ex_var_params::elset_var_tab, ex_var_params::eset_var_tab, EX_DEFINE_VARS, EX_EDGE_BLOCK, EX_EDGE_SET, EX_ELEM_BLOCK, EX_ELEM_SET, ex_err(), EX_FACE_BLOCK, EX_FACE_SET, EX_FATAL, EX_GET_IDS_STATUS, ex_large_model(), EX_NODE_SET, EX_NOERR, EX_SIDE_SET, exerrval, ex_var_params::face_var_tab, ex_var_params::fset_var_tab, MAX_ERR_LENGTH, nc_flt_code(), ex_var_params::nset_var_tab, ex_var_params::num_edge, ex_var_params::num_elem, ex_var_params::num_elset, ex_var_params::num_eset, ex_var_params::num_face, ex_var_params::num_fset, ex_var_params::num_glob, ex_var_params::num_node, ex_var_params::num_nset, ex_var_params::num_sset, put_truth_table(), safe_free(), ex_var_params::sset_var_tab, VAR_EBLK_TAB, VAR_ELEM_TAB, VAR_ELS_STAT, VAR_ELSET_TAB, VAR_ES_STAT, VAR_ESET_TAB, VAR_FBLK_TAB, VAR_FS_STAT, VAR_FSET_TAB, VAR_GLO_VAR, VAR_NAME_EDG_VAR, VAR_NAME_ELE_VAR, VAR_NAME_ELSET_VAR, VAR_NAME_ESET_VAR, VAR_NAME_FAC_VAR, VAR_NAME_FSET_VAR, VAR_NAME_GLO_VAR, VAR_NAME_NOD_VAR, VAR_NAME_NSET_VAR, VAR_NAME_SSET_VAR, VAR_NOD_VAR, VAR_NOD_VAR_NEW, VAR_NS_STAT, VAR_NSET_TAB, VAR_SS_STAT, VAR_SSET_TAB, VAR_STAT_ED_BLK, VAR_STAT_EL_BLK, and VAR_STAT_FA_BLK.

Referenced by ex_put_all_var_param().

int * get_status_array ( int  exoid,
int  count,
const char *  VARIABLE,
const char *  label 
) [static]
int put_truth_table ( int  exoid,
int  varid,
int *  table,
const char *  label 
) [static]
static void* safe_free ( void *  array) [static]