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

Data Structures

struct  file_item

Defines

#define NC_FLOAT_WORDSIZE   4
#define NC_DOUBLE_WORDSIZE   8
#define FIND_FILE(ptr, id)

Functions

int ex_conv_ini (int exoid, int *comp_wordsize, int *io_wordsize, int file_wordsize)
void ex_conv_exit (int exoid)
nc_type nc_flt_code (int exoid)
int ex_comp_ws (int exoid)

Variables

struct file_itemfile_list = NULL

Detailed Description

this file contains code needed to support the various floating point word size combinations for computation and i/o that applications might want to use. See the netcdf documentation for more details on the floating point conversion capabilities.

netCDF supports two floating point word sizes for its files:

  • NC_FLOAT - 32 bit IEEE
  • NC_DOUBLE - 64 bit IEEE

Define Documentation

#define FIND_FILE (   ptr,
  id 
)
Value:
{ ptr = file_list;                    \
                            while(ptr) {                        \
                              if( ptr->file_id == id ) break;   \
                              ptr = ptr->next;                  \
                            }                                   \
                          }

Referenced by ex_comp_ws(), and nc_flt_code().

#define NC_DOUBLE_WORDSIZE   8
#define NC_FLOAT_WORDSIZE   4

Referenced by ex_conv_ini().


Function Documentation

void ex_conv_exit ( int  exoid)

ex_conv_exit() takes the structure identified by "exoid" out of the linked list which describes the files that ex_conv_array() knows how to convert.

Note:
it is absolutely necessary for ex_conv_exit() to be called after ncclose(), if the parameter used as "exoid" is the id returned from an ncopen() or nccreate() call, as netCDF reuses file ids! the best place to do this is ex_close(), which is where I did it.
Parameters:
exoidinteger which uniquely identifies the file of interest.

References EX_BADFILEID, ex_err(), EX_MSG, exerrval, file_item::file_id, file_list, MAX_ERR_LENGTH, file_item::next, and NULL.

Referenced by ex_close().

int ex_conv_ini ( int  exoid,
int *  comp_wordsize,
int *  io_wordsize,
int  file_wordsize 
)

ex_conv_ini() initializes the floating point conversion process.

Parameters:
exoidan integer uniquely identifying the file of interest.
comp_wordsizecompute floating point word size in the user's code. a zero value indicates that the user is requesting the default float size for the machine. The appropriate value is chosen and returned in comp_wordsize, and used in subsequent conversions. a valid but inappropriate for this parameter cannot be detected.
io_wordsizethe desired floating point word size for a netCDF file. for an existing file, if this parameter doesn't match the word size of data already stored in the file, a fatal error is generated. a value of 0 for an existing file indicates that the word size of the file was not known a priori, so use whatever is in the file. a value of 0 for a new file means to use the default size, an NC_FLOAT (4 bytes). when a value of 0 is specified the actual value used is returned in io_wordsize.
file_wordsizefloating point word size in an existing netCDF file. a value of 0 should be passed in for a new netCDF file.

word size parameters are specified in bytes. valid values are 0, 4, and 8:

References ex_err(), EX_FATAL, EX_MSG, EX_NOERR, file_item::file_id, file_list, MAX_ERR_LENGTH, NC_FLOAT_WORDSIZE, file_item::netcdf_type_code, file_item::next, and file_item::user_compute_wordsize.

Referenced by ex_create_int(), and ex_open_int().


Variable Documentation

struct file_item* file_list = NULL

Referenced by ex_conv_exit(), and ex_conv_ini().