moab
File operations

Classes

struct  mhdf_EntDesc
struct  mhdf_TagDesc
struct  mhdf_ElemDesc
struct  mhdf_FileDesc

Typedefs

typedef void * mhdf_FileHandle
 Opaque handle to an open file.

Functions

mhdf_FileHandle mhdf_createFile (const char *filename, int overwrite, const char **elem_type_list, size_t elem_type_list_len, hid_t id_type, mhdf_Status *status)
 Create a new file.
mhdf_FileHandle mhdf_openFile (const char *filename, int writable, unsigned long *max_id, hid_t id_type, mhdf_Status *status)
 Open an existing file.
mhdf_FileHandle mhdf_openFileWithOpt (const char *filename, int writable, unsigned long *max_id, hid_t id_type, hid_t options, mhdf_Status *status)
 Open an existing file with options.
int mhdf_countOpenHandles (mhdf_FileHandle h)
 Get number of open HDF5 objects from file.
struct mhdf_FileDescmhdf_getFileSummary (mhdf_FileHandle file_handle, hid_t file_id_type, mhdf_Status *status)
 Get summary of data tables contained within file.
void mhdf_fixFileDesc (struct mhdf_FileDesc *copy_ptr, const struct mhdf_FileDesc *orig_addr)
 Fix nested pointers for copied/moved FileDesc struct.
void mhdf_getElemName (mhdf_FileHandle file_handle, unsigned int type_index, char *buffer, size_t buffer_size, mhdf_Status *status)
 Given an element type Id, get the name. Fails if buffer is not of sufficient size.
void mhdf_closeFile (mhdf_FileHandle handle, mhdf_Status *status)
 Close the file.
int mhdf_checkOpenHandles (mhdf_FileHandle handle, mhdf_Status *status)
 Check for open handles in file.
void mhdf_closeData (mhdf_FileHandle file, hid_t handle, mhdf_Status *status)
 Common close function for all data handle types.
void mhdf_getNextStartId (mhdf_FileHandle file, mhdf_index_t *start_id_out, mhdf_Status *status)
 Get start ID that will be assigned to next created dataset.
void mhdf_writeHistory (mhdf_FileHandle file, const char **strings, int num_strings, mhdf_Status *status)
 Write the file history as a list of strings.
char ** mhdf_readHistory (mhdf_FileHandle file, int *num_records_out, mhdf_Status *status)
 Read the file history as a list of strings.

Typedef Documentation

typedef void* mhdf_FileHandle

Opaque handle to an open file.

Definition at line 416 of file mhdf.h.


Function Documentation

int mhdf_checkOpenHandles ( mhdf_FileHandle  handle,
mhdf_Status status 
)

Check for open handles in file.

void mhdf_closeData ( mhdf_FileHandle  file,
hid_t  handle,
mhdf_Status status 
)

Common close function for all data handle types.

Close an hid_t-type handle returned from any of the following functions. Any hid_t passed-back or returned must be closed via this function to avoid resource loss.

Parameters:
fileThe file the object pointed to by the passed data handled exists int.
handleThe data object to close.
statusPassed back status of API call.
void mhdf_closeFile ( mhdf_FileHandle  handle,
mhdf_Status status 
)

Close the file.

Parameters:
handleThe file to close.
statusPassed back status of API call.

Get number of open HDF5 objects from file.

mhdf_FileHandle mhdf_createFile ( const char *  filename,
int  overwrite,
const char **  elem_type_list,
size_t  elem_type_list_len,
hid_t  id_type,
mhdf_Status status 
)

Create a new file.

Create a new HDF mesh file. This handle must be closed with mhdf_closeFile to avoid resource loss.

Parameters:
filenameThe path and name of the file to create
overwriteIf zero, will fail if the specified file already exists. If non-zero, will overwrite an existing file.
elem_type_listThe list of element types that will be stored in the file. If the element name exits as a pre- defined constant (Common element type names.), that constant should be used. If a constant does not exist for the type, a similar naming pattern should be used (accepted name for type, first character uppercase, subsequent characters lowercase.) The element type index passed to mhdf_addElement is then an index into this list. The array may contain null entries to allow the caller some control over the assigned indices without creating dummy types which may confuse readers.
elem_type_list_lenThe length of elem_type_list.
id_typeType to use when creating datasets containing file IDs
statusPassed back status of API call.
Returns:
An opaque handle to the file.
void mhdf_fixFileDesc ( struct mhdf_FileDesc copy_ptr,
const struct mhdf_FileDesc orig_addr 
)

Fix nested pointers for copied/moved FileDesc struct.

This is a utility method to facility copying/moving/communicating struct FileDesc instances. The structure and all data it references are allocated in a single contiguous block of memory of size FileDesc::total_size. As such, the struct can be copied with a single memcpy, packed into a single network packet, communicated with a single MPI call, etc. However, the pointers contained within the struct will not be valid in the copied instance (they will still point into the original instance.) Given a pointer to the copied struct and the address of the original struct, this function will updated all contained pointers.

void mhdf_getElemName ( mhdf_FileHandle  file_handle,
unsigned int  type_index,
char *  buffer,
size_t  buffer_size,
mhdf_Status status 
)

Given an element type Id, get the name. Fails if buffer is not of sufficient size.

Parameters:
file_handleThe file.
type_indexThe type index. Corresponds to indices into the element type list passed to mhdf_createFile.
bufferThe buffer into which to copy the name.
buffer_sizeThe length of buffer.
statusPassed back status of API call.
struct mhdf_FileDesc* mhdf_getFileSummary ( mhdf_FileHandle  file_handle,
hid_t  file_id_type,
mhdf_Status status 
) [read]

Get summary of data tables contained within file.

Returned struct, including all pointed-to data, is allocated in a single contiguous block of memory with a size equal to 'total_size'. Caller is responsible for freeing the returned struct FileDesc pointer (and *only* that pointer, not pointers nexted within the struct!). Caller may copy (e.g. MPI_BCast) entire struct as one contiguous block, assuming all nested pointers in the copy are updated to the correct relative offset from the beginning of the struct.

void mhdf_getNextStartId ( mhdf_FileHandle  file,
mhdf_index_t start_id_out,
mhdf_Status status 
)

Get start ID that will be assigned to next created dataset.

Get the first_id parameter that will be returned from the next call to any of mhdf_createNodeCoords, mhdf_createConnectivity, mhdf_createPolyConnectivity, or mhdf_createSetMeta

mhdf_FileHandle mhdf_openFile ( const char *  filename,
int  writable,
unsigned long *  max_id,
hid_t  id_type,
mhdf_Status status 
)

Open an existing file.

Open an existing HDF mesh file. This handle must be closed with mhdf_closeFile to avoid resource loss.

Parameters:
filenameThe path and name of the file to open
writableIf non-zero, open read-write. Otherwise read-only.
statusPassed back status of API call.
max_idUsed to pass back the maximum global ID used in the file. Provided as an indication to the caller of the size of the mesh. This parameter is optional. NULL may be passed.
id_typeType to use when creating datasets containing file IDs
Returns:
An opaque handle to the file.
mhdf_FileHandle mhdf_openFileWithOpt ( const char *  filename,
int  writable,
unsigned long *  max_id,
hid_t  id_type,
hid_t  options,
mhdf_Status status 
)

Open an existing file with options.

Open an existing HDF mesh file. This handle must be closed with mhdf_closeFile to avoid resource loss. This function allows the calling application to specify the HDF5 access property list that is passed to the HDF5 H5Fopen API. If this is passed as H5P_DEFAULT, the behavior is the same as mhdf_openFile . This argument is typically used to specify a parallel context for for writing the file in parallel.

Parameters:
filenameThe path and name of the file to open
writableIf non-zero, open read-write. Otherwise read-only.
statusPassed back status of API call.
max_idUsed to pass back the maximum global ID used in the file. Provided as an indication to the caller of the size of the mesh. This parameter is optional. NULL may be passed.
optionsThe HDF5 access property list to use when opening the file. See the HDF5 documentation for H5Fopen.
id_typeType to use when creating datasets containing file IDs
Returns:
An opaque handle to the file.
char** mhdf_readHistory ( mhdf_FileHandle  file,
int *  num_records_out,
mhdf_Status status 
)

Read the file history as a list of strings.

Each entry is composed of four strings: application, version, date, and time.

Strings and array are allocated with malloc. Caller must release them by calling free

Parameters:
fileThe file.
num_records_outThe length of the returned array.
statusPassed back status of API call.
Returns:
An array of null-terminates strings.
void mhdf_writeHistory ( mhdf_FileHandle  file,
const char **  strings,
int  num_strings,
mhdf_Status status 
)

Write the file history as a list of strings.

Each entry is composed of four strings: application, version, date, and time.

Parameters:
fileThe file.
stringsAn array of null-terminated strings.
num_stringsThe length of strings
statusPassed back status of API call.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines