#include "moab/mhdf_public.h"
Go to the source code of this file.
Macros | |
#define | MHDF_INDEX_TYPE H5T_NATIVE_LONG |
#define | mhdf_SET_OWNER_BIT 0x1 |
Make entities in set aware of owning set (MOAB-specific?) More... | |
#define | mhdf_SET_UNIQUE_BIT 0x2 |
Set cannot contain duplicates. More... | |
#define | mhdf_SET_ORDER_BIT 0x4 |
Set order is preserved. More... | |
#define | mhdf_SET_RANGE_BIT 0x8 |
The bit specifying set storage format. More... | |
#define | mhdf_DENSE_TYPE 2 |
Was dense tag data in mesh database. More... | |
#define | mhdf_SPARSE_TYPE 1 |
Was sparse tag data in mesh database. More... | |
#define | mhdf_BIT_TYPE 0 |
Was bit-field tag data in mesh database. More... | |
#define | mhdf_MESH_TYPE 3 |
Unused. More... | |
Functions | |
const char * | mhdf_node_type_handle (void) |
Get an mhdf_ElemHandle object for the node data. More... | |
const char * | mhdf_set_type_handle (void) |
Return a special element group handle used to specify the set group. More... | |
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. More... | |
int | mhdf_checkOpenHandles (mhdf_FileHandle handle, mhdf_Status *status) |
void | mhdf_closeData (mhdf_FileHandle file, hid_t handle, mhdf_Status *status) |
Common close function for all data handle types. More... | |
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. More... | |
void | mhdf_writeHistory (mhdf_FileHandle file, const char **strings, int num_strings, mhdf_Status *status) |
Write the file history as a list of strings. More... | |
char ** | mhdf_readHistory (mhdf_FileHandle file, int *num_records_out, mhdf_Status *status) |
Read the file history as a list of strings. More... | |
int | mhdf_haveNodes (mhdf_FileHandle file_handle, mhdf_Status *status) |
hid_t | mhdf_createNodeCoords (mhdf_FileHandle file_handle, int dimension, long num_nodes, long *first_node_id_out, mhdf_Status *status) |
Create new table for node coordinate data. More... | |
hid_t | mhdf_openNodeCoords (mhdf_FileHandle file_handle, long *num_nodes_out, int *dimension_out, long *first_node_id_out, mhdf_Status *status) |
Open table containing node coordinate data. More... | |
hid_t | mhdf_openNodeCoordsSimple (mhdf_FileHandle file_handle, mhdf_Status *status) |
void | mhdf_writeNodeCoords (hid_t data_handle, long offset, long count, const double *coords, mhdf_Status *status) |
Write node coordinate data. More... | |
void | mhdf_writeNodeCoordsWithOpt (hid_t data_handle, long offset, long count, const double *coords, hid_t write_prop, mhdf_Status *status) |
void | mhdf_writeNodeCoord (hid_t data_handle, long offset, long count, int dimension, const double *coords, mhdf_Status *status) |
Write node coordinate data. More... | |
void | mhdf_writeNodeCoordWithOpt (hid_t data_handle, long offset, long count, int dimension, const double *coords, hid_t write_prop, mhdf_Status *status) |
void | mhdf_readNodeCoords (hid_t data_handle, long offset, long count, double *coordinates, mhdf_Status *status) |
Read node coordinate data. More... | |
void | mhdf_readNodeCoordsWithOpt (hid_t data_handle, long offset, long count, double *coordinates, hid_t read_prop, mhdf_Status *status) |
void | mhdf_readNodeCoord (hid_t data_handle, long offset, long count, int dimension, double *coords, mhdf_Status *status) |
Read node coordinate data. More... | |
void | mhdf_readNodeCoordWithOpt (hid_t data_handle, long offset, long count, int dimension, double *coords, hid_t read_prop, mhdf_Status *status) |
void | mhdf_addElement (mhdf_FileHandle file_handle, const char *elem_handle, unsigned int named_elem_type, mhdf_Status *status) |
Add a new table of element data to the file. More... | |
char ** | mhdf_getElemHandles (mhdf_FileHandle file_handle, unsigned int *count_out, mhdf_Status *status) |
Get the list of element groups in the file. More... | |
void | mhdf_getElemTypeName (mhdf_FileHandle file_handle, const char *elem_handle, char *buffer, size_t buf_len, mhdf_Status *status) |
Get the element type name for a given element group handle. More... | |
int | mhdf_isPolyElement (mhdf_FileHandle file_handle, const char *elem_handle, mhdf_Status *status) |
Check if an element group contains polygon or polyhedron. More... | |
hid_t | mhdf_createConnectivity (mhdf_FileHandle file_handle, const char *elem_handle, int num_nodes_per_elem, long num_elements, long *first_elem_id_out, mhdf_Status *status) |
Create connectivity table for an element group. More... | |
hid_t | mhdf_openConnectivity (mhdf_FileHandle file_handle, const char *elem_handle, int *num_nodes_per_elem_out, long *num_elements_out, long *first_elem_id_out, mhdf_Status *status) |
Open connectivity table for an element group. More... | |
hid_t | mhdf_openConnectivitySimple (mhdf_FileHandle file_handle, const char *elem_handle, mhdf_Status *status) |
void | mhdf_writeConnectivity (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, const void *node_id_list, mhdf_Status *status) |
Write element coordinate data. More... | |
void | mhdf_writeConnectivityWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, const void *node_id_list, hid_t write_prop, mhdf_Status *status) |
void | mhdf_readConnectivity (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *node_id_list, mhdf_Status *status) |
Read element coordinate data. More... | |
void | mhdf_readConnectivityWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *node_id_list, hid_t read_prop, mhdf_Status *status) |
void | mhdf_createPolyConnectivity (mhdf_FileHandle file_handle, const char *elem_handle, long num_poly, long data_list_length, long *first_id_out, hid_t idx_and_id_handles_out[2], mhdf_Status *status) |
Create a new table for polygon or polyhedron connectivity data. More... | |
void | mhdf_openPolyConnectivity (mhdf_FileHandle file_handle, const char *elem_handle, long *num_poly_out, long *data_list_length_out, long *first_id_out, hid_t idx_and_id_handles_out[2], mhdf_Status *status) |
Open a table of polygon or polyhedron connectivity data. More... | |
void | mhdf_writePolyConnIndices (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, const void *index_list, mhdf_Status *status) |
Write polygon or polyhedron index data. More... | |
void | mhdf_writePolyConnIndicesWithOpt (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, const void *index_list, hid_t write_prop, mhdf_Status *status) |
void | mhdf_writePolyConnIDs (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, const void *id_list, mhdf_Status *status) |
Write polygon or polyhedron connectivity data. More... | |
void | mhdf_writePolyConnIDsWithOpt (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, const void *id_list, hid_t write_prop, mhdf_Status *status) |
void | mhdf_readPolyConnIndices (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, void *index_list, mhdf_Status *status) |
Read polygon or polyhedron index data. More... | |
void | mhdf_readPolyConnIndicesWithOpt (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, void *index_list, hid_t read_prop, mhdf_Status *status) |
void | mhdf_readPolyConnIDs (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, void *id_list, mhdf_Status *status) |
Read polygon or polyhedron connectivity data. More... | |
void | mhdf_readPolyConnIDsWithOpt (hid_t poly_handle, long offset, long count, hid_t hdf_integer_type, void *id_list, hid_t read_prop, mhdf_Status *status) |
hid_t | mhdf_createAdjacency (mhdf_FileHandle file_handle, const char *elem_handle, long adj_list_size, mhdf_Status *status) |
Create adjacency data table for nodes, elements, polys, etc. More... | |
int | mhdf_haveAdjacency (mhdf_FileHandle file, const char *elem_handle, mhdf_Status *status) |
Check if adjacency data is present in the file for the specified element group. More... | |
hid_t | mhdf_openAdjacency (mhdf_FileHandle file_handle, const char *elem_handle, long *adj_list_size, mhdf_Status *status) |
Open adjacency data table for nodes, elements, polys, etc. More... | |
void | mhdf_writeAdjacency (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, const void *adj_list_data, mhdf_Status *status) |
Write node/element adjacency data. More... | |
void | mhdf_writeAdjacencyWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, const void *adj_list_data, hid_t write_prop, mhdf_Status *status) |
void | mhdf_readAdjacency (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *adj_list_data_out, mhdf_Status *status) |
Read node/element adjacency data. More... | |
void | mhdf_readAdjacencyWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *adj_list_data_out, hid_t read_prop, mhdf_Status *status) |
hid_t | mhdf_createSetMeta (mhdf_FileHandle file_handle, long num_sets, long *first_set_id_out, mhdf_Status *status) |
Create table holding list of meshsets and their properties. More... | |
int | mhdf_haveSets (mhdf_FileHandle file, int *have_set_data_out, int *have_set_child_out, int *have_set_parents_out, mhdf_Status *status) |
Check if file contains any sets. More... | |
hid_t | mhdf_openSetMeta (mhdf_FileHandle file_handle, long *num_sets_out, long *first_set_id_out, mhdf_Status *status) |
Open table holding list of meshsets and their properties. More... | |
hid_t | mhdf_openSetMetaSimple (mhdf_FileHandle file_handle, mhdf_Status *status) |
void | mhdf_readSetMeta (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *set_desc_data, mhdf_Status *status) |
Read list of sets and meta-information about sets. More... | |
void | mhdf_readSetMetaWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *set_desc_data, hid_t read_prop, mhdf_Status *status) |
void | mhdf_readSetFlags (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *set_flag_data, mhdf_Status *status) |
Read only the flags portion of the set description table. More... | |
void | mhdf_readSetFlagsWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *set_flag_data, hid_t read_prop, mhdf_Status *status) |
void | mhdf_readSetContentEndIndices (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *end_indices_out, mhdf_Status *status) |
Read only the content end indices portion of the set description table. More... | |
void | mhdf_readSetContentEndIndicesWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *end_indices_out, hid_t read_prop, mhdf_Status *status) |
void | mhdf_readSetChildEndIndices (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *end_indices_out, mhdf_Status *status) |
Read only the child end indices portion of the set description table. More... | |
void | mhdf_readSetChildEndIndicesWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *end_indices_out, hid_t read_prop, mhdf_Status *status) |
void | mhdf_readSetParentEndIndices (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *end_indices_out, mhdf_Status *status) |
Read only the parent end indices portion of the set description table. More... | |
void | mhdf_readSetParentEndIndicesWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *end_indices_out, hid_t read_prop, mhdf_Status *status) |
void | mhdf_writeSetMeta (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, const void *set_desc_data, mhdf_Status *status) |
Write list of sets and meta-information about sets. More... | |
void | mhdf_writeSetMetaWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, const void *set_desc_data, hid_t write_prop, mhdf_Status *status) |
hid_t | mhdf_createSetData (mhdf_FileHandle file_handle, long data_list_size, mhdf_Status *status) |
Create file object to hold list of meshset contents. More... | |
hid_t | mhdf_openSetData (mhdf_FileHandle file_handle, long *data_list_size_out, mhdf_Status *status) |
Open the file object for the meshset contents. More... | |
void | mhdf_writeSetData (hid_t set_handle, long offset, long count, hid_t hdf_integer_type, const void *set_data, mhdf_Status *status) |
Write set contents. More... | |
void | mhdf_writeSetDataWithOpt (hid_t set_handle, long offset, long count, hid_t hdf_integer_type, const void *set_data, hid_t write_prop, mhdf_Status *status) |
void | mhdf_readSetData (hid_t set_handle, long offset, long count, hid_t hdf_integer_type, void *set_data, mhdf_Status *status) |
Read set contents. More... | |
void | mhdf_readSetDataWithOpt (hid_t set_handle, long offset, long count, hid_t hdf_integer_type, void *set_data, hid_t read_prop, mhdf_Status *status) |
hid_t | mhdf_createSetChildren (mhdf_FileHandle file_handle, long child_list_size, mhdf_Status *status) |
Create file object for storing the set child list. More... | |
hid_t | mhdf_openSetChildren (mhdf_FileHandle file_handle, long *child_list_size, mhdf_Status *status) |
Open the file object containing the set child list. More... | |
hid_t | mhdf_createSetParents (mhdf_FileHandle file_handle, long parent_list_size, mhdf_Status *status) |
Create file object for storing the set parent list. More... | |
hid_t | mhdf_openSetParents (mhdf_FileHandle file_handle, long *parent_list_size, mhdf_Status *status) |
Open the file object containing the set parent list. More... | |
void | mhdf_writeSetParentsChildren (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, const void *id_list, mhdf_Status *status) |
Write set parent/child list. More... | |
void | mhdf_writeSetParentsChildrenWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, const void *id_list, hid_t write_prop, mhdf_Status *status) |
void | mhdf_readSetParentsChildren (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *id_list, mhdf_Status *status) |
Read set parent/child list. More... | |
void | mhdf_readSetParentsChildrenWithOpt (hid_t data_handle, long offset, long count, hid_t hdf_integer_type, void *id_list, hid_t read_prop, mhdf_Status *status) |
hid_t | mhdf_getNativeType (hid_t input_type, int size, mhdf_Status *status) |
Make type native-endian. More... | |
void | mhdf_createTag (mhdf_FileHandle file_handle, const char *tag_name, enum mhdf_TagDataType tag_type, int size, int storage, const void *default_value, const void *global_value, hid_t hdf_type, hid_t mhdf_base_type, mhdf_Status *status) |
Add a tag to the file. More... | |
hid_t | mhdf_getTagDataType (mhdf_FileHandle file_handle, const char *tag_name, mhdf_Status *status) |
Get handle to HDF5 type object for tag data. More... | |
void | mhdf_createVarLenTag (mhdf_FileHandle file_handle, const char *tag_name, enum mhdf_TagDataType tag_type, int storage, const void *default_value, int default_value_length, const void *global_value, int global_value_length, hid_t hdf_type, hid_t hdf_base_type, mhdf_Status *status) |
Add variable-length tag to file. More... | |
int | mhdf_getNumberTags (mhdf_FileHandle file_handle, mhdf_Status *status) |
Get the number of tags in the file. More... | |
char ** | mhdf_getTagNames (mhdf_FileHandle file_handle, int *num_names_out, mhdf_Status *status) |
Get the name for each tag defined in the file. More... | |
void | mhdf_getTagInfo (mhdf_FileHandle file_handle, const char *tag_name, enum mhdf_TagDataType *class_out, int *size_out, int *tstt_storage_out, int *have_default_out, int *have_global_out, int *have_sparse_out, mhdf_Status *status) |
Get the description of a specified tag. More... | |
void | mhdf_getTagValues (mhdf_FileHandle file_handle, const char *tag_name, hid_t output_data_type, void *default_value, void *global_value, mhdf_Status *status) |
Get the default and global values of the tag. More... | |
int | mhdf_haveDenseTag (mhdf_FileHandle file_handle, const char *tag_name, const char *elem_group, mhdf_Status *status) |
Check if the file contains dense tag data for the specified tag and element group. More... | |
hid_t | mhdf_createDenseTagData (mhdf_FileHandle file_handle, const char *tag_name, const char *elem_group, long num_values, mhdf_Status *status) |
Create an object to hold dense tag values for a given element group. More... | |
hid_t | mhdf_openDenseTagData (mhdf_FileHandle file_handle, const char *tag_name, const char *elem_group, long *num_values_out, mhdf_Status *status) |
Open the object containing dense tag values for a given element group. More... | |
void | mhdf_createSparseTagData (mhdf_FileHandle file_handle, const char *tag_name, long num_values, hid_t entities_and_values_out[2], mhdf_Status *status) |
Create file objects to store sparse tag data. More... | |
void | mhdf_createVarLenTagData (mhdf_FileHandle file_handle, const char *tag_name, long num_entities, long num_values, hid_t entities_and_values_out[3], mhdf_Status *status) |
Create file objects to store (sparse) variable-length tag data. More... | |
void | mhdf_openSparseTagData (mhdf_FileHandle file_handle, const char *tag_name, long *num_entity_out, long *num_values_out, hid_t entities_and_values_out[3], mhdf_Status *status) |
Create file objects to read sparse tag data. More... | |
void | mhdf_writeSparseTagEntities (hid_t id_handle, long offset, long count, hid_t hdf_integer_type, const void *id_list, mhdf_Status *status) |
Write Global ID list for sparse tag data. More... | |
void | mhdf_writeSparseTagEntitiesWithOpt (hid_t id_handle, long offset, long count, hid_t hdf_integer_type, const void *id_list, hid_t write_prop, mhdf_Status *status) |
void | mhdf_writeTagValues (hid_t value_handle, long offset, long count, hid_t hdf_tag_data_type, const void *tag_data, mhdf_Status *status) |
Write tag values. More... | |
void | mhdf_writeTagValuesWithOpt (hid_t value_handle, long offset, long count, hid_t hdf_tag_data_type, const void *tag_data, hid_t write_prop, mhdf_Status *status) |
void | mhdf_writeSparseTagIndices (hid_t tag_handle, long offset, long count, hid_t hdf_integer_type, const void *end_indices, mhdf_Status *status) |
Write sparse tag end indices for variable-length tag data. More... | |
void | mhdf_writeSparseTagIndicesWithOpt (hid_t tag_handle, long offset, long count, hid_t hdf_integer_type, const void *end_indices, hid_t write_prop, mhdf_Status *status) |
void | mhdf_readSparseTagEntities (hid_t id_handle, long offset, long count, hid_t hdf_integer_type, void *id_list, mhdf_Status *status) |
Read Global ID list for sparse tag data. More... | |
void | mhdf_readSparseTagEntitiesWithOpt (hid_t id_handle, long offset, long count, hid_t hdf_integer_type, void *id_list, hid_t read_prop, mhdf_Status *status) |
void | mhdf_readTagValues (hid_t value_handle, long offset, long count, hid_t hdf_type, void *memory, mhdf_Status *status) |
Read tag values. More... | |
void | mhdf_readTagValuesWithOpt (hid_t value_handle, long offset, long count, hid_t hdf_type, void *memory, hid_t read_prop, mhdf_Status *status) |
void | mhdf_readSparseTagIndices (hid_t tag_handle, long offset, long count, hid_t hdf_integer_type, void *end_indices, mhdf_Status *status) |
Read sparse tag end indices for variable-length tag data. More... | |
void | mhdf_readSparseTagIndicesWithOpt (hid_t tag_handle, long offset, long count, hid_t hdf_integer_type, void *end_indices, hid_t read_prop, mhdf_Status *status) |
#define mhdf_BIT_TYPE 0 |
#define mhdf_DENSE_TYPE 2 |
Was dense tag data in mesh database.
Tag data.
The data for each tag can be stored in two places/formats: sparse and/or dense. The data may be stored in both, but there should not be redundant values for the same entity.
Dense tag data is stored as multiple tables of tag values, one for each element group. (Note: special mhdf_ElemHandle values are available for accessing dense tag data on nodes or meshsets via the mhdf_node_type_handle and mhdf_set_type_handle functions.) Each dense tag table should contain the same number of entries as the element connectivity table. The tag values are associated with the corresponding element in the connectivity table.
Sparse tag data is stored as a global table pair for each tag type. The first if the pair of tables is a list of Global IDs. The second is the corresponding tag value for each entity in the ID list. Tag type values (MOAB-specific)
#define mhdf_SET_OWNER_BIT 0x1 |
Make entities in set aware of owning set (MOAB-specific?)
Meshset data.
Meshset data is divided into three groups of data. The set-list/meta-information table, the set contents table and the set children table. Each is written and read independently.
The set list table contains one row for each set. Each row contains four values: {content list end index, child list end index, parent list end index, and flags}. The flags value is a collection of bits with values defined in mhdf_set_flag . The all the flags except mhdf_SET_RANGE_BIT are saved properties of the mesh data and are not relevant to the actual file in any way. The mhdf_SET_RANGE_BIT flag is a toggle for how the meshset contents (not children) are saved. It is an internal property of the file format and should not be passed on to the mesh database. The content list end index and child list end index are the indices of the last entry for the set in the contents and children tables respectively. In the case where a set has either no children or no contents, the last index of should be the same as the last index of the previous set in the table, or -1 for the first set in the table. Thus the first index is always one greater than the last index of the previous set. If the first index, calculated as one greater that the last index of the previous set is greater than the last index of the current set, then there are no values in the corresponding contents or children table for that set.
The set contents table is a vector of integer global IDs that is the concatenation of the contents data for all of the mesh sets. The values are stored corresponding to the order of the sets in the set list table. Depending on the value of mhdf_SET_RANGE_BIT in the flags field of the set list table, the contents for a specific set may be stored in one of two formats. If the flag is set, the contents list is a list of pairs where each pair is a starting global Id and a count. For each pair, the set contains the range of global Ids beginning at the start value. If the mhdf_SET_RANGE_BIT flag is not set, the meshset contents are a simple list of global Ids.
The meshset child table is a vector of integer global IDs. It is a concatenation of the child lists for all the mesh sets, in the order the sets occur in the meshset list table. The values are always simple lists. The child table may never contain ranges of IDs. Set flag bits
#define mhdf_SET_RANGE_BIT 0x8 |
The bit specifying set storage format.
If this bit is set, then the contents of a set (not the children) is written as set of ranges, where each range is of the form {global start id, count}. For such a range, the set contains the count
entities with sequential global IDs beginning with the specified start ID. If this bit is not set in the set flags, the contents of the set are stored as a simple list of global IDs.
#define mhdf_SET_UNIQUE_BIT 0x2 |
#define mhdf_SPARSE_TYPE 1 |
void mhdf_addElement | ( | mhdf_FileHandle | file_handle, |
const char * | elem_handle, | ||
unsigned int | named_elem_type, | ||
mhdf_Status * | status | ||
) |
Add a new table of element data to the file.
Add a element group to the file. An element group is the data for a block of elements with the same TSTT type and same number of nodes in their connectivity data. (e.g. all the MBHEX20 elements). This function is also used to create the groups for general polygon data and general polyhedron data. The requirement that all elements have the same number of nodes in their connectivity does not apply for poly(gons|hedra).
file_handle | File in which to create the element type. |
elem_handle | The name to use for the element data. This name is used as an identifier to reference the data for this element type later. The selected name also appears explicitly in the file and therefore should be something descriptive of the element type such as the 'base type' and number of nodes (e.g. "Hex20"). |
named_elem_type | An index into the list of named element types passed to mhdf_createFile . |
status | Passed back status of API call. |
Definition at line 507 of file file.c.
508 {
509 FileHandle* file_ptr = (FileHandle*)file_handle;
510 hid_t group_id, tag_id, enum_id;
511 char *path, *ptr;
512 size_t name_len;
513 herr_t rval;
514 API_BEGIN;
515
516 if( !mhdf_check_valid_file( file_ptr, status ) ) return;
517
518 name_len = mhdf_name_to_path( name, NULL, 0 );
519 name_len += strlen( ELEMENT_GROUP ) + 1;
520 path = (char*)mhdf_malloc( name_len, status );
521 if( !path ) return;
522
523 strcpy( path, ELEMENT_GROUP );
524 ptr = path + strlen( ELEMENT_GROUP );
525 if( !mhdf_path_to_name( name, ptr ) )
526 {
527 mhdf_setFail( status, "Invalid character string in internal file path: \"%s\"\n", name );
528 return;
529 }
530
531 #if defined( H5Gcreate_vers ) && H5Gcreate_vers > 1
532 group_id = H5Gcreate2( file_ptr->hdf_handle, path, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
533 #else
534 group_id = H5Gcreate( file_ptr->hdf_handle, path, 3 );
535 #endif
536 if( group_id < 0 )
537 {
538 mhdf_setFail( status, "Creation of \"%s\" group failed.\n", path );
539 free( path );
540 return;
541 }
542 free( path );
543
544 #if defined( H5Gcreate_vers ) && H5Gcreate_vers > 1
545 tag_id = H5Gcreate2( group_id, DENSE_TAG_SUBGROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
546 #else
547 tag_id = H5Gcreate( group_id, DENSE_TAG_SUBGROUP, 0 );
548 #endif
549 if( tag_id < 0 )
550 {
551 H5Gclose( group_id );
552 mhdf_setFail( status, "Creation of tag subgroup failed.\n" );
553 return;
554 }
555 H5Gclose( tag_id );
556
557 enum_id = get_elem_type_enum( file_ptr, status );
558 if( enum_id < 0 )
559 {
560 H5Gclose( group_id );
561 return;
562 }
563
564 rval = H5Tconvert( H5T_NATIVE_UINT, H5Tget_super( enum_id ), 1, &elem_type, NULL, H5P_DEFAULT );
565 if( rval < 0 )
566 {
567 H5Gclose( group_id );
568 H5Tclose( enum_id );
569 mhdf_setFail( status, "Internal error converting to enum type." );
570 return;
571 }
572
573 rval = mhdf_create_scalar_attrib( group_id, ELEM_TYPE_ATTRIB, enum_id, &elem_type, status );
574 H5Tclose( enum_id );
575 if( rval < 0 )
576 {
577 H5Gclose( group_id );
578 return;
579 }
580
581 H5Gclose( group_id );
582 mhdf_setOkay( status );
583 API_END;
584 }
References API_BEGIN, API_END, DENSE_TAG_SUBGROUP, ELEM_TYPE_ATTRIB, ELEMENT_GROUP, get_elem_type_enum(), struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_create_scalar_attrib(), mhdf_malloc(), mhdf_name_to_path(), mhdf_path_to_name(), mhdf_setFail(), and mhdf_setOkay().
Referenced by moab::WriteHDF5::create_elem_table().
int mhdf_checkOpenHandles | ( | mhdf_FileHandle | handle, |
mhdf_Status * | status | ||
) |
Definition at line 409 of file file.c.
410 {
411 FileHandle* file_ptr;
412 int result;
413 API_BEGIN;
414
415 file_ptr = (FileHandle*)( handle );
416 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
417
418 /* Check for open handles. HDF5 will not actually close the
419 file until all handles are closed. */
420 result = H5Fget_obj_count( file_ptr->hdf_handle, H5F_OBJ_ALL );
421 if( result != 1 )
422 {
423 mhdf_setFail( status,
424 "Cannot close file with open handles: "
425 "%d file, %d data, %d group, %d type, %d attr\n",
426 H5Fget_obj_count( file_ptr->hdf_handle, H5F_OBJ_FILE ) - 1,
427 H5Fget_obj_count( file_ptr->hdf_handle, H5F_OBJ_DATASET ),
428 H5Fget_obj_count( file_ptr->hdf_handle, H5F_OBJ_GROUP ),
429 H5Fget_obj_count( file_ptr->hdf_handle, H5F_OBJ_DATATYPE ),
430 H5Fget_obj_count( file_ptr->hdf_handle, H5F_OBJ_ATTR ) );
431 return result - 1;
432 }
433
434 API_END_H( 0 );
435 return 0;
436 }
References API_BEGIN, API_END_H, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), and mhdf_setFail().
Referenced by mhdf_closeFile().
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.
file | The file the object pointed to by the passed data handled exists int. |
handle | The data object to close. |
status | Passed back status of API call. |
Definition at line 470 of file file.c.
471 {
472 FileHandle* file_ptr;
473 herr_t rval = -1;
474
475 file_ptr = (FileHandle*)( file );
476 if( !mhdf_check_valid_file( file_ptr, status ) ) return;
477
478 switch( H5Iget_type( handle ) )
479 {
480 case H5I_GROUP:
481 rval = H5Gclose( handle );
482 break;
483 case H5I_DATATYPE:
484 rval = H5Tclose( handle );
485 break;
486 case H5I_DATASPACE:
487 rval = H5Sclose( handle );
488 break;
489 case H5I_DATASET:
490 rval = H5Dclose( handle );
491 break;
492 default:
493 rval = -1;
494 }
495
496 if( rval < 0 )
497 {
498 mhdf_setFail( status, "H5Xclose failed. Invalid handle?\n" );
499 }
500 else
501 {
502 file_ptr->open_handle_count--;
503 mhdf_setOkay( status );
504 }
505 }
References mhdf_check_valid_file(), mhdf_setFail(), mhdf_setOkay(), and struct_FileHandle::open_handle_count.
Referenced by check_valid_adjacencies(), check_valid_elem_conn(), check_valid_poly_conn(), check_valid_sets(), check_valid_tag(), check_valid_var_len_tag(), moab::WriteHDF5Parallel::create_adjacency_tables(), moab::WriteHDF5::create_elem_table(), moab::WriteHDF5Parallel::create_node_table(), moab::WriteHDF5::create_set_meta(), moab::WriteHDF5::create_set_tables(), moab::WriteHDF5::create_tag(), moab::ReadHDF5::find_sets_containing(), get_elem_desc(), moab::ReadHDF5::get_tagged_entities(), moab::ReadHDF5::load_file_impl(), moab::ReadHDF5::load_file_partial(), main(), mhdf_getFileSummary(), moab::ReadHDF5::read_all_set_meta(), moab::ReadHDF5::read_node_adj_elems(), moab::ReadHDF5::read_nodes(), moab::ReadHDF5::read_tag(), moab::ReadHDF5::read_tag_values_all(), moab::ReadHDF5::search_tag_values(), moab::WriteHDF5::serial_create_file(), moab::WriteHDF5::write_adjacencies(), moab::WriteHDF5::write_dense_tag(), moab::WriteHDF5::write_elems(), moab::WriteHDF5::write_nodes(), moab::WriteHDF5::write_sets(), moab::WriteHDF5::write_sparse_tag(), and moab::WriteHDF5::write_var_len_tag().
hid_t mhdf_createAdjacency | ( | mhdf_FileHandle | file_handle, |
const char * | elem_handle, | ||
long | adj_list_size, | ||
mhdf_Status * | status | ||
) |
Create adjacency data table for nodes, elements, polys, etc.
Adjacency data.
Adjacency data is formated as a sequence of integer groups where the first entry in each group is the ID of the element for which adjacencies are being specified, the second value is the count of adjacent entities, and the remainder of the group is the list of IDs of the adjacent entities.
Create file object for adjacency data for a nodes or a specified element group.
Adjacency data is formated as a sequence of integer groups where the first entry in each group is the ID of the element for which adjacencies are being specified, the second value is the count of adjacent entities, and the remainder of the group is the list of IDs of the adjacent entities.
file_handle | The file. |
elem_handle | The element group (or the result of mhdf_node_type_handle for nodes) for which the adjacency data is to be specified. |
adj_list_size | The total number of integer values contained in the adjacency data for the specified element group. |
status | Passed back status of API call. |
Definition at line 61 of file adjacency.c.
62 {
63 FileHandle* file_ptr;
64 hid_t elem_id, table_id;
65 hsize_t dim = (hsize_t)adj_list_size;
66 API_BEGIN;
67
68 file_ptr = (FileHandle*)( file );
69 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
70
71 if( adj_list_size < 1 )
72 {
73 mhdf_setFail( status, "Invalid argument.\n" );
74 return -1;
75 }
76
77 if( elem_handle == mhdf_node_type_handle() )
78 {
79 table_id = mhdf_create_table( file_ptr->hdf_handle, NODE_ADJCY_PATH, file_ptr->id_type, 1, &dim, status );
80 }
81 else
82 {
83 elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status );
84 if( elem_id < 0 ) return -1;
85
86 table_id = mhdf_create_table( elem_id, ADJACENCY_NAME, file_ptr->id_type, 1, &dim, status );
87 H5Gclose( elem_id );
88 }
89
90 API_END_H( 1 );
91 return table_id;
92 }
References ADJACENCY_NAME, API_BEGIN, API_END_H, dim, struct_FileHandle::hdf_handle, struct_FileHandle::id_type, mhdf_check_valid_file(), mhdf_create_table(), mhdf_elem_group_from_handle(), mhdf_node_type_handle(), mhdf_setFail(), and NODE_ADJCY_PATH.
Referenced by moab::WriteHDF5Parallel::create_adjacency_tables(), and moab::WriteHDF5::serial_create_file().
hid_t mhdf_createConnectivity | ( | mhdf_FileHandle | file_handle, |
const char * | elem_handle, | ||
int | nodes_per_elem, | ||
long | count, | ||
long * | first_id_out, | ||
mhdf_Status * | status | ||
) |
Create connectivity table for an element group.
Create fixed-connectivity data for an element group. Do NOT use this function for poly(gon/hedron) data.
file_handle | The file. |
elem_handle | The element group. |
num_nodes_per_elem | The number of nodes in the connectivity data for each element. |
num_elements | The number of elements to be written to the table. |
first_elem_id_out | Elements are assigned global IDs in sequential blocks where the block is the table in which their connectivity data is written and the sequence is the sequence in which they are written in that table. The global ID for the first element in this group is passed back at this address. The global IDs for all other elements in the table are assigned in the sequence in which they are written in the table. |
status | Passed back status of API call. |
MOAB, a Mesh-Oriented datABase, is a software component for creating, storing and accessing finite element mesh data.
Copyright 2004 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
Definition at line 26 of file connectivity.c.
32 {
33 FileHandle* file_ptr;
34 hid_t elem_id, table_id;
35 hsize_t dims[2];
36 long first_id;
37 API_BEGIN;
38
39 file_ptr = (FileHandle*)( file_handle );
40 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
41
42 if( nodes_per_elem <= 0 || count < 0 || !first_id_out )
43 {
44 mhdf_setFail( status, "Invalid argument." );
45 return -1;
46 }
47
48 elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status );
49 if( elem_id < 0 ) return -1;
50
51 dims[0] = (hsize_t)count;
52 dims[1] = (hsize_t)nodes_per_elem;
53 table_id = mhdf_create_table( elem_id, CONNECTIVITY_NAME, file_ptr->id_type, 2, dims, status );
54 H5Gclose( elem_id );
55 if( table_id < 0 ) return -1;
56
57 first_id = file_ptr->max_id + 1;
58 if( !mhdf_create_scalar_attrib( table_id, START_ID_ATTRIB, H5T_NATIVE_LONG, &first_id, status ) )
59 {
60 H5Dclose( table_id );
61 return -1;
62 }
63
64 *first_id_out = first_id;
65 file_ptr->max_id += count;
66 if( !mhdf_write_max_id( file_ptr, status ) )
67 {
68 H5Dclose( table_id );
69 return -1;
70 }
71 file_ptr->open_handle_count++;
72 mhdf_setOkay( status );
73
74 API_END_H( 1 );
75 return table_id;
76 }
References API_BEGIN, API_END_H, CONNECTIVITY_NAME, struct_FileHandle::id_type, struct_FileHandle::max_id, mhdf_check_valid_file(), mhdf_create_scalar_attrib(), mhdf_create_table(), mhdf_elem_group_from_handle(), mhdf_setFail(), mhdf_setOkay(), mhdf_write_max_id(), struct_FileHandle::open_handle_count, and START_ID_ATTRIB.
Referenced by moab::WriteHDF5::create_elem_table().
hid_t mhdf_createDenseTagData | ( | mhdf_FileHandle | file_handle, |
const char * | tag_name, | ||
const char * | elem_group, | ||
long | num_values, | ||
mhdf_Status * | status | ||
) |
Create an object to hold dense tag values for a given element group.
file_handle | The file. |
tag_name | The tag. |
elem_group | The element group handle, or the return value of mhdf_node_type_handle or mhdf_set_type_handle for nodes or sets respectively. |
num_values | The number of tag values to be written. Must be The same as the number of elements in the group. Specified here to allow tag values to be written before node coordinates, element connectivity or meshsets. |
status | Passed back status of API call. |
Definition at line 1268 of file tags.c.
1273 {
1274 char* path;
1275 hid_t elem_id, data_id, type_id;
1276 FileHandle* file_ptr;
1277 size_t name_len, path_len, dir_len;
1278 hsize_t size;
1279 API_BEGIN;
1280
1281 file_ptr = (FileHandle*)file_handle;
1282 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
1283
1284 if( type_handle == mhdf_node_type_handle() )
1285 {
1286 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
1287 elem_id = H5Gopen2( file_ptr->hdf_handle, NODE_GROUP, H5P_DEFAULT );
1288 #else
1289 elem_id = H5Gopen( file_ptr->hdf_handle, NODE_GROUP );
1290 #endif
1291 if( elem_id < 0 ) mhdf_setFail( status, "Could not open node group." );
1292 }
1293 else if( type_handle == mhdf_set_type_handle() )
1294 {
1295 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
1296 elem_id = H5Gopen2( file_ptr->hdf_handle, SET_GROUP, H5P_DEFAULT );
1297 #else
1298 elem_id = H5Gopen( file_ptr->hdf_handle, SET_GROUP );
1299 #endif
1300 if( elem_id < 0 ) mhdf_setFail( status, "Could not open set group." );
1301 }
1302 else
1303 {
1304 elem_id = mhdf_elem_group_from_handle( file_ptr, type_handle, status );
1305 }
1306 if( elem_id < 0 ) return -1;
1307
1308 dir_len = strlen( DENSE_TAG_SUBGROUP );
1309 name_len = mhdf_name_to_path( tag_name, NULL, 0 );
1310 path_len = dir_len + name_len + 1;
1311 path = (char*)mhdf_malloc( path_len, status );
1312 if( NULL == path )
1313 {
1314 H5Gclose( elem_id );
1315 return -1;
1316 }
1317 strcpy( path, DENSE_TAG_SUBGROUP );
1318 mhdf_name_to_path( tag_name, path + dir_len, name_len + 1 );
1319
1320 type_id = get_tag_type( file_ptr, path + dir_len, status );
1321 if( type_id < 0 )
1322 {
1323 H5Gclose( elem_id );
1324 return -1;
1325 }
1326
1327 size = (hsize_t)num_values;
1328 data_id = mhdf_create_table( elem_id, path, type_id, 1, &size, status );
1329 free( path );
1330 H5Gclose( elem_id );
1331 H5Tclose( type_id );
1332
1333 if( data_id > 0 ) mhdf_setOkay( status );
1334
1335 API_END_H( 1 );
1336 return data_id;
1337 }
References API_BEGIN, API_END_H, DENSE_TAG_SUBGROUP, get_tag_type(), struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_create_table(), mhdf_elem_group_from_handle(), mhdf_malloc(), mhdf_name_to_path(), mhdf_node_type_handle(), mhdf_set_type_handle(), mhdf_setFail(), mhdf_setOkay(), NODE_GROUP, SET_GROUP, and size.
Referenced by moab::WriteHDF5::create_tag().
hid_t mhdf_createNodeCoords | ( | mhdf_FileHandle | file_handle, |
int | dimension, | ||
long | num_nodes, | ||
long * | first_node_id_out, | ||
mhdf_Status * | status | ||
) |
Create new table for node coordinate data.
file_handle | The file. |
dimension | Number of coordinate values per node. |
num_nodes | The number of nodes the table will contain. |
first_node_id_out | Nodes are assigned IDs sequentially in the order they occur in the table, where the ID of the first node in the table is this passed-back value. |
status | Passed back status of API call. |
Definition at line 72 of file nodes.c.
77 {
78 FileHandle* file_ptr = (FileHandle*)file_handle;
79 hid_t table_id;
80 hsize_t dims[2];
81 long first_id;
82 API_BEGIN;
83
84 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
85
86 if( dimension < 1 )
87 {
88 mhdf_setFail( status, "Invalid argument: dimension = %d.", dimension );
89 return -1;
90 }
91
92 dims[0] = (hsize_t)num_nodes;
93 dims[1] = (hsize_t)dimension;
94 table_id = mhdf_create_table( file_ptr->hdf_handle, NODE_COORD_PATH, H5T_NATIVE_DOUBLE, 2, dims, status );
95 if( table_id < 0 ) return -1;
96
97 first_id = file_ptr->max_id + 1;
98 if( !mhdf_create_scalar_attrib( table_id, START_ID_ATTRIB, H5T_NATIVE_LONG, &first_id, status ) )
99 {
100 H5Dclose( table_id );
101 return -1;
102 }
103
104 *first_id_out = first_id;
105 file_ptr->max_id += num_nodes;
106 if( !mhdf_write_max_id( file_ptr, status ) )
107 {
108 H5Dclose( table_id );
109 return -1;
110 }
111 file_ptr->open_handle_count++;
112 mhdf_setOkay( status );
113
114 API_END_H( 1 );
115 return table_id;
116 }
References API_BEGIN, API_END_H, struct_FileHandle::hdf_handle, struct_FileHandle::max_id, mhdf_check_valid_file(), mhdf_create_scalar_attrib(), mhdf_create_table(), mhdf_setFail(), mhdf_setOkay(), mhdf_write_max_id(), NODE_COORD_PATH, struct_FileHandle::open_handle_count, and START_ID_ATTRIB.
Referenced by moab::WriteHDF5Parallel::create_node_table(), and moab::WriteHDF5::serial_create_file().
void mhdf_createPolyConnectivity | ( | mhdf_FileHandle | file_handle, |
const char * | elem_handle, | ||
long | num_poly, | ||
long | data_list_length, | ||
long * | first_id_out, | ||
hid_t | idx_and_id_handles_out[2], | ||
mhdf_Status * | status | ||
) |
Create a new table for polygon or polyhedron connectivity data.
Poly (polygon or polyhedron) connectivity is stored as two lists. One list is the concatenation of the the connectivity data for all the polys in the group. The other contains one value per poly where that value is the index of the last entry in the connectivity of the corresponding poly. The ID list for polygons contains global node IDs. The ID list for polyhedra contains the global IDs of faces (either polygons or 2D fixed-connectivity elements.)
file_handle | The file to write. |
elem_handle | The element group. |
num_poly | The total number number of polygons or polyhedra to be written in the table. |
data_list_length | The total number of values to be written to the table (the number of polys plus the sum of the number of entities in each poly's connectivity data.) |
first_id_out | Elements are assigned global IDs in sequential blocks where the block is the table in which their connectivity data is written and the sequence is the sequence in which they are written in that table. The global ID for the first element in this group is passed back at this address. The global IDs for all other elements in the table are assigned in the sequence in which they are written in the table. |
idx_and_id_handles_out | The handles for the index list and connectivity list, respectively. |
status | Passed back status of API call. |
Definition at line 187 of file connectivity.c.
194 {
195 FileHandle* file_ptr;
196 hid_t elem_id, index_id, conn_id;
197 hsize_t dim;
198 long first_id;
199 API_BEGIN;
200
201 file_ptr = (FileHandle*)( file_handle );
202 if( !mhdf_check_valid_file( file_ptr, status ) ) return;
203
204 if( num_poly <= 0 || data_list_length <= 0 || !first_id_out )
205 {
206 mhdf_setFail( status, "Invalid argument." );
207 return;
208 }
209
210 if( data_list_length < 3 * num_poly )
211 {
212 /* Could check agains 4*num_poly, but allow degenerate polys
213 (1 for count plus 2 dim-1 defining entities, where > 2
214 defining entities is a normal poly, 2 defining entities
215 is a degenerate poly and 1 defning entity is not valid.)
216 */
217
218 mhdf_setFail( status,
219 "Invalid polygon data: data length of %ld is "
220 "insufficient for %ld poly(gons/hedra).\n",
221 data_list_length, num_poly );
222 return;
223 }
224
225 elem_id = mhdf_elem_group_from_handle( file_ptr, elem_type, status );
226 if( elem_id < 0 ) return;
227
228 dim = (hsize_t)num_poly;
229 index_id = mhdf_create_table( elem_id, POLY_INDEX_NAME, MHDF_INDEX_TYPE, 1, &dim, status );
230 if( index_id < 0 )
231 {
232 H5Gclose( elem_id );
233 return;
234 }
235
236 dim = (hsize_t)data_list_length;
237 conn_id = mhdf_create_table( elem_id, CONNECTIVITY_NAME, file_ptr->id_type, 1, &dim, status );
238 H5Gclose( elem_id );
239 if( conn_id < 0 )
240 {
241 H5Dclose( index_id );
242 return;
243 }
244
245 first_id = file_ptr->max_id + 1;
246 if( !mhdf_create_scalar_attrib( conn_id, START_ID_ATTRIB, H5T_NATIVE_LONG, &first_id, status ) )
247 {
248 H5Dclose( index_id );
249 H5Dclose( conn_id );
250 return;
251 }
252
253 *first_id_out = first_id;
254 file_ptr->max_id += num_poly;
255 if( !mhdf_write_max_id( file_ptr, status ) )
256 {
257 H5Dclose( index_id );
258 H5Dclose( conn_id );
259 return;
260 }
261 file_ptr->open_handle_count++;
262 mhdf_setOkay( status );
263 handles_out[0] = index_id;
264 handles_out[1] = conn_id;
265 API_END_H( 2 );
266 }
References API_BEGIN, API_END_H, CONNECTIVITY_NAME, dim, struct_FileHandle::id_type, struct_FileHandle::max_id, mhdf_check_valid_file(), mhdf_create_scalar_attrib(), mhdf_create_table(), mhdf_elem_group_from_handle(), MHDF_INDEX_TYPE, mhdf_setFail(), mhdf_setOkay(), mhdf_write_max_id(), struct_FileHandle::open_handle_count, POLY_INDEX_NAME, and START_ID_ATTRIB.
hid_t mhdf_createSetChildren | ( | mhdf_FileHandle | file_handle, |
long | child_list_size, | ||
mhdf_Status * | status | ||
) |
Create file object for storing the set child list.
Create a data group for the list of set children.
The format of this data is the concatenation of the lists of global IDs of child sets for each set. The order of the sets and the number of children for each set is contained in the set meta table. (See mhdf_createSetMeta ).
file_handle | The file |
child_list_size | The total length of the data (the sum of the number of children for each set.) |
status | Passed back status of API call. |
Definition at line 718 of file sets.c.
719 {
720 FileHandle* file_ptr;
721 hid_t table_id;
722 hsize_t dim = (hsize_t)child_list_size;
723 API_BEGIN;
724
725 file_ptr = (FileHandle*)( file_handle );
726 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
727
728 if( child_list_size < 1 )
729 {
730 mhdf_setFail( status, "Invalid argument.\n" );
731 return -1;
732 }
733
734 table_id = mhdf_create_table( file_ptr->hdf_handle, SET_CHILD_PATH, file_ptr->id_type, 1, &dim, status );
735
736 API_END_H( 1 );
737 return table_id;
738 }
References API_BEGIN, API_END_H, dim, struct_FileHandle::hdf_handle, struct_FileHandle::id_type, mhdf_check_valid_file(), mhdf_create_table(), mhdf_setFail(), and SET_CHILD_PATH.
Referenced by moab::WriteHDF5::create_set_tables().
hid_t mhdf_createSetData | ( | mhdf_FileHandle | file_handle, |
long | data_list_size, | ||
mhdf_Status * | status | ||
) |
Create file object to hold list of meshset contents.
Create set contents data object. The format of this data is a vector of integer values which is the concatenation of the contents list for all the meshsets. The length and format of the data for each set is stored in the set meta table. See mhdf_createSetMeta and mhdf_SET_RANGE_BIT for a description of that data.
file_handle | The file. |
data_list_size | The total length (number of integer values) to be written for all the sets. |
status | Passed back status of API call. |
Definition at line 635 of file sets.c.
636 {
637 FileHandle* file_ptr;
638 hid_t table_id;
639 hsize_t dim = (hsize_t)data_list_size;
640 API_BEGIN;
641
642 file_ptr = (FileHandle*)( file_handle );
643 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
644
645 if( data_list_size < 1 )
646 {
647 mhdf_setFail( status, "Invalid argument.\n" );
648 return -1;
649 }
650
651 table_id = mhdf_create_table( file_ptr->hdf_handle, SET_DATA_PATH, file_ptr->id_type, 1, &dim, status );
652
653 API_END_H( 1 );
654 return table_id;
655 }
References API_BEGIN, API_END_H, dim, struct_FileHandle::hdf_handle, struct_FileHandle::id_type, mhdf_check_valid_file(), mhdf_create_table(), mhdf_setFail(), and SET_DATA_PATH.
Referenced by moab::WriteHDF5::create_set_tables().
hid_t mhdf_createSetMeta | ( | mhdf_FileHandle | file_handle, |
long | num_sets, | ||
long * | first_set_id_out, | ||
mhdf_Status * | status | ||
) |
Create table holding list of meshsets and their properties.
The set table contains description of sets, but not contents or children. The table is a n x 4
matrix of values.
One row for each of n
sets. Each row contains the end index for the set in the contents table, the end index for the set in the children table, the end index for the set in the parents table, and the set flags, respectively. The mhdf_SET_RANGE_BIT bit in the flags specifies the format of the contents list for each set. See a description of the mhdf_SET_RANGE_BIT flag for a description of the two possible data formats. The index values in the first two columns of the table are the index of the last value for the set in the corresponding contents and children lists. The first index is always one greater than the last index for the previous set in the table. The first index of the first set in the table is implicitly zero. A special value of -1 in the appropriate column should be used to indicate that the first set contains no contents or has no children. For any other set, if the last index for the set is the same as that of the previous set, it has no data in the corresponding list.
file_handle | The file. |
num_sets | The number of sets in the table. |
first_set_id_out | The global ID that will be assigned to the first set in the table. All subsequent sets in the table will be assigned sequential global IDs. |
status | Passed back status of API call. |
Definition at line 109 of file sets.c.
110 {
111 FileHandle* file_ptr = (FileHandle*)file;
112 hid_t table_id;
113 hsize_t dims[2];
114 long first_id;
115 API_BEGIN;
116
117 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
118
119 dims[0] = (hsize_t)num_sets;
120 dims[1] = (hsize_t)4;
121 table_id = mhdf_create_table( file_ptr->hdf_handle, SET_META_PATH, MHDF_INDEX_TYPE, 2, dims, status );
122 if( table_id < 0 ) return -1;
123
124 first_id = file_ptr->max_id + 1;
125 if( !mhdf_create_scalar_attrib( table_id, START_ID_ATTRIB, H5T_NATIVE_LONG, &first_id, status ) )
126 {
127 H5Dclose( table_id );
128 return -1;
129 }
130
131 *first_id_out = first_id;
132 file_ptr->max_id += num_sets;
133 if( !mhdf_write_max_id( file_ptr, status ) )
134 {
135 H5Dclose( table_id );
136 return -1;
137 }
138 file_ptr->open_handle_count++;
139 mhdf_setOkay( status );
140
141 API_END_H( 1 );
142 return table_id;
143 }
References API_BEGIN, API_END_H, struct_FileHandle::hdf_handle, struct_FileHandle::max_id, mhdf_check_valid_file(), mhdf_create_scalar_attrib(), mhdf_create_table(), MHDF_INDEX_TYPE, mhdf_setOkay(), mhdf_write_max_id(), struct_FileHandle::open_handle_count, SET_META_PATH, and START_ID_ATTRIB.
Referenced by moab::WriteHDF5::create_set_meta().
hid_t mhdf_createSetParents | ( | mhdf_FileHandle | file_handle, |
long | parent_list_size, | ||
mhdf_Status * | status | ||
) |
Create file object for storing the set parent list.
Create a data group for the list of set parents.
The format of this data is the concatenation of the lists of global IDs of parent sets for each set. The order of the sets and the number of parents for each set is contained in the set meta table. (See mhdf_createSetMeta ).
file_handle | The file |
parent_list_size | The total length of the data (the sum of the number of parents for each set.) |
status | Passed back status of API call. |
Definition at line 763 of file sets.c.
764 {
765 FileHandle* file_ptr;
766 hid_t table_id;
767 hsize_t dim = (hsize_t)parent_list_size;
768 API_BEGIN;
769
770 file_ptr = (FileHandle*)( file_handle );
771 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
772
773 if( parent_list_size < 1 )
774 {
775 mhdf_setFail( status, "Invalid argument.\n" );
776 return -1;
777 }
778
779 table_id = mhdf_create_table( file_ptr->hdf_handle, SET_PARENT_PATH, file_ptr->id_type, 1, &dim, status );
780
781 API_END_H( 1 );
782 return table_id;
783 }
References API_BEGIN, API_END_H, dim, struct_FileHandle::hdf_handle, struct_FileHandle::id_type, mhdf_check_valid_file(), mhdf_create_table(), mhdf_setFail(), and SET_PARENT_PATH.
Referenced by moab::WriteHDF5::create_set_tables().
void mhdf_createSparseTagData | ( | mhdf_FileHandle | file_handle, |
const char * | tag_name, | ||
long | num_values, | ||
hid_t | entities_and_values_out[2], | ||
mhdf_Status * | status | ||
) |
Create file objects to store sparse tag data.
Create the file objects to store all sparse data for a given tag in. The sparse data is stored in a pair of objects. The first is a vector of global IDs. The second is a vector of tag values for each entity specified in the list of global IDs.
file_handle | The file. |
tag_name | The tag. |
num_values | The number of tag values to be written. |
entities_and_values_out | The handles to the file objects. The first is the vector of global IDs. The second is the list of corresponding tag values. |
status | Passed back status of API call. |
Definition at line 1402 of file tags.c.
1407 {
1408 hid_t tag_id, index_id, data_id, type_id, id_type;
1409 hsize_t count = (hsize_t)num_values;
1410 API_BEGIN;
1411
1412 tag_id = get_tag( file_handle, tag_name, &id_type, status );
1413 if( tag_id < 0 ) return;
1414
1415 #if defined( H5Topen_vers ) && H5Topen_vers > 1
1416 type_id = H5Topen2( tag_id, TAG_TYPE_NAME, H5P_DEFAULT );
1417 #else
1418 type_id = H5Topen( tag_id, TAG_TYPE_NAME );
1419 #endif
1420 if( type_id < 0 )
1421 {
1422 H5Gclose( tag_id );
1423 mhdf_setFail( status, "Failed to get type object for tag \"%s\".", tag_name );
1424 return;
1425 }
1426
1427 index_id = mhdf_create_table( tag_id, SPARSE_ENTITY_NAME, id_type, 1, &count, status );
1428 if( index_id < 0 )
1429 {
1430 H5Gclose( tag_id );
1431 H5Tclose( type_id );
1432 return;
1433 }
1434
1435 data_id = mhdf_create_table( tag_id, SPARSE_VALUES_NAME, type_id, 1, &count, status );
1436 H5Tclose( type_id );
1437 H5Gclose( tag_id );
1438 if( data_id < 0 )
1439 {
1440 H5Dclose( index_id );
1441 return;
1442 }
1443
1444 handles_out[0] = index_id;
1445 handles_out[1] = data_id;
1446 mhdf_setOkay( status );
1447 API_END_H( 2 );
1448 }
References API_BEGIN, API_END_H, get_tag(), mhdf_create_table(), mhdf_setFail(), mhdf_setOkay(), SPARSE_ENTITY_NAME, SPARSE_VALUES_NAME, and TAG_TYPE_NAME.
Referenced by moab::WriteHDF5::create_tag().
void mhdf_createTag | ( | mhdf_FileHandle | file_handle, |
const char * | tag_name, | ||
enum mhdf_TagDataType | tag_type, | ||
int | size, | ||
int | storage, | ||
const void * | default_value, | ||
const void * | global_value, | ||
hid_t | hdf_type, | ||
hid_t | mhdf_base_type, | ||
mhdf_Status * | status | ||
) |
Add a tag to the file.
Add a new tag to the file. This function must be called to define the tag characteristics before values for the tag can be written.
file_handle | The file |
tag_name | The tag name |
tag_type | The tag type. |
size | If tag_type == mhdf_BITFIELD, the number of bits. If tag_type == mhdf_OPAQUE, the size of the opaque type in bytes. Otherwise the length of the array of tag_type entities associated with each mesh entity, or 1 for a scalar value. |
storage | MOAB storage type (dense, sparse, etc.) |
default_value | Default value for tag, or NULL if none. |
global_value | Global value for tag, or NULL if none. |
hdf_type | If non-zero, assumed to be a user-specified type for opaque data. Ignored if tag_type is not mhdf_OPAQUE. |
hdf_base_type | Ignored if hdf_type is non-zero. If hdf_type is zero and this type is non-zero, it is used either as the type or as the base type for an array type for default_value and global_value, respectively. Typically used to specify the input data type for mhdf_ENTITY_ID tags. |
Definition at line 570 of file tags.c.
580 {
581 hid_t tag_id;
582 API_BEGIN;
583 tag_id = create_tag_common( file_handle, tag_name, tag_type, size, storage, default_value, 1, global_value, 1,
584 hdf_type, hdf_base_type, status );
585 if( tag_id >= 0 ) H5Gclose( tag_id );
586 API_END;
587 }
References API_BEGIN, API_END, create_tag_common(), and size.
Referenced by moab::WriteHDF5::create_tag().
void mhdf_createVarLenTag | ( | mhdf_FileHandle | file_handle, |
const char * | tag_name, | ||
enum mhdf_TagDataType | tag_type, | ||
int | storage, | ||
const void * | default_value, | ||
int | default_value_length, | ||
const void * | global_value, | ||
int | global_value_length, | ||
hid_t | hdf_type, | ||
hid_t | hdf_base_type, | ||
mhdf_Status * | status | ||
) |
Add variable-length tag to file.
Add a new tag to the file. This function must be called to define the tag characteristics before values for the tag can be written. Use this function if the tag values are not fixed-length.
file_handle | The file |
tag_name | The tag name |
tag_type | The tag type. |
storage | MOAB storage type (dense, sparse, etc.) |
default_value | Default value for tag, or NULL if none. |
default_value_length | Length of default value. |
global_value | Global value for tag, or NULL if none. |
global_value_length | Length of global value. |
hdf_type | If non-zero, assumed to be a user-specified type for opaque data. Ignored if tag_type is not mhdf_OPAQUE. |
hdf_base_type | Ignored if hdf_type is non-zero. If hdf_type is zero and this type is non-zero, it is used either as the type or as the base type for an array type for default_value and global_value, respectively. Typically used to specify the input data type for mhdf_ENTITY_ID tags. |
Definition at line 589 of file tags.c.
600 {
601 hid_t tag_id;
602 int one = 1;
603
604 API_BEGIN;
605 tag_id = create_tag_common( file_handle, tag_name, tag_type, -1, storage, default_value, default_value_length,
606 global_value, global_value_length, hdf_type, hdf_base_type, status );
607 if( tag_id >= 0 )
608 {
609 mhdf_create_scalar_attrib( tag_id, TAG_VARLEN_ATTRIB, H5T_NATIVE_INT, &one, status );
610 H5Gclose( tag_id );
611 }
612 API_END;
613 }
References API_BEGIN, API_END, create_tag_common(), mhdf_create_scalar_attrib(), and TAG_VARLEN_ATTRIB.
Referenced by moab::WriteHDF5::create_tag().
void mhdf_createVarLenTagData | ( | mhdf_FileHandle | file_handle, |
const char * | tag_name, | ||
long | num_entities, | ||
long | num_values, | ||
hid_t | entities_and_values_out[3], | ||
mhdf_Status * | status | ||
) |
Create file objects to store (sparse) variable-length tag data.
Create the file objects to store all sparse data for a given tag in. The sparse data is stored in a pair of objects. The first is a vector of global IDs. The second is a vector of tag values for each entity specified in the list of global IDs.
file_handle | The file. |
tag_name | The tag. |
num_entities | The number of entities for which tag values are to be stored |
num_values | The total number of scalar values to be written (the total number of bytes of data for all tags for opaque data.) |
entities_and_values_out | The handles to the file objects. The first is the vector of global IDs. The second is the list of corresponding tag values. The third is the handle to the index table. |
status | Passed back status of API call. |
Definition at line 1450 of file tags.c.
1456 {
1457 hid_t tag_id, index_id, data_id, type_id, offset_id, id_type;
1458 hsize_t count = (hsize_t)num_entities;
1459 API_BEGIN;
1460
1461 tag_id = get_tag( file_handle, tag_name, &id_type, status );
1462 if( tag_id < 0 ) return;
1463
1464 #if defined( H5Topen_vers ) && H5Topen_vers > 1
1465 type_id = H5Topen2( tag_id, TAG_TYPE_NAME, H5P_DEFAULT );
1466 #else
1467 type_id = H5Topen( tag_id, TAG_TYPE_NAME );
1468 #endif
1469 if( type_id < 0 )
1470 {
1471 H5Gclose( tag_id );
1472 mhdf_setFail( status, "Failed to get type object for tag \"%s\".", tag_name );
1473 return;
1474 }
1475
1476 index_id = mhdf_create_table( tag_id, SPARSE_ENTITY_NAME, id_type, 1, &count, status );
1477 if( index_id < 0 )
1478 {
1479 H5Gclose( tag_id );
1480 H5Tclose( type_id );
1481 return;
1482 }
1483
1484 offset_id = mhdf_create_table( tag_id, TAG_VAR_INDICES, MHDF_INDEX_TYPE, 1, &count, status );
1485 if( index_id < 0 )
1486 {
1487 H5Dclose( offset_id );
1488 H5Gclose( tag_id );
1489 H5Tclose( type_id );
1490 return;
1491 }
1492
1493 count = (hsize_t)num_values;
1494 data_id = mhdf_create_table( tag_id, SPARSE_VALUES_NAME, type_id, 1, &count, status );
1495 H5Tclose( type_id );
1496 H5Gclose( tag_id );
1497 if( data_id < 0 )
1498 {
1499 H5Dclose( offset_id );
1500 H5Dclose( index_id );
1501 return;
1502 }
1503
1504 handles_out[0] = index_id;
1505 handles_out[1] = data_id;
1506 handles_out[2] = offset_id;
1507 mhdf_setOkay( status );
1508 API_END_H( 3 );
1509 }
References API_BEGIN, API_END_H, get_tag(), mhdf_create_table(), MHDF_INDEX_TYPE, mhdf_setFail(), mhdf_setOkay(), SPARSE_ENTITY_NAME, SPARSE_VALUES_NAME, TAG_TYPE_NAME, and TAG_VAR_INDICES.
Referenced by moab::WriteHDF5::create_tag().
char** mhdf_getElemHandles | ( | mhdf_FileHandle | file_handle, |
unsigned int * | count_out, | ||
mhdf_Status * | status | ||
) |
Get the list of element groups in the file.
Get the list of element groups in the file. An element group is the data for a block of elements with the same TSTT type and same number of nodes in their connectivity data. (e.g. all the MBHEX20 elements). This function is also used to retrieve the groups for general polygon data and general polyhedron data. The requirement that all elements have the same number of nodes in their connectivity does not apply for poly(gons|hedra).
file_handle | The file. |
count_out | Memory location at which to store the length of the returned array. |
status | Passed back status of API call. |
Definition at line 586 of file file.c.
587 {
588 hsize_t count, length, i;
589 char** buffer;
590 char* current;
591 hid_t group_id;
592 herr_t rval;
593 ssize_t rlen = 0;
594 size_t remaining;
595 FileHandle* file_ptr = (FileHandle*)file_handle;
596 if( !mhdf_check_valid_file( file_ptr, status ) ) return NULL;
597
598 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
599 group_id = H5Gopen2( file_ptr->hdf_handle, ELEMENT_GROUP, H5P_DEFAULT );
600 #else
601 group_id = H5Gopen( file_ptr->hdf_handle, ELEMENT_GROUP );
602 #endif
603 if( group_id < 0 )
604 {
605 mhdf_setFail( status, "Invalid file -- element group does not exist." );
606 return NULL;
607 }
608
609 rval = H5Gget_num_objs( group_id, &count );
610 if( rval < 0 )
611 {
612 H5Gclose( group_id );
613 mhdf_setFail( status, "Internal error calling H5Gget_num_objs." );
614 return NULL;
615 }
616 *count_out = count;
617
618 for( i = 0; i < count; ++i )
619 {
620 rlen += H5Gget_objname_by_idx( group_id, i, NULL, 0 ) + 1;
621 }
622
623 length = count * sizeof( char* ) + rlen;
624 buffer = (char**)mhdf_malloc( length, status );
625 if( !buffer )
626 {
627 H5Gclose( group_id );
628 return NULL;
629 }
630 current = (char*)( buffer + count );
631 remaining = rlen;
632
633 for( i = 0; i < count; ++i )
634 {
635 buffer[i] = current;
636 rlen = H5Gget_objname_by_idx( group_id, i, current, remaining ) + 1;
637 if( rlen < 0 )
638 {
639 H5Gclose( group_id );
640 free( buffer );
641 mhdf_setFail( status, "Internal error calling H5Gget_objname_by_idx." );
642 return NULL;
643 }
644
645 mhdf_path_to_name( current, current );
646 remaining -= rlen;
647 current += rlen;
648 }
649
650 H5Gclose( group_id );
651 mhdf_setOkay( status );
652 return buffer;
653 }
References buffer, ELEMENT_GROUP, struct_FileHandle::hdf_handle, length(), mhdf_check_valid_file(), mhdf_malloc(), mhdf_path_to_name(), mhdf_setFail(), and mhdf_setOkay().
Referenced by main(), and mhdf_getFileSummary().
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.
file_handle | The file. |
type_index | The type index. Corresponds to indices into the element type list passed to mhdf_createFile. |
buffer | The buffer into which to copy the name. |
buffer_size | The length of buffer . |
status | Passed back status of API call. |
Definition at line 368 of file file.c.
373 {
374 FileHandle* file_ptr;
375 herr_t rval;
376 hid_t enum_id;
377 API_BEGIN;
378
379 if( type_index > 255 )
380 {
381 mhdf_setFail( status, "Type index out of bounds." );
382 return;
383 }
384
385 file_ptr = (FileHandle*)( file_handle );
386 if( !mhdf_check_valid_file( file_ptr, status ) ) return;
387
388 enum_id = get_elem_type_enum( file_ptr, status );
389 if( enum_id < 0 ) return;
390
391 rval = H5Tconvert( H5T_NATIVE_UINT, H5Tget_super( enum_id ), 1, &type_index, NULL, H5P_DEFAULT );
392 if( rval < 0 )
393 {
394 H5Tclose( enum_id );
395 mhdf_setFail( status, "Internal error converting to enum type." );
396 return;
397 }
398
399 rval = H5Tenum_nameof( enum_id, &type_index, buffer, buf_size );
400 H5Tclose( enum_id );
401 if( rval < 0 )
402 mhdf_setFail( status, "H5Tenum_nameof failed. Invalid type index?" );
403 else
404 mhdf_setOkay( status );
405
406 API_END;
407 }
References API_BEGIN, API_END, buffer, get_elem_type_enum(), mhdf_check_valid_file(), mhdf_setFail(), and mhdf_setOkay().
void mhdf_getElemTypeName | ( | mhdf_FileHandle | file_handle, |
const char * | elem_handle, | ||
char * | buffer, | ||
size_t | buf_len, | ||
mhdf_Status * | status | ||
) |
Get the element type name for a given element group handle.
Fails if name is longer than buf_len
.
file_handle | The file. |
elem_handle | One of the group names passed back from mhdf_getElemHandles |
buffer | A buffer to copy the name into. |
buf_len | The length of buffer . |
status | Passed back status of API call. |
Definition at line 655 of file file.c.
660 {
661 FileHandle* file_ptr;
662 hid_t elem_id, type_id, attr_id;
663 char bytes[16];
664 herr_t rval;
665 API_BEGIN;
666
667 if( NULL == buffer || buf_len < 2 )
668 {
669 mhdf_setFail( status, "invalid input" );
670 return;
671 }
672 buffer[0] = '\0';
673
674 file_ptr = (FileHandle*)( file_handle );
675 if( !mhdf_check_valid_file( file_ptr, status ) ) return;
676
677 elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status );
678 if( elem_id < 0 ) return;
679
680 attr_id = H5Aopen_name( elem_id, ELEM_TYPE_ATTRIB );
681 H5Gclose( elem_id );
682 if( attr_id < 0 )
683 {
684 mhdf_setFail( status, "Missing element type attribute. Invalid file." );
685 return;
686 }
687
688 type_id = H5Aget_type( attr_id );
689 assert( type_id > 0 );
690
691 rval = H5Aread( attr_id, type_id, bytes );
692 H5Aclose( attr_id );
693 if( rval < 0 )
694 {
695 H5Tclose( type_id );
696 mhdf_setFail( status, "Failed to read element type attribute. Invalid file." );
697 return;
698 }
699
700 rval = H5Tenum_nameof( type_id, bytes, buffer, buf_len );
701 H5Tclose( type_id );
702 if( rval < 0 )
703 {
704 mhdf_setFail( status, "Invalid datatype for element type attribute. Invalid file." );
705 return;
706 }
707
708 mhdf_setOkay( status );
709 API_END;
710 return;
711 }
References API_BEGIN, API_END, buffer, ELEM_TYPE_ATTRIB, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_setFail(), and mhdf_setOkay().
Referenced by get_elem_desc(), and main().
hid_t mhdf_getNativeType | ( | hid_t | input_type, |
int | size, | ||
mhdf_Status * | status | ||
) |
Make type native-endian.
Given an atomic HDF5 data type, return the built-in type that matches the class of the passed type and is the specified size.
This function is provided to allow converting the stored tag type in a file to the preferred type for it's representation in memory when reading tag values.
This function works only for atomic types. The returned type will be a pre-defined HDF5 object and does not need to be closed/released.
input_type | The type to convert. |
size | The desired size in bytes. |
status | Passed back status of API call. |
MOAB, a Mesh-Oriented datABase, is a software component for creating, storing and accessing finite element mesh data.
Copyright 2004 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
Definition at line 30 of file tags.c.
31 {
32 H5T_sign_t sgn;
33 H5T_class_t cls;
34 hid_t tmp_id, type_id;
35
36 mhdf_setOkay( status );
37
38 cls = H5Tget_class( input_type );
39 switch( cls )
40 {
41 case H5T_FLOAT:
42 switch( size )
43 {
44 case 4:
45 return H5T_NATIVE_FLOAT;
46 case 8:
47 return H5T_NATIVE_DOUBLE;
48 case 16:
49 return H5T_NATIVE_LDOUBLE;
50 default:
51 mhdf_setFail( status, "Invalid size for floating point type: %d", size );
52 return -1;
53 }
54
55 case H5T_INTEGER:
56 sgn = H5Tget_sign( input_type );
57 if( H5T_SGN_ERROR == sgn )
58 {
59 mhdf_setFail( status, "Internall errror calling H5Tget_sign." );
60 return -1;
61 }
62 if( sizeof( char ) == size )
63 return sgn == H5T_SGN_NONE ? H5T_NATIVE_UCHAR : H5T_NATIVE_SCHAR;
64 else if( sizeof( short ) == size )
65 return sgn == H5T_SGN_NONE ? H5T_NATIVE_USHORT : H5T_NATIVE_SHORT;
66 else if( sizeof( int ) == size )
67 return sgn == H5T_SGN_NONE ? H5T_NATIVE_UINT : H5T_NATIVE_INT;
68 else if( sizeof( long ) == size )
69 return sgn == H5T_SGN_NONE ? H5T_NATIVE_ULONG : H5T_NATIVE_LONG;
70 else if( (int)H5Tget_size( H5T_NATIVE_LLONG ) == size )
71 return sgn == H5T_SGN_NONE ? H5T_NATIVE_ULLONG : H5T_NATIVE_LLONG;
72
73 mhdf_setFail( status, "Invalid size for integer type: %d", size );
74 return -1;
75
76 case H5T_ENUM:
77 tmp_id = H5Tget_super( input_type );
78 if( tmp_id < 0 )
79 {
80 mhdf_setFail( status, "Internal error calling H5Tget_super." );
81 return -1;
82 }
83 type_id = mhdf_getNativeType( tmp_id, size, status );
84 H5Tclose( tmp_id );
85 return type_id;
86
87 case H5T_TIME:
88 case H5T_OPAQUE:
89 case H5T_REFERENCE:
90 mhdf_setFail( status, "Unsupported type class." );
91 return -1;
92
93 case H5T_COMPOUND:
94 case H5T_VLEN:
95 case H5T_ARRAY:
96 case H5T_STRING:
97 mhdf_setFail( status, "Only atomic types are supported." );
98 return -1;
99
100 default:
101 mhdf_setFail( status, "Internal error calling H5Tget_class. Bad handle?" );
102 return -1;
103 }
104 }
References mhdf_getNativeType(), mhdf_setFail(), mhdf_setOkay(), and size.
Referenced by mhdf_getNativeType().
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
Definition at line 925 of file file.c.
926 {
927 FileHandle* file_ptr = (FileHandle*)file;
928 API_BEGIN;
929
930 mhdf_setOkay( status );
931 if( mhdf_check_valid_file( file_ptr, status ) ) *start_id_out = file_ptr->max_id + 1;
932
933 API_END;
934 }
References API_BEGIN, API_END, struct_FileHandle::max_id, mhdf_check_valid_file(), and mhdf_setOkay().
int mhdf_getNumberTags | ( | mhdf_FileHandle | file_handle, |
mhdf_Status * | status | ||
) |
Get the number of tags in the file.
file_handle | The file. |
status | Passed back status of API call. |
Definition at line 615 of file tags.c.
616 {
617 hid_t group_id;
618 hsize_t result;
619 FileHandle* file_ptr;
620 API_BEGIN;
621
622 /* Validate input */
623
624 file_ptr = (FileHandle*)file_handle;
625 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
626
627 /* Open the tags group */
628
629 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
630 group_id = H5Gopen2( file_ptr->hdf_handle, TAG_GROUP, H5P_DEFAULT );
631 #else
632 group_id = H5Gopen( file_ptr->hdf_handle, TAG_GROUP );
633 #endif
634 if( group_id < 0 )
635 {
636 mhdf_setFail( status, "H5Gopen(\"%s\") failed", TAG_GROUP );
637 return -1;
638 }
639
640 /* Get number of objects in tags group */
641
642 if( H5Gget_num_objs( group_id, &result ) < 0 )
643 {
644 mhdf_setFail( status, "Internal failure calling H5Gget_num_objs." );
645 H5Gclose( group_id );
646 return -1;
647 }
648
649 H5Gclose( group_id );
650 mhdf_setOkay( status );
651 API_END;
652 return (int)result;
653 }
References API_BEGIN, API_END, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_setFail(), mhdf_setOkay(), and TAG_GROUP.
hid_t mhdf_getTagDataType | ( | mhdf_FileHandle | file_handle, |
const char * | tag_name, | ||
mhdf_Status * | status | ||
) |
Get handle to HDF5 type object for tag data.
Definition at line 537 of file tags.c.
538 {
539 FileHandle* file_ptr;
540 hid_t result;
541 char* path;
542 API_BEGIN;
543
544 /* Validate input */
545
546 file_ptr = (FileHandle*)file_handle;
547 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
548
549 if( !tag_name || !*tag_name )
550 {
551 mhdf_setFail( status, "Invalid tag name" );
552 return -1;
553 }
554
555 /* Create path string for tag object */
556
557 path = mhdf_name_to_path_copy( tag_name, status );
558 if( !path )
559 {
560 return -1;
561 }
562
563 result = get_tag_type( file_ptr, path, status );
564
565 free( path );
566 API_END;
567 return result;
568 }
References API_BEGIN, API_END, get_tag_type(), mhdf_check_valid_file(), mhdf_name_to_path_copy(), and mhdf_setFail().
void mhdf_getTagInfo | ( | mhdf_FileHandle | file_handle, |
const char * | tag_name, | ||
enum mhdf_TagDataType * | class_out, | ||
int * | size_out, | ||
int * | tstt_storage_out, | ||
int * | have_default_out, | ||
int * | have_global_out, | ||
int * | have_sparse_out, | ||
mhdf_Status * | status | ||
) |
Get the description of a specified tag.
Get everything about a tag except the actual values.
file_handle | The file. |
tag_name | The name of the tag to retrieve the data for. |
class_out | The TSTT class of the tag data. |
size_out | Depends on value of class_out:
|
tstt_storage_out | The value of the TSTT enum for storage (dense, sparse, etc.) |
have_default_out | Non-zero if file contains a default value for the tag. Length of default value if variable-lenth tag. |
have_global_out | Non-zero if the file contains a global/mesh value for the tag. |
have_sparse_out | Non-zero if the file contains a sparse data table for this tag. |
Definition at line 806 of file tags.c.
815 {
816 hid_t tag_id, type_id, super_id;
817 int i, rval, is_handle;
818 hsize_t size, sup_size;
819 unsigned int idx;
820 int rank, var_data;
821 hsize_t dims[H5S_MAX_RANK];
822 int perm[H5S_MAX_RANK];
823 H5T_class_t class_tmp;
824
825 API_BEGIN;
826
827 /* Validate input */
828 if( NULL == tag_name || NULL == class_out || NULL == size_out || NULL == tstt_storage_out ||
829 NULL == have_default_out || NULL == have_global_out || NULL == have_sparse_out )
830 {
831 mhdf_setFail( status, "Invalid input." );
832 return;
833 }
834
835 /* Get group for tag */
836 tag_id = get_tag( file_handle, tag_name, NULL, status );
837 if( tag_id < 0 ) return;
838
839 /* Check for sparse data */
840 rval = mhdf_is_in_group( tag_id, SPARSE_ENTITY_NAME, status );
841 if( rval < 0 )
842 {
843 H5Gclose( tag_id );
844 return;
845 }
846 *have_sparse_out = rval ? 1 : 0;
847
848 /* Check for variable-length tag data */
849 rval = mhdf_find_attribute( tag_id, TAG_VARLEN_ATTRIB, &idx, status );
850 if( rval < 0 )
851 {
852 H5Gclose( tag_id );
853 return;
854 }
855 var_data = rval ? 1 : 0;
856
857 /* Check if have default value for tag */
858 rval = mhdf_find_attribute( tag_id, TAG_DEFAULT_ATTRIB, &idx, status );
859 if( rval < 0 )
860 {
861 H5Gclose( tag_id );
862 return;
863 }
864 if( !rval )
865 *have_default_out = 0;
866 else if( !var_data )
867 *have_default_out = 1;
868 else
869 {
870 /* *have_default_out = get_attrib_array_length_index( tag_id, index ); */
871 *have_default_out = get_attrib_array_length_name( tag_id, TAG_DEFAULT_ATTRIB );
872 if( *have_default_out < 0 )
873 {
874 mhdf_setFail( status, "Error checking length of default value for tag: %s\n", tag_name );
875 H5Gclose( tag_id );
876 return;
877 }
878 }
879
880 /* Check if have global value for tag */
881 rval = mhdf_find_attribute( tag_id, TAG_GLOBAL_ATTRIB, &idx, status );
882 if( rval < 0 )
883 {
884 H5Gclose( tag_id );
885 return;
886 }
887 if( !rval )
888 *have_global_out = 0;
889 else if( !var_data )
890 *have_global_out = 1;
891 else
892 {
893 /* *have_global_out = get_attrib_array_length_index( tag_id, index ); */
894 *have_global_out = get_attrib_array_length_name( tag_id, TAG_GLOBAL_ATTRIB );
895 if( *have_global_out < 0 )
896 {
897 mhdf_setFail( status, "Error checking length of global value for tag: %s\n", tag_name );
898 H5Gclose( tag_id );
899 return;
900 }
901 }
902
903 /* Get TSTT tag class */
904 rval = mhdf_read_scalar_attrib( tag_id, TAG_TYPE_ATTRIB, H5T_NATIVE_INT, tstt_storage_out, status );
905 if( rval < 1 )
906 {
907 H5Gclose( tag_id );
908 return;
909 }
910
911 /* Check if tag is storing entity handles */
912 rval = mhdf_find_attribute( tag_id, TAG_HANDLE_TYPE_ATTRIB, &idx, status );
913 if( rval < 0 )
914 {
915 H5Gclose( tag_id );
916 return;
917 }
918 is_handle = rval;
919
920 /* Get tag type */
921 #if defined( H5Topen_vers ) && H5Topen_vers > 1
922 type_id = H5Topen2( tag_id, TAG_TYPE_NAME, H5P_DEFAULT );
923 #else
924 type_id = H5Topen( tag_id, TAG_TYPE_NAME );
925 #endif
926 if( type_id < 0 )
927 {
928 H5Gclose( tag_id );
929 mhdf_setFail( status, "Failed to get type object for tag \"%s\".", tag_name );
930 return;
931 }
932
933 class_tmp = H5Tget_class( type_id );
934 if( class_tmp < 0 )
935 {
936 mhdf_setFail( status, "H5Tget_class failed." );
937 H5Gclose( tag_id );
938 H5Tclose( type_id );
939 return;
940 }
941
942 size = H5Tget_size( type_id );
943 if( size <= 0 )
944 {
945 mhdf_setFail( status, "H5Tget_size failed." );
946 H5Gclose( tag_id );
947 H5Tclose( type_id );
948 return;
949 }
950
951 switch( class_tmp )
952 {
953 case H5T_INTEGER:
954 *class_out = ( size == 1 ) ? mhdf_BOOLEAN : mhdf_INTEGER;
955 *size_out = 1;
956 break;
957
958 case H5T_FLOAT:
959 *class_out = mhdf_FLOAT;
960 *size_out = 1;
961 break;
962
963 case H5T_BITFIELD:
964 *class_out = mhdf_BITFIELD;
965 *size_out = H5Tget_precision( type_id );
966 if( *size_out <= 0 )
967 {
968 mhdf_setFail( status, "H5Tget_precision failed." );
969 H5Gclose( tag_id );
970 H5Tclose( type_id );
971 return;
972 }
973 break;
974
975 default:
976 case H5T_OPAQUE:
977 *class_out = mhdf_OPAQUE;
978 *size_out = size;
979 break;
980
981 case H5T_ARRAY:
982
983 #if defined( H5Tget_array_dims_vers ) && H5Tget_array_dims_vers > 1
984 (void)perm; /* suppress warning */
985 rank = H5Tget_array_dims2( type_id, dims );
986 #else
987 rank = H5Tget_array_dims( type_id, dims, perm );
988 #endif
989 if( rank <= 0 )
990 {
991 mhdf_setFail( status, "H5Tget_size failed." );
992 H5Gclose( tag_id );
993 H5Tclose( type_id );
994 return;
995 }
996 for( i = 1; i < rank; ++i )
997 dims[0] *= dims[i];
998
999 super_id = H5Tget_super( type_id );
1000 if( super_id < 0 )
1001 {
1002 mhdf_setFail( status, "H5Tget_super failed" );
1003 H5Gclose( tag_id );
1004 H5Tclose( type_id );
1005 return;
1006 }
1007
1008 class_tmp = H5Tget_class( super_id );
1009 if( class_tmp < 0 )
1010 {
1011 mhdf_setFail( status, "H5Tget_class failed." );
1012 H5Gclose( tag_id );
1013 H5Tclose( type_id );
1014 H5Tclose( super_id );
1015 return;
1016 }
1017
1018 sup_size = H5Tget_size( super_id );
1019 H5Tclose( super_id );
1020 if( sup_size <= 0 )
1021 {
1022 mhdf_setFail( status, "H5Tget_size failed." );
1023 H5Gclose( tag_id );
1024 H5Tclose( type_id );
1025 return;
1026 }
1027
1028 switch( class_tmp )
1029 {
1030 case H5T_INTEGER:
1031 *class_out = ( sup_size == 1 ) ? mhdf_BOOLEAN : mhdf_INTEGER;
1032 *size_out = dims[0];
1033 break;
1034
1035 case H5T_FLOAT:
1036 *class_out = mhdf_FLOAT;
1037 *size_out = dims[0];
1038 break;
1039
1040 default:
1041 *class_out = mhdf_OPAQUE;
1042 *size_out = size;
1043 break;
1044 }
1045
1046 break;
1047 }
1048 H5Tclose( type_id );
1049 H5Gclose( tag_id );
1050
1051 if( is_handle )
1052 {
1053 if( *class_out != mhdf_INTEGER )
1054 {
1055 mhdf_setFail( status, "Non-integer tag marked as handle type." );
1056 return;
1057 }
1058 *class_out = mhdf_ENTITY_ID;
1059 }
1060
1061 if( var_data )
1062 {
1063 if( *size_out != 1 || *class_out == mhdf_BITFIELD )
1064 {
1065 mhdf_setFail( status, "Invalid or unexpected variable-length tag data" );
1066 return;
1067 }
1068 *size_out = -1;
1069 }
1070
1071 mhdf_setOkay( status );
1072 API_END;
1073 }
References API_BEGIN, API_END, get_attrib_array_length_name(), get_tag(), mhdf_BITFIELD, mhdf_BOOLEAN, mhdf_ENTITY_ID, mhdf_find_attribute(), mhdf_FLOAT, mhdf_INTEGER, mhdf_is_in_group(), mhdf_OPAQUE, mhdf_read_scalar_attrib(), mhdf_setFail(), mhdf_setOkay(), size, SPARSE_ENTITY_NAME, TAG_DEFAULT_ATTRIB, TAG_GLOBAL_ATTRIB, TAG_HANDLE_TYPE_ATTRIB, TAG_TYPE_ATTRIB, TAG_TYPE_NAME, and TAG_VARLEN_ATTRIB.
Referenced by get_tag_desc(), and main().
char** mhdf_getTagNames | ( | mhdf_FileHandle | file_handle, |
int * | num_names_out, | ||
mhdf_Status * | status | ||
) |
Get the name for each tag defined in the file.
file_handle | The file. |
num_names_out | The length of the returned array of strings. |
status | Passed back status of API call. |
malloc
. The caller should release this memory by calling free
for each string and the array. Definition at line 655 of file tags.c.
656 {
657 hid_t group_id;
658 FileHandle* file_ptr;
659 hsize_t count, idx;
660 char* name;
661 char** result;
662 ssize_t size;
663 API_BEGIN;
664
665 /* Validate input */
666
667 file_ptr = (FileHandle*)file_handle;
668 if( !mhdf_check_valid_file( file_ptr, status ) ) return NULL;
669
670 /* Open the tags group */
671
672 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
673 group_id = H5Gopen2( file_ptr->hdf_handle, TAG_GROUP, H5P_DEFAULT );
674 #else
675 group_id = H5Gopen( file_ptr->hdf_handle, TAG_GROUP );
676 #endif
677 if( group_id < 0 )
678 {
679 mhdf_setFail( status, "H5Gopen(\"%s\") failed", TAG_GROUP );
680 return NULL;
681 }
682
683 /* Get number of objects in tags group */
684
685 if( H5Gget_num_objs( group_id, &count ) < 0 )
686 {
687 mhdf_setFail( status, "Internal failure calling H5Gget_num_objs." );
688 H5Gclose( group_id );
689 return NULL;
690 }
691
692 /* No tags? */
693
694 *num_names_out = (int)count;
695 if( count == 0 )
696 {
697 H5Gclose( group_id );
698 mhdf_setOkay( status );
699 return NULL;
700 }
701
702 /* Allocate string array */
703
704 result = (char**)mhdf_malloc( sizeof( char* ) * count, status );
705 if( NULL == result )
706 {
707 H5Gclose( group_id );
708 return NULL;
709 }
710
711 /* Get names */
712
713 for( idx = 0; idx < count; ++idx )
714 {
715 size = H5Gget_objname_by_idx( group_id, idx, NULL, 0 );
716 if( size < 1 || NULL == ( name = (char*)mhdf_malloc( size + 1, status ) ) )
717 {
718 while( ( --idx ) > 0 )
719 free( result[idx] );
720 free( result );
721 H5Gclose( group_id );
722 mhdf_setFail( status, "Internal failure calling H5Gget_objname_by_idx." );
723 return NULL;
724 }
725
726 H5Gget_objname_by_idx( group_id, idx, name, size + 1 );
727 if( !mhdf_path_to_name( name, name ) )
728 {
729 mhdf_setFail( status, "Invalid character string in internal file path: \"%s\"\n", name );
730 return NULL;
731 }
732 result[idx] = name;
733 }
734
735 H5Gclose( group_id );
736 mhdf_setOkay( status );
737 API_END;
738 return result;
739 }
References API_BEGIN, API_END, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_malloc(), mhdf_path_to_name(), mhdf_setFail(), mhdf_setOkay(), size, and TAG_GROUP.
Referenced by mhdf_getFileSummary().
void mhdf_getTagValues | ( | mhdf_FileHandle | file_handle, |
const char * | tag_name, | ||
hid_t | output_data_type, | ||
void * | default_value, | ||
void * | global_value, | ||
mhdf_Status * | status | ||
) |
Get the default and global values of the tag.
file_handle | The file. |
tag_name | The tag name. |
output_data_type | The HDF5 type for the memory into which the tag data is to be written. If zero, then the value(s) will be read as opaque data. |
default_value | Memory location at which to write the default value of the tag. |
global_value | If the tag has a global value, the memory location at which to write that value. |
status | Passed back status of API call. |
Definition at line 1135 of file tags.c.
1141 {
1142 hid_t tag_id;
1143 int rval, var_data;
1144 unsigned int idx;
1145 API_BEGIN;
1146
1147 /* check args */
1148 if( NULL == tag_name || !*tag_name )
1149 {
1150 mhdf_setFail( status, "Invalid input." );
1151 return;
1152 }
1153
1154 /* Get the tag group */
1155 tag_id = get_tag( file_handle, tag_name, NULL, status );
1156 if( tag_id < 0 ) return;
1157
1158 /* Check for variable-length tag data */
1159 rval = mhdf_find_attribute( tag_id, TAG_VARLEN_ATTRIB, &idx, status );
1160 if( rval < 0 )
1161 {
1162 H5Gclose( tag_id );
1163 return;
1164 }
1165 var_data = rval ? 1 : 0;
1166
1167 /* Read default value if present */
1168 rval = read_tag_attrib_data( tag_id, TAG_DEFAULT_ATTRIB, output_data_type, default_value, var_data, status );
1169 if( !rval )
1170 {
1171 H5Gclose( tag_id );
1172 return;
1173 }
1174
1175 /* Read mesh value if present */
1176 rval = read_tag_attrib_data( tag_id, TAG_GLOBAL_ATTRIB, output_data_type, global_value, var_data, status );
1177 if( !rval )
1178 {
1179 H5Gclose( tag_id );
1180 return;
1181 }
1182
1183 H5Gclose( tag_id );
1184 mhdf_setOkay( status );
1185 API_END;
1186 }
References API_BEGIN, API_END, get_tag(), mhdf_find_attribute(), mhdf_setFail(), mhdf_setOkay(), read_tag_attrib_data(), TAG_DEFAULT_ATTRIB, TAG_GLOBAL_ATTRIB, and TAG_VARLEN_ATTRIB.
Referenced by moab::ReadHDF5::create_tag(), and get_tag_desc().
int mhdf_haveAdjacency | ( | mhdf_FileHandle | file, |
const char * | elem_group, | ||
mhdf_Status * | status | ||
) |
Check if adjacency data is present in the file for the specified element group.
file | The file. |
elem_handle | A handle to an element group. |
status | Passed back status of API call. |
MOAB, a Mesh-Oriented datABase, is a software component for creating, storing and accessing finite element mesh data.
Copyright 2004 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
Definition at line 25 of file adjacency.c.
26 {
27 FileHandle* file_ptr;
28 hid_t elem_id;
29 int result;
30 API_BEGIN;
31
32 file_ptr = (FileHandle*)( file );
33 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
34
35 if( elem_group == mhdf_node_type_handle() )
36 {
37 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
38 elem_id = H5Gopen( file_ptr->hdf_handle, NODE_GROUP, H5P_DEFAULT );
39 #else
40 elem_id = H5Gopen( file_ptr->hdf_handle, NODE_GROUP );
41 #endif
42 if( elem_id < 0 )
43 {
44 mhdf_setFail( status, "H5Gopen( \"%s\" ) failed.\n", NODE_GROUP );
45 return -1;
46 }
47 }
48 else
49 {
50 elem_id = mhdf_elem_group_from_handle( file_ptr, elem_group, status );
51 if( elem_id < 0 ) return -1;
52 }
53
54 result = mhdf_is_in_group( elem_id, ADJACENCY_NAME, status );
55 H5Gclose( elem_id );
56 mhdf_setOkay( status );
57 API_END;
58 return result;
59 }
References ADJACENCY_NAME, API_BEGIN, API_END, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_is_in_group(), mhdf_node_type_handle(), mhdf_setFail(), mhdf_setOkay(), and NODE_GROUP.
Referenced by get_elem_desc().
int mhdf_haveDenseTag | ( | mhdf_FileHandle | file_handle, |
const char * | tag_name, | ||
const char * | elem_group, | ||
mhdf_Status * | status | ||
) |
Check if the file contains dense tag data for the specified tag and element group.
Check if there is dense tag data for a given element type for the specified tag.
file_handle | The file. |
tag_name | The tag. |
elem_group | The element group handle, or the return value of mhdf_node_type_handle or mhdf_set_type_handle for nodes or sets respectively. |
status | Passed back status of API call. |
Definition at line 1188 of file tags.c.
1189 {
1190 char* path;
1191 hid_t elem_id, group_id;
1192 FileHandle* file_ptr;
1193 int rval = 0;
1194 API_BEGIN;
1195
1196 file_ptr = (FileHandle*)file_handle;
1197 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
1198
1199 if( type_handle == mhdf_node_type_handle() )
1200 {
1201 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
1202 elem_id = H5Gopen2( file_ptr->hdf_handle, NODE_GROUP, H5P_DEFAULT );
1203 #else
1204 elem_id = H5Gopen( file_ptr->hdf_handle, NODE_GROUP );
1205 #endif
1206 if( elem_id < 0 ) mhdf_setFail( status, "Could not open node group." );
1207 }
1208 else if( type_handle == mhdf_set_type_handle() )
1209 {
1210 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
1211 elem_id = H5Gopen2( file_ptr->hdf_handle, SET_GROUP, H5P_DEFAULT );
1212 #else
1213 elem_id = H5Gopen( file_ptr->hdf_handle, SET_GROUP );
1214 #endif
1215 if( elem_id < 0 ) mhdf_setFail( status, "Could not open set group." );
1216 }
1217 else
1218 {
1219 elem_id = mhdf_elem_group_from_handle( file_ptr, type_handle, status );
1220 }
1221 if( elem_id < 0 ) return -1;
1222
1223 rval = mhdf_is_in_group( elem_id, TAG_GROUP_NAME, status );
1224 if( rval < 0 )
1225 {
1226 H5Gclose( elem_id );
1227 return -1;
1228 }
1229 else if( rval == 0 )
1230 {
1231 H5Gclose( elem_id );
1232 mhdf_setOkay( status );
1233 return 0;
1234 }
1235
1236 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
1237 group_id = H5Gopen2( elem_id, DENSE_TAG_SUBGROUP, H5P_DEFAULT );
1238 #else
1239 group_id = H5Gopen( elem_id, DENSE_TAG_SUBGROUP );
1240 #endif
1241 H5Gclose( elem_id );
1242 if( group_id < 0 )
1243 {
1244 mhdf_setFail( status, "Could not open tag subgroup." );
1245 return -1;
1246 }
1247
1248 path = mhdf_name_to_path_copy( tag_name, status );
1249 if( NULL == path )
1250 {
1251 H5Gclose( group_id );
1252 return -1;
1253 }
1254
1255 rval = mhdf_is_in_group( group_id, path, status );
1256 H5Gclose( group_id );
1257 free( path );
1258
1259 if( rval >= 0 )
1260 {
1261 mhdf_setOkay( status );
1262 }
1263
1264 API_END;
1265 return rval;
1266 }
References API_BEGIN, API_END, DENSE_TAG_SUBGROUP, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_is_in_group(), mhdf_name_to_path_copy(), mhdf_node_type_handle(), mhdf_set_type_handle(), mhdf_setFail(), mhdf_setOkay(), NODE_GROUP, SET_GROUP, and TAG_GROUP_NAME.
Referenced by main(), and mhdf_getFileSummary().
int mhdf_haveNodes | ( | mhdf_FileHandle | file, |
mhdf_Status * | status | ||
) |
MOAB, a Mesh-Oriented datABase, is a software component for creating, storing and accessing finite element mesh data.
Copyright 2004 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
Definition at line 26 of file nodes.c.
27 {
28 FileHandle* file_ptr = (FileHandle*)file;
29 hid_t root_id, node_id;
30 int result;
31 API_BEGIN;
32
33 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
34
35 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
36 root_id = H5Gopen2( file_ptr->hdf_handle, ROOT_GROUP, H5P_DEFAULT );
37 #else
38 root_id = H5Gopen( file_ptr->hdf_handle, ROOT_GROUP );
39 #endif
40 if( root_id < 0 )
41 {
42 mhdf_setFail( status, "H5Gopen( \"%s\" ) failed.", ROOT_GROUP );
43 return -1;
44 }
45
46 result = mhdf_is_in_group( root_id, NODE_GROUP_NAME, status );
47 if( result < 1 )
48 {
49 H5Gclose( root_id );
50 return result;
51 }
52
53 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
54 node_id = H5Gopen2( root_id, NODE_GROUP_NAME, H5P_DEFAULT );
55 #else
56 node_id = H5Gopen( root_id, NODE_GROUP_NAME );
57 #endif
58 H5Gclose( root_id );
59 if( node_id < 0 )
60 {
61 mhdf_setFail( status, "H5Gopen( \"%s\" ) failed.", NODE_GROUP );
62 return -1;
63 }
64
65 result = mhdf_is_in_group( node_id, NODE_COORD_NAME, status );
66 if( result >= 0 ) mhdf_setOkay( status );
67 H5Gclose( node_id );
68 API_END;
69 return result;
70 }
References API_BEGIN, API_END, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_is_in_group(), mhdf_setFail(), mhdf_setOkay(), NODE_COORD_NAME, NODE_GROUP, NODE_GROUP_NAME, and ROOT_GROUP.
Referenced by mhdf_getFileSummary().
int mhdf_haveSets | ( | mhdf_FileHandle | file, |
int * | have_data, | ||
int * | have_child, | ||
int * | have_parent, | ||
mhdf_Status * | status | ||
) |
Check if file contains any sets.
file | The file. |
have_set_data_out | If non-null set to 1 if file contains table of set contents, zero otherwise. |
have_set_child_out | If non-null set to 1 if file contains table of set children, zero otherwise. |
have_set_parents_out | If non-null set to 1 if file contains table of set parents, zero otherwise. |
status | Passed back status of API call. |
MOAB, a Mesh-Oriented datABase, is a software component for creating, storing and accessing finite element mesh data.
Copyright 2004 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
Definition at line 27 of file sets.c.
28 {
29 FileHandle* file_ptr = (FileHandle*)file;
30 hid_t root_id, set_id;
31 int result;
32 API_BEGIN;
33
34 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
35
36 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
37 root_id = H5Gopen2( file_ptr->hdf_handle, ROOT_GROUP, H5P_DEFAULT );
38 #else
39 root_id = H5Gopen( file_ptr->hdf_handle, ROOT_GROUP );
40 #endif
41 if( root_id < 0 )
42 {
43 mhdf_setFail( status, "H5Gopen( \"%s\" ) failed.", ROOT_GROUP );
44 return -1;
45 }
46
47 result = mhdf_is_in_group( root_id, SET_GROUP_NAME, status );
48 if( result < 1 )
49 {
50 H5Gclose( root_id );
51 return result;
52 }
53
54 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
55 set_id = H5Gopen2( root_id, SET_GROUP_NAME, H5P_DEFAULT );
56 #else
57 set_id = H5Gopen( root_id, SET_GROUP_NAME );
58 #endif
59 H5Gclose( root_id );
60 if( set_id < 0 )
61 {
62 mhdf_setFail( status, "H5Gopen( \"%s\" ) failed.", SET_GROUP );
63 return -1;
64 }
65
66 result = mhdf_is_in_group( set_id, SET_META_NAME, status );
67 if( result < 0 )
68 {
69 H5Gclose( set_id );
70 return result;
71 }
72
73 if( have_data )
74 {
75 *have_data = mhdf_is_in_group( set_id, SET_DATA_NAME, status );
76 if( *have_data < 0 )
77 {
78 H5Gclose( set_id );
79 return *have_data;
80 }
81 }
82
83 if( have_child )
84 {
85 *have_child = mhdf_is_in_group( set_id, SET_CHILD_NAME, status );
86 if( *have_child < 0 )
87 {
88 H5Gclose( set_id );
89 return *have_child;
90 }
91 }
92
93 if( have_parent )
94 {
95 *have_parent = mhdf_is_in_group( set_id, SET_PARENT_NAME, status );
96 if( *have_parent < 0 )
97 {
98 H5Gclose( set_id );
99 return *have_parent;
100 }
101 }
102
103 mhdf_setOkay( status );
104 H5Gclose( set_id );
105 API_END;
106 return result;
107 }
References API_BEGIN, API_END, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_is_in_group(), mhdf_setFail(), mhdf_setOkay(), ROOT_GROUP, SET_CHILD_NAME, SET_DATA_NAME, SET_GROUP, SET_GROUP_NAME, SET_META_NAME, and SET_PARENT_NAME.
Referenced by mhdf_getFileSummary().
int mhdf_isPolyElement | ( | mhdf_FileHandle | file_handle, |
const char * | elem_handle, | ||
mhdf_Status * | status | ||
) |
Check if an element group contains polygon or polyhedron.
Check if an element group contains general polygon or polyhedrons rather than typically fixed-connectivity elements.
file_handle | The file. |
elem_handle | The element group. |
status | Passed back status of API call. |
Definition at line 748 of file file.c.
749 {
750 FileHandle* file_ptr;
751 hid_t elem_id;
752 int rval;
753 API_BEGIN;
754
755 file_ptr = (FileHandle*)( file_handle );
756 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
757
758 elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status );
759 if( elem_id < 0 ) return -1;
760
761 mhdf_setOkay( status );
762 rval = mhdf_is_in_group( elem_id, POLY_INDEX_NAME, status );
763 H5Gclose( elem_id );
764 API_END;
765 return rval;
766 }
References API_BEGIN, API_END, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_is_in_group(), mhdf_setOkay(), and POLY_INDEX_NAME.
Referenced by get_elem_desc().
const char* mhdf_node_type_handle | ( | void | ) |
Get an mhdf_ElemHandle object for the node data.
MOAB, a Mesh-Oriented datABase, is a software component for creating, storing and accessing finite element mesh data.
Copyright 2004 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. MHDF API for reading/writing MOAB-format HDF5 mesh files. Error handling Element group handle
Definition at line 736 of file file.c.
737 {
738 static const char rval[] = "nodes";
739 return rval;
740 }
Referenced by check_valid_tag(), main(), mhdf_createAdjacency(), mhdf_createDenseTagData(), mhdf_getFileSummary(), mhdf_haveAdjacency(), mhdf_haveDenseTag(), mhdf_openAdjacency(), mhdf_openDenseTagData(), moab::WriteHDF5::ExportSet::name(), moab::ReadHDF5::read_tag(), moab::ReadHDF5::read_tag_values_all(), moab::ReadHDF5::read_tag_values_partial(), moab::ReadHDF5::search_tag_values(), and moab::WriteHDF5::serial_create_file().
hid_t mhdf_openAdjacency | ( | mhdf_FileHandle | file_handle, |
const char * | elem_handle, | ||
long * | adj_list_size, | ||
mhdf_Status * | status | ||
) |
Open adjacency data table for nodes, elements, polys, etc.
Open the file object containing adjacency data for a nodes or a specified element group.
Adjacency data is formated as a sequence of integer groups where the first entry in each group is the ID of the element for which adjacencies are being specified, the second value is the count of adjacent entities, and the remainder of the group is the list of IDs of the adjacent entities.
file_handle | The file. |
elem_handle | The element group (or the result of mhdf_node_type_handle for nodes) for which the adjacency data is to be specified. |
adj_list_size | The total number of integer values contained in the adjacency data for the specified element group. |
status | Passed back status of API call. |
Definition at line 94 of file adjacency.c.
96 {
97 FileHandle* file_ptr;
98 hid_t elem_id, table_id;
99 hsize_t dim;
100 API_BEGIN;
101
102 file_ptr = (FileHandle*)( file );
103 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
104
105 if( !adj_list_size_out )
106 {
107 mhdf_setFail( status, "Invalid argument.\n" );
108 return -1;
109 }
110
111 if( elem_handle == mhdf_node_type_handle() )
112 {
113 table_id = mhdf_open_table( file_ptr->hdf_handle, NODE_ADJCY_PATH, 1, &dim, status );
114 }
115 else
116 {
117 elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status );
118 if( elem_id < 0 ) return -1;
119 table_id = mhdf_open_table( elem_id, ADJACENCY_NAME, 1, &dim, status );
120 H5Gclose( elem_id );
121 }
122
123 *adj_list_size_out = (long)dim;
124 API_END_H( 1 );
125 return table_id;
126 }
References ADJACENCY_NAME, API_BEGIN, API_END_H, dim, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_node_type_handle(), mhdf_open_table(), mhdf_setFail(), and NODE_ADJCY_PATH.
Referenced by check_valid_adjacencies(), moab::ReadHDF5::load_file_impl(), moab::ReadHDF5::load_file_partial(), and moab::WriteHDF5::write_adjacencies().
hid_t mhdf_openConnectivity | ( | mhdf_FileHandle | file_handle, |
const char * | elem_handle, | ||
int * | num_nodes_per_elem_out, | ||
long * | num_elements_out, | ||
long * | first_elem_id_out, | ||
mhdf_Status * | status | ||
) |
Open connectivity table for an element group.
Open fixed-connectivity data for an element group. Do NOT use this function for poly(gon/hedron) data. Use mhdf_isPolyElement
or mhdf_getTsttElemType
to check if the data is poly(gon|hedron) data before calling this function to open the data.
file_handle | The file. |
elem_handle | The element group. |
num_nodes_per_elem_out | Used to pass back the number of nodes in each element. |
num_elements_out | Pass back the number of elements in the table. |
first_elem_id_out | Elements are assigned global IDs in sequential blocks where the block is the table in which their connectivity data is written and the sequence is the sequence in which they are written in that table. The global ID for the first element in this group is passed back at this address. The global IDs for all other elements in the table are assigned in the sequence in which they are written in the table. |
status | Passed back status of API call. |
Definition at line 78 of file connectivity.c.
84 {
85 FileHandle* file_ptr;
86 hid_t elem_id, table_id;
87 hsize_t dims[2];
88 API_BEGIN;
89
90 file_ptr = (FileHandle*)( file_handle );
91 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
92
93 if( !num_nodes_per_elem_out || !num_elements_out || !first_elem_id_out )
94 {
95 mhdf_setFail( status, "Invalid argument." );
96 return -1;
97 }
98
99 elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status );
100 if( elem_id < 0 ) return -1;
101
102 table_id = mhdf_open_table2( elem_id, CONNECTIVITY_NAME, 2, dims, first_elem_id_out, status );
103
104 H5Gclose( elem_id );
105 if( table_id < 0 ) return -1;
106
107 *num_elements_out = dims[0];
108 *num_nodes_per_elem_out = dims[1];
109
110 file_ptr->open_handle_count++;
111 mhdf_setOkay( status );
112 API_END_H( 1 );
113 return table_id;
114 }
References API_BEGIN, API_END_H, CONNECTIVITY_NAME, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_open_table2(), mhdf_setFail(), mhdf_setOkay(), and struct_FileHandle::open_handle_count.
Referenced by get_elem_desc(), main(), and moab::WriteHDF5::write_elems().
hid_t mhdf_openConnectivitySimple | ( | mhdf_FileHandle | file_handle, |
const char * | elem_handle, | ||
mhdf_Status * | status | ||
) |
Definition at line 116 of file connectivity.c.
117 {
118 FileHandle* file_ptr;
119 hid_t elem_id, table_id;
120 API_BEGIN;
121
122 file_ptr = (FileHandle*)( file_handle );
123 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
124
125 elem_id = mhdf_elem_group_from_handle( file_ptr, elem_handle, status );
126 if( elem_id < 0 ) return -1;
127
128 table_id = mhdf_open_table_simple( elem_id, CONNECTIVITY_NAME, status );
129
130 H5Gclose( elem_id );
131 if( table_id < 0 ) return -1;
132
133 file_ptr->open_handle_count++;
134 mhdf_setOkay( status );
135 API_END_H( 1 );
136 return table_id;
137 }
References API_BEGIN, API_END_H, CONNECTIVITY_NAME, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_open_table_simple(), mhdf_setOkay(), and struct_FileHandle::open_handle_count.
Referenced by check_valid_elem_conn(), moab::ReadHDF5::read_elems(), and moab::ReadHDF5::read_node_adj_elems().
hid_t mhdf_openDenseTagData | ( | mhdf_FileHandle | file_handle, |
const char * | tag_name, | ||
const char * | elem_group, | ||
long * | num_values_out, | ||
mhdf_Status * | status | ||
) |
Open the object containing dense tag values for a given element group.
file_handle | The file. |
tag_name | The tag. |
elem_group | The element group handle, or the return value of mhdf_node_type_handle or mhdf_set_type_handle for nodes or sets respectively. |
num_values_out | The number of tag values to be written. Must be The same as the number of elements in the group. |
status | Passed back status of API call. |
Definition at line 1339 of file tags.c.
1344 {
1345 char* path;
1346 hid_t elem_id, data_id;
1347 FileHandle* file_ptr;
1348 size_t name_len, path_len, dir_len;
1349 hsize_t size;
1350 API_BEGIN;
1351
1352 file_ptr = (FileHandle*)file_handle;
1353 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
1354
1355 if( type_handle == mhdf_node_type_handle() )
1356 {
1357 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
1358 elem_id = H5Gopen2( file_ptr->hdf_handle, NODE_GROUP, H5P_DEFAULT );
1359 #else
1360 elem_id = H5Gopen( file_ptr->hdf_handle, NODE_GROUP );
1361 #endif
1362 if( elem_id < 0 ) mhdf_setFail( status, "Could not open node group." );
1363 }
1364 else if( type_handle == mhdf_set_type_handle() )
1365 {
1366 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
1367 elem_id = H5Gopen2( file_ptr->hdf_handle, SET_GROUP, H5P_DEFAULT );
1368 #else
1369 elem_id = H5Gopen( file_ptr->hdf_handle, SET_GROUP );
1370 #endif
1371 if( elem_id < 0 ) mhdf_setFail( status, "Could not open set group." );
1372 }
1373 else
1374 {
1375 elem_id = mhdf_elem_group_from_handle( file_ptr, type_handle, status );
1376 }
1377 if( elem_id < 0 ) return -1;
1378
1379 dir_len = strlen( DENSE_TAG_SUBGROUP );
1380 name_len = mhdf_name_to_path( tag_name, NULL, 0 );
1381 path_len = dir_len + name_len + 1;
1382 path = (char*)mhdf_malloc( path_len, status );
1383 if( NULL == path )
1384 {
1385 H5Gclose( elem_id );
1386 return -1;
1387 }
1388 strcpy( path, DENSE_TAG_SUBGROUP );
1389 mhdf_name_to_path( tag_name, path + dir_len, name_len + 1 );
1390
1391 data_id = mhdf_open_table( elem_id, path, 1, &size, status );
1392 free( path );
1393 H5Gclose( elem_id );
1394 *num_values_out = (long)size;
1395
1396 if( data_id >= 0 ) mhdf_setOkay( status );
1397
1398 API_END_H( 1 );
1399 return data_id;
1400 }
References API_BEGIN, API_END_H, DENSE_TAG_SUBGROUP, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_malloc(), mhdf_name_to_path(), mhdf_node_type_handle(), mhdf_open_table(), mhdf_set_type_handle(), mhdf_setFail(), mhdf_setOkay(), NODE_GROUP, SET_GROUP, and size.
Referenced by check_valid_tag(), main(), mhdf_getFileSummary(), moab::ReadHDF5::read_tag(), moab::ReadHDF5::read_tag_values_all(), moab::ReadHDF5::read_tag_values_partial(), moab::ReadHDF5::search_tag_values(), and moab::WriteHDF5::write_dense_tag().
hid_t mhdf_openNodeCoords | ( | mhdf_FileHandle | file_handle, |
long * | num_nodes_out, | ||
int * | dimension_out, | ||
long * | first_node_id_out, | ||
mhdf_Status * | status | ||
) |
Open table containing node coordinate data.
file_handle | The file. |
dimension_out | Number of coordinate values per node. |
num_nodes_out | The number of nodes the table contains. |
first_node_id_out | Nodes are assigned IDs sequentially in the order they occur in the table, where the ID of the first node in the table is this passed-back value. |
status | Passed back status of API call. |
Definition at line 118 of file nodes.c.
123 {
124 FileHandle* file_ptr = (FileHandle*)file_handle;
125 hid_t table_id;
126 hsize_t dims[2];
127 API_BEGIN;
128
129 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
130
131 table_id = mhdf_open_table2( file_ptr->hdf_handle, NODE_COORD_PATH, 2, dims, first_id_out, status );
132 if( table_id < 0 ) return -1;
133
134 *num_nodes_out = dims[0];
135 *dimension_out = dims[1];
136 file_ptr->open_handle_count++;
137 mhdf_setOkay( status );
138 API_END_H( 1 );
139 return table_id;
140 }
References API_BEGIN, API_END_H, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_open_table2(), mhdf_setOkay(), NODE_COORD_PATH, and struct_FileHandle::open_handle_count.
Referenced by main(), mhdf_getFileSummary(), and moab::WriteHDF5::write_nodes().
hid_t mhdf_openNodeCoordsSimple | ( | mhdf_FileHandle | file_handle, |
mhdf_Status * | status | ||
) |
Definition at line 142 of file nodes.c.
143 {
144 FileHandle* file_ptr = (FileHandle*)file_handle;
145 hid_t table_id;
146 API_BEGIN;
147
148 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
149
150 table_id = mhdf_open_table_simple( file_ptr->hdf_handle, NODE_COORD_PATH, status );
151 if( table_id < 0 ) return -1;
152
153 file_ptr->open_handle_count++;
154 mhdf_setOkay( status );
155 API_END_H( 1 );
156 return table_id;
157 }
References API_BEGIN, API_END_H, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_open_table_simple(), mhdf_setOkay(), NODE_COORD_PATH, and struct_FileHandle::open_handle_count.
Referenced by moab::ReadHDF5::read_nodes().
void mhdf_openPolyConnectivity | ( | mhdf_FileHandle | file_handle, |
const char * | elem_handle, | ||
long * | num_poly_out, | ||
long * | data_list_length_out, | ||
long * | first_id_out, | ||
hid_t | idx_and_id_handles_out[2], | ||
mhdf_Status * | status | ||
) |
Open a table of polygon or polyhedron connectivity data.
Poly (polygon or polyhedron) connectivity is stored as two lists. One list is the concatenation of the the connectivity data for all the polys in the group. The other contains one value per poly where that value is the index of the last entry in the connectivity of the corresponding poly. The ID list for polygons contains global node IDs. The ID list for polyhedra contains the global IDs of faces (either polygons or 2D fixed-connectivity elements.)
file_handle | The file to write. |
elem_handle | The element group. |
num_poly_out | The total number number of polygons or polyhedra to be written in the table. |
data_list_length_out | The total number of values to be written to the table (the number of polys plus the sum of the number of entities in each poly's connectivity data.) |
first_id_out | Elements are assigned global IDs in sequential blocks where the block is the table in which their connectivity data is written and the sequence is the sequence in which they are written in that table. The global ID for the first element in this group is passed back at this address. The global IDs for all other elements in the table are assigned in the sequence in which they are written in the table. |
idx_and_id_handles_out | The handles for the index list and connectivity list, respectively. |
status | Passed back status of API call. |
Definition at line 268 of file connectivity.c.
275 {
276 FileHandle* file_ptr;
277 hid_t elem_id, table_id, index_id;
278 hsize_t row_count;
279 API_BEGIN;
280
281 file_ptr = (FileHandle*)( file_handle );
282 if( !mhdf_check_valid_file( file_ptr, status ) ) return;
283
284 if( !num_poly_out || !data_list_length_out || !first_poly_id_out )
285 {
286 mhdf_setFail( status, "Invalid argument." );
287 return;
288 }
289
290 elem_id = mhdf_elem_group_from_handle( file_ptr, element_handle, status );
291 if( elem_id < 0 ) return;
292
293 index_id = mhdf_open_table( elem_id, POLY_INDEX_NAME, 1, &row_count, status );
294 if( index_id < 0 )
295 {
296 H5Gclose( elem_id );
297 return;
298 }
299 *num_poly_out = (int)row_count;
300
301 table_id = mhdf_open_table( elem_id, CONNECTIVITY_NAME, 1, &row_count, status );
302
303 H5Gclose( elem_id );
304 if( table_id < 0 )
305 {
306 H5Dclose( index_id );
307 return;
308 }
309 *data_list_length_out = (long)row_count;
310
311 if( !mhdf_read_scalar_attrib( table_id, START_ID_ATTRIB, H5T_NATIVE_LONG, first_poly_id_out, status ) )
312 {
313 H5Dclose( table_id );
314 H5Dclose( index_id );
315 return;
316 }
317
318 file_ptr->open_handle_count++;
319 handles_out[0] = index_id;
320 handles_out[1] = table_id;
321 mhdf_setOkay( status );
322 API_END_H( 2 );
323 }
References API_BEGIN, API_END_H, CONNECTIVITY_NAME, mhdf_check_valid_file(), mhdf_elem_group_from_handle(), mhdf_open_table(), mhdf_read_scalar_attrib(), mhdf_setFail(), mhdf_setOkay(), struct_FileHandle::open_handle_count, POLY_INDEX_NAME, and START_ID_ATTRIB.
Referenced by check_valid_poly_conn(), get_elem_desc(), and moab::ReadHDF5::read_poly().
hid_t mhdf_openSetChildren | ( | mhdf_FileHandle | file_handle, |
long * | child_list_size, | ||
mhdf_Status * | status | ||
) |
Open the file object containing the set child list.
Open the data group containing the list of set children.
See mhdf_createSetChildren and mhdf_createSetMeta for a description of this data.
file_handle | The file |
child_list_size | The total length of the data (the sum of the number of children for each set.) |
status | Passed back status of API call. |
Definition at line 740 of file sets.c.
741 {
742 FileHandle* file_ptr;
743 hid_t table_id;
744 hsize_t dim;
745 API_BEGIN;
746
747 file_ptr = (FileHandle*)( file_handle );
748 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
749
750 if( !child_list_size )
751 {
752 mhdf_setFail( status, "Invalid argument.\n" );
753 return -1;
754 }
755
756 table_id = mhdf_open_table( file_ptr->hdf_handle, SET_CHILD_PATH, 1, &dim, status );
757
758 *child_list_size = (long)dim;
759 API_END_H( 1 );
760 return table_id;
761 }
References API_BEGIN, API_END_H, dim, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_open_table(), mhdf_setFail(), and SET_CHILD_PATH.
Referenced by check_valid_sets(), moab::ReadHDF5::read_set_ids_recursive(), moab::ReadHDF5::read_sets(), and moab::WriteHDF5::write_sets().
hid_t mhdf_openSetData | ( | mhdf_FileHandle | file_handle, |
long * | data_list_size_out, | ||
mhdf_Status * | status | ||
) |
Open the file object for the meshset contents.
Open set contents data object. The format of this data is a vector of integer values which is the concatenation of the contents list for all the meshsets. The length and format of the data for each set is stored in the set meta table. See mhdf_createSetMeta and mhdf_SET_RANGE_BIT for a description of that data.
file_handle | The file. |
data_list_size_out | The length of the table. |
status | Passed back status of API call. |
Definition at line 657 of file sets.c.
658 {
659 FileHandle* file_ptr;
660 hid_t table_id;
661 hsize_t dim;
662 API_BEGIN;
663
664 file_ptr = (FileHandle*)( file_handle );
665 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
666
667 if( !data_list_size_out )
668 {
669 mhdf_setFail( status, "Invalid argument.\n" );
670 return -1;
671 }
672
673 table_id = mhdf_open_table( file_ptr->hdf_handle, SET_DATA_PATH, 1, &dim, status );
674
675 *data_list_size_out = (long)dim;
676 API_END_H( 1 );
677 return table_id;
678 }
References API_BEGIN, API_END_H, dim, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_open_table(), mhdf_setFail(), and SET_DATA_PATH.
Referenced by check_valid_sets(), moab::ReadHDF5::find_sets_containing(), moab::ReadHDF5::get_set_contents(), moab::ReadHDF5::read_set_ids_recursive(), moab::ReadHDF5::read_sets(), and moab::WriteHDF5::write_sets().
hid_t mhdf_openSetMeta | ( | mhdf_FileHandle | file_handle, |
long * | num_sets_out, | ||
long * | first_set_id_out, | ||
mhdf_Status * | status | ||
) |
Open table holding list of meshsets and their properties.
Open set list.
See mhdf_createSetMeta or mhdf Meshset data for a description of this data.
file_handle | The file. |
num_sets_out | The number of sets in the table. |
first_set_id_out | The global ID that will of the first set in the table. All subsequent sets in the table have sequential global IDs. |
status | Passed back status of API call. |
Definition at line 145 of file sets.c.
146 {
147 FileHandle* file_ptr = (FileHandle*)file;
148 hid_t table_id;
149 hsize_t dims[2];
150 API_BEGIN;
151
152 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
153
154 table_id = mhdf_open_table2( file_ptr->hdf_handle, SET_META_PATH, 2, dims, first_id_out, status );
155 if( table_id < 0 ) return -1;
156
157 /* If dims[1] == 3, then old format of table.
158 * Deal with it in mhdf_readSetMeta and mhdf_writeSetMeta
159 */
160 if( dims[1] != 4 && dims[1] != 3 )
161 {
162 mhdf_setFail( status, "Invalid format for meshset table.\n" );
163 H5Dclose( table_id );
164 return -1;
165 }
166
167 *num_sets = dims[0];
168 file_ptr->open_handle_count++;
169 mhdf_setOkay( status );
170 API_END_H( 1 );
171 return table_id;
172 }
References API_BEGIN, API_END_H, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_open_table2(), mhdf_setFail(), mhdf_setOkay(), struct_FileHandle::open_handle_count, and SET_META_PATH.
Referenced by check_valid_sets(), mhdf_getFileSummary(), and moab::WriteHDF5::write_sets().
hid_t mhdf_openSetMetaSimple | ( | mhdf_FileHandle | file_handle, |
mhdf_Status * | status | ||
) |
Definition at line 174 of file sets.c.
175 {
176 FileHandle* file_ptr = (FileHandle*)file;
177 hid_t table_id;
178 API_BEGIN;
179
180 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
181
182 table_id = mhdf_open_table_simple( file_ptr->hdf_handle, SET_META_PATH, status );
183 if( table_id < 0 ) return -1;
184
185 file_ptr->open_handle_count++;
186 mhdf_setOkay( status );
187 API_END_H( 1 );
188 return table_id;
189 }
References API_BEGIN, API_END_H, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_open_table_simple(), mhdf_setOkay(), struct_FileHandle::open_handle_count, and SET_META_PATH.
Referenced by moab::ReadHDF5::read_all_set_meta().
hid_t mhdf_openSetParents | ( | mhdf_FileHandle | file_handle, |
long * | parent_list_size, | ||
mhdf_Status * | status | ||
) |
Open the file object containing the set parent list.
Open the data group containing the list of set parents.
See mhdf_createSetParents and mhdf_createSetMeta for a description of this data.
file_handle | The file |
parent_list_size | The total length of the data (the sum of the number of parents for each set.) |
status | Passed back status of API call. |
Definition at line 785 of file sets.c.
786 {
787 FileHandle* file_ptr;
788 hid_t table_id;
789 hsize_t dim;
790 API_BEGIN;
791
792 file_ptr = (FileHandle*)( file_handle );
793 if( !mhdf_check_valid_file( file_ptr, status ) ) return -1;
794
795 if( !parent_list_size )
796 {
797 mhdf_setFail( status, "Invalid argument.\n" );
798 return -1;
799 }
800
801 table_id = mhdf_open_table( file_ptr->hdf_handle, SET_PARENT_PATH, 1, &dim, status );
802
803 *parent_list_size = (long)dim;
804 API_END_H( 1 );
805 return table_id;
806 }
References API_BEGIN, API_END_H, dim, struct_FileHandle::hdf_handle, mhdf_check_valid_file(), mhdf_open_table(), mhdf_setFail(), and SET_PARENT_PATH.
Referenced by check_valid_sets(), moab::ReadHDF5::read_sets(), and moab::WriteHDF5::write_sets().
void mhdf_openSparseTagData | ( | mhdf_FileHandle | file_handle, |
const char * | tag_name, | ||
long * | num_entity_out, | ||
long * | num_values_out, | ||
hid_t | entities_and_values_out[3], | ||
mhdf_Status * | status | ||
) |
Create file objects to read sparse tag data.
Open the file objects containing all sparse data for a given tag in. The sparse data is stored in a pair of objects. The first is a vector of global IDs. The second is a vector of tag values for each entity specified in the list of global IDs. For variable-length tags, a third table containing end offsets for each tag value is returned in the third position of the output hid_t array (see mhdf_readSparseTagIndices.)
file_handle | The file. |
tag_name | The tag. |
num_entity_out | The number of entities for which there are tag values. |
num_values_out | The number of data values. For fixed-length tags, this is the same as num_entity_out. For variable-length tags, it is the total number of values in the data table. |
entities_and_values_out | The handles to the pair of file objects. The first is the vector of global IDs. The second is the list of corresponding tag values. The third is the handle to the index table, iff the tag is variable-length. If the tag is fixed-length, this value is not set. |
status | Passed back status of API call. |
Definition at line 1511 of file tags.c.
1517 {
1518 hid_t tag_id, index_id, data_id, offset_id = -1;
1519 hsize_t num_ent, data_size, num_data;
1520 int rval;
1521 unsigned idx;
1522 API_BEGIN;
1523
1524 tag_id = get_tag( file_handle, tag_name, NULL, status );
1525 if( tag_id < 0 ) return;
1526
1527 index_id = mhdf_open_table( tag_id, SPARSE_ENTITY_NAME, 1, &num_ent, status );
1528 if( index_id < 0 )
1529 {
1530 H5Gclose( tag_id );
1531 return;
1532 }
1533
1534 data_id = mhdf_open_table( tag_id, SPARSE_VALUES_NAME, 1, &data_size, status );
1535 if( data_id < 0 )
1536 {
1537 H5Gclose( tag_id );
1538 H5Dclose( index_id );
1539 return;
1540 }
1541
1542 /* check if tag is variable-lentgth */
1543 rval = mhdf_find_attribute( tag_id, TAG_VARLEN_ATTRIB, &idx, status );
1544 if( rval < 0 )
1545 {
1546 H5Gclose( tag_id );
1547 H5Dclose( index_id );
1548 H5Dclose( data_id );
1549 return;
1550 }
1551
1552 /* If variable length... */
1553 if( rval )
1554 {
1555 offset_id = mhdf_open_table( tag_id, TAG_VAR_INDICES, 1, &num_data, status );
1556 if( offset_id < 0 )
1557 {
1558 H5Gclose( tag_id );
1559 H5Dclose( index_id );
1560 H5Dclose( data_id );
1561 return;
1562 }
1563 }
1564 /* Otherwise the number of values is the same as the size of the data table */
1565 else
1566 {
1567 num_data = data_size;
1568 }
1569
1570 H5Gclose( tag_id );
1571 if( num_ent != num_data )
1572 {
1573 mhdf_setFail( status, "Data length mismatch for sparse tag data -- invalid file." );
1574 if( offset_id >= 0 ) H5Dclose( offset_id );
1575 H5Dclose( index_id );
1576 H5Dclose( data_id );
1577 return;
1578 }
1579 *num_entity_out = (long)num_ent;
1580 if( num_values_out ) *num_values_out = (long)data_size;
1581
1582 handles_out[0] = index_id;
1583 handles_out[1] = data_id;
1584 if( offset_id >= 0 ) handles_out[2] = offset_id;
1585 mhdf_setOkay( status );
1586 API_END_H( 2 );
1587 }
References API_BEGIN, API_END_H, get_tag(), mhdf_find_attribute(), mhdf_open_table(), mhdf_setFail(), mhdf_setOkay(), SPARSE_ENTITY_NAME, SPARSE_VALUES_NAME, TAG_VAR_INDICES, and TAG_VARLEN_ATTRIB.
Referenced by check_valid_tag(), check_valid_var_len_tag(), moab::ReadHDF5::get_tagged_entities(), main(), mhdf_getFileSummary(), moab::ReadHDF5::read_tag(), moab::ReadHDF5::read_tag_values_all(), moab::ReadHDF5::read_tag_values_partial(), moab::ReadHDF5::search_tag_values(), moab::WriteHDF5::write_sparse_tag(), and moab::WriteHDF5::write_var_len_tag().
void mhdf_readAdjacency | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | adj_list_data_out, | ||
mhdf_Status * | status | ||
) |
Read node/element adjacency data.
Read adjacency data.
Adjacency data is formated as a sequence of integer groups where the first entry in each group is the ID of the element for which adjacencies are being specified, the second value is the count of adjacent entities, and the remainder of the group is the list of IDs of the adjacent entities.
data_handle | Handle returned from mhdf_createAdjacency or mhdf_openAdjacency . |
offset | List position at which to start reading. Offset is from the count if integer values written, NOT a count of the number of elements for which adjacency data is written. |
count | Number of integer values to reading. |
hdf_integer_type | The type of the integer data in adj_list_data_out . Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
adj_list_data_out | Pointer to memory at which to write adjacency data. |
status | Passed back status of API call. |
Definition at line 148 of file adjacency.c.
149 {
150 API_BEGIN;
151 mhdf_read_data( table_id, offset, count, type, data, H5P_DEFAULT, status );
152 API_END;
153 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by check_valid_adjacencies().
void mhdf_readAdjacencyWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | adj_list_data_out, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 154 of file adjacency.c.
161 {
162 API_BEGIN;
163 mhdf_read_data( table_id, offset, count, type, data, prop, status );
164 API_END;
165 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by moab::ReadHDF5::read_adjacencies().
void mhdf_readConnectivity | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | node_id_list, | ||
mhdf_Status * | status | ||
) |
Read element coordinate data.
Read interleaved fixed-connectivity element data for a block of elements. Note: Do not use this for polygon or polyhedron data.
data_handle | Handle returned from mhdf_createConnectivity or mhdf_openConnectivity . |
offset | Table row (element index) at which to start read. |
count | Number of rows (number of elements) to read. |
hdf_integer_type | The type of the integer data in node_id_list. Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
node_id_list | Pointer to memory at which to write interleaved connectivity data specified as global node IDs. |
status | Passed back status of API call. |
Definition at line 163 of file connectivity.c.
169 {
170 API_BEGIN;
171 mhdf_read_data( table_id, offset, count, hdf_integer_type, nodes, H5P_DEFAULT, status );
172 API_END;
173 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by check_valid_elem_conn(), and main().
void mhdf_readConnectivityWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | node_id_list, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 174 of file connectivity.c.
181 {
182 API_BEGIN;
183 mhdf_read_data( table_id, offset, count, hdf_integer_type, nodes, prop, status );
184 API_END;
185 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by moab::ReadHDF5::read_node_adj_elems().
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
file | The file. |
num_records_out | The length of the returned array. |
status | Passed back status of API call. |
Definition at line 823 of file file.c.
824 {
825 FileHandle* file_ptr;
826 hid_t data_id, type_id, space_id, group_id;
827 hsize_t dim;
828 herr_t rval;
829 char** array;
830 API_BEGIN;
831
832 file_ptr = (FileHandle*)( file_handle );
833 if( !mhdf_check_valid_file( file_ptr, status ) ) return NULL;
834
835 /* check if file contains history data */
836 #if defined( H5Gopen_vers ) && H5Gopen_vers > 1
837 group_id = H5Gopen2( file_ptr->hdf_handle, ROOT_GROUP, H5P_DEFAULT );
838 #else
839 group_id = H5Gopen( file_ptr->hdf_handle, ROOT_GROUP );
840 #endif
841 if( group_id < 0 )
842 {
843 mhdf_setFail( status, "Could not open root group. Invalid file." );
844 return NULL;
845 }
846
847 rval = mhdf_is_in_group( group_id, HISTORY_NAME, status );
848 if( rval < 1 )
849 {
850 H5Gclose( group_id );
851 *num_strings = 0;
852 if( 0 == rval ) mhdf_setOkay( status );
853 return NULL;
854 }
855
856 #if defined( H5Dopen_vers ) && H5Dopen_vers > 1
857 data_id = H5Dopen2( group_id, HISTORY_NAME, H5P_DEFAULT );
858 #else
859 data_id = H5Dopen( group_id, HISTORY_NAME );
860 #endif
861 H5Gclose( group_id );
862 if( data_id < 0 )
863 {
864 mhdf_setFail( status, "Failed to open \"%s\".", HISTORY_PATH );
865 return NULL;
866 }
867
868 space_id = H5Dget_space( data_id );
869 if( space_id < 0 )
870 {
871 H5Dclose( data_id );
872 mhdf_setFail( status, "Internal error calling H5Dget_space." );
873 return NULL;
874 }
875
876 if( 1 != H5Sget_simple_extent_ndims( space_id ) || 1 != H5Sget_simple_extent_dims( space_id, &dim, NULL ) )
877 {
878 H5Dclose( data_id );
879 mhdf_setFail( status, "Invalid dimension for \"%s\".", HISTORY_PATH );
880 return NULL;
881 }
882 H5Sclose( space_id );
883
884 if( 0 == dim )
885 {
886 H5Dclose( data_id );
887 *num_strings = 0;
888 mhdf_setOkay( status );
889 return NULL;
890 }
891
892 array = (char**)mhdf_malloc( dim * sizeof( char* ), status );
893 if( !array )
894 {
895 H5Dclose( data_id );
896 return NULL;
897 }
898
899 type_id = H5Tcopy( H5T_C_S1 );
900 if( type_id < 0 || H5Tset_size( type_id, H5T_VARIABLE ) < 0 )
901 {
902 H5Dclose( data_id );
903 if( type_id >= 0 ) H5Tclose( type_id );
904 mhdf_setFail( status, "Could not create variable length string type." );
905 free( array );
906 return NULL;
907 }
908
909 rval = H5Dread( data_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, array );
910 H5Tclose( type_id );
911 H5Dclose( data_id );
912 if( rval < 0 )
913 {
914 free( array );
915 mhdf_setFail( status, "H5Dread failed." );
916 return NULL;
917 }
918
919 *num_strings = dim;
920 mhdf_setOkay( status );
921 API_END;
922 return array;
923 }
References API_BEGIN, API_END, dim, struct_FileHandle::hdf_handle, HISTORY_NAME, HISTORY_PATH, mhdf_check_valid_file(), mhdf_is_in_group(), mhdf_malloc(), mhdf_setFail(), mhdf_setOkay(), and ROOT_GROUP.
Referenced by moab::ReadHDF5::read_qa().
void mhdf_readNodeCoord | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
int | dimension, | ||
double * | coords, | ||
mhdf_Status * | status | ||
) |
Read node coordinate data.
Read a single coordinate value (e.g. the 'x' coordinate) for a block of nodes.
data_handle | Handle returned from mhdf_createNodeCoords or mhdf_openNodeCoords . |
offset | Table row (node index) at which to start reading. |
count | Number of rows (number of nodes) to read. |
dimension | The coordinate to read (0->x, 1->y, ...) |
coords | Buffer in which to write node coordinate data. |
status | Passed back status of API call. |
Definition at line 219 of file nodes.c.
220 {
221 API_BEGIN;
222 mhdf_read_column( table_id, dimension, offset, count, H5T_NATIVE_DOUBLE, coords, H5P_DEFAULT, status );
223 API_END;
224 }
References API_BEGIN, API_END, and mhdf_read_column().
void mhdf_readNodeCoords | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
double * | coordinates, | ||
mhdf_Status * | status | ||
) |
Read node coordinate data.
Read interleaved coordinate data for a block of nodes
data_handle | Handle returned from mhdf_createNodeCoords or mhdf_openNodeCoords . |
offset | Table row (node index) at which to start reading. |
count | Number of rows (number of nodes) to read. |
coordinates | Buffer in which to write node coordinate data. |
status | Passed back status of API call. |
Definition at line 177 of file nodes.c.
178 {
179 API_BEGIN;
180 mhdf_read_data( table_id, offset, count, H5T_NATIVE_DOUBLE, coords, H5P_DEFAULT, status );
181 API_END;
182 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by main().
void mhdf_readNodeCoordsWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
double * | coordinates, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 183 of file nodes.c.
189 {
190 API_BEGIN;
191 mhdf_read_data( table_id, offset, count, H5T_NATIVE_DOUBLE, coords, prop, status );
192 API_END;
193 }
References API_BEGIN, API_END, and mhdf_read_data().
void mhdf_readNodeCoordWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
int | dimension, | ||
double * | coords, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 225 of file nodes.c.
232 {
233 API_BEGIN;
234 mhdf_read_column( table_id, dimension, offset, count, H5T_NATIVE_DOUBLE, coords, prop, status );
235 API_END;
236 }
References API_BEGIN, API_END, and mhdf_read_column().
void mhdf_readPolyConnIDs | ( | hid_t | poly_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | id_list, | ||
mhdf_Status * | status | ||
) |
Read polygon or polyhedron connectivity data.
Poly (polygon or polyhedron) connectivity is stored as two lists. One list is the concatenation of the the connectivity data for all the polys in the group. The other contains one value per poly where that value is the index of the last entry in the connectivity of the corresponding poly. The ID list for polygons contains global node IDs. The ID list for polyhedra contains the global IDs of faces (either polygons or 2D fixed-connectivity elements.)
poly_handle | The handle returned from mhdf_createPolyConnectivity or mhdf_openPolyConnectivity . |
offset | The offset in the table at which to read. The offset is in terms of the integer values in the table, not the count of polys. |
count | The size of the integer list to read. |
hdf_integer_type | The type of the integer data as written into memory. Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
id_list | The memory location at which to write the connectivity data. |
status | Passed back status of API call. |
Definition at line 397 of file connectivity.c.
403 {
404 API_BEGIN;
405 mhdf_read_data( table_id, offset, count, hdf_integer_type, id_list, H5P_DEFAULT, status );
406 API_END;
407 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by check_valid_poly_conn().
void mhdf_readPolyConnIDsWithOpt | ( | hid_t | poly_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | id_list, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 408 of file connectivity.c.
415 {
416 API_BEGIN;
417 mhdf_read_data( table_id, offset, count, hdf_integer_type, id_list, prop, status );
418 API_END;
419 }
References API_BEGIN, API_END, and mhdf_read_data().
void mhdf_readPolyConnIndices | ( | hid_t | poly_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | index_list, | ||
mhdf_Status * | status | ||
) |
Read polygon or polyhedron index data.
Poly (polygon or polyhedron) connectivity is stored as two lists. One list is the concatenation of the the connectivity data for all the polys in the group. The other contains one value per poly where that value is the index of the last entry in the connectivity of the corresponding poly. The ID list for polygons contains global node IDs. The ID list for polyhedra contains the global IDs of faces (either polygons or 2D fixed-connectivity elements.)
poly_handle | The handle returned from mhdf_createPolyConnectivity or mhdf_openPolyConnectivity . |
offset | The offset in the table at which to read. The offset is in terms of the integer values in the table, not the count of polys. |
count | The size of the integer list to read. |
hdf_integer_type | The type of the integer data as written into memory. Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
index_list | The memory location at which to write the indices. |
status | Passed back status of API call. |
Definition at line 349 of file connectivity.c.
355 {
356 API_BEGIN;
357 mhdf_read_data( table_id, offset, count, hdf_integer_type, index_list, H5P_DEFAULT, status );
358 API_END;
359 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by check_valid_poly_conn().
void mhdf_readPolyConnIndicesWithOpt | ( | hid_t | poly_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | index_list, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 360 of file connectivity.c.
367 {
368 API_BEGIN;
369 mhdf_read_data( table_id, offset, count, hdf_integer_type, index_list, prop, status );
370 API_END;
371 }
References API_BEGIN, API_END, and mhdf_read_data().
void mhdf_readSetChildEndIndices | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | end_indices_out, | ||
mhdf_Status * | status | ||
) |
Read only the child end indices portion of the set description table.
For each set, read the last index of that set's data in the set children table.
NOTE: This is a signed value. Any sets w/out contents that occur first in the list will have an end index of -1.
data_handle | The handle returned from mdhf_createSetMeta or mhdf_openSetMeta |
offset | The offset (set index) at which to begin reading. |
count | The number of values (number of sets) to read. |
hdf_integer_type | The integer type of the input array 'set_flag_data'. |
end_indices_out | Array of indices. |
status | Location at which to store status of API call. |
Definition at line 592 of file sets.c.
593 {
594 API_BEGIN;
595 mhdf_readSetMetaColumn( table_id, CHILDREN, offset, count, type, data, H5P_DEFAULT, status );
596 API_END;
597 }
References API_BEGIN, API_END, CHILDREN, and mhdf_readSetMetaColumn().
Referenced by check_valid_parents_children().
void mhdf_readSetChildEndIndicesWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | end_indices_out, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
void mhdf_readSetContentEndIndices | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | end_indices_out, | ||
mhdf_Status * | status | ||
) |
Read only the content end indices portion of the set description table.
For each set, read the last index of that set's data in the set contents table.
NOTE: This is a signed value. Any sets w/out contents that occur first in the list will have an end index of -1.
data_handle | The handle returned from mdhf_createSetMeta or mhdf_openSetMeta |
offset | The offset (set index) at which to begin reading. |
count | The number of values (number of sets) to read. |
hdf_integer_type | The integer type of the input array 'set_flag_data'. |
end_indices_out | Array of indices. |
status | Location at which to store status of API call. |
Definition at line 568 of file sets.c.
574 {
575 API_BEGIN;
576 mhdf_readSetMetaColumn( table_id, CONTENT, offset, count, type, data, H5P_DEFAULT, status );
577 API_END;
578 }
References API_BEGIN, API_END, CONTENT, and mhdf_readSetMetaColumn().
Referenced by check_valid_set_contents().
void mhdf_readSetContentEndIndicesWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | end_indices_out, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
void mhdf_readSetData | ( | hid_t | set_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | set_data, | ||
mhdf_Status * | status | ||
) |
Read set contents.
Read data specifying entities contained in sets. The format of this data is a vector of integer values which is the concatenation of the contents list for all the meshsets. The length and format of the data for each set is stored in the set meta table. See mhdf_createSetMeta and mhdf_SET_RANGE_BIT for a description of that data.
set_handle | The handle returned from mhdf_createSetData or mhdf_openSetData . |
offset | The position at which to read from the integer vector. |
count | The number of values to read from the data vector. |
hdf_integer_type | The type of the integer data in set_data . Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
set_data | A pointer to memory at which to store the read data. |
status | Passed back status of API call. |
Definition at line 699 of file sets.c.
700 {
701 API_BEGIN;
702 mhdf_read_data( table_id, offset, count, type, data, H5P_DEFAULT, status );
703 API_END;
704 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by check_valid_set_contents(), and moab::ReadHDF5::find_sets_containing().
void mhdf_readSetDataWithOpt | ( | hid_t | set_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | set_data, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 705 of file sets.c.
712 {
713 API_BEGIN;
714 mhdf_read_data( table_id, offset, count, type, data, prop, status );
715 API_END;
716 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by moab::ReadHDF5::find_sets_containing().
void mhdf_readSetFlags | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | set_flag_data, | ||
mhdf_Status * | status | ||
) |
Read only the flags portion of the set description table.
Read flags for each set from the set description table. See mhdf_createSetMeta for a description of this data.
data_handle | The handle returned from mdhf_createSetMeta or mhdf_openSetMeta |
offset | The offset (set index) at which to begin reading. |
count | The number of values (number of sets) to read. |
hdf_integer_type | The integer type of the input array 'set_flag_data'. |
set_flag_data | Array of integers. |
status | Location at which to store status of API call. |
Definition at line 549 of file sets.c.
550 {
551 API_BEGIN;
552 mhdf_readSetMetaColumn( table_id, FLAGS, offset, count, type, data, H5P_DEFAULT, status );
553 API_END;
554 }
References API_BEGIN, API_END, FLAGS, and mhdf_readSetMetaColumn().
Referenced by check_valid_set_contents().
void mhdf_readSetFlagsWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | set_flag_data, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
void mhdf_readSetMeta | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | set_desc_data, | ||
mhdf_Status * | status | ||
) |
Read list of sets and meta-information about sets.
Read set descriptions. See mhdf_createSetMeta or mhdf Meshset data for a description of this data.
data_handle | The handle returned from mhdf_createSetMeta or mhdf_openSetMeta. |
offset | The offset (set index) to begin reading at. |
count | The number of rows (sets, integer triples) to read. |
hdf_integer_type | The type of the integer data in set_desc_data . Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
status | Passed back status of API call. |
set_desc_data | The memory location at which to write the data. |
Definition at line 367 of file sets.c.
368 {
369 API_BEGIN;
370 mhdf_readwriteSetMeta( table_id, 1, offset, count, type, data, H5P_DEFAULT, status );
371 API_END;
372 }
References API_BEGIN, API_END, and mhdf_readwriteSetMeta().
void mhdf_readSetMetaWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | set_desc_data, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 373 of file sets.c.
380 {
381 API_BEGIN;
382 mhdf_readwriteSetMeta( table_id, 1, offset, count, type, data, prop, status );
383 API_END;
384 }
References API_BEGIN, API_END, and mhdf_readwriteSetMeta().
Referenced by moab::ReadHDF5::read_all_set_meta().
void mhdf_readSetParentEndIndices | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | end_indices_out, | ||
mhdf_Status * | status | ||
) |
Read only the parent end indices portion of the set description table.
For each set, read the last index of that set's data in the set parents table.
NOTE: This is a signed value. Any sets w/out contents that occur first in the list will have an end index of -1.
data_handle | The handle returned from mdhf_createSetMeta or mhdf_openSetMeta |
offset | The offset (set index) at which to begin reading. |
count | The number of values (number of sets) to read. |
hdf_integer_type | The integer type of the input array 'set_flag_data'. |
end_indices_out | Array of indices. |
status | Location at which to store status of API call. |
Definition at line 611 of file sets.c.
617 {
618 API_BEGIN;
619 mhdf_readSetMetaColumn( table_id, PARENTS, offset, count, type, data, H5P_DEFAULT, status );
620 API_END;
621 }
References API_BEGIN, API_END, mhdf_readSetMetaColumn(), and PARENTS.
Referenced by check_valid_parents_children().
void mhdf_readSetParentEndIndicesWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | end_indices_out, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
void mhdf_readSetParentsChildren | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | id_list, | ||
mhdf_Status * | status | ||
) |
Read set parent/child list.
Read from the list of parent or child IDs for sets. See mhdf_createSetChildren and mhdf_createSetMeta for a description of this data.
data_handle | The value returned from mhdf_createSetChildren or mhdf_openSetChildren. |
offset | The offset into the list of global IDs. |
count | The number of global IDs to read. |
hdf_integer_type | The type of the integer data in child_id_list . Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
id_list | Pointer to memory in which to the read data. |
status | Passed back status of API call. |
Definition at line 832 of file sets.c.
833 {
834 API_BEGIN;
835 mhdf_read_data( table_id, offset, count, type, data, H5P_DEFAULT, status );
836 API_END;
837 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by check_valid_parents_children().
void mhdf_readSetParentsChildrenWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | id_list, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 838 of file sets.c.
845 {
846 API_BEGIN;
847 mhdf_read_data( table_id, offset, count, type, data, prop, status );
848 API_END;
849 }
References API_BEGIN, API_END, and mhdf_read_data().
void mhdf_readSparseTagEntities | ( | hid_t | id_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | id_list, | ||
mhdf_Status * | status | ||
) |
Read Global ID list for sparse tag data.
id_handle | The first handle passed back from either mhdf_createSparseTagData or mhdf_openSparseTagData. |
offset | The offset at which to begin reading. |
count | The number of global IDs to read. |
hdf_integer_type | The type of the integer data in id_list . Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
id_list | The memory location at which to store the global IDs. |
status | Passed back status of API call. |
Definition at line 1660 of file tags.c.
1666 {
1667 API_BEGIN;
1668 mhdf_read_data( table_id, offset, count, int_type, id_list, H5P_DEFAULT, status );
1669 API_END;
1670 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by check_valid_tag(), check_valid_var_len_tag(), and main().
void mhdf_readSparseTagEntitiesWithOpt | ( | hid_t | id_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | id_list, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 1671 of file tags.c.
1678 {
1679 API_BEGIN;
1680 mhdf_read_data( table_id, offset, count, int_type, id_list, io_prop, status );
1681 API_END;
1682 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by moab::ReadHDF5::get_tagged_entities(), and moab::ReadHDF5::search_tag_values().
void mhdf_readSparseTagIndices | ( | hid_t | tag_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | end_indices, | ||
mhdf_Status * | status | ||
) |
Read sparse tag end indices for variable-length tag data.
Read sparse tag end indices for variable-length tag data. Each value in the list is the last index (zero-based) into the tag data for the corresponding entity.
tag_handle | handle to the data object to read from. |
offset | The offset into the table at which to begin reading |
count | The number of values to read. |
hdf_integer_type | The type of the values pointed to by end_indices (must be an integer type). |
end_indices | Memory in which to store the data read from the table. |
status | Output: API result. |
Definition at line 1701 of file tags.c.
1707 {
1708 API_BEGIN;
1709 mhdf_read_data( table_id, offset, count, int_type, indices, H5P_DEFAULT, status );
1710 API_END;
1711 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by check_valid_var_len_tag().
void mhdf_readSparseTagIndicesWithOpt | ( | hid_t | tag_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
void * | end_indices, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 1712 of file tags.c.
1719 {
1720 API_BEGIN;
1721 mhdf_read_data( table_id, offset, count, int_type, indices, io_prop, status );
1722 API_END;
1723 }
References API_BEGIN, API_END, and mhdf_read_data().
void mhdf_readTagValues | ( | hid_t | value_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_type, | ||
void * | memory, | ||
mhdf_Status * | status | ||
) |
Read tag values.
value_handle | The second handle passed back from either mhdf_createSparseTagData or mhdf_openSparseTagData; or the handle returned by mhdf_createDenseTagData or mhdf_openDenseTagData. |
offset | The offset at which to begin reading. |
count | The number of tag values to read. |
hdf_type | The type of the data in memory. If this is specified, it must be possible for the HDF library to convert between this type and the type the tag data is stored as. If zero, the values will be read as opaque data. |
memory | Memory location at which to store tag values. |
status | Passed back status of API call. |
Definition at line 1684 of file tags.c.
1685 {
1686 mhdf_readTagValuesWithOpt( table_id, offset, count, tag_type, tag_data, H5P_DEFAULT, status );
1687 }
References mhdf_readTagValuesWithOpt().
Referenced by check_valid_tag(), check_valid_var_len_tag(), and mhdf_getFileSummary().
void mhdf_readTagValuesWithOpt | ( | hid_t | value_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_type, | ||
void * | memory, | ||
hid_t | read_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 1688 of file tags.c.
1695 {
1696 API_BEGIN;
1697 mhdf_read_data( table_id, offset, count, tag_type, tag_data, io_prop, status );
1698 API_END;
1699 }
References API_BEGIN, API_END, and mhdf_read_data().
Referenced by mhdf_readTagValues(), moab::ReadHDF5::read_tag_values_all(), and moab::ReadHDF5::search_tag_values().
const char* mhdf_set_type_handle | ( | void | ) |
Return a special element group handle used to specify the set group.
Definition at line 742 of file file.c.
743 {
744 static const char rval[] = "sets";
745 return rval;
746 }
Referenced by check_valid_tag(), mhdf_createDenseTagData(), mhdf_getFileSummary(), mhdf_haveDenseTag(), mhdf_openDenseTagData(), moab::WriteHDF5::ExportSet::name(), moab::ReadHDF5::read_tag(), moab::ReadHDF5::read_tag_values_all(), moab::ReadHDF5::read_tag_values_partial(), and moab::ReadHDF5::search_tag_values().
void mhdf_writeAdjacency | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | adj_list_data, | ||
mhdf_Status * | status | ||
) |
Write node/element adjacency data.
Write adjacency data.
Adjacency data is formated as a sequence of integer groups where the first entry in each group is the ID of the element for which adjacencies are being specified, the second value is the count of adjacent entities, and the remainder of the group is the list of IDs of the adjacent entities.
data_handle | Handle returned from mhdf_createAdjacency or mhdf_openAdjacency . |
offset | List position at which to start writing. Offset is from the count if integer values written, NOT a count of the number of elements for which adjacency data is written. |
count | Number of integer values to write. |
hdf_integer_type | The type of the integer data in adj_list_data . Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
adj_list_data | Adjacency data to write. |
status | Passed back status of API call. |
Definition at line 128 of file adjacency.c.
129 {
130 API_BEGIN;
131 mhdf_write_data( table_id, offset, count, type, data, H5P_DEFAULT, status );
132 API_END;
133 }
References API_BEGIN, API_END, and mhdf_write_data().
void mhdf_writeAdjacencyWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | adj_list_data, | ||
hid_t | write_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 135 of file adjacency.c.
142 {
143 API_BEGIN;
144 mhdf_write_data( table_id, offset, count, type, data, prop, status );
145 API_END;
146 }
References API_BEGIN, API_END, and mhdf_write_data().
Referenced by moab::WriteHDF5::write_adjacencies().
void mhdf_writeConnectivity | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | node_id_list, | ||
mhdf_Status * | status | ||
) |
Write element coordinate data.
Write interleaved fixed-connectivity element data for a block of elements. Note: Do not use this for polygon or polyhedron data.
data_handle | Handle returned from mhdf_createConnectivity or mhdf_openConnectivity . |
offset | Table row (element index) at which to start writing. |
count | Number of rows (number of elements) to write. |
hdf_integer_type | The type of the integer data in node_id_list. Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
node_id_list | Interleaved connectivity data specified as global node IDs. |
status | Passed back status of API call. |
Definition at line 139 of file connectivity.c.
145 {
146 API_BEGIN;
147 mhdf_write_data( table_id, offset, count, hdf_integer_type, nodes, H5P_DEFAULT, status );
148 API_END;
149 }
References API_BEGIN, API_END, and mhdf_write_data().
void mhdf_writeConnectivityWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | node_id_list, | ||
hid_t | write_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 150 of file connectivity.c.
157 {
158 API_BEGIN;
159 mhdf_write_data( table_id, offset, count, hdf_integer_type, nodes, prop, status );
160 API_END;
161 }
References API_BEGIN, API_END, and mhdf_write_data().
Referenced by moab::WriteHDF5::write_elems().
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.
file | The file. |
strings | An array of null-terminated strings. |
num_strings | The length of strings |
status | Passed back status of API call. |
Definition at line 768 of file file.c.
769 {
770 FileHandle* file_ptr;
771 hid_t data_id, type_id, space_id;
772 hsize_t dim = (hsize_t)num_strings;
773 herr_t rval;
774 API_BEGIN;
775
776 file_ptr = (FileHandle*)( file_handle );
777 if( !mhdf_check_valid_file( file_ptr, status ) ) return;
778
779 type_id = H5Tcopy( H5T_C_S1 );
780 if( type_id < 0 || H5Tset_size( type_id, H5T_VARIABLE ) < 0 )
781 {
782 if( type_id >= 0 ) H5Tclose( type_id );
783 mhdf_setFail( status, "Could not create variable length string type." );
784 return;
785 }
786
787 space_id = H5Screate_simple( 1, &dim, NULL );
788 if( space_id < 0 )
789 {
790 H5Tclose( type_id );
791 mhdf_setFail( status, "H5Screate_simple failed." );
792 return;
793 }
794
795 #if defined( H5Dcreate_vers ) && H5Dcreate_vers > 1
796 data_id =
797 H5Dcreate2( file_ptr->hdf_handle, HISTORY_PATH, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT );
798 #else
799 data_id = H5Dcreate( file_ptr->hdf_handle, HISTORY_PATH, type_id, space_id, H5P_DEFAULT );
800 #endif
801 H5Sclose( space_id );
802 if( data_id < 0 )
803 {
804 H5Tclose( type_id );
805 mhdf_setFail( status, "Failed to create \"%s\".", HISTORY_PATH );
806 return;
807 }
808
809 rval = H5Dwrite( data_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, strings );
810 H5Dclose( data_id );
811 H5Tclose( type_id );
812 if( rval < 0 )
813 {
814 H5Gunlink( file_ptr->hdf_handle, HISTORY_PATH );
815 mhdf_setFail( status, "Failed to write history data." );
816 return;
817 }
818
819 mhdf_setOkay( status );
820 API_END;
821 }
References API_BEGIN, API_END, dim, struct_FileHandle::hdf_handle, HISTORY_PATH, mhdf_check_valid_file(), mhdf_setFail(), and mhdf_setOkay().
Referenced by moab::WriteHDF5::write_qa().
void mhdf_writeNodeCoord | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
int | dimension, | ||
const double * | coords, | ||
mhdf_Status * | status | ||
) |
Write node coordinate data.
Write a single coordinate value (e.g. the 'x' coordinate) for a block of nodes.
data_handle | Handle returned from mhdf_createNodeCoords or mhdf_openNodeCoords . |
offset | Table row (node index) at which to start writing. |
count | Number of rows (number of nodes) to write. |
dimension | The coordinate to write (0->x, 1->y, ...) |
coords | Coordinate list. |
status | Passed back status of API call. |
Definition at line 195 of file nodes.c.
201 {
202 API_BEGIN;
203 mhdf_write_column( table_id, dimension, offset, count, H5T_NATIVE_DOUBLE, coords, H5P_DEFAULT, status );
204 API_END;
205 }
References API_BEGIN, API_END, and mhdf_write_column().
void mhdf_writeNodeCoords | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
const double * | coords, | ||
mhdf_Status * | status | ||
) |
Write node coordinate data.
Write interleaved coordinate data for a block of nodes
data_handle | Handle returned from mhdf_createNodeCoords or mhdf_openNodeCoords . |
offset | Table row (node index) at which to start writing. |
count | Number of rows (number of nodes) to write. |
coords | Interleaved node coordinate data. |
status | Passed back status of API call. |
Definition at line 159 of file nodes.c.
160 {
161 API_BEGIN;
162 mhdf_write_data( table_id, offset, count, H5T_NATIVE_DOUBLE, coords, H5P_DEFAULT, status );
163 API_END;
164 }
References API_BEGIN, API_END, and mhdf_write_data().
void mhdf_writeNodeCoordsWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
const double * | coords, | ||
hid_t | write_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 165 of file nodes.c.
171 {
172 API_BEGIN;
173 mhdf_write_data( table_id, offset, count, H5T_NATIVE_DOUBLE, coords, prop, status );
174 API_END;
175 }
References API_BEGIN, API_END, and mhdf_write_data().
Referenced by moab::WriteHDF5::write_nodes().
void mhdf_writeNodeCoordWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
int | dimension, | ||
const double * | coords, | ||
hid_t | write_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 206 of file nodes.c.
213 {
214 API_BEGIN;
215 mhdf_write_column( table_id, dimension, offset, count, H5T_NATIVE_DOUBLE, coords, prop, status );
216 API_END;
217 }
References API_BEGIN, API_END, and mhdf_write_column().
Referenced by moab::WriteHDF5::write_nodes().
void mhdf_writePolyConnIDs | ( | hid_t | poly_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | id_list, | ||
mhdf_Status * | status | ||
) |
Write polygon or polyhedron connectivity data.
Poly (polygon or polyhedron) connectivity is stored as two lists. One list is the concatenation of the the connectivity data for all the polys in the group. The other contains one value per poly where that value is the index of the last entry in the connectivity of the corresponding poly. The ID list for polygons contains global node IDs. The ID list for polyhedra contains the global IDs of faces (either polygons or 2D fixed-connectivity elements.)
This function writes the connectivity/ID list.
poly_handle | The handle returned from mhdf_createPolyConnectivity or mhdf_openPolyConnectivity . |
offset | The offset in the table at which to write. The offset is in terms of the integer values in the table, not the count of polys. |
count | The size of the integer list to write. |
hdf_integer_type | The type of the integer data in id_list . Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
id_list | The count/global ID list specifying the connectivity of the polys. |
status | Passed back status of API call. |
Definition at line 373 of file connectivity.c.
379 {
380 API_BEGIN;
381 mhdf_write_data( table_id, offset, count, hdf_integer_type, id_list, H5P_DEFAULT, status );
382 API_END;
383 }
References API_BEGIN, API_END, and mhdf_write_data().
void mhdf_writePolyConnIDsWithOpt | ( | hid_t | poly_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | id_list, | ||
hid_t | write_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 384 of file connectivity.c.
391 {
392 API_BEGIN;
393 mhdf_write_data( table_id, offset, count, hdf_integer_type, id_list, prop, status );
394 API_END;
395 }
References API_BEGIN, API_END, and mhdf_write_data().
void mhdf_writePolyConnIndices | ( | hid_t | poly_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | index_list, | ||
mhdf_Status * | status | ||
) |
Write polygon or polyhedron index data.
Poly (polygon or polyhedron) connectivity is stored as two lists. One list is the concatenation of the the connectivity data for all the polys in the group. The other contains one value per poly where that value is the index of the last entry in the connectivity of the corresponding poly. The ID list for polygons contains global node IDs. The ID list for polyhedra contains the global IDs of faces (either polygons or 2D fixed-connectivity elements.)
This function writes the index list.
poly_handle | The handle returned from mhdf_createPolyConnectivity or mhdf_openPolyConnectivity . |
offset | The offset in the table at which to write. The offset is in terms of the integer values in the table, not the count of polys. |
count | The size of the integer list to write. |
hdf_integer_type | The type of the integer data in id_list . Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
index_list | The index list for the polys. |
status | Passed back status of API call. |
Definition at line 325 of file connectivity.c.
331 {
332 API_BEGIN;
333 mhdf_write_data( table_id, offset, count, hdf_integer_type, index_list, H5P_DEFAULT, status );
334 API_END;
335 }
References API_BEGIN, API_END, and mhdf_write_data().
void mhdf_writePolyConnIndicesWithOpt | ( | hid_t | poly_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | index_list, | ||
hid_t | write_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 336 of file connectivity.c.
343 {
344 API_BEGIN;
345 mhdf_write_data( table_id, offset, count, hdf_integer_type, index_list, prop, status );
346 API_END;
347 }
References API_BEGIN, API_END, and mhdf_write_data().
void mhdf_writeSetData | ( | hid_t | set_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | set_data, | ||
mhdf_Status * | status | ||
) |
Write set contents.
Write data specifying entities contained in sets. The format of this data is a vector of integer values which is the concatenation of the contents list for all the meshsets. The length and format of the data for each set is stored in the set meta table. See mhdf_createSetMeta and mhdf_SET_RANGE_BIT for a description of that data.
set_handle | The handle returned from mhdf_createSetData or mhdf_openSetData . |
offset | The position at which to write into the integer vector. |
count | The number of values to write into the data vector. |
hdf_integer_type | The type of the integer data in set_data . Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
set_data | The data to write. |
status | Passed back status of API call. |
Definition at line 680 of file sets.c.
681 {
682 API_BEGIN;
683 mhdf_write_data( table_id, offset, count, type, data, H5P_DEFAULT, status );
684 API_END;
685 }
References API_BEGIN, API_END, and mhdf_write_data().
void mhdf_writeSetDataWithOpt | ( | hid_t | set_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | set_data, | ||
hid_t | write_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 686 of file sets.c.
693 {
694 API_BEGIN;
695 mhdf_write_data( table_id, offset, count, type, data, prop, status );
696 API_END;
697 }
References API_BEGIN, API_END, and mhdf_write_data().
Referenced by moab::WriteHDF5::write_set_data().
void mhdf_writeSetMeta | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | set_desc_data, | ||
mhdf_Status * | status | ||
) |
Write list of sets and meta-information about sets.
Write set descriptions. See mhdf_createSetMeta or mhdf Meshset data for a description of the data format.
data_handle | The handle returned from mhdf_createSetMeta or mhdf_openSetMeta. |
offset | The offset (set index) to begin writing at. |
count | The number of rows (sets, integer triples) to write. |
hdf_integer_type | The type of the integer data in set_desc_data . Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
set_desc_data | The data to write. |
status | Passed back status of API call. |
Definition at line 386 of file sets.c.
387 {
388 API_BEGIN;
389 mhdf_readwriteSetMeta( table_id, 0, offset, count, type, (void*)data, H5P_DEFAULT, status );
390 API_END;
391 }
References API_BEGIN, API_END, and mhdf_readwriteSetMeta().
void mhdf_writeSetMetaWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | set_desc_data, | ||
hid_t | write_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 392 of file sets.c.
399 {
400 API_BEGIN;
401 mhdf_readwriteSetMeta( table_id, 0, offset, count, type, (void*)data, prop, status );
402 API_END;
403 }
References API_BEGIN, API_END, and mhdf_readwriteSetMeta().
Referenced by moab::WriteHDF5::write_sets().
void mhdf_writeSetParentsChildren | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | id_list, | ||
mhdf_Status * | status | ||
) |
Write set parent/child list.
Write the list of parent or child IDs for sets. See mhdf_createSetChildren and mhdf_createSetMeta for a description of this data.
data_handle | The value returned from mhdf_createSetChildren or mhdf_openSetChildren. |
offset | The offset into the list of global IDs. |
count | The number of global IDs to write. |
hdf_integer_type | The type of the integer data in child_id_list . Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
id_list | The data to write. |
status | Passed back status of API call. |
Definition at line 808 of file sets.c.
814 {
815 API_BEGIN;
816 mhdf_write_data( table_id, offset, count, type, data, H5P_DEFAULT, status );
817 API_END;
818 }
References API_BEGIN, API_END, and mhdf_write_data().
void mhdf_writeSetParentsChildrenWithOpt | ( | hid_t | data_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | id_list, | ||
hid_t | write_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 819 of file sets.c.
826 {
827 API_BEGIN;
828 mhdf_write_data( table_id, offset, count, type, data, prop, status );
829 API_END;
830 }
References API_BEGIN, API_END, and mhdf_write_data().
Referenced by moab::WriteHDF5::write_set_data().
void mhdf_writeSparseTagEntities | ( | hid_t | id_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | id_list, | ||
mhdf_Status * | status | ||
) |
Write Global ID list for sparse tag data.
id_handle | The first handle passed back from either mhdf_createSparseTagData or mhdf_openSparseTagData. |
offset | The offset at which to begin writing. |
count | The number of global IDs to write. |
hdf_integer_type | The type of the integer data in id_list . Typically H5T_NATIVE_INT or N5T_NATIVE_LONG as defined in H5Tpublic.h. The HDF class of this type object must be H5T_INTEGER |
id_list | The list of global IDs to write. |
status | Passed back status of API call. |
Definition at line 1589 of file tags.c.
1595 {
1596 API_BEGIN;
1597 mhdf_write_data( table_id, offset, count, int_type, id_list, H5P_DEFAULT, status );
1598 API_END;
1599 }
References API_BEGIN, API_END, and mhdf_write_data().
void mhdf_writeSparseTagEntitiesWithOpt | ( | hid_t | id_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | id_list, | ||
hid_t | write_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 1600 of file tags.c.
1607 {
1608 API_BEGIN;
1609 mhdf_write_data( table_id, offset, count, int_type, id_list, io_prop, status );
1610 API_END;
1611 }
References API_BEGIN, API_END, and mhdf_write_data().
Referenced by moab::WriteHDF5::write_sparse_ids().
void mhdf_writeSparseTagIndices | ( | hid_t | tag_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | end_indices, | ||
mhdf_Status * | status | ||
) |
Write sparse tag end indices for variable-length tag data.
Write sparse tag end indices for variable-length tag data. Each value in the list is the last index (zero-based) into the tag data for the corresponding entity.
tag_handle | handle to the data object to write to. |
offset | The offset into the table at which to begin writting |
count | The number of values to write. |
hdf_integer_type | The type of the values pointed to by end_indices (must be an integer type). |
end_indices | The values to store in the table. |
status | Output: API result. |
Definition at line 1636 of file tags.c.
1642 {
1643 API_BEGIN;
1644 mhdf_write_data( table_id, offset, count, int_type, indices, H5P_DEFAULT, status );
1645 API_END;
1646 }
References API_BEGIN, API_END, and mhdf_write_data().
void mhdf_writeSparseTagIndicesWithOpt | ( | hid_t | tag_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_integer_type, | ||
const void * | end_indices, | ||
hid_t | write_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 1647 of file tags.c.
1654 {
1655 API_BEGIN;
1656 mhdf_write_data( table_id, offset, count, int_type, indices, io_prop, status );
1657 API_END;
1658 }
References API_BEGIN, API_END, and mhdf_write_data().
Referenced by moab::WriteHDF5::write_var_len_indices().
void mhdf_writeTagValues | ( | hid_t | value_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_tag_data_type, | ||
const void * | tag_data, | ||
mhdf_Status * | status | ||
) |
Write tag values.
value_handle | The second handle passed back from either mhdf_createSparseTagData or mhdf_openSparseTagData; or the handle returned by mhdf_createDenseTagData or mhdf_openDenseTagData. |
offset | The offset at which to begin writing. |
count | The number of tag values to write. |
hdf_tag_data_type | The type of the data in memory. It must be possible for the HDF library to convert between this type and the type the tag data is stored as. |
tag_data | The list of tag values to write. |
status | Passed back status of API call. |
Definition at line 1613 of file tags.c.
1619 {
1620 mhdf_writeTagValuesWithOpt( table_id, offset, count, tag_type, tag_data, H5P_DEFAULT, status );
1621 }
References mhdf_writeTagValuesWithOpt().
void mhdf_writeTagValuesWithOpt | ( | hid_t | value_handle, |
long | offset, | ||
long | count, | ||
hid_t | hdf_tag_data_type, | ||
const void * | tag_data, | ||
hid_t | write_prop, | ||
mhdf_Status * | status | ||
) |
Definition at line 1623 of file tags.c.
1630 {
1631 API_BEGIN;
1632 mhdf_write_data( table_id, offset, count, tag_type, tag_data, io_prop, status );
1633 API_END;
1634 }
References API_BEGIN, API_END, and mhdf_write_data().
Referenced by mhdf_writeTagValues(), moab::WriteHDF5::write_tag_values(), and moab::WriteHDF5::write_var_len_data().