diff --git a/src/h5core/h5b_attribs.c b/src/h5core/h5b_attribs.c index 5701c90..7d034f4 100644 --- a/src/h5core/h5b_attribs.c +++ b/src/h5core/h5b_attribs.c @@ -55,7 +55,7 @@ h5b_read_field_attrib ( const h5_file_t fh, /*!< IN: file handle */ const char *field_name, /*!< IN: field name */ const char *attrib_name, /*!< IN: attribute name */ - const h5_int64_t attrib_type, /*!< IN: attribute type */ + const h5_types_t attrib_type, /*!< IN: attribute type */ void *buffer /*!< OUT: attribute value */ ) { h5_file_p f = (h5_file_p)fh; @@ -250,7 +250,7 @@ h5b_set_3d_field_coords ( (h5_file_t)f, field_name, attrib_name, - H5_FLOAT64, + H5_FLOAT64_T, coords, n_coords)); @@ -286,7 +286,7 @@ h5b_get_3d_field_coords ( (h5_file_t)f, field_name, attrib_name, - H5_FLOAT64, + H5_FLOAT64_T, coords)); H5_RETURN (H5_SUCCESS); diff --git a/src/h5core/h5t_io.c b/src/h5core/h5t_io.c index e5b8c0e..15e2446 100644 --- a/src/h5core/h5t_io.c +++ b/src/h5core/h5t_io.c @@ -244,14 +244,6 @@ exchange_g2l_vtx_map ( } #endif -static int -sort_glb_idx ( - const void *p_a, - const void *p_b - ) { - return (*(h5_glb_idx_t*)p_a) - (*(h5_glb_idx_t*)p_b); -} - /* * instead of bsearch it returns the first element that fulfills compare(key,element) == 0 in an unsorted array * we don't want to sort array since it's also containing a permutation @@ -275,6 +267,15 @@ linsearch ( return NULL; } +#if defined(WITH_PARALLEL_H5GRID) +static int +sort_glb_idx ( + const void *p_a, + const void *p_b + ) { + return (*(h5_glb_idx_t*)p_a) - (*(h5_glb_idx_t*)p_b); +} + static h5_err_t remove_item_from_idxmap ( h5_idxmap_t* map, @@ -288,7 +289,6 @@ remove_item_from_idxmap ( H5_RETURN (H5_SUCCESS); } -#if defined(WITH_PARALLEL_H5GRID) /* * Check if any proc with lower rank already writes a vtx that this proc has planed to write * if so remove it from the map. Only the proc with the lowest rank writes the vertex @@ -801,7 +801,7 @@ write_chunks ( TRY (h5priv_write_attrib ( m->mesh_gid, "__num_chunks__", - H5_INT32, + H5_INT32_T, &m->chunks->num_alloc, 1, 1)); @@ -809,7 +809,7 @@ write_chunks ( TRY (h5priv_write_attrib ( m->mesh_gid, "__num_chk_levels__", - H5_INT16, // WARNING should maybe be uint + H5_INT16_T, // note: better uint16? &m->chunks->num_levels, 1, 1)); @@ -817,7 +817,7 @@ write_chunks ( TRY (h5priv_write_attrib ( m->mesh_gid, "__num_chk_p_level__", - H5_INT32, + H5_INT32_T, m->chunks->num_chunks_p_level, m->chunks->num_levels, 1)); @@ -899,18 +899,18 @@ write_octree ( m->dsinfo_octree.dims[0] = m->octree->current_oct_idx + 1; TRY (h5priv_write_dataset_by_name ( - m, - m->f, - m->mesh_gid, - &m->dsinfo_octree, - set_oct_memspace, - set_oct_diskspace, - m->octree->octants)); + m, + m->f, + m->mesh_gid, + &m->dsinfo_octree, + set_oct_memspace, + set_oct_diskspace, + m->octree->octants)); TRY (h5priv_write_attrib ( m->mesh_gid, "__curr_oct_idx__", - H5_INT32, + H5_INT32_T, &m->octree->current_oct_idx, 1, 1)); @@ -918,24 +918,24 @@ write_octree ( TRY (h5priv_write_attrib ( m->mesh_gid, "__oct_maxpoints__", - H5_INT32, + H5_INT32_T, &m->octree->maxpoints, 1, 1)); TRY (h5priv_write_attrib ( m->mesh_gid, "__oct_size_userdata__", - H5_INT32, + H5_INT32_T, &m->octree->size_userdata, 1, 1)); TRY (h5priv_write_attrib ( - m->mesh_gid, - "__oct_bounding_box__", - H5_FLOAT64, - m->octree->bounding_box, - 6, - 1)); + m->mesh_gid, + "__oct_bounding_box__", + H5_FLOAT64_T, + m->octree->bounding_box, + 6, + 1)); if (m->octree->size_userdata > 0) { m->dsinfo_userdata.dims[0] = m->octree->current_oct_idx + 1; @@ -1040,7 +1040,7 @@ write_weights ( TRY (h5priv_write_attrib ( m->mesh_gid, "__num_weights__", - H5_INT32, + H5_INT32_T, &m->num_weights, 1, 1)); @@ -1732,25 +1732,25 @@ read_octree ( int size_userdata = -1; h5_float64_t bounding_box[6]; TRY (h5priv_read_attrib ( - m->mesh_gid, - "__curr_oct_idx__", - H5_INT32, - &oct_size)); + m->mesh_gid, + "__curr_oct_idx__", + H5_INT32_T, + &oct_size)); TRY (h5priv_read_attrib ( - m->mesh_gid, - "__oct_maxpoints__", - H5_INT32, - &maxpoints)); + m->mesh_gid, + "__oct_maxpoints__", + H5_INT32_T, + &maxpoints)); TRY (h5priv_read_attrib ( - m->mesh_gid, - "__oct_size_userdata__", - H5_INT32, - &size_userdata)); + m->mesh_gid, + "__oct_size_userdata__", + H5_INT32_T, + &size_userdata)); TRY (h5priv_read_attrib ( - m->mesh_gid, - "__oct_bounding_box__", - H5_FLOAT64, - bounding_box)) + m->mesh_gid, + "__oct_bounding_box__", + H5_FLOAT64_T, + bounding_box)) h5t_octant_t* octants; h5t_oct_userdata_t* userdata; TRY (H5t_read_octree ( @@ -1807,10 +1807,10 @@ read_weights ( TRY (h5priv_read_attrib ( - m->mesh_gid, - "__num_weights__", - H5_INT32, - &m->num_weights)); + m->mesh_gid, + "__num_weights__", + H5_INT32_T, + &m->num_weights)); TRY (m->weights = h5_calloc (m->num_weights * m->num_glb_elems[m->num_leaf_levels-1], sizeof (*m->weights))); if (m->num_weights < 1) { @@ -1857,25 +1857,25 @@ read_chunks ( TRY (m->chunks = h5_calloc (1, sizeof (*m->chunks))); TRY (h5priv_read_attrib ( - m->mesh_gid, - "__num_chunks__", - H5_INT32, - &m->chunks->num_alloc)); + m->mesh_gid, + "__num_chunks__", + H5_INT32_T, + &m->chunks->num_alloc)); m->chunks->curr_idx = m->chunks->num_alloc -1; TRY (h5priv_read_attrib ( - m->mesh_gid, - "__num_chk_levels__", - H5_INT16, - &m->chunks->num_levels)); + m->mesh_gid, + "__num_chk_levels__", + H5_INT16_T, + &m->chunks->num_levels)); TRY (m->chunks->num_chunks_p_level = h5_calloc (m->chunks->num_levels, sizeof (*m->chunks->num_chunks_p_level))); TRY (h5priv_read_attrib ( - m->mesh_gid, - "__num_chk_p_level__", - H5_INT32, - m->chunks->num_chunks_p_level)); + m->mesh_gid, + "__num_chk_p_level__", + H5_INT32_T, + m->chunks->num_chunks_p_level)); TRY (m->chunks->chunks = h5_calloc (m->chunks->num_alloc, sizeof (*m->chunks->chunks))); diff --git a/src/h5core/h5t_model.c b/src/h5core/h5t_model.c index 91af9a3..8087e50 100644 --- a/src/h5core/h5t_model.c +++ b/src/h5core/h5t_model.c @@ -195,7 +195,7 @@ h5tpriv_init_mesh ( TRY (h5priv_read_attrib ( m->mesh_gid, "__num_leaf_levels__", - H5T_NATIVE_INT16, + H5_INT16_T, &m->num_leaf_levels)); //seems not to be set otherwise but for reading vtx it should be... m->leaf_level = m->num_leaf_levels-1; @@ -214,19 +214,19 @@ h5tpriv_init_mesh ( TRY (h5priv_read_attrib ( m->mesh_gid, "__num_elems__", - H5T_NATIVE_INT64, + H5_INT64_T, m->num_glb_elems)); TRY (h5priv_read_attrib ( m->mesh_gid, "__num_leaf_elems__", - H5T_NATIVE_INT64, + H5_INT64_T, m->num_glb_leaf_elems)); TRY (h5priv_read_attrib ( m->mesh_gid, "__num_vertices__", - H5T_NATIVE_INT64, + H5_INT64_T, m->num_glb_vertices)); // if the file version is lower the following attributes are missing: hid_t exists; @@ -238,22 +238,22 @@ h5tpriv_init_mesh ( TRY (h5priv_read_attrib ( m->mesh_gid, "__num_b_vertices__", - H5T_NATIVE_INT64, + H5_INT64_T, m->num_b_vtx)); TRY (h5priv_read_attrib ( m->mesh_gid, "__first_b_vertices__", - H5T_NATIVE_INT64, + H5_INT64_T, m->first_b_vtx)); TRY (h5priv_read_attrib ( m->mesh_gid, "__is_chunked__", - H5T_NATIVE_INT16, + H5_INT16_T, &m->is_chunked)); TRY (h5priv_read_attrib ( m->mesh_gid, "__num_weights__", - H5T_NATIVE_INT32, + H5_INT32_T, &m->num_weights)); } else { memset (m->num_b_vtx, -1, m->num_leaf_levels * sizeof (m->num_b_vtx)); diff --git a/src/h5core/h5t_store.c b/src/h5core/h5t_store.c index 7f873f6..1db1ef8 100644 --- a/src/h5core/h5t_store.c +++ b/src/h5core/h5t_store.c @@ -2778,7 +2778,7 @@ h5t_create_index_set ( int codim; int dim = h5tpriv_ref_elem_get_dim (m); // todo: check tagset already exist - TRY (h5t_add_mtagset (m, "__IndexSet__", H5_INT64)); + TRY (h5t_add_mtagset (m, "__IndexSet__", H5_INT64_T); for (codim = 0; codim <= dim; codim++) { h5_glb_idx_t idx = 0; diff --git a/src/h5core/h5t_tags.c b/src/h5core/h5t_tags.c index 5814300..5f8e60f 100644 --- a/src/h5core/h5t_tags.c +++ b/src/h5core/h5t_tags.c @@ -195,7 +195,7 @@ h5_err_t h5t_create_mtagset ( h5t_mesh_t* const m, const char name[], - const h5_id_t type, + const h5_types_t type, h5t_tagset_t** set ) { H5_CORE_API_ENTER (h5_err_t, @@ -208,7 +208,7 @@ h5t_create_mtagset ( } // validate type - if (type != H5_INT64 && type != H5_FLOAT64) { + if (type != H5_INT64_T && type != H5_FLOAT64_T) { H5_LEAVE ( h5_error (H5_ERR_INVAL, "Unsupported data type." )); } @@ -458,7 +458,7 @@ read_tagset ( &dsinfo, open_space_all, open_space_all, vals)); - TRY (hdf5_close_dataset (dset_id )); + TRY (hdf5_close_dataset (dset_id)); tagset->type = dsinfo.type_id; /* @@ -466,9 +466,9 @@ read_tagset ( */ h5_int64_t scope; - TRY (h5priv_read_attrib (loc_id, "__scope_min__", H5_INT64, &scope)); + TRY (h5priv_read_attrib (loc_id, "__scope_min__", H5_INT64_T, &scope)); tagset->scope.min_level = scope; - TRY (h5priv_read_attrib (loc_id, "__scope_max__", H5_INT64, &scope)); + TRY (h5priv_read_attrib (loc_id, "__scope_max__", H5_INT64_T, &scope)); tagset->scope.max_level = scope; for (ent_idx = 0; ent_idx < num_entities; ent_idx++) { @@ -488,6 +488,7 @@ read_tagset ( dim, &vals[entity->idx])); } + TRY (hdf5_close_group (loc_id)); TRY (h5_free (elems)); TRY (h5_free (entities)); TRY (h5_free (vals)); diff --git a/src/h5core/private/h5_attribs.h b/src/h5core/private/h5_attribs.h index 37c591f..ff61b9b 100644 --- a/src/h5core/private/h5_attribs.h +++ b/src/h5core/private/h5_attribs.h @@ -32,7 +32,7 @@ static inline h5_err_t h5priv_read_attrib ( const hid_t id, /*!< HDF5 object ID */ const char* attrib_name, /*!< name of HDF5 attribute to read */ - const h5_int64_t attrib_type, /*!< H5hut enum type of attribute */ + const h5_types_t attrib_type, /*!< H5hut enum type of attribute */ void* const attrib_value /*!< OUT: attribute value */ ) { H5_PRIV_API_ENTER (h5_err_t, diff --git a/src/h5core/private/h5_init.c b/src/h5core/private/h5_init.c index b22f8f9..56b62b3 100644 --- a/src/h5core/private/h5_init.c +++ b/src/h5core/private/h5_init.c @@ -210,7 +210,7 @@ create_tet_type ( h5_dta_types.h5_tet_t, "child_idx", HOFFSET (h5_glb_tet_t, child_idx), - H5T_NATIVE_INT32) ); + H5_INT32) ); TRY( hdf5_insert_type ( h5_dta_types.h5_tet_t, diff --git a/src/h5core/private/h5_model.h b/src/h5core/private/h5_model.h index 407357f..97ad407 100644 --- a/src/h5core/private/h5_model.h +++ b/src/h5core/private/h5_model.h @@ -119,16 +119,6 @@ h5priv_close_step ( const h5_file_p f ); -#define H5_STRING H5T_NATIVE_CHAR -#define H5_INT16 H5T_NATIVE_INT16 -#define H5_UINT16 H5T_NATIVE_UINT16 -#define H5_INT32 H5T_NATIVE_INT32 -#define H5_UINT32 H5T_NATIVE_UINT32 -#define H5_INT64 H5T_NATIVE_INT64 -#define H5_UINT64 H5T_NATIVE_UINT64 -#define H5_FLOAT32 H5T_NATIVE_FLOAT -#define H5_FLOAT64 H5T_NATIVE_DOUBLE - /* Map given enumeration type to corresponding HDF5 type. We use this HDF5 type for reading and writing datasets and attributes. diff --git a/src/h5core/private/h5_types.h b/src/h5core/private/h5_types.h index a96f386..cc4f1df 100644 --- a/src/h5core/private/h5_types.h +++ b/src/h5core/private/h5_types.h @@ -22,6 +22,7 @@ #define H5_FLOAT32 H5T_NATIVE_FLOAT #define H5_FLOAT64 H5T_NATIVE_DOUBLE #define H5_ID H5T_NATIVE_INT64 +#define H5_STRING H5T_NATIVE_CHAR struct h5_prop { // generic property class h5_int64_t class; // property class diff --git a/src/include/H5Fed_tags.h b/src/include/H5Fed_tags.h index 5345968..4ede4b7 100644 --- a/src/include/H5Fed_tags.h +++ b/src/include/H5Fed_tags.h @@ -84,7 +84,7 @@ static inline h5_err_t H5FedAddMTagset ( h5t_mesh_t* const m, const char name[], - const h5_id_t type, + const h5_types_t type, h5t_tagset_t** tagset ) { H5_API_ENTER (h5_err_t, diff --git a/src/include/h5core/h5t_tags.h b/src/include/h5core/h5t_tags.h index de0c422..464144a 100644 --- a/src/include/h5core/h5t_tags.h +++ b/src/include/h5core/h5t_tags.h @@ -30,7 +30,7 @@ h5_err_t h5t_mtagset_exists (h5t_mesh_t* const, const char* const); h5_err_t -h5t_create_mtagset (h5t_mesh_t* const, const char[], const h5_id_t, h5t_tagset_t**); +h5t_create_mtagset (h5t_mesh_t* const, const char[], const h5_types_t, h5t_tagset_t**); h5_err_t h5t_open_mtagset (h5t_mesh_t* const, const char* const, h5t_tagset_t**);