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

Defines

#define EX_QSORT_CUTOFF   12

Functions

char * ex_catstr (const char *string, int num)
char * ex_catstr2 (const char *string1, int num1, const char *string2, int num2)
char * ex_name_of_object (ex_entity_type obj_type)
ex_entity_type ex_var_type_to_ex_entity_type (char var_type)
char * ex_dim_num_objects (ex_entity_type obj_type)
char * ex_dim_num_entries_in_object (ex_entity_type obj_type, int idx)
char * ex_name_var_of_object (ex_entity_type obj_type, int i, int j)
char * ex_name_of_map (ex_entity_type map_type, int map_index)
int ex_id_lkup (int exoid, ex_entity_type id_type, int num)
struct obj_statsex_get_stat_ptr (int exoid, struct obj_stats **obj_ptr)
void ex_rm_stat_ptr (int exoid, struct obj_stats **obj_ptr)
struct list_item ** ex_get_counter_list (ex_entity_type obj_type)
int ex_inc_file_item (int exoid, struct list_item **list_ptr)
int ex_get_file_item (int exoid, struct list_item **list_ptr)
void ex_rm_file_item (int exoid, struct list_item **list_ptr)
int ex_get_num_props (int exoid, ex_entity_type obj_type)
int ex_get_cpu_ws (void)
static void ex_swap (int v[], int i, int j)
static int ex_int_median3 (int v[], int iv[], int left, int right)
static void ex_int_iqsort (int v[], int iv[], int left, int right)
static void ex_int_iisort (int v[], int iv[], int N)
void ex_iqsort (int v[], int iv[], int N)
int ex_large_model (int exoid)
int ex_get_dimension (int exoid, const char *DIMENSION, const char *label, size_t *count, int *dimid, const char *routine)
size_t ex_header_size (int exoid)

Variables

struct obj_statsexoII_eb = 0
struct obj_statsexoII_ed = 0
struct obj_statsexoII_fa = 0
struct obj_statsexoII_ns = 0
struct obj_statsexoII_es = 0
struct obj_statsexoII_fs = 0
struct obj_statsexoII_ss = 0
struct obj_statsexoII_els = 0
struct obj_statsexoII_em = 0
struct obj_statsexoII_edm = 0
struct obj_statsexoII_fam = 0
struct obj_statsexoII_nm = 0
static char ret_string [10 *(MAX_VAR_NAME_LENGTH+1)]
static char * cur_string = &ret_string[0]
static struct list_itemed_ctr_list = 0
static struct list_itemfa_ctr_list = 0
static struct list_itemeb_ctr_list = 0
static struct list_itemns_ctr_list = 0
static struct list_itemes_ctr_list = 0
static struct list_itemfs_ctr_list = 0
static struct list_itemss_ctr_list = 0
static struct list_itemels_ctr_list = 0
static struct list_itemnm_ctr_list = 0
static struct list_itemedm_ctr_list = 0
static struct list_itemfam_ctr_list = 0
static struct list_itemem_ctr_list = 0

Define Documentation

#define EX_QSORT_CUTOFF   12

The following 'indexed qsort' routine is modified from Sedgewicks algorithm It selects the pivot based on the median of the left, right, and center values to try to avoid degenerate cases ocurring when a single value is chosen. It performs a quicksort on intervals down to the EX_QSORT_CUTOFF size and then performs a final insertion sort on the almost sorted final array. Based on data in Sedgewick, the EX_QSORT_CUTOFF value should be between 5 and 20.

See Sedgewick for further details Define DEBUG_QSORT at the top of this file and recompile to compile in code that verifies that the array is sorted.

Referenced by ex_int_iqsort().


Function Documentation

char* ex_catstr ( const char *  string,
int  num 
)

ex_catstr - concatenate string/number (where number is converted to ASCII)

References cur_string, MAX_VAR_NAME_LENGTH, and ret_string.

Referenced by ex_put_truth_table().

char* ex_catstr2 ( const char *  string1,
int  num1,
const char *  string2,
int  num2 
)

ex_catstr2 - concatenate string1num1string2num2

References cur_string, MAX_VAR_NAME_LENGTH, and ret_string.

Referenced by ex_get_object_truth_vector(), ex_get_truth_table(), ex_get_varid(), and ex_put_truth_table().

int ex_get_cpu_ws ( void  )
int ex_get_file_item ( int  exoid,
struct list_item **  list_ptr 
)

this routine accesses a structure to track and increment a counter for each open exodus file. it is designed to be used by the routines ex_put_elem_block(), and ex_put_set_param(), to get the number of element blocks, or a type of set, respectively, for an open exodus II file.

The list structure is used as follows:

ptr -----------> list item structure ------------------- exodus file id item value (int) ptr to next (NULL if last)

NOTE: since netCDF reuses its file ids, and a user may open and close any number of files in one application, items must be taken out of the linked lists in each of the above routines. these should be called after ncclose().

References list_item::exo_id, list_item::next, and list_item::value.

Referenced by ex_put_block(), ex_put_concat_all_blocks(), ex_put_concat_elem_block(), ex_put_concat_sets(), ex_put_num_map(), ex_put_partial_elem_map(), and ex_put_set_param().

struct obj_stats* ex_get_stat_ptr ( int  exoid,
struct obj_stats **  obj_ptr 
) [read]

this routine returns a pointer to a structure containing the ids of element blocks, node sets, or side sets according to exoid; if there is not a structure that matches the exoid, one is created

References obj_stats::exoid, obj_stats::id_vals, obj_stats::next, obj_stats::num, obj_stats::stat_vals, obj_stats::valid_ids, and obj_stats::valid_stat.

Referenced by ex_id_lkup().

size_t ex_header_size ( int  exoid)

Calculate the number of words of storage required to store the header information. Total bytes can be obtained by multiplying words by 4. Size is slightly underestimated since it only considers the bulk data storage...

References DIM_NUM_DIM, DIM_NUM_EL_BLK, DIM_NUM_ELEM, DIM_NUM_EM, DIM_NUM_NM, DIM_NUM_NODES, DIM_NUM_NS, DIM_NUM_SS, EX_ELEM_BLOCK, ex_get_dimension(), ex_get_elem_block(), ex_get_ids(), ex_get_node_set_param(), ex_get_side_set_param(), ex_large_model(), EX_NODE_SET, EX_SIDE_SET, MAX_STR_LENGTH, nc_flt_code(), NULL, VAR_ELEM_NUM_MAP, VAR_MAP, and VAR_NODE_NUM_MAP.

int ex_id_lkup ( int  exoid,
ex_entity_type  id_type,
int  num 
)

References DIM_NUM_ED_BLK, DIM_NUM_EDM, DIM_NUM_EL_BLK, DIM_NUM_ELS, DIM_NUM_EM, DIM_NUM_ES, DIM_NUM_FA_BLK, DIM_NUM_FAM, DIM_NUM_FS, DIM_NUM_NM, DIM_NUM_NS, DIM_NUM_SS, EX_BADPARAM, EX_EDGE_BLOCK, EX_EDGE_MAP, EX_EDGE_SET, EX_ELEM_BLOCK, EX_ELEM_MAP, EX_ELEM_SET, ex_err(), EX_FACE_BLOCK, EX_FACE_MAP, EX_FACE_SET, EX_FATAL, ex_get_stat_ptr(), EX_GLOBAL, EX_LOOKUPFAIL, EX_MEMFAIL, EX_NODAL, EX_NODE_MAP, EX_NODE_SET, EX_NULLENTITY, EX_SIDE_SET, exerrval, FALSE, obj_stats::id_vals, MAX_ERR_LENGTH, MAX_VAR_NAME_LENGTH, NULL, obj_stats::num, obj_stats::stat_vals, TRUE, obj_stats::valid_ids, obj_stats::valid_stat, VAR_EDM_PROP, VAR_ELS_IDS, VAR_ELS_STAT, VAR_EM_PROP, VAR_ES_IDS, VAR_ES_STAT, VAR_FAM_PROP, VAR_FS_IDS, VAR_FS_STAT, VAR_ID_ED_BLK, VAR_ID_EL_BLK, VAR_ID_FA_BLK, VAR_NM_PROP, VAR_NS_IDS, VAR_NS_STAT, VAR_SS_IDS, VAR_SS_STAT, VAR_STAT_ED_BLK, VAR_STAT_EL_BLK, and VAR_STAT_FA_BLK.

Referenced by ex_get_attr(), ex_get_attr_names(), ex_get_attr_param(), ex_get_block(), ex_get_conn(), ex_get_entity_count_per_polyhedra(), ex_get_n_conn(), ex_get_n_one_attr(), ex_get_n_var(), ex_get_name(), ex_get_num_map(), ex_get_object_truth_vector(), ex_get_one_attr(), ex_get_partial_elem_map(), ex_get_prop(), ex_get_set(), ex_get_set_dist_fact(), ex_get_set_param(), ex_get_side_set_node_count(), ex_get_side_set_node_list(), ex_get_var(), ex_put_attr(), ex_put_attr_names(), ex_put_attr_param(), ex_put_block(), ex_put_conn(), ex_put_entity_count_per_polyhedra(), ex_put_n_one_attr(), ex_put_name(), ex_put_num_map(), ex_put_one_attr(), ex_put_partial_elem_map(), ex_put_partial_set_dist_fact(), ex_put_prop(), ex_put_set(), ex_put_set_dist_fact(), and ex_put_set_param().

int ex_inc_file_item ( int  exoid,
struct list_item **  list_ptr 
)

this routine sets up a structure to track and increment a counter for each open exodus file. it is designed to be used by the routines ex_put_elem_block() and ex_put_set_param(), to keep track of the number of element blocks, and each type of set, respectively, for each open exodus II file.

The list structure is used as follows:

ptr -----------> list item structure ------------------- exodus file id item value (int) ptr to next (NULL if last)

NOTE: since netCDF reuses its file ids, and a user may open and close any number of files in one application, items must be taken out of the linked lists in each of the above routines. these should be called after ncclose().

