Commit 85ecf4c3 authored by gsell's avatar gsell
Browse files

core API/C-API: use enumeration for data-types

parent 6979a358
...@@ -55,7 +55,7 @@ h5b_read_field_attrib ( ...@@ -55,7 +55,7 @@ h5b_read_field_attrib (
const h5_file_t fh, /*!< IN: file handle */ const h5_file_t fh, /*!< IN: file handle */
const char *field_name, /*!< IN: field name */ const char *field_name, /*!< IN: field name */
const char *attrib_name, /*!< IN: attribute 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 */ void *buffer /*!< OUT: attribute value */
) { ) {
h5_file_p f = (h5_file_p)fh; h5_file_p f = (h5_file_p)fh;
...@@ -250,7 +250,7 @@ h5b_set_3d_field_coords ( ...@@ -250,7 +250,7 @@ h5b_set_3d_field_coords (
(h5_file_t)f, (h5_file_t)f,
field_name, field_name,
attrib_name, attrib_name,
H5_FLOAT64, H5_FLOAT64_T,
coords, coords,
n_coords)); n_coords));
...@@ -286,7 +286,7 @@ h5b_get_3d_field_coords ( ...@@ -286,7 +286,7 @@ h5b_get_3d_field_coords (
(h5_file_t)f, (h5_file_t)f,
field_name, field_name,
attrib_name, attrib_name,
H5_FLOAT64, H5_FLOAT64_T,
coords)); coords));
H5_RETURN (H5_SUCCESS); H5_RETURN (H5_SUCCESS);
......
...@@ -244,14 +244,6 @@ exchange_g2l_vtx_map ( ...@@ -244,14 +244,6 @@ exchange_g2l_vtx_map (
} }
#endif #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 * 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 * we don't want to sort array since it's also containing a permutation
...@@ -275,6 +267,15 @@ linsearch ( ...@@ -275,6 +267,15 @@ linsearch (
return NULL; 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 static h5_err_t
remove_item_from_idxmap ( remove_item_from_idxmap (
h5_idxmap_t* map, h5_idxmap_t* map,
...@@ -288,7 +289,6 @@ remove_item_from_idxmap ( ...@@ -288,7 +289,6 @@ remove_item_from_idxmap (
H5_RETURN (H5_SUCCESS); 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 * 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 * if so remove it from the map. Only the proc with the lowest rank writes the vertex
...@@ -801,7 +801,7 @@ write_chunks ( ...@@ -801,7 +801,7 @@ write_chunks (
TRY (h5priv_write_attrib ( TRY (h5priv_write_attrib (
m->mesh_gid, m->mesh_gid,
"__num_chunks__", "__num_chunks__",
H5_INT32, H5_INT32_T,
&m->chunks->num_alloc, &m->chunks->num_alloc,
1, 1,
1)); 1));
...@@ -809,7 +809,7 @@ write_chunks ( ...@@ -809,7 +809,7 @@ write_chunks (
TRY (h5priv_write_attrib ( TRY (h5priv_write_attrib (
m->mesh_gid, m->mesh_gid,
"__num_chk_levels__", "__num_chk_levels__",
H5_INT16, // WARNING should maybe be uint H5_INT16_T, // note: better uint16?
&m->chunks->num_levels, &m->chunks->num_levels,
1, 1,
1)); 1));
...@@ -817,7 +817,7 @@ write_chunks ( ...@@ -817,7 +817,7 @@ write_chunks (
TRY (h5priv_write_attrib ( TRY (h5priv_write_attrib (
m->mesh_gid, m->mesh_gid,
"__num_chk_p_level__", "__num_chk_p_level__",
H5_INT32, H5_INT32_T,
m->chunks->num_chunks_p_level, m->chunks->num_chunks_p_level,
m->chunks->num_levels, m->chunks->num_levels,
1)); 1));
...@@ -899,18 +899,18 @@ write_octree ( ...@@ -899,18 +899,18 @@ write_octree (
m->dsinfo_octree.dims[0] = m->octree->current_oct_idx + 1; m->dsinfo_octree.dims[0] = m->octree->current_oct_idx + 1;
TRY (h5priv_write_dataset_by_name ( TRY (h5priv_write_dataset_by_name (
m, m,
m->f, m->f,
m->mesh_gid, m->mesh_gid,
&m->dsinfo_octree, &m->dsinfo_octree,
set_oct_memspace, set_oct_memspace,
set_oct_diskspace, set_oct_diskspace,
m->octree->octants)); m->octree->octants));
TRY (h5priv_write_attrib ( TRY (h5priv_write_attrib (
m->mesh_gid, m->mesh_gid,
"__curr_oct_idx__", "__curr_oct_idx__",
H5_INT32, H5_INT32_T,
&m->octree->current_oct_idx, &m->octree->current_oct_idx,
1, 1,
1)); 1));
...@@ -918,24 +918,24 @@ write_octree ( ...@@ -918,24 +918,24 @@ write_octree (
TRY (h5priv_write_attrib ( TRY (h5priv_write_attrib (
m->mesh_gid, m->mesh_gid,
"__oct_maxpoints__", "__oct_maxpoints__",
H5_INT32, H5_INT32_T,
&m->octree->maxpoints, &m->octree->maxpoints,
1, 1,
1)); 1));
TRY (h5priv_write_attrib ( TRY (h5priv_write_attrib (
m->mesh_gid, m->mesh_gid,
"__oct_size_userdata__", "__oct_size_userdata__",
H5_INT32, H5_INT32_T,
&m->octree->size_userdata, &m->octree->size_userdata,
1, 1,
1)); 1));
TRY (h5priv_write_attrib ( TRY (h5priv_write_attrib (
m->mesh_gid, m->mesh_gid,
"__oct_bounding_box__", "__oct_bounding_box__",
H5_FLOAT64, H5_FLOAT64_T,
m->octree->bounding_box, m->octree->bounding_box,
6, 6,
1)); 1));
if (m->octree->size_userdata > 0) { if (m->octree->size_userdata > 0) {
m->dsinfo_userdata.dims[0] = m->octree->current_oct_idx + 1; m->dsinfo_userdata.dims[0] = m->octree->current_oct_idx + 1;
...@@ -1040,7 +1040,7 @@ write_weights ( ...@@ -1040,7 +1040,7 @@ write_weights (
TRY (h5priv_write_attrib ( TRY (h5priv_write_attrib (
m->mesh_gid, m->mesh_gid,
"__num_weights__", "__num_weights__",
H5_INT32, H5_INT32_T,
&m->num_weights, &m->num_weights,
1, 1,
1)); 1));
...@@ -1732,25 +1732,25 @@ read_octree ( ...@@ -1732,25 +1732,25 @@ read_octree (
int size_userdata = -1; int size_userdata = -1;
h5_float64_t bounding_box[6]; h5_float64_t bounding_box[6];
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__curr_oct_idx__", "__curr_oct_idx__",
H5_INT32, H5_INT32_T,
&oct_size)); &oct_size));
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__oct_maxpoints__", "__oct_maxpoints__",
H5_INT32, H5_INT32_T,
&maxpoints)); &maxpoints));
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__oct_size_userdata__", "__oct_size_userdata__",
H5_INT32, H5_INT32_T,
&size_userdata)); &size_userdata));
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__oct_bounding_box__", "__oct_bounding_box__",
H5_FLOAT64, H5_FLOAT64_T,
bounding_box)) bounding_box))
h5t_octant_t* octants; h5t_octant_t* octants;
h5t_oct_userdata_t* userdata; h5t_oct_userdata_t* userdata;
TRY (H5t_read_octree ( TRY (H5t_read_octree (
...@@ -1807,10 +1807,10 @@ read_weights ( ...@@ -1807,10 +1807,10 @@ read_weights (
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__num_weights__", "__num_weights__",
H5_INT32, H5_INT32_T,
&m->num_weights)); &m->num_weights));
TRY (m->weights = TRY (m->weights =
h5_calloc (m->num_weights * m->num_glb_elems[m->num_leaf_levels-1], sizeof (*m->weights))); h5_calloc (m->num_weights * m->num_glb_elems[m->num_leaf_levels-1], sizeof (*m->weights)));
if (m->num_weights < 1) { if (m->num_weights < 1) {
...@@ -1857,25 +1857,25 @@ read_chunks ( ...@@ -1857,25 +1857,25 @@ read_chunks (
TRY (m->chunks = h5_calloc (1, sizeof (*m->chunks))); TRY (m->chunks = h5_calloc (1, sizeof (*m->chunks)));
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__num_chunks__", "__num_chunks__",
H5_INT32, H5_INT32_T,
&m->chunks->num_alloc)); &m->chunks->num_alloc));
m->chunks->curr_idx = m->chunks->num_alloc -1; m->chunks->curr_idx = m->chunks->num_alloc -1;
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__num_chk_levels__", "__num_chk_levels__",
H5_INT16, H5_INT16_T,
&m->chunks->num_levels)); &m->chunks->num_levels));
TRY (m->chunks->num_chunks_p_level = TRY (m->chunks->num_chunks_p_level =
h5_calloc (m->chunks->num_levels, sizeof (*m->chunks->num_chunks_p_level))); h5_calloc (m->chunks->num_levels, sizeof (*m->chunks->num_chunks_p_level)));
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__num_chk_p_level__", "__num_chk_p_level__",
H5_INT32, H5_INT32_T,
m->chunks->num_chunks_p_level)); m->chunks->num_chunks_p_level));
TRY (m->chunks->chunks = TRY (m->chunks->chunks =
h5_calloc (m->chunks->num_alloc, sizeof (*m->chunks->chunks))); h5_calloc (m->chunks->num_alloc, sizeof (*m->chunks->chunks)));
......
...@@ -195,7 +195,7 @@ h5tpriv_init_mesh ( ...@@ -195,7 +195,7 @@ h5tpriv_init_mesh (
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__num_leaf_levels__", "__num_leaf_levels__",
H5T_NATIVE_INT16, H5_INT16_T,
&m->num_leaf_levels)); &m->num_leaf_levels));
//seems not to be set otherwise but for reading vtx it should be... //seems not to be set otherwise but for reading vtx it should be...
m->leaf_level = m->num_leaf_levels-1; m->leaf_level = m->num_leaf_levels-1;
...@@ -214,19 +214,19 @@ h5tpriv_init_mesh ( ...@@ -214,19 +214,19 @@ h5tpriv_init_mesh (
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__num_elems__", "__num_elems__",
H5T_NATIVE_INT64, H5_INT64_T,
m->num_glb_elems)); m->num_glb_elems));
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__num_leaf_elems__", "__num_leaf_elems__",
H5T_NATIVE_INT64, H5_INT64_T,
m->num_glb_leaf_elems)); m->num_glb_leaf_elems));
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__num_vertices__", "__num_vertices__",
H5T_NATIVE_INT64, H5_INT64_T,
m->num_glb_vertices)); m->num_glb_vertices));
// if the file version is lower the following attributes are missing: // if the file version is lower the following attributes are missing:
hid_t exists; hid_t exists;
...@@ -238,22 +238,22 @@ h5tpriv_init_mesh ( ...@@ -238,22 +238,22 @@ h5tpriv_init_mesh (
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__num_b_vertices__", "__num_b_vertices__",
H5T_NATIVE_INT64, H5_INT64_T,
m->num_b_vtx)); m->num_b_vtx));
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__first_b_vertices__", "__first_b_vertices__",
H5T_NATIVE_INT64, H5_INT64_T,
m->first_b_vtx)); m->first_b_vtx));
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__is_chunked__", "__is_chunked__",
H5T_NATIVE_INT16, H5_INT16_T,
&m->is_chunked)); &m->is_chunked));
TRY (h5priv_read_attrib ( TRY (h5priv_read_attrib (
m->mesh_gid, m->mesh_gid,
"__num_weights__", "__num_weights__",
H5T_NATIVE_INT32, H5_INT32_T,
&m->num_weights)); &m->num_weights));
} else { } else {
memset (m->num_b_vtx, -1, m->num_leaf_levels * sizeof (m->num_b_vtx)); memset (m->num_b_vtx, -1, m->num_leaf_levels * sizeof (m->num_b_vtx));
......
...@@ -2778,7 +2778,7 @@ h5t_create_index_set ( ...@@ -2778,7 +2778,7 @@ h5t_create_index_set (
int codim; int codim;
int dim = h5tpriv_ref_elem_get_dim (m); int dim = h5tpriv_ref_elem_get_dim (m);
// todo: check tagset already exist // 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++) { for (codim = 0; codim <= dim; codim++) {
h5_glb_idx_t idx = 0; h5_glb_idx_t idx = 0;
......
...@@ -195,7 +195,7 @@ h5_err_t ...@@ -195,7 +195,7 @@ h5_err_t
h5t_create_mtagset ( h5t_create_mtagset (
h5t_mesh_t* const m, h5t_mesh_t* const m,
const char name[], const char name[],
const h5_id_t type, const h5_types_t type,
h5t_tagset_t** set h5t_tagset_t** set
) { ) {
H5_CORE_API_ENTER (h5_err_t, H5_CORE_API_ENTER (h5_err_t,
...@@ -208,7 +208,7 @@ h5t_create_mtagset ( ...@@ -208,7 +208,7 @@ h5t_create_mtagset (
} }
// validate type // validate type
if (type != H5_INT64 && type != H5_FLOAT64) { if (type != H5_INT64_T && type != H5_FLOAT64_T) {
H5_LEAVE ( H5_LEAVE (
h5_error (H5_ERR_INVAL, "Unsupported data type." )); h5_error (H5_ERR_INVAL, "Unsupported data type." ));
} }
...@@ -458,7 +458,7 @@ read_tagset ( ...@@ -458,7 +458,7 @@ read_tagset (
&dsinfo, &dsinfo,
open_space_all, open_space_all, open_space_all, open_space_all,
vals)); vals));
TRY (hdf5_close_dataset (dset_id )); TRY (hdf5_close_dataset (dset_id));
tagset->type = dsinfo.type_id; tagset->type = dsinfo.type_id;
/* /*
...@@ -466,9 +466,9 @@ read_tagset ( ...@@ -466,9 +466,9 @@ read_tagset (
*/ */
h5_int64_t scope; 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; 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; tagset->scope.max_level = scope;
for (ent_idx = 0; ent_idx < num_entities; ent_idx++) { for (ent_idx = 0; ent_idx < num_entities; ent_idx++) {
...@@ -488,6 +488,7 @@ read_tagset ( ...@@ -488,6 +488,7 @@ read_tagset (
dim, dim,
&vals[entity->idx])); &vals[entity->idx]));
} }
TRY (hdf5_close_group (loc_id));
TRY (h5_free (elems)); TRY (h5_free (elems));
TRY (h5_free (entities)); TRY (h5_free (entities));
TRY (h5_free (vals)); TRY (h5_free (vals));
......
...@@ -32,7 +32,7 @@ static inline h5_err_t ...@@ -32,7 +32,7 @@ static inline h5_err_t
h5priv_read_attrib ( h5priv_read_attrib (
const hid_t id, /*!< HDF5 object ID */ const hid_t id, /*!< HDF5 object ID */
const char* attrib_name, /*!< name of HDF5 attribute to read */ 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 */ void* const attrib_value /*!< OUT: attribute value */
) { ) {
H5_PRIV_API_ENTER (h5_err_t, H5_PRIV_API_ENTER (h5_err_t,
......
...@@ -210,7 +210,7 @@ create_tet_type ( ...@@ -210,7 +210,7 @@ create_tet_type (
h5_dta_types.h5_tet_t, h5_dta_types.h5_tet_t,
"child_idx", "child_idx",
HOFFSET (h5_glb_tet_t, child_idx), HOFFSET (h5_glb_tet_t, child_idx),
H5T_NATIVE_INT32) ); H5_INT32) );
TRY( TRY(
hdf5_insert_type ( hdf5_insert_type (
h5_dta_types.h5_tet_t, h5_dta_types.h5_tet_t,
......
...@@ -119,16 +119,6 @@ h5priv_close_step ( ...@@ -119,16 +119,6 @@ h5priv_close_step (
const h5_file_p f 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 Map given enumeration type to corresponding HDF5 type. We use this HDF5
type for reading and writing datasets and attributes. type for reading and writing datasets and attributes.
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define H5_FLOAT32 H5T_NATIVE_FLOAT #define H5_FLOAT32 H5T_NATIVE_FLOAT
#define H5_FLOAT64 H5T_NATIVE_DOUBLE #define H5_FLOAT64 H5T_NATIVE_DOUBLE
#define H5_ID H5T_NATIVE_INT64 #define H5_ID H5T_NATIVE_INT64
#define H5_STRING H5T_NATIVE_CHAR
struct h5_prop { // generic property class struct h5_prop { // generic property class
h5_int64_t class; // property class h5_int64_t class; // property class
......
...@@ -84,7 +84,7 @@ static inline h5_err_t ...@@ -84,7 +84,7 @@ static inline h5_err_t
H5FedAddMTagset ( H5FedAddMTagset (
h5t_mesh_t* const m, h5t_mesh_t* const m,
const char name[], const char name[],
const h5_id_t type, const h5_types_t type,
h5t_tagset_t** tagset h5t_tagset_t** tagset
) { ) {
H5_API_ENTER (h5_err_t, H5_API_ENTER (h5_err_t,
......
...@@ -30,7 +30,7 @@ h5_err_t ...@@ -30,7 +30,7 @@ h5_err_t
h5t_mtagset_exists (h5t_mesh_t* const, const char* const); h5t_mtagset_exists (h5t_mesh_t* const, const char* const);
h5_err_t 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 h5_err_t
h5t_open_mtagset (h5t_mesh_t* const, const char* const, h5t_tagset_t**); h5t_open_mtagset (h5t_mesh_t* const, const char* const, h5t_tagset_t**);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment