next up previous
Next: Initial Data Up: Evolution Previous: FORTRAN Interface

C Interface

The C interface is identical to the FORTRAN interface with the addition of some extra routines. The C prototypes are:

#include <bbhutil.h>

int gft_close(const char *nm);
int gft_close_all(void);

int gft_set_d_type(int type)

int gft_write(const char *func_name, double time, 
              int *shape, int rank, double *data);
int gft_write_brief(const char *func_name, double time, 
                    int *shape, int rank, double *data);
int gft_write_bbox(const char *func_name, double time, 
                   int *shape, int rank, double *coords, double *data);
int gft_write_full(const char *func_name, double time,
                   int *shape, char **cnames, int rank,
                   double *coords, double *data); 

int gft_read_brief(const char *file_name, int level, double *data);
int gft_read_full(const char *file_name, int level, 
                  int *shape, char **cnames,
                  int rank, char *time, double *coords, 
                  double *data);
int gft_read_shape(const char *file_name, int *shape);

gft_close closes the HDF file whose name is passed as a parameter.

gft_close_all closes all open HDF files.

gft_set_d_type will set the grid function type which is written by the gft_write* calls. The default type is DFNT_FLOAT64. The only other valid type is DFNT_INT32.

gft_write and gft_write_brief will write the grid function given in data to the evolution HDF file whose name is formed from the func_name. Func_name is the name of the grid function. Time gives the time at which the grid function had the values given in data. The rank and shape provide the size of the grid function. The coordinates are named x,y,z and the coordinate values are integers running from 1 to shape.

gft_write_bbox performs the same function as gft_write. In addition, the coordinate values are taken from the bounding box coords. Coords is a one dimensional array the whose first two values provide the min and max for the first coordinate, the next two values provide the min and max for the second coordinate, etc. In general, the minimum for the nth coordinate is stored in position 2(n-1) and the maximum is in position 2(n-1) + 1.

gft_write_full works as the above except the coordinate names are given explicitly in cnames and the coordinate values are given explicitly in coords. The first shape[0] values of coords are the values of the first coordinate, the next shape[1] values are for the second coordinate, etc.

gft_read_brief returns a grid function from the file given by file_name. Level runs from 1 to the number of time levels stored in the file.

gft_read_full takes the file name, desired time level, and rank and returns complete information including the grid function, time, shape, coordinate names, and coordinate values. Storage for the returned values must be preallocated.

gft_read_shape returns the shape of the data sets in an RNPL evolution HDF file.



next up previous
Next: Initial Data Up: Evolution Previous: FORTRAN Interface



Robert Marsa
Fri Jul 14 13:58:46 CDT 1995