References list_item::exo_id, list_item::next, and list_item::value.

Referenced by ex_put_block(), ex_put_concat_all_blocks(), ex_put_concat_elem_block(), ex_put_concat_sets(), ex_put_num_map(), ex_put_partial_elem_map(), ex_put_set_param(), and update_internal_structs().

static void ex_int_iisort ( int  v[],
int  iv[],
int  N 
) [static]

References ex_swap().

Referenced by ex_iqsort().

static void ex_int_iqsort ( int  v[],
int  iv[],
int  left,
int  right 
) [static]

References ex_int_median3(), EX_QSORT_CUTOFF, and ex_swap().

Referenced by ex_iqsort().

static int ex_int_median3 ( int  v[],
int  iv[],
int  left,
int  right 
) [static]

References ex_swap().

Referenced by ex_int_iqsort().

int ex_large_model ( int  exoid)

Determine whether the new large model storage is being used in this file, or old method. Basically, the difference is whether the coordinates and nodal variables are stored in a blob (xyz components together) or as a variable per component per nodal_variable.

References ATT_FILESIZE, EXODUS_DEFAULT_SIZE, FALSE, NULL, and TRUE.

Referenced by ex_copy(), ex_create_int(), ex_get_coord(), ex_get_n_coord(), ex_get_n_nodal_var(), ex_get_nodal_var(), ex_get_nodal_var_time(), ex_get_nodal_varid(), ex_get_nodal_varid_var(), ex_header_size(), ex_put_all_var_param_ext(), ex_put_coord(), ex_put_init_ext(), ex_put_n_coord(), ex_put_n_nodal_var(), ex_put_nodal_var(), ex_put_nodal_varid_var(), and ex_put_variable_param().

char* ex_name_of_map ( ex_entity_type  map_type,
int  map_index 
)
void ex_rm_file_item ( int  exoid,
struct list_item **  list_ptr 
)

this routine removes a structure to track and increment a counter for each open exodus file.

The list structure is used as follows:

ptr -----------> list item structure ------------------- exodus file id item value (int) ptr to next (NULL if last)

NOTE: since netCDF reuses its file ids, and a user may open and close any number of files in one application, items must be taken out of the linked lists in each of the above routines. these should be called after ncclose().

References list_item::exo_id, and list_item::next.

Referenced by ex_close().

void ex_rm_stat_ptr ( int  exoid,
struct obj_stats **  obj_ptr 
)

this routine removes a pointer to a structure containing the ids of element blocks, node sets, or side sets according to exoid; this is necessary to clean up because netCDF reuses file ids; should be called from ex_close

References obj_stats::exoid, obj_stats::id_vals, obj_stats::next, NULL, and obj_stats::stat_vals.

Referenced by ex_close().

static void ex_swap ( int  v[],
int  i,
int  j 
) [static]

Variable Documentation

char* cur_string = &ret_string[0] [static]

Referenced by ex_catstr(), and ex_catstr2().

struct list_item* eb_ctr_list = 0 [static]

Referenced by ex_get_counter_list().

struct list_item* ed_ctr_list = 0 [static]

Referenced by ex_get_counter_list().

struct list_item* edm_ctr_list = 0 [static]

Referenced by ex_get_counter_list().

struct list_item* els_ctr_list = 0 [static]

Referenced by ex_get_counter_list().

struct list_item* em_ctr_list = 0 [static]

Referenced by ex_get_counter_list().

struct list_item* es_ctr_list = 0 [static]

Referenced by ex_get_counter_list().

struct obj_stats* exoII_eb = 0

Referenced by ex_close().

struct obj_stats* exoII_ed = 0

Referenced by ex_close().

struct obj_stats* exoII_edm = 0

Referenced by ex_close().

struct obj_stats* exoII_els = 0

Referenced by ex_close().

struct obj_stats* exoII_em = 0

Referenced by ex_close().

struct obj_stats* exoII_es = 0

Referenced by ex_close().

struct obj_stats* exoII_fa = 0

Referenced by ex_close().

struct obj_stats* exoII_fam = 0

Referenced by ex_close().

struct obj_stats* exoII_fs = 0

Referenced by ex_close().

struct obj_stats* exoII_nm = 0

Referenced by ex_close().

struct obj_stats* exoII_ns = 0

Referenced by ex_close().

struct obj_stats* exoII_ss = 0

Referenced by ex_close().

struct list_item* fa_ctr_list = 0 [static]

Referenced by ex_get_counter_list().

struct list_item* fam_ctr_list = 0 [static]

Referenced by ex_get_counter_list().

struct list_item* fs_ctr_list = 0 [static]

Referenced by ex_get_counter_list().

struct list_item* nm_ctr_list = 0 [static]

Referenced by ex_get_counter_list().

struct list_item* ns_ctr_list = 0 [static]

Referenced by ex_get_counter_list().

char ret_string[10 *(MAX_VAR_NAME_LENGTH+1)] [static]

Referenced by ex_catstr(), and ex_catstr2().

struct list_item* ss_ctr_list = 0 [static]

Referenced by ex_get_counter_list().