From d3c09a61b2d0fec88088a245919c72197c1d1ebb Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 24 Feb 2011 08:18:45 +0000 Subject: [PATCH] - removed "h5_file_t f" argument where we don't need need (but not in API) - removed arguments from macros h5_error_internal() h5_error_not_implemented() - some coding style issues fixed --- src/C/H5Fed.c | 2 +- src/h5core/h5_attribs.c | 13 +- src/h5core/h5_attribs_private.h | 3 - src/h5core/h5_hdf5.c | 108 +++++++-------- src/h5core/h5_hsearch.c | 32 ++--- src/h5core/h5_hsearch_private.h | 11 +- src/h5core/h5_maps.c | 17 +-- src/h5core/h5_maps_private.h | 9 -- src/h5core/h5_mpi.c | 12 -- src/h5core/h5_mpi_private.h | 12 -- src/h5core/h5_openclose.c | 20 +-- src/h5core/h5_readwrite.c | 8 +- src/h5core/h5b_model.c | 18 +-- src/h5core/h5t_access_tetm.c | 2 +- src/h5core/h5t_access_trim.c | 2 +- src/h5core/h5t_adjacencies.c | 5 +- src/h5core/h5t_adjacencies_private.h | 3 +- src/h5core/h5t_adjacencies_tetm.c | 107 +++++++-------- src/h5core/h5t_adjacencies_trim.c | 70 +++++----- src/h5core/h5t_errorhandling_private.h | 3 +- src/h5core/h5t_hsearch.c | 37 ++--- src/h5core/h5t_map.c | 2 +- src/h5core/h5t_openclose.c | 6 +- src/h5core/h5t_readwrite.c | 4 +- src/h5core/h5t_retrieve.c | 8 +- src/h5core/h5t_retrieve_private.h | 4 +- src/h5core/h5t_retrieve_tetm.c | 3 +- src/h5core/h5t_retrieve_trim.c | 3 +- src/h5core/h5t_store.c | 8 +- src/h5core/h5t_store_tetm.c | 13 +- src/h5core/h5t_store_trim.c | 11 +- src/h5core/h5t_tags.c | 183 +++++++++++++++++-------- src/h5core/h5u_model.c | 4 +- src/h5core/h5u_readwrite.c | 4 +- src/include/h5core/h5_core.h | 7 + src/include/h5core/h5_errorhandling.h | 8 +- src/include/h5core/h5_readwrite.h | 2 - 37 files changed, 374 insertions(+), 390 deletions(-) diff --git a/src/C/H5Fed.c b/src/C/H5Fed.c index e6b5b40..db9d53b 100644 --- a/src/C/H5Fed.c +++ b/src/C/H5Fed.c @@ -49,5 +49,5 @@ H5FedLinkMeshToStep ( ) { UNUSED_ARGUMENT (mesh_id); H5_API_ENTER (h5_err_t); - H5_API_RETURN (h5_error_not_implemented (__FILE__, __func__, __LINE__)); + H5_API_RETURN (h5_error_not_implemented ()); } diff --git a/src/h5core/h5_attribs.c b/src/h5core/h5_attribs.c index 97ad7b4..7ee5555 100644 --- a/src/h5core/h5_attribs.c +++ b/src/h5core/h5_attribs.c @@ -16,7 +16,6 @@ get_hdf5_obj_id( h5_err_t h5priv_read_attrib ( - h5_file_t* const f, /*!< handle to open file */ const hid_t id, /*!< HDF5 object ID */ const char* attrib_name, /*!< name of HDF5 attribute to read */ const hid_t attrib_type, /*!< HDF5 type of attribute */ @@ -30,7 +29,7 @@ h5priv_read_attrib ( TRY (type_id = hdf5_get_attribute_type (attrib_id)); hid_t h5type_id; - TRY (h5type_id = h5_normalize_h5_type (f, type_id)); + TRY (h5type_id = h5_normalize_h5_type (type_id)); if (h5type_id != attrib_type) H5_PRIV_API_LEAVE ( h5_error ( @@ -70,13 +69,12 @@ h5_read_attrib ( hid_t id; TRY (get_hdf5_obj_id(f, mode, &id)); - TRY (h5priv_read_attrib (f, id, attrib_name, attrib_type, attrib_value)); + TRY (h5priv_read_attrib (id, attrib_name, attrib_type, attrib_value)); H5_CORE_API_RETURN (H5_SUCCESS); } h5_err_t h5priv_write_attrib ( - h5_file_t* const f, /*!< handle to open file */ const hid_t id, /*!< HDF5 object ID */ const char* attrib_name, /*!< name of HDF5 attribute to write */ const hid_t attrib_type, /*!< HDF5 type of attribute */ @@ -134,14 +132,13 @@ h5_write_attrib ( hid_t id; TRY (get_hdf5_obj_id(f, mode, &id)); - TRY (h5priv_write_attrib (f, id, attrib_name, attrib_type, + TRY (h5priv_write_attrib (id, attrib_name, attrib_type, attrib_value, attrib_nelem)); H5_CORE_API_RETURN (H5_SUCCESS); } h5_err_t h5priv_get_attrib_info ( - h5_file_t* const f, /*!< handle to open file */ const hid_t id, /*!< HDF5 object ID */ const h5_size_t attrib_idx, /*!< index of attribute */ char* attrib_name, /*!< OUT: name of attribute */ @@ -170,7 +167,7 @@ h5priv_get_attrib_info ( } if (attrib_type) { TRY (mytype = hdf5_get_attribute_type (attrib_id)); - TRY (*attrib_type = h5_normalize_h5_type (f, mytype)); + TRY (*attrib_type = h5_normalize_h5_type (mytype)); TRY (hdf5_close_type (mytype)); } TRY (hdf5_close_attribute (attrib_id)); @@ -199,7 +196,7 @@ h5_get_attrib_info ( hid_t id; TRY (get_hdf5_obj_id(f, mode, &id)); - TRY (h5priv_get_attrib_info (f, id, attrib_idx, attrib_name, len_attrib_name, + TRY (h5priv_get_attrib_info (id, attrib_idx, attrib_name, len_attrib_name, attrib_type, attrib_nelem)); H5_CORE_API_RETURN (H5_SUCCESS); } diff --git a/src/h5core/h5_attribs_private.h b/src/h5core/h5_attribs_private.h index 7ac597e..efb9c30 100644 --- a/src/h5core/h5_attribs_private.h +++ b/src/h5core/h5_attribs_private.h @@ -3,7 +3,6 @@ h5_err_t h5priv_read_attrib ( - h5_file_t* const f, const hid_t id, const char* attrib_name, const hid_t attrib_type, @@ -12,7 +11,6 @@ h5priv_read_attrib ( h5_err_t h5priv_write_attrib ( - h5_file_t* const f, const hid_t id, const char* attrib_name, const hid_t attrib_type, @@ -22,7 +20,6 @@ h5priv_write_attrib ( h5_err_t h5priv_get_attrib_info ( - h5_file_t* const f, const hid_t id, const h5_size_t attrib_idx, char* attrib_name, diff --git a/src/h5core/h5_hdf5.c b/src/h5core/h5_hdf5.c index 6d05953..7e3bcbc 100644 --- a/src/h5core/h5_hdf5.c +++ b/src/h5core/h5_hdf5.c @@ -1188,9 +1188,9 @@ hdf5_get_attribute_name ( char *buf ) { HDF5_WRAPPER_ENTER4 (h5_ssize_t, - "attr_id=%d (%s), buf_size=%zd, buf=0x%p", + "attr_id=%d (%s), buf_size=%llu, buf=0x%p", attr_id, h5_get_objname (attr_id), - buf_size, buf); + (unsigned long long)buf_size, buf); ssize_t size = H5Aget_name ( attr_id, buf_size, buf ); if (size < 0) HDF5_WRAPPER_LEAVE ( @@ -1336,36 +1336,34 @@ iter_op_get_obj_type ( const char* name, const H5L_info_t* info ) { - H5_PRIV_FUNC_ENTER3 (H5O_type_t, - "g_id=%d, name=\"%s\", info=0x%p", - g_id, name, info); herr_t herr; H5O_info_t objinfo; - if ( info->type == H5L_TYPE_EXTERNAL ) { - char *buf; - TRY (buf = h5_calloc (1, info->u.val_size)); - + if (info->type == H5L_TYPE_EXTERNAL) { + char* buf = h5_calloc (1, info->u.val_size); + if ((ptrdiff_t)buf == (ptrdiff_t)H5_ERR) { + return H5O_TYPE_UNKNOWN; + } herr = H5Lget_val(g_id, name, buf, info->u.val_size, H5P_DEFAULT); - if (herr < 0) - H5_PRIV_FUNC_LEAVE ( - (H5O_type_t)h5_error ( - H5_ERR_HDF5, - "Can't get external link for object '%s'!", - name)); - + if (herr < 0) { + h5_error ( + H5_ERR_HDF5, + "Can't get external link for object '%s'!", + name); + return H5O_TYPE_UNKNOWN; + } const char *filename; const char *objname; herr = H5Lunpack_elink_val(buf, info->u.val_size, 0, &filename, &objname); - if (herr < 0) - H5_PRIV_FUNC_LEAVE ( - (H5O_type_t)h5_error( - H5_ERR_HDF5, - "Can't unpack external link for object '%s'!", - name)); - + if (herr < 0) { + h5_error( + H5_ERR_HDF5, + "Can't unpack external link for object '%s'!", + name); + return H5O_TYPE_UNKNOWN; + } h5_debug( "Followed external link to file '%s' / object '%s'.", filename, objname); @@ -1373,25 +1371,26 @@ iter_op_get_obj_type ( h5_free (buf); hid_t obj_id = H5Oopen(g_id, name, H5P_DEFAULT); - if (obj_id < 0) - H5_PRIV_FUNC_LEAVE ( - (H5O_type_t)h5_error( - H5_ERR_HDF5, - "Can't open external link for object '%s'!", - name)); + if (obj_id < 0) { + h5_error( + H5_ERR_HDF5, + "Can't open external link for object '%s'!", + name); + return H5O_TYPE_UNKNOWN; + } herr = H5Oget_info(obj_id, &objinfo); } else { // H5L_TYPE_HARD herr = H5Oget_info_by_name(g_id, name, &objinfo, H5P_DEFAULT); } - if (herr < 0) - H5_PRIV_FUNC_LEAVE ( - (H5O_type_t)h5_error( - H5_ERR_HDF5, - "Can't query object with name '%s'!", name)); - - H5_PRIV_FUNC_RETURN (objinfo.type); + if (herr < 0) { + h5_error( + H5_ERR_HDF5, + "Can't query object with name '%s'!", name); + return H5O_TYPE_UNKNOWN; + } + return objinfo.type; } static herr_t @@ -1401,16 +1400,13 @@ iter_op_count ( const H5L_info_t* info, void* _op_data ) { - H5_PRIV_FUNC_ENTER4 (herr_t, - "g_id=%d, name=\"%s\", info=0x%p, _op_data=0x%p", - g_id, name, info, _op_data); op_data_t* op_data = (op_data_t*)_op_data; - H5O_type_t type; - TRY (type = iter_op_get_obj_type (g_id, name, info)); - if (type != op_data->type ) - H5_PRIV_FUNC_LEAVE (0); - op_data->cnt++; - H5_PRIV_FUNC_RETURN (0); + H5O_type_t type = iter_op_get_obj_type (g_id, name, info); + if (type == H5O_TYPE_UNKNOWN) + return -1; + if (type == op_data->type) + op_data->cnt++; + return 0; } static herr_t @@ -1420,22 +1416,20 @@ iter_op_idx ( const H5L_info_t* info, void* _op_data ) { - H5_PRIV_FUNC_ENTER4 (herr_t, - "g_id=%d, name=\"%s\", info=0x%p, _op_data=0x%p", - g_id, name, info, _op_data); op_data_t* op_data = (op_data_t*)_op_data; - H5O_type_t type; - TRY (type = iter_op_get_obj_type (g_id, name, info)); + H5O_type_t type = iter_op_get_obj_type (g_id, name, info); + if (type == H5O_TYPE_UNKNOWN) + return -1; if (type != op_data->type) - H5_PRIV_FUNC_LEAVE (0); + return 0; // ignore on wrong type op_data->cnt++; /* stop iterating if index is equal cnt */ if (op_data->queried_idx == op_data->cnt) { memset (op_data->name, 0, op_data->len); strncpy (op_data->name, name, op_data->len-1); - H5_PRIV_FUNC_LEAVE (1); + return 1; } - H5_PRIV_FUNC_RETURN (0); + return 0; } static herr_t @@ -1518,9 +1512,9 @@ h5_get_hdf5_groupname_by_idx ( size_t len ) { HDF5_WRAPPER_ENTER5 (h5_err_t, - "loc_id=%d (%s), idx=%llu, name=0x%p, len=%zd", + "loc_id=%d (%s), idx=%llu, name=0x%p, len=%llu", loc_id, h5_get_objname (loc_id), - idx, name, len); + idx, name, (unsigned long long)len); op_data_t op_data; memset (&op_data, 0, sizeof (op_data)); op_data.type = H5O_TYPE_GROUP; @@ -1578,9 +1572,9 @@ h5_get_hdf5_datasetname_by_idx ( size_t len ) { HDF5_WRAPPER_ENTER5 (h5_err_t, - "loc_id=%d (%s), idx=%llu, name=0x%p, len=%zd", + "loc_id=%d (%s), idx=%llu, name=0x%p, len=%llu", loc_id, h5_get_objname (loc_id), - idx, name, len); + idx, name, (unsigned long long)len); op_data_t op_data; memset (&op_data, 0, sizeof (op_data)); op_data.type = H5O_TYPE_DATASET; diff --git a/src/h5core/h5_hsearch.c b/src/h5core/h5_hsearch.c index 7656568..e7a76c8 100644 --- a/src/h5core/h5_hsearch.c +++ b/src/h5core/h5_hsearch.c @@ -61,18 +61,17 @@ isprime (const unsigned int number) { becomes zero. */ h5_err_t h5priv_hcreate ( - h5_file_t* const f, size_t nel, h5_hashtable_t* htab, int (*compare)(const void*, const void*), unsigned int (*compute_hash)(const void*), - h5_err_t (*free_entry)(h5_file_t* const f, const void*) + h5_err_t (*free_entry)(const void*) ) { H5_PRIV_API_ENTER (h5_err_t); /* Test for correct arguments. */ if (htab == NULL || htab->table != NULL) { - H5_PRIV_API_LEAVE (h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_API_LEAVE (h5_error_internal ()); } /* Change nel to the first prime number not smaller as nel. */ nel |= 1; /* make odd */ @@ -98,20 +97,19 @@ h5priv_hcreate ( */ h5_err_t h5priv_hresize ( - h5_file_t* const f, size_t nel, // number of entries to grow h5_hashtable_t* htab // hash table to resize ) { H5_PRIV_API_ENTER (h5_err_t); if (htab == NULL || htab->table == NULL) { - H5_PRIV_API_LEAVE (h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_API_LEAVE (h5_error_internal ()); } // create new hash table h5_hashtable_t __htab; memset (&__htab, 0, sizeof (__htab)); nel += htab->size; h5_debug ("Resize hash table from %u to %lu elements.", htab->size, nel); - TRY (h5priv_hcreate (f, nel, &__htab, htab->compare, + TRY (h5priv_hcreate (nel, &__htab, htab->compare, htab->compute_hash, htab->free_entry)); // add all entries to new hash table @@ -120,7 +118,6 @@ h5priv_hresize ( if (htab->table[idx].used) { void* ventry; TRY (h5priv_hsearch ( - f, htab->table[idx].entry, H5_ENTER, &ventry, @@ -138,15 +135,14 @@ h5priv_hresize ( static inline h5_err_t hwalk ( - h5_file_t* const f, struct hsearch_data* htab, - h5_err_t (*visit)(h5_file_t*const f, const void *item) + h5_err_t (*visit)(const void *item) ) { H5_PRIV_FUNC_ENTER (h5_err_t); unsigned int idx = 1; for (idx = 1; idx < htab->size; idx++) { if (htab->table[idx].used) { - TRY ((*visit)(f, &htab->table[idx].entry)); + TRY ((*visit)(&htab->table[idx].entry)); } } H5_PRIV_FUNC_RETURN (H5_SUCCESS); @@ -157,16 +153,15 @@ hwalk ( be freed and the local static variable can be marked as not used. */ h5_err_t h5priv_hdestroy ( - h5_file_t* const f, struct hsearch_data* htab ) { H5_PRIV_API_ENTER (h5_err_t); /* Test for correct arguments. */ if (htab == NULL) { - H5_PRIV_API_LEAVE (h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_API_LEAVE (h5_error_internal ()); } - TRY (hwalk (f, htab, htab->free_entry)); + TRY (hwalk (htab, htab->free_entry)); /* Free used memory. */ TRY (h5_free (htab->table)); @@ -193,7 +188,6 @@ h5priv_hdestroy ( unnecessary expensive calls of strcmp. */ h5_err_t h5priv_hsearch ( - h5_file_t* const f, void* item, const h5_action_t action, void** retval, @@ -257,7 +251,7 @@ h5priv_hsearch ( if (retval) { *retval = NULL; } - H5_PRIV_API_LEAVE (h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_API_LEAVE (h5_error_internal ()); } htab->table[idx].used = hval; @@ -310,7 +304,6 @@ compute_string_keyed ( static h5_err_t free_string_keyed ( - h5_file_t* const f, const void* __entry ) { H5_PRIV_FUNC_ENTER (h5_err_t); @@ -322,19 +315,18 @@ free_string_keyed ( h5_err_t h5priv_hcreate_string_keyed ( - h5_file_t* const f, size_t nel, h5_hashtable_t* htab, - h5_err_t (*free_entry)(h5_file_t* const f, const void*) + h5_err_t (*free_entry)(const void*) ) { H5_PRIV_API_ENTER (h5_err_t); if (free_entry == NULL) { - TRY (h5priv_hcreate (f, nel, htab, + TRY (h5priv_hcreate (nel, htab, cmp_string_keyed, compute_string_keyed, free_string_keyed)); } else { - TRY (h5priv_hcreate (f, nel, htab, + TRY (h5priv_hcreate (nel, htab, cmp_string_keyed, compute_string_keyed, free_entry)); diff --git a/src/h5core/h5_hsearch_private.h b/src/h5core/h5_hsearch_private.h index d779b5f..4fe1d8d 100644 --- a/src/h5core/h5_hsearch_private.h +++ b/src/h5core/h5_hsearch_private.h @@ -7,7 +7,7 @@ typedef struct hsearch_data { unsigned int filled; int (*compare)(const void*, const void*); unsigned int (*compute_hash)(const void*); - h5_err_t (*free_entry)(h5_file_t* const f, const void*); + h5_err_t (*free_entry)(const void*); } h5_hashtable_t; /* Action which shall be performed in the call to hsearch. */ @@ -25,7 +25,6 @@ typedef struct h5_entry { same time. */ extern h5_err_t h5priv_hsearch ( - h5_file_t* const f, void* item, const h5_action_t action, void** retval, @@ -34,33 +33,29 @@ h5priv_hsearch ( extern h5_err_t h5priv_hcreate ( - h5_file_t* const f, size_t __nel, h5_hashtable_t* __htab, int (*compare)(const void*, const void*), unsigned int (*compute_hash)(const void*), - h5_err_t (*free_entry)(h5_file_t* const f, const void*) + h5_err_t (*free_entry)(const void*) ); extern h5_err_t h5priv_hresize ( - h5_file_t* const f, size_t nel, h5_hashtable_t* htab ); extern h5_err_t h5priv_hdestroy ( - h5_file_t* f, h5_hashtable_t* __htab ); extern h5_err_t h5priv_hcreate_string_keyed ( - h5_file_t* const f, size_t nel, h5_hashtable_t* htab, - h5_err_t (*free_entry)(h5_file_t* const f, const void*) + h5_err_t (*free_entry)(const void*) ); #endif diff --git a/src/h5core/h5_maps.c b/src/h5core/h5_maps.c index b99a196..1e8e4a4 100644 --- a/src/h5core/h5_maps.c +++ b/src/h5core/h5_maps.c @@ -15,7 +15,6 @@ */ h5_err_t h5priv_alloc_idlist ( - h5_file_t* const f, h5_loc_idlist_t** list, const h5_size_t size ) { @@ -28,7 +27,6 @@ h5priv_alloc_idlist ( h5_err_t h5priv_free_idlist ( - h5_file_t* const f, h5_loc_idlist_t** list ) { H5_PRIV_API_ENTER (h5_err_t); @@ -40,7 +38,6 @@ h5priv_free_idlist ( static inline h5_err_t grow_idlist ( - h5_file_t* const f, h5_loc_idlist_t** list, size_t new_size ) { @@ -56,14 +53,13 @@ grow_idlist ( */ h5_loc_idx_t h5priv_insert_idlist ( - h5_file_t* const f, h5_loc_idlist_t** list, h5_loc_id_t id, h5_loc_idx_t idx ) { H5_PRIV_API_ENTER (h5_loc_idx_t); if (*list == NULL) { - TRY (h5priv_alloc_idlist (f, list, 2)); + TRY (h5priv_alloc_idlist (list, 2)); } else if ((*list)->num_items == (*list)->size) { h5_size_t size = (*list)->size; if (size == 0) { @@ -71,7 +67,7 @@ h5priv_insert_idlist ( } else { size *= 2; } - TRY (grow_idlist (f, list, size)); + TRY (grow_idlist (list, size)); } h5_loc_idlist_t* l = *list; if (idx == -1) { @@ -92,12 +88,10 @@ h5priv_insert_idlist ( */ h5_loc_id_t h5priv_find_idlist ( - h5_file_t* const f, h5_loc_idlist_t* list, const h5_loc_id_t item ) { H5_PRIV_API_ENTER (h5_loc_id_t); - UNUSED_ARGUMENT (f); if (!list) { H5_PRIV_API_LEAVE (-1); } @@ -130,15 +124,14 @@ h5priv_find_idlist ( */ h5_loc_idx_t h5priv_search_idlist ( - h5_file_t* const f, h5_loc_idlist_t** list, h5_loc_id_t item ) { H5_PRIV_API_ENTER (h5_loc_idx_t); - h5_loc_idx_t idx = h5priv_find_idlist (f, *list, item); + h5_loc_idx_t idx = h5priv_find_idlist (*list, item); if (idx < 0) { idx = -(idx+1); - TRY (idx = h5priv_insert_idlist (f, list, item, idx)); + TRY (idx = h5priv_insert_idlist (list, item, idx)); } H5_PRIV_API_RETURN (idx); } @@ -146,7 +139,6 @@ h5priv_search_idlist ( h5_err_t h5priv_alloc_idxmap ( - h5_file_t* const f, h5_idxmap_t* map, const h5_size_t size ) { @@ -161,7 +153,6 @@ h5priv_alloc_idxmap ( h5_err_t h5priv_insert_idxmap ( - h5_file_t* const f, h5_idxmap_t* map, h5_glb_idx_t glb_idx, h5_loc_idx_t loc_idx diff --git a/src/h5core/h5_maps_private.h b/src/h5core/h5_maps_private.h index fbc425d..3a720b4 100644 --- a/src/h5core/h5_maps_private.h +++ b/src/h5core/h5_maps_private.h @@ -3,27 +3,23 @@ h5_err_t h5priv_alloc_idlist ( - h5_file_t * const f, h5_loc_idlist_t **list, const h5_size_t size ); h5_err_t h5priv_free_idlist ( - h5_file_t * const f, h5_loc_idlist_t **list ); h5_loc_id_t h5priv_find_idlist ( - h5_file_t * const f, h5_loc_idlist_t* list, h5_loc_id_t item ); h5_loc_idx_t h5priv_insert_idlist ( - h5_file_t * const f, h5_loc_idlist_t** list, h5_loc_id_t item, h5_loc_idx_t idx @@ -31,22 +27,17 @@ h5priv_insert_idlist ( h5_loc_idx_t h5priv_search_idlist ( - h5_file_t * const f, h5_loc_idlist_t** list, h5_loc_id_t item ); - - h5_err_t h5priv_alloc_idxmap ( - h5_file_t * const f, h5_idxmap_t *map, const h5_size_t size ); h5_err_t h5priv_insert_idxmap ( - h5_file_t * const f, h5_idxmap_t *map, h5_glb_idx_t glb_idx, h5_loc_idx_t loc_idx diff --git a/src/h5core/h5_mpi.c b/src/h5core/h5_mpi.c index 3c3472e..bbd96a8 100644 --- a/src/h5core/h5_mpi.c +++ b/src/h5core/h5_mpi.c @@ -5,7 +5,6 @@ h5_err_t h5priv_mpi_recv( - h5_file_t *const f, void* buf, const int count, const MPI_Datatype type, @@ -29,7 +28,6 @@ h5priv_mpi_recv( h5_err_t h5priv_mpi_send( - h5_file_t *f, void* buf, const int count, const MPI_Datatype type, @@ -52,7 +50,6 @@ h5priv_mpi_send( h5_err_t h5priv_mpi_bcast ( - h5_file_t* const f, void* buf, const int count, const MPI_Datatype type, @@ -75,7 +72,6 @@ h5priv_mpi_bcast ( h5_err_t h5priv_mpi_sum ( - h5_file_t* const f, void* sendbuf, void* recvbuf, const int count, @@ -97,7 +93,6 @@ h5priv_mpi_sum ( h5_err_t h5priv_mpi_prefix_sum ( - h5_file_t* const f, void* sendbuf, void* recvbuf, const int count, @@ -119,7 +114,6 @@ h5priv_mpi_prefix_sum ( h5_err_t h5priv_mpi_allgather ( - h5_file_t* const f, void* sendbuf, const int sendcount, const MPI_Datatype sendtype, @@ -143,7 +137,6 @@ h5priv_mpi_allgather ( h5_err_t h5priv_mpi_comm_size ( - h5_file_t* const f, MPI_Comm comm, int* size ) { @@ -156,7 +149,6 @@ h5priv_mpi_comm_size ( h5_err_t h5priv_mpi_comm_rank ( - h5_file_t* const f, MPI_Comm comm, int* rank ) { @@ -168,7 +160,6 @@ h5priv_mpi_comm_rank ( h5_err_t h5priv_mpi_type_contiguous ( - h5_file_t* const f, const size_t nelems, const MPI_Datatype oldtype, MPI_Datatype *const newtype @@ -185,7 +176,6 @@ h5priv_mpi_type_contiguous ( h5_err_t h5priv_mpi_type_free ( - h5_file_t* const f, MPI_Datatype *type ) { int err = MPI_Type_free( type ); @@ -196,7 +186,6 @@ h5priv_mpi_type_free ( h5_err_t h5priv_mpi_cart_create ( - h5_file_t* const f, MPI_Comm old_comm, int ndims, int *dims, @@ -213,7 +202,6 @@ h5priv_mpi_cart_create ( h5_err_t h5priv_mpi_cart_coords ( - h5_file_t* const f, MPI_Comm comm, int rank, int maxdim, diff --git a/src/h5core/h5_mpi_private.h b/src/h5core/h5_mpi_private.h index 5b15516..b47ab07 100644 --- a/src/h5core/h5_mpi_private.h +++ b/src/h5core/h5_mpi_private.h @@ -4,7 +4,6 @@ #ifdef PARALLEL_IO h5_err_t h5priv_mpi_recv( - h5_file_t *f, void* buf, const int count, const MPI_Datatype type, @@ -15,7 +14,6 @@ h5priv_mpi_recv( h5_err_t h5priv_mpi_send( - h5_file_t *f, void* buf, const int count, const MPI_Datatype type, @@ -26,7 +24,6 @@ h5priv_mpi_send( h5_err_t h5priv_mpi_bcast ( - h5_file_t* const f, void* buf, const int count, const MPI_Datatype type, @@ -36,7 +33,6 @@ h5priv_mpi_bcast ( h5_err_t h5priv_mpi_sum ( - h5_file_t* const f, void* sendbuf, void* recvbuf, const int count, @@ -46,7 +42,6 @@ h5priv_mpi_sum ( h5_err_t h5priv_mpi_prefix_sum ( - h5_file_t* const f, void* sendbuf, void* recvbuf, const int count, @@ -56,7 +51,6 @@ h5priv_mpi_prefix_sum ( h5_err_t h5priv_mpi_allgather ( - h5_file_t* const f, void* sendbuf, const int sendcount, const MPI_Datatype sendtype, @@ -68,21 +62,18 @@ h5priv_mpi_allgather ( h5_err_t h5priv_mpi_comm_size ( - h5_file_t* const f, MPI_Comm comm, int* size ); h5_err_t h5priv_mpi_comm_rank ( - h5_file_t* const f, MPI_Comm comm, int* rank ); h5_err_t h5priv_mpi_type_contiguous ( - h5_file_t* const f, const size_t nelems, const MPI_Datatype oldtype, MPI_Datatype *newtype @@ -90,13 +81,11 @@ h5priv_mpi_type_contiguous ( h5_err_t h5priv_mpi_type_free ( - h5_file_t* const f, MPI_Datatype *type ); h5_err_t h5priv_mpi_cart_create ( - h5_file_t* const f, MPI_Comm old_comm, int ndims, int *dims, @@ -107,7 +96,6 @@ h5priv_mpi_cart_create ( h5_err_t h5priv_mpi_cart_coords ( - h5_file_t* const f, MPI_Comm comm, int rank, int maxdim, diff --git a/src/h5core/h5_openclose.c b/src/h5core/h5_openclose.c index ee4fc8e..bde65c4 100644 --- a/src/h5core/h5_openclose.c +++ b/src/h5core/h5_openclose.c @@ -110,8 +110,7 @@ h5bpriv_open_file ( #if defined(PARALLEL_IO) size_t n = sizeof (struct h5b_partition) / sizeof (h5_int64_t); - TRY (h5priv_mpi_type_contiguous(f, - n, MPI_LONG_LONG, &b->partition_mpi_t)); + TRY (h5priv_mpi_type_contiguous(n, MPI_LONG_LONG, &b->partition_mpi_t)); #endif memset (b->user_layout, 0, sizeof(*b->user_layout)); memset (b->write_layout, 0, sizeof(*b->write_layout)); @@ -159,8 +158,8 @@ h5_open_file ( #ifdef PARALLEL_IO f->comm = comm; - TRY2 (h5priv_mpi_comm_size (f, comm, &f->nprocs)); - TRY2 (h5priv_mpi_comm_rank (f, comm, &f->myproc)); + TRY2 (h5priv_mpi_comm_size (comm, &f->nprocs)); + TRY2 (h5priv_mpi_comm_rank (comm, &f->myproc)); /* xfer_prop: also used for parallel I/O, during actual writes rather than the access_prop which is for file creation. */ @@ -292,7 +291,7 @@ h5bpriv_close_file ( TRY (hdf5_close_dataspace (b->memshape)); TRY (hdf5_close_property (b->dcreate_prop)); #if defined(PARALLEL_IO) - TRY (h5priv_mpi_type_free (f, &b->partition_mpi_t)); + TRY (h5priv_mpi_type_free (&b->partition_mpi_t)); #endif TRY (h5_free (f->b)); f->b = NULL; @@ -379,7 +378,7 @@ h5_get_stepname_fmt ( UNUSED_ARGUMENT (name); UNUSED_ARGUMENT (l_name); UNUSED_ARGUMENT (width); - return h5_error_not_implemented (__FILE__, __func__, __LINE__); + return h5_error_not_implemented (); } /*! @@ -393,7 +392,8 @@ h5_id_t h5_get_step ( h5_file_t* const f /*!< file handle */ ) { - return h5_error_not_implemented (__FILE__, __func__, __LINE__); + UNUSED_ARGUMENT (f); + return h5_error_not_implemented (); } /*! @@ -453,7 +453,8 @@ h5_err_t h5_start_traverse_steps ( h5_file_t* const f /*!< file handle */ ) { - return h5_error_not_implemented (__FILE__, __func__, __LINE__); + UNUSED_ARGUMENT (f); + return h5_error_not_implemented (); } /*! @@ -467,7 +468,8 @@ h5_err_t h5_traverse_steps ( h5_file_t* const f /*!< file handle */ ) { - return h5_error_not_implemented (__FILE__, __func__, __LINE__); + UNUSED_ARGUMENT (f); + return h5_error_not_implemented (); } char * diff --git a/src/h5core/h5_readwrite.c b/src/h5core/h5_readwrite.c index da2ae75..530aaec 100644 --- a/src/h5core/h5_readwrite.c +++ b/src/h5core/h5_readwrite.c @@ -179,7 +179,6 @@ h5_set_step ( */ h5_int64_t h5_normalize_h5_type ( - h5_file_t* const f, hid_t type ) { H5_CORE_API_ENTER (h5_int64_t); @@ -219,13 +218,14 @@ h5_get_dataset_type( hid_t group_id, const char* dset_name ) { + UNUSED_ARGUMENT (f); H5_CORE_API_ENTER (h5_int64_t); hid_t dset_id; hid_t hdf5_type; h5_int64_t type; TRY (dset_id = hdf5_open_dataset (group_id, dset_name)); TRY (hdf5_type = hdf5_get_dataset_type (dset_id)); - TRY (type = h5_normalize_h5_type (f, hdf5_type)); + TRY (type = h5_normalize_h5_type (hdf5_type)); TRY (hdf5_close_type (hdf5_type)); TRY (hdf5_close_dataset (dset_id)); @@ -247,7 +247,6 @@ h5_has_step ( h5_err_t h5_normalize_dataset_name ( - h5_file_t *const f, const char *name, char *name2 ) { @@ -301,7 +300,7 @@ h5_start_throttle ( h5_debug ("[%d] throttle: waiting on token from %d", f->myproc, f->myproc - f->throttle); // wait to receive token before continuing with read - TRY( h5priv_mpi_recv(f, + TRY( h5priv_mpi_recv( &token, 1, MPI_INT, f->myproc - f->throttle, // receive from previous proc f->myproc, // use this proc id as message tag @@ -325,7 +324,6 @@ h5_end_throttle ( h5_debug ("[%d] throttle: passing token to %d", f->myproc, f->myproc + f->throttle); TRY (h5priv_mpi_send( - f, &token, 1, MPI_INT, f->myproc + f->throttle, // send to next proc f->myproc + f->throttle, // use the id of the target as tag diff --git a/src/h5core/h5b_model.c b/src/h5core/h5b_model.c index 68499c9..4acca85 100644 --- a/src/h5core/h5b_model.c +++ b/src/h5core/h5b_model.c @@ -239,7 +239,7 @@ _dissolve_ghostzone ( h5b_partition_t *const p, /*!< IN/OUT: ptr to first partition */ h5b_partition_t *const q /*!< IN/OUT: ptr to second partition */ ) { - + UNUSED_ARGUMENT (f); h5b_partition_t p_; h5b_partition_t q_; h5b_partition_t p_best; @@ -458,7 +458,7 @@ h5bpriv_have_field_group ( ) { H5_CORE_API_ENTER (h5_err_t); char name2[H5_DATANAME_LEN]; - h5_normalize_dataset_name(f, name, name2); + h5_normalize_dataset_name (name, name2); TRY( h5bpriv_open_block_group(f) ); H5_CORE_API_RETURN (hdf5_link_exists(f->b->block_gid, name2)); @@ -471,7 +471,7 @@ h5bpriv_open_field_group ( ) { H5_CORE_API_ENTER (h5_err_t); char name2[H5_DATANAME_LEN]; - h5_normalize_dataset_name(f, name, name2); + h5_normalize_dataset_name (name, name2); TRY (hdf5_close_group (f->b->field_gid)); TRY (h5bpriv_open_block_group (f)); @@ -495,7 +495,7 @@ h5bpriv_create_field_group ( TRY( _create_block_group(f) ); char name2[H5_DATANAME_LEN]; - h5_normalize_dataset_name(f, name, name2); + h5_normalize_dataset_name (name, name2); h5_err_t exists; TRY (exists = hdf5_link_exists ( b->block_gid, name2)); @@ -546,7 +546,7 @@ h5b_3d_set_view ( TRY( user_layout = h5_alloc (NULL, size) ); TRY( write_layout = h5_alloc (NULL, size) ); - TRY( h5priv_mpi_allgather(f, + TRY( h5priv_mpi_allgather( p, 1, f->b->partition_mpi_t, user_layout, 1, f->b->partition_mpi_t, f->comm) ); @@ -716,7 +716,7 @@ h5b_3d_set_grid ( int dims[3] = { k, j, i }; int period[3] = { 0, 0, 0 }; - TRY( h5priv_mpi_cart_create(f, + TRY( h5priv_mpi_cart_create( f->comm, 3, dims, period, 0, &f->b->cart_comm) ); f->b->have_grid = 1; @@ -739,7 +739,7 @@ h5b_3d_get_grid_coords ( "Grid dimensions have not been set!")); int coords[3]; - TRY( h5priv_mpi_cart_coords(f, f->b->cart_comm, proc, 3, coords) ); + TRY( h5priv_mpi_cart_coords(f->b->cart_comm, proc, 3, coords) ); *k = coords[0]; *j = coords[1]; *i = coords[2]; @@ -762,7 +762,7 @@ h5b_3d_set_dims ( h5_size_t dims[3] = { k, j, i }; h5_size_t check_dims[3] = { k, j, i }; - TRY( h5priv_mpi_bcast(f, + TRY( h5priv_mpi_bcast( check_dims, 3, MPI_LONG_LONG, 0, f->comm) ); if ( dims[0] != check_dims[0] || @@ -885,7 +885,7 @@ h5b_get_field_info_by_name ( TRY (h5type = hdf5_get_dataset_type (dataset_id)); if ( type ) - TRY( *type = h5_normalize_h5_type(f, h5type) ); + TRY( *type = h5_normalize_h5_type(h5type) ); TRY (hdf5_close_dataspace (dataspace_id)); TRY (hdf5_close_dataset (dataset_id)); diff --git a/src/h5core/h5t_access_tetm.c b/src/h5core/h5t_access_tetm.c index b0583a2..ce4df70 100644 --- a/src/h5core/h5t_access_tetm.c +++ b/src/h5core/h5t_access_tetm.c @@ -326,7 +326,7 @@ is_boundary_face ( UNUSED_ARGUMENT (elem_idx); UNUSED_ARGUMENT (facet_idx); - return h5_error_internal (__FILE__, __func__, __LINE__); + return h5_error_internal (); } struct h5t_access_methods h5tpriv_access_tetm_methods = { diff --git a/src/h5core/h5t_access_trim.c b/src/h5core/h5t_access_trim.c index 2ad32a0..bd93e50 100644 --- a/src/h5core/h5t_access_trim.c +++ b/src/h5core/h5t_access_trim.c @@ -322,7 +322,7 @@ is_boundary_face ( UNUSED_ARGUMENT (dim); UNUSED_ARGUMENT (elem_idx); UNUSED_ARGUMENT (facet_idx); - return h5_error_internal (__FILE__, __func__, __LINE__); + return h5_error_internal (); } struct h5t_access_methods h5tpriv_access_trim_methods = { diff --git a/src/h5core/h5t_adjacencies.c b/src/h5core/h5t_adjacencies.c index fbca8a6..ed38146 100644 --- a/src/h5core/h5t_adjacencies.c +++ b/src/h5core/h5t_adjacencies.c @@ -32,8 +32,9 @@ h5t_release_list_of_adjacencies ( h5_file_t* const f, h5_loc_idlist_t** list ) { - H5_CORE_API_ENTER (h5_err_t);; - H5_CORE_API_RETURN (h5priv_free_idlist (f, list)); + UNUSED_ARGUMENT (f); + H5_CORE_API_ENTER (h5_err_t); + H5_CORE_API_RETURN (h5priv_free_idlist (list)); } h5_err_t diff --git a/src/h5core/h5t_adjacencies_private.h b/src/h5core/h5t_adjacencies_private.h index a076593..882b19c 100644 --- a/src/h5core/h5t_adjacencies_private.h +++ b/src/h5core/h5t_adjacencies_private.h @@ -21,8 +21,7 @@ h5tpriv_get_adjacencies ( ) { H5_PRIV_API_ENTER (h5_err_t); if (f->t->methods.adjacency == NULL) { - H5_PRIV_API_LEAVE ( - h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_API_LEAVE (h5_error_internal ()); } H5_PRIV_API_RETURN (f->t->methods.adjacency->get_adjacencies( f, entity_id, dim, list)); diff --git a/src/h5core/h5t_adjacencies_tetm.c b/src/h5core/h5t_adjacencies_tetm.c index 47b1748..11c4098 100644 --- a/src/h5core/h5t_adjacencies_tetm.c +++ b/src/h5core/h5t_adjacencies_tetm.c @@ -56,7 +56,7 @@ release_tv ( h5_loc_idx_t vertex_idx = 0; h5_loc_idx_t last = t->num_vertices[t->num_leaf_levels-1]; for (; vertex_idx < last; vertex_idx++) { - TRY( h5priv_free_idlist (f, &adj->tv.v[vertex_idx]) ); + TRY( h5priv_free_idlist (&adj->tv.v[vertex_idx]) ); } TRY( h5_free (adj->tv.v) ); adj->tv.v = NULL; @@ -154,7 +154,7 @@ compute_children_of_edge ( h5_loc_idx_t face_idx = h5tpriv_get_face_idx (*edge_idp); h5_loc_tet_t* elem = &f->t->loc_elems.tets[elem_idx]; if (h5tpriv_is_leaf_elem (f, elem)) { - TRY( h5priv_insert_idlist (f, children, *edge_idp, -1) ); + TRY( h5priv_insert_idlist (children, *edge_idp, -1) ); } else { h5_loc_id_t edge_ids[2]; TRY( h5tpriv_get_direct_children_of_edge ( @@ -201,7 +201,7 @@ compute_sections_of_edge ( } } while (++edge_idp < end); if (!refined) { - TRY( h5priv_insert_idlist (f, children, te->items[0], -1) ); + TRY( h5priv_insert_idlist (children, te->items[0], -1) ); } H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -253,8 +253,7 @@ compute_direct_children_of_triangle ( }; int num_faces = h5tpriv_ref_elem_get_num_facets (f->t); if ((face_idx < 0) || (face_idx >= num_faces)) { - H5_PRIV_FUNC_LEAVE ( - h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_FUNC_LEAVE (h5_error_internal ()); } children[0] = h5tpriv_build_triangle_id ( map[face_idx][0][0], elem_idx+map[face_idx][0][1]); @@ -283,7 +282,7 @@ compute_children_of_triangle ( h5_loc_idx_t face_idx = h5tpriv_get_face_idx (*triangle_idp); h5_loc_tet_t* elem = &f->t->loc_elems.tets[elem_idx]; if (h5tpriv_is_leaf_elem (f, elem)) { - TRY( h5priv_insert_idlist (f, children, *triangle_idp, -1) ); + TRY( h5priv_insert_idlist (children, *triangle_idp, -1) ); } else { h5_loc_id_t triangle_ids[4] = {-1,-1,-1,-1}; TRY( compute_direct_children_of_triangle ( @@ -331,7 +330,7 @@ compute_sections_of_triangle ( } } while (++triangle_idp < end); if (! refined) { - TRY( h5priv_insert_idlist (f, children, td->items[0], -1) ); + TRY( h5priv_insert_idlist (children, td->items[0], -1) ); } H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -349,7 +348,7 @@ add_vertex2 ( H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* tv; TRY( h5tpriv_find_tv2 (f, face_idx, elem_idx, &tv) ); - TRY( h5priv_search_idlist (f, list, tv->items[0]) ); + TRY( h5priv_search_idlist (list, tv->items[0]) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -365,7 +364,7 @@ add_edge ( H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* te; TRY( h5tpriv_find_te (f, entity_id, &te) ); - TRY( h5priv_search_idlist (f, list, te->items[0]) ); + TRY( h5priv_search_idlist (list, te->items[0]) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -379,7 +378,7 @@ add_edge2 ( H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* te; TRY( h5tpriv_find_te2 (f, face_idx, elem_idx, &te) ); - TRY( h5priv_search_idlist (f, list, te->items[0]) ); + TRY( h5priv_search_idlist (list, te->items[0]) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -395,7 +394,7 @@ add_triangle ( H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* td; TRY( h5tpriv_find_td (f, entity_id, &td) ); - TRY( h5priv_search_idlist (f, list, td->items[0]) ); + TRY( h5priv_search_idlist (list, td->items[0]) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -410,20 +409,19 @@ add_triangle2 ( H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* td; TRY( h5tpriv_find_td2 (f, face_idx, elem_idx, &td) ); - TRY( h5priv_search_idlist (f, list, td->items[0]) ); + TRY( h5priv_search_idlist (list, td->items[0]) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } static inline h5_err_t add_elem2 ( - h5_file_t* const f, // in h5_loc_idlist_t** list, // out h5_loc_idx_t elem_idx // in ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_id_t elem_id = h5tpriv_build_tet_id (0, elem_idx); - TRY( h5priv_search_idlist (f, list, elem_id) ); + TRY( h5priv_search_idlist (list, elem_id) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -442,7 +440,7 @@ get_edges_uadj_to_vertex ( TRY( h5t_get_vertex_index_of_vertex (f, entity_id, &vertex_idx) ); h5_loc_idlist_t* tv = f->t->adjacencies.tv.v[vertex_idx]; - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* vertex_idp = tv->items; h5_loc_id_t* end = vertex_idp + tv->num_items; do { @@ -484,7 +482,7 @@ get_triangles_uadj_to_vertex ( h5_loc_idlist_t* tv = f->t->adjacencies.tv.v[vertex_idx]; // build list of upward adjacent triangles - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* vertex_idp = tv->items; h5_loc_id_t* end = vertex_idp + tv->num_items; do { @@ -521,7 +519,7 @@ get_tets_uadj_to_vertex ( TRY( h5t_get_vertex_index_of_vertex (f, entity_id, &vertex_idx) ); h5_loc_idlist_t* tv = f->t->adjacencies.tv.v[vertex_idx]; - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* vertex_idp = tv->items; h5_loc_id_t* end = vertex_idp + tv->num_items; do { @@ -530,7 +528,7 @@ get_tets_uadj_to_vertex ( if (!h5tpriv_is_leaf_elem (f, elem)) { continue; } - TRY( add_elem2 (f, list, elem_idx) ); + TRY( add_elem2 (list, elem_idx) ); } while (++vertex_idp < end); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -543,9 +541,9 @@ get_triangles_uadj_to_edge ( ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; - TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( h5priv_alloc_idlist (&children, 8) ); TRY( compute_children_of_edge (f, entity_id, &children) ); - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* edge_idp = children->items; h5_loc_id_t* end = children->items+children->num_items; do { @@ -560,7 +558,7 @@ get_triangles_uadj_to_edge ( f->t, 1, face_idx, 1), elem_idx) ); } while (++edge_idp < end); - TRY( h5priv_free_idlist ( f, &children) ); + TRY (h5priv_free_idlist (&children)); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -573,15 +571,15 @@ get_tets_uadj_to_edge ( ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; - TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( h5priv_alloc_idlist (&children, 8) ); TRY( compute_children_of_edge (f, entity_id, &children) ); - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* edge_idp = children->items; h5_loc_id_t* end = children->items+children->num_items; do { - TRY( add_elem2 (f, list, h5tpriv_get_elem_idx (*edge_idp)) ); + TRY( add_elem2 (list, h5tpriv_get_elem_idx (*edge_idp)) ); } while (++edge_idp < end); - TRY( h5priv_free_idlist (f, &children) ); + TRY( h5priv_free_idlist (&children) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -593,15 +591,15 @@ get_tets_uadj_to_triangle ( ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; - TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( h5priv_alloc_idlist (&children, 8) ); TRY( compute_children_of_triangle (f, entity_id, &children) ); - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* triangle_idp = children->items; h5_loc_id_t* end = triangle_idp + children->num_items; do { - TRY( add_elem2 (f, list, h5tpriv_get_elem_idx (*triangle_idp)) ); + TRY( add_elem2 (list, h5tpriv_get_elem_idx (*triangle_idp)) ); } while (++triangle_idp < end); - TRY( h5priv_free_idlist (f, &children) ); + TRY( h5priv_free_idlist (&children) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -613,10 +611,10 @@ get_vertices_dadj_to_edge ( ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; - TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( h5priv_alloc_idlist (&children, 8) ); TRY( compute_sections_of_edge (f, entity_id, &children) ); // build list of unique vertex IDs - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* edge_idp = children->items; h5_loc_id_t* end = edge_idp + children->num_items; do { @@ -632,7 +630,7 @@ get_vertices_dadj_to_edge ( f->t, 1, face_idx, 1), elem_idx) ); } while (++edge_idp < end); - TRY( h5priv_free_idlist(f, &children) ); + TRY( h5priv_free_idlist(&children) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -647,7 +645,7 @@ get_vertices_dadj_to_triangle ( ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; - TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( h5priv_alloc_idlist (&children, 8) ); h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id); h5_loc_idx_t face_idx = h5tpriv_get_face_idx (entity_id); h5_loc_idx_t edge_idx; @@ -661,7 +659,7 @@ get_vertices_dadj_to_triangle ( &children) ); } // build list of unique vertex IDs - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* edge_idp = children->items; h5_loc_id_t* end = edge_idp + children->num_items; do { @@ -677,7 +675,7 @@ get_vertices_dadj_to_triangle ( f->t, 1, edge_idx, 1), elem_idx) ); } while (++edge_idp < end ); - TRY( h5priv_free_idlist(f, &children) ); + TRY( h5priv_free_idlist(&children) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -693,7 +691,7 @@ get_vertices_dadj_to_tet ( H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id); - TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( h5priv_alloc_idlist (&children, 8) ); // loop over all edges of tetrahedron h5_loc_idx_t edge_idx = h5tpriv_ref_elem_get_num_edges(f->t); while (--edge_idx >= 0) { @@ -703,7 +701,7 @@ get_vertices_dadj_to_tet ( &children) ); } // build list of unique vertex IDs - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* edge_idp = children->items; h5_loc_id_t* end = edge_idp + children->num_items; do { @@ -719,7 +717,7 @@ get_vertices_dadj_to_tet ( f->t, 1, edge_idx, 1), elem_idx) ); } while (++edge_idp < end); - TRY( h5priv_free_idlist(f, &children) ); + TRY( h5priv_free_idlist(&children) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -731,7 +729,7 @@ get_edges_dadj_to_triangle ( ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; - TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( h5priv_alloc_idlist (&children, 8) ); h5_loc_idx_t face_idx = h5tpriv_get_face_idx (entity_id); h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id); // loop over all three edges of triangle @@ -746,13 +744,13 @@ get_edges_dadj_to_triangle ( &children) ); } // build list of unique edge IDs - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* edge_idp = children->items; h5_loc_id_t* end = edge_idp + children->num_items; do { TRY( add_edge (f, list, *edge_idp) ); } while (++edge_idp < end); - TRY( h5priv_free_idlist (f, &children) ); + TRY( h5priv_free_idlist (&children) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -764,7 +762,7 @@ get_edges_dadj_to_tet ( ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; - TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( h5priv_alloc_idlist (&children, 8) ); h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (elem_id); // loop over all edges of tet @@ -776,13 +774,13 @@ get_edges_dadj_to_tet ( &children) ); } // build list of unique edge IDs - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* edge_idp = children->items; h5_loc_id_t* end = edge_idp + children->num_items; do { TRY( add_edge (f, list, *edge_idp) ); } while (++edge_idp < end); - TRY( h5priv_free_idlist (f, &children) ); + TRY( h5priv_free_idlist (&children) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -794,7 +792,7 @@ get_triangles_dadj_to_tet ( ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; - TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( h5priv_alloc_idlist (&children, 8) ); h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id); // loop over all triangle of element h5_loc_idx_t triangle_idx = h5tpriv_ref_elem_get_num_facets(f->t); @@ -804,19 +802,18 @@ get_triangles_dadj_to_tet ( h5tpriv_build_edge_id (triangle_idx, elem_idx), &children) ); } - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* triangle_idp = children->items; h5_loc_id_t* end = triangle_idp + children->num_items; do { TRY( add_triangle (f, list, *triangle_idp) ); } while (++triangle_idp < end); - TRY( h5priv_free_idlist (f, &children) ); + TRY( h5priv_free_idlist (&children) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } static inline h5_err_t dim_error( - h5_file_t* const f, const h5_int32_t dim ) { return h5_error ( @@ -839,7 +836,7 @@ get_adjacencies_to_vertex ( case 3: return get_tets_uadj_to_vertex(f, entity_id, list); default: - return dim_error (f, dim); + return dim_error (dim); } } @@ -858,7 +855,7 @@ get_adjacencies_to_edge ( case 3: return get_tets_uadj_to_edge(f, entity_id, list); default: - return dim_error (f, dim); + return dim_error (dim); } } @@ -877,7 +874,7 @@ get_adjacencies_to_triangle ( case 3: return get_tets_uadj_to_triangle(f, entity_id, list); default: - return dim_error (f, dim); + return dim_error (dim); } } @@ -896,7 +893,7 @@ get_adjacencies_to_tet ( case 2: return get_triangles_dadj_to_tet(f, entity_id, list); default: - return dim_error (f, dim); + return dim_error (dim); } } @@ -920,7 +917,7 @@ get_adjacencies ( default: break; } - return h5_error_internal (__FILE__, __func__, __LINE__); + return h5_error_internal (); } @@ -956,8 +953,8 @@ release_internal_structs ( H5_PRIV_FUNC_ENTER (h5_err_t); h5t_fdata_t* t = f->t; TRY( release_tv (f) ); - TRY( h5priv_hdestroy (f, &t->adjacencies.te_hash) ); - TRY( h5priv_hdestroy (f, &t->adjacencies.td_hash) ); + TRY( h5priv_hdestroy (&t->adjacencies.te_hash) ); + TRY( h5priv_hdestroy (&t->adjacencies.td_hash) ); bzero (&t->adjacencies, sizeof (t->adjacencies)); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } diff --git a/src/h5core/h5t_adjacencies_trim.c b/src/h5core/h5t_adjacencies_trim.c index 593f279..7b1a542 100644 --- a/src/h5core/h5t_adjacencies_trim.c +++ b/src/h5core/h5t_adjacencies_trim.c @@ -49,7 +49,7 @@ release_tv ( h5_loc_idx_t vertex_idx = 0; h5_loc_idx_t last = t->num_vertices[t->num_leaf_levels-1]; for (; vertex_idx < last; vertex_idx++) { - TRY( h5priv_free_idlist (f, &adj->tv.v[vertex_idx]) ); + TRY( h5priv_free_idlist (&adj->tv.v[vertex_idx]) ); } TRY( h5_free (adj->tv.v) ); adj->tv.v = NULL; @@ -124,7 +124,7 @@ compute_children_of_edge ( h5_loc_idx_t face_idx = h5tpriv_get_face_idx (*edge_idp); h5_loc_triangle_t *elem = &f->t->loc_elems.tris[elem_idx]; if (h5tpriv_is_leaf_elem (f, elem)) { - TRY( h5priv_insert_idlist (f, children, *edge_idp, -1) ); + TRY( h5priv_insert_idlist (children, *edge_idp, -1) ); } else { h5_loc_id_t edge_ids[2]; TRY( h5tpriv_get_direct_children_of_edge ( @@ -172,7 +172,7 @@ compute_sections_of_edge ( } } while (++edge_idp < end); if (!refined) { - TRY( h5priv_insert_idlist (f, children, te->items[0], -1) ); + TRY( h5priv_insert_idlist (children, te->items[0], -1) ); } H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -190,7 +190,7 @@ add_vertex2 ( H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* tv; TRY( h5tpriv_find_tv2 (f, face_idx, elem_idx, &tv) ); - TRY( h5priv_search_idlist (f, list, tv->items[0]) ); + TRY( h5priv_search_idlist (list, tv->items[0]) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -206,7 +206,7 @@ add_edge ( H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* te; TRY( h5tpriv_find_te (f, entity_id, &te) ); - TRY( h5priv_search_idlist (f, list, te->items[0]) ); + TRY( h5priv_search_idlist (list, te->items[0]) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -220,19 +220,18 @@ add_edge2 ( H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t *te; TRY( h5tpriv_find_te2 (f, face_idx, elem_idx, &te) ); - TRY( h5priv_search_idlist (f, list, te->items[0]) ); + TRY( h5priv_search_idlist (list, te->items[0]) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } static inline h5_err_t add_elem2 ( - h5_file_t* const f, // in h5_loc_idlist_t** list, // out h5_loc_idx_t elem_idx // in ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_id_t elem_id = h5tpriv_build_triangle_id (0, elem_idx); - TRY( h5priv_search_idlist (f, list, elem_id) ); + TRY( h5priv_search_idlist (list, elem_id) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -251,7 +250,7 @@ get_edges_uadj_to_vertex ( TRY( h5t_get_vertex_index_of_vertex (f, entity_id, &vertex_idx) ); h5_loc_idlist_t* tv = f->t->adjacencies.tv.v[vertex_idx]; - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* vertex_idp = tv->items; h5_loc_id_t* end = vertex_idp + tv->num_items; do { @@ -285,7 +284,7 @@ get_triangles_uadj_to_vertex ( TRY( h5t_get_vertex_index_of_vertex (f, entity_id, &vertex_idx) ); h5_loc_idlist_t* tv = f->t->adjacencies.tv.v[vertex_idx]; - TRY ( h5priv_alloc_idlist ( f, list, 8 ) ); + TRY ( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t *vertex_idp = tv->items; h5_loc_id_t* end = vertex_idp + tv->num_items; do { @@ -295,7 +294,7 @@ get_triangles_uadj_to_vertex ( if (!h5tpriv_is_leaf_elem (f, elem)) { continue; } - TRY( add_elem2 (f, list, elem_idx) ); + TRY (add_elem2 (list, elem_idx)); } while (++vertex_idp < end); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -308,16 +307,16 @@ get_triangles_uadj_to_edge ( ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; - TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( h5priv_alloc_idlist (&children, 8) ); TRY( compute_children_of_edge (f, entity_id, &children) ); - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t *edge_idp = children->items; h5_loc_id_t *end = children->items+children->num_items; do { h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (*edge_idp); - TRY( add_elem2 (f, list, elem_idx) ); + TRY (add_elem2 (list, elem_idx)); } while (++edge_idp < end); - TRY( h5priv_free_idlist (f, &children) ); + TRY( h5priv_free_idlist (&children) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -329,17 +328,17 @@ get_edges_adj_to_edge ( h5_loc_idlist_t** list ) { H5_PRIV_FUNC_ENTER (h5_err_t); - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_idlist_t* children; - TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( h5priv_alloc_idlist (&children, 8) ); TRY( compute_sections_of_edge (f, entity_id, &children) ); - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* edge_idp = children->items; h5_loc_id_t* end = children->items+children->num_items; do { TRY( add_edge (f, list, *edge_idp) ); } while (++edge_idp < end); - TRY( h5priv_free_idlist(f, &children) ); + TRY( h5priv_free_idlist(&children) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -351,9 +350,9 @@ get_vertices_dadj_to_edge ( ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; - TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( h5priv_alloc_idlist (&children, 8) ); TRY( compute_sections_of_edge (f, entity_id, &children) ); - TRY( h5priv_alloc_idlist (f, list, 8) ); + TRY( h5priv_alloc_idlist (list, 8) ); h5_loc_id_t* edge_idp = children->items; h5_loc_id_t* end = edge_idp + children->num_items; do { @@ -369,7 +368,7 @@ get_vertices_dadj_to_edge ( f->t, 1, face_idx, 1), elem_idx) ); } while (++edge_idp < end); - TRY( h5priv_free_idlist (f, &children) ); + TRY( h5priv_free_idlist (&children) ); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -384,7 +383,7 @@ get_vertices_dadj_to_triangle ( ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; - TRY ( h5priv_alloc_idlist ( f, &children, 8 ) ); + TRY (h5priv_alloc_idlist (&children, 8)); h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx ( entity_id ); // loop over all edges of triangle @@ -396,12 +395,12 @@ get_vertices_dadj_to_triangle ( h5tpriv_build_edge_id (face_idx, elem_idx), &children) ); } - TRY ( h5priv_alloc_idlist (f, list, 8) ); + TRY (h5priv_alloc_idlist (list, 8)); h5_loc_id_t *edge_idp = children->items; h5_loc_id_t *end = edge_idp + children->num_items; do { - h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (*edge_idp); - h5_loc_idx_t face_idx = h5tpriv_get_face_idx (*edge_idp); + elem_idx = h5tpriv_get_elem_idx (*edge_idp); + face_idx = h5tpriv_get_face_idx (*edge_idp); TRY( add_vertex2 (f, list, h5tpriv_ref_elem_get_vertex_idx ( @@ -412,7 +411,7 @@ get_vertices_dadj_to_triangle ( f->t, 1, face_idx, 1), elem_idx) ); } while (++edge_idp < end); - TRY ( h5priv_free_idlist(f, &children) ); + TRY (h5priv_free_idlist(&children)); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -424,7 +423,7 @@ get_edges_dadj_to_triangle ( ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5_loc_idlist_t* children; - TRY ( h5priv_alloc_idlist (f, &children, 8) ); + TRY (h5priv_alloc_idlist (&children, 8)); h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id); // loop over all edges of triangle h5_loc_idx_t edge_idx = h5tpriv_ref_elem_get_num_edges (f->t); @@ -434,19 +433,18 @@ get_edges_dadj_to_triangle ( h5tpriv_build_edge_id (edge_idx, elem_idx), &children) ); } - TRY ( h5priv_alloc_idlist (f, list, 8) ); + TRY (h5priv_alloc_idlist (list, 8)); h5_loc_id_t* edge_idp = children->items; h5_loc_id_t* end = edge_idp + children->num_items; do { TRY( add_edge (f, list, *edge_idp) ); } while (++edge_idp < end); - TRY ( h5priv_free_idlist(f, &children) ); + TRY (h5priv_free_idlist(&children)); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } static inline h5_err_t dim_error( - h5_file_t* const f, const h5_int32_t dim ) { return h5_error ( @@ -467,7 +465,7 @@ get_adjacencies_to_vertex ( case 2: return get_triangles_uadj_to_vertex(f, entity_id, list); default: - return dim_error (f, dim); + return dim_error (dim); } } @@ -486,7 +484,7 @@ get_adjacencies_to_edge ( case 2: return get_triangles_uadj_to_edge(f, entity_id, list); default: - return dim_error (f, dim); + return dim_error (dim); } } @@ -503,7 +501,7 @@ get_adjacencies_to_triangle ( case 1: return get_edges_dadj_to_triangle(f, entity_id, list); default: - return dim_error (f, dim); + return dim_error (dim); } } @@ -525,7 +523,7 @@ get_adjacencies ( default: break; } - return h5_error_internal (__FILE__, __func__, __LINE__); + return h5_error_internal (); } static inline h5_err_t @@ -556,7 +554,7 @@ release_internal_structs ( H5_PRIV_FUNC_ENTER (h5_err_t); h5t_fdata_t *t = f->t; TRY( release_tv (f) ); - TRY( h5priv_hdestroy (f, &t->adjacencies.te_hash) ); + TRY( h5priv_hdestroy (&t->adjacencies.te_hash) ); bzero (&t->adjacencies, sizeof (t->adjacencies)); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } diff --git a/src/h5core/h5t_errorhandling_private.h b/src/h5core/h5t_errorhandling_private.h index 29882ca..0e0cc26 100644 --- a/src/h5core/h5t_errorhandling_private.h +++ b/src/h5core/h5t_errorhandling_private.h @@ -21,7 +21,7 @@ h5tpriv_error_local_elem_nexist ( "%lld,", (long long)vertex_indices[i]); if ((sizeof (s) - num_chars_printed) < 32) { // buffer to small - return h5_error_internal (__FILE__, __func__, __LINE__); + return h5_error_internal (); } } @@ -30,7 +30,6 @@ h5tpriv_error_local_elem_nexist ( static inline h5_err_t h5tpriv_inval_codim ( - h5_file_t * const f, int codim, int min_codim, int max_codim diff --git a/src/h5core/h5t_hsearch.c b/src/h5core/h5t_hsearch.c index 2dfde93..ab800dd 100644 --- a/src/h5core/h5t_hsearch.c +++ b/src/h5core/h5t_hsearch.c @@ -7,9 +7,9 @@ h5_err_t h5tpriv_search_tv2 ( h5_file_t* const f, - h5_loc_idx_t face_idx, - h5_loc_idx_t elem_idx, - h5_loc_idlist_t** idlist + h5_loc_idx_t face_idx, // in + h5_loc_idx_t elem_idx, // in + h5_loc_idlist_t** idlist // out ) { H5_PRIV_API_ENTER (h5_err_t); h5t_fdata_t* t = f->t; @@ -21,9 +21,12 @@ h5tpriv_search_tv2 ( &vertex_idx)); TRY (h5priv_search_idlist ( - f, &t->adjacencies.tv.v[vertex_idx], h5tpriv_build_vertex_id (face_idx, elem_idx))); + if (idlist) { + *idlist = t->adjacencies.tv.v[vertex_idx]; + } + H5_PRIV_API_RETURN (H5_SUCCESS); } @@ -57,13 +60,12 @@ compute_te_hashval ( static h5_err_t release_te_entry ( - h5_file_t * const f, const void* __entry ) { H5_PRIV_FUNC_ENTER (h5_err_t); struct h5_te_entry* entry = *(struct h5_te_entry**)__entry; h5_loc_idlist_t* list = entry->value; - TRY (h5priv_free_idlist (f, &list)); + TRY (h5priv_free_idlist (&list)); TRY (h5_free (entry)); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -77,14 +79,13 @@ h5tpriv_resize_te_htab ( h5t_adjacencies_t* a = &f->t->adjacencies; if ( a->te_hash.size == 0 ) { TRY (h5priv_hcreate ( - f, nel, &a->te_hash, cmp_te_entries, compute_te_hashval, release_te_entry)); } else if (a->te_hash.size < nel) { - TRY (h5priv_hresize (f, nel, &a->te_hash)); + TRY (h5priv_hresize (nel, &a->te_hash)); } H5_PRIV_API_RETURN (H5_SUCCESS); } @@ -121,19 +122,16 @@ h5tpriv_search_te2 ( */ h5_loc_idx_t num_elems = t->num_elems[t->num_leaf_levels-1]; TRY (h5priv_hresize ( - f, 3*(num_elems - elem_idx), &a->te_hash)); } TRY (h5priv_hsearch ( - f, entry, H5_ENTER, &__retval, &a->te_hash)); h5t_te_entry_t* te_entry = (h5t_te_entry_t *)__retval; TRY (h5priv_search_idlist ( - f, &te_entry->value, h5tpriv_build_edge_id (face_idx, elem_idx))); if (te_entry->value->num_items > 1) { @@ -160,7 +158,6 @@ find_te ( H5_PRIV_FUNC_ENTER (h5_err_t); void* __entry; TRY (h5priv_hsearch ( - f, item, H5_FIND, &__entry, @@ -244,13 +241,12 @@ compute_td_hashval ( static h5_err_t release_td_entry ( - h5_file_t * const f, const void* __entry ) { H5_PRIV_FUNC_ENTER (h5_err_t); struct h5_td_entry* entry = *(struct h5_td_entry**)__entry; h5_loc_idlist_t* list = entry->value; - TRY (h5priv_free_idlist (f, &list)); + TRY (h5priv_free_idlist (&list)); TRY (h5_free (entry)); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -265,14 +261,13 @@ h5tpriv_resize_td_htab ( h5t_adjacencies_t* a = &f->t->adjacencies; if (a->td_hash.size == 0) { TRY (h5priv_hcreate ( - f, nel, &a->td_hash, cmp_td_entries, compute_td_hashval, release_td_entry)); } else if (a->td_hash.size < nel) { - TRY (h5priv_hresize (f, nel, &a->td_hash)); + TRY (h5priv_hresize (nel, &a->td_hash)); } H5_PRIV_API_RETURN (H5_SUCCESS); } @@ -299,14 +294,10 @@ h5tpriv_search_td2 ( */ if ((a->td_hash.size*6) <= (a->td_hash.filled<<3)) { h5_loc_idx_t num_elems = t->num_elems[t->num_leaf_levels-1]; - TRY (h5priv_hresize ( - f, - 3*(num_elems-elem_idx), - &a->td_hash)); + TRY (h5priv_hresize (3*(num_elems-elem_idx), &a->td_hash)); } - /* search in directory, add if entry doen't already exists */ + /* search in directory, add if entry doesn't already exists */ TRY (h5priv_hsearch ( - f, entry, H5_ENTER, &__retval, @@ -315,7 +306,6 @@ h5tpriv_search_td2 ( /* search ID in list of IDs for given triangle */ h5t_td_entry_t *td_entry = (h5t_td_entry_t *)__retval; TRY (h5priv_search_idlist ( - f, &td_entry->value, h5tpriv_build_triangle_id (face_idx, elem_idx))); if (td_entry->value->num_items > 1) { @@ -335,7 +325,6 @@ find_td ( ) { void* __entry; h5priv_hsearch ( - f, item, H5_FIND, &__entry, diff --git a/src/h5core/h5t_map.c b/src/h5core/h5t_map.c index 5fb6812..c87a26e 100644 --- a/src/h5core/h5t_map.c +++ b/src/h5core/h5t_map.c @@ -200,7 +200,7 @@ h5t_get_vertex_indices_of_entity ( case H5T_TYPE_TRIANGLE: dim = 2; break; case H5T_TYPE_TET: dim = 3; break; default: - H5_CORE_API_LEAVE (h5_error_internal (__FILE__, __func__, __LINE__)); + H5_CORE_API_LEAVE (h5_error_internal ()); } H5_CORE_API_RETURN (h5t_get_vertex_indices_of_entity2 (f, dim, face_idx, elem_idx, vertex_indices)); } diff --git a/src/h5core/h5t_openclose.c b/src/h5core/h5t_openclose.c index 23b2444..0e4311b 100644 --- a/src/h5core/h5t_openclose.c +++ b/src/h5core/h5t_openclose.c @@ -458,7 +458,7 @@ h5t_open_mesh ( break; default: H5_CORE_API_LEAVE ( - h5_error_internal (__FILE__, __func__, __LINE__)); + h5_error_internal ()); } TRY (h5tpriv_open_mesh_group (f, type_id, id)); @@ -553,7 +553,7 @@ h5t_set_level ( t->leaf_level = level_id; if (level_id >= t->num_loaded_levels) { - TRY (h5tpriv_update_adjacency_structs (f, prev_level+1)); + TRY (h5tpriv_update_adjacency_structs (f, ++prev_level)); } H5_CORE_API_RETURN (H5_SUCCESS); } @@ -570,7 +570,7 @@ h5tpriv_alloc_num_vertices ( h5t_fdata_t* t = f->t; ssize_t size = num * sizeof (t->vertices[0]); TRY (t->vertices = h5_alloc (t->vertices, size)); - TRY (h5priv_alloc_idxmap (f, &t->map_vertex_g2l, num)); + TRY (h5priv_alloc_idxmap (&t->map_vertex_g2l, num)); H5_CORE_API_RETURN (H5_SUCCESS); } diff --git a/src/h5core/h5t_readwrite.c b/src/h5core/h5t_readwrite.c index 9cf6238..42666fb 100644 --- a/src/h5core/h5t_readwrite.c +++ b/src/h5core/h5t_readwrite.c @@ -159,7 +159,7 @@ read_num_vertices ( if (t->mesh_gid < 0) { H5_PRIV_FUNC_LEAVE ( - h5_error_internal (__FILE__, __func__, __LINE__)); + h5_error_internal ()); } ssize_t num_bytes = t->num_leaf_levels*sizeof (t->num_vertices[0]); TRY( t->num_vertices = h5_alloc (t->num_vertices, num_bytes) ); @@ -275,7 +275,7 @@ h5tpriv_read_mesh ( H5_PRIV_API_ENTER (h5_err_t); h5t_fdata_t* t = f->t; if (t->mesh_gid < 0) { - H5_PRIV_API_LEAVE (h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_API_LEAVE (h5_error_internal ()); } TRY (read_num_leaf_levels (f)); TRY (read_num_vertices (f)); diff --git a/src/h5core/h5t_retrieve.c b/src/h5core/h5t_retrieve.c index a432daa..9aad8a1 100644 --- a/src/h5core/h5t_retrieve.c +++ b/src/h5core/h5t_retrieve.c @@ -167,7 +167,7 @@ iterate_boundary_faces ( f, dim, it->elem_idx, it->face_idx)); // Skip already visited faces } while (0); - H5_PRIV_FUNC_RETURN (h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_FUNC_RETURN (h5_error_internal ()); } static h5_loc_id_t @@ -177,6 +177,7 @@ iterate_tags ( ) { H5_PRIV_FUNC_ENTER (h5_loc_id_t); UNUSED_ARGUMENT (f); + UNUSED_ARGUMENT (iter); #if 0 h5t_tagsel_t* tags; do { @@ -189,7 +190,7 @@ iterate_tags ( tags = iter->tagset->elems[iter->elem_idx]; } while ((tags == NULL) || (tags->idx[iter->subentity_idx])); #endif - H5_PRIV_FUNC_RETURN (h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_FUNC_RETURN (h5_error_internal ()); } h5_err_t @@ -230,7 +231,7 @@ h5t_init_boundary_face_iterator ( it->ref_elem = f->t->ref_elem; if (it->codim <= 0 || it->codim > it->ref_elem->dim) { - H5_CORE_API_LEAVE (h5tpriv_inval_codim (f, codim, 1, it->ref_elem->dim)); + H5_CORE_API_LEAVE (h5tpriv_inval_codim (codim, 1, it->ref_elem->dim)); } else if (it->codim == 1) { it->iter = iterate_boundary_facets; } @@ -261,6 +262,7 @@ h5t_release_entity_iterator ( h5_file_t* const f, h5t_iterator_t* iter ) { + UNUSED_ARGUMENT (f); H5_CORE_API_ENTER (h5_err_t); H5_CORE_API_RETURN (h5_free (iter)); } diff --git a/src/h5core/h5t_retrieve_private.h b/src/h5core/h5t_retrieve_private.h index 6267174..71ba14a 100644 --- a/src/h5core/h5t_retrieve_private.h +++ b/src/h5core/h5t_retrieve_private.h @@ -5,7 +5,7 @@ struct h5t_retrieve_methods { h5_err_t (*init_entity_iterator)( - h5_file_t* const, h5t_iterator_t*, const int); + h5t_iterator_t*, const int); }; extern struct h5t_retrieve_methods h5tpriv_trim_retrieve_methods; @@ -26,7 +26,7 @@ h5tpriv_init_entity_iterator ( h5t_iterator_t* const iter, const int codim ) { - return (*f->t->methods.retrieve->init_entity_iterator) (f, iter, codim); + return (*f->t->methods.retrieve->init_entity_iterator) (iter, codim); } #endif diff --git a/src/h5core/h5t_retrieve_tetm.c b/src/h5core/h5t_retrieve_tetm.c index e9dfb87..791d4f5 100644 --- a/src/h5core/h5t_retrieve_tetm.c +++ b/src/h5core/h5t_retrieve_tetm.c @@ -5,7 +5,6 @@ static h5_err_t begin_iterate_entities ( - h5_file_t* f, h5t_iterator_t* const iter, const int codim ) { @@ -24,7 +23,7 @@ begin_iterate_entities ( it->find = NULL; break; default: - return h5_error_internal (__FILE__, __func__, __LINE__); + return h5_error_internal (); } return H5_SUCCESS; } diff --git a/src/h5core/h5t_retrieve_trim.c b/src/h5core/h5t_retrieve_trim.c index 9a6503e..d9826d6 100644 --- a/src/h5core/h5t_retrieve_trim.c +++ b/src/h5core/h5t_retrieve_trim.c @@ -5,7 +5,6 @@ static h5_err_t begin_iterate_entities ( - h5_file_t* f, h5t_iterator_t* iter, const int codim ) { @@ -21,7 +20,7 @@ begin_iterate_entities ( it->find = NULL; break; default: - return h5_error_internal (__FILE__, __func__, __LINE__); + return h5_error_internal (); } return H5_SUCCESS; } diff --git a/src/h5core/h5t_store.c b/src/h5core/h5t_store.c index c8f8140..40d486d 100644 --- a/src/h5core/h5t_store.c +++ b/src/h5core/h5t_store.c @@ -302,7 +302,7 @@ h5t_mark_entity ( ) { H5_CORE_API_ENTER (h5_err_t); h5t_fdata_t* const t = f->t; - H5_CORE_API_RETURN (h5priv_insert_idlist (f, &t->marked_entities, entity_id, -1)); + H5_CORE_API_RETURN (h5priv_insert_idlist (&t->marked_entities, entity_id, -1)); } /* @@ -346,7 +346,7 @@ h5t_pre_refine ( num_elems_to_add = num_elems_to_refine*4; break; default: - H5_CORE_API_LEAVE (h5_error_internal (__FILE__, __func__, __LINE__)); + H5_CORE_API_LEAVE (h5_error_internal ()); } TRY (h5t_begin_store_vertices (f, num_vertices_to_add)); TRY (h5t_begin_store_elems (f, num_elems_to_add)); @@ -378,7 +378,7 @@ h5t_post_refine ( h5t_fdata_t* const t = f->t; TRY (h5t_end_store_vertices (f)); TRY (h5t_end_store_elems (f)); - H5_CORE_API_RETURN (h5priv_free_idlist (f, &t->marked_entities)); + H5_CORE_API_RETURN (h5priv_free_idlist (&t->marked_entities)); } @@ -393,7 +393,7 @@ h5t_begin_refine_elems ( Pre-allocate space for items to avoid allocating small pieces of memory. */ - TRY (h5priv_alloc_idlist (f, &t->marked_entities, 2048)); + TRY (h5priv_alloc_idlist (&t->marked_entities, 2048)); H5_CORE_API_RETURN (H5_SUCCESS); } diff --git a/src/h5core/h5t_store_tetm.c b/src/h5core/h5t_store_tetm.c index 583dfb7..2d47329 100644 --- a/src/h5core/h5t_store_tetm.c +++ b/src/h5core/h5t_store_tetm.c @@ -22,7 +22,7 @@ alloc_tets ( (new-cur) * sizeof (t->loc_elems.tets[0]) ); /* alloc mem for global to local ID mapping */ - TRY ( h5priv_alloc_idxmap ( f, &t->map_elem_g2l, new ) ); + TRY (h5priv_alloc_idxmap (&t->map_elem_g2l, new)); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -54,8 +54,7 @@ get_direct_children_of_edge ( }; h5_loc_idx_t num_faces = h5tpriv_ref_elem_get_num_edges (f->t); if ((face_idx < 0) || (face_idx >= num_faces)) { - H5_PRIV_FUNC_LEAVE ( - h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_FUNC_LEAVE (h5_error_internal ()); } children[0] = h5tpriv_build_edge_id (face_idx, elem_idx+offs[face_idx][0]); children[1] = h5tpriv_build_edge_id (face_idx, elem_idx+offs[face_idx][1]); @@ -239,9 +238,7 @@ compute_neighbor_of_face ( elem_idx, &td) ); if (td == NULL) { - H5_PRIV_FUNC_LEAVE ( - h5_error_internal ( - __FILE__, __func__, __LINE__)); + H5_PRIV_FUNC_LEAVE (h5_error_internal ()); } if (td->num_items == 1) { // neighbor is coarser or face is on the boundary @@ -259,9 +256,7 @@ compute_neighbor_of_face ( } } else { - H5_PRIV_FUNC_LEAVE ( - h5_error_internal ( - __FILE__, __func__, __LINE__)); + H5_PRIV_FUNC_LEAVE (h5_error_internal ()); } } while (neighbor_idx < -1); H5_PRIV_FUNC_RETURN (neighbor_idx); diff --git a/src/h5core/h5t_store_trim.c b/src/h5core/h5t_store_trim.c index f88025a..d5ca62e 100644 --- a/src/h5core/h5t_store_trim.c +++ b/src/h5core/h5t_store_trim.c @@ -22,7 +22,7 @@ alloc_triangles ( (new-cur) * sizeof (t->loc_elems.tris[0]) ); /* alloc mem for global to local ID mapping */ - TRY ( h5priv_alloc_idxmap ( f, &t->map_elem_g2l, new ) ); + TRY (h5priv_alloc_idxmap (&t->map_elem_g2l, new)); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -52,8 +52,7 @@ get_direct_children_of_edge ( }; h5_loc_idx_t num_faces = h5tpriv_ref_elem_get_num_edges (f->t); if ((face_idx < 0) || (face_idx >= num_faces)) { - H5_PRIV_FUNC_LEAVE ( - h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_FUNC_LEAVE (h5_error_internal ()); } children[0] = h5tpriv_build_edge_id (face_idx, elem_idx+off[face_idx][0]); children[1] = h5tpriv_build_edge_id (face_idx, elem_idx+off[face_idx][1]); @@ -198,8 +197,7 @@ compute_neighbor_of_face ( elem_idx, &te) ); if (te == NULL) { - H5_PRIV_FUNC_LEAVE ( - h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_FUNC_LEAVE (h5_error_internal ()); } if (te->num_items == 1) { // neighbor is coarser or face is on the boundary @@ -217,8 +215,7 @@ compute_neighbor_of_face ( } } else { - H5_PRIV_FUNC_LEAVE ( - h5_error_internal (__FILE__, __func__, __LINE__)); + H5_PRIV_FUNC_LEAVE (h5_error_internal ()); } } while (neighbor_idx < -1); H5_PRIV_FUNC_RETURN (neighbor_idx); diff --git a/src/h5core/h5t_tags.c b/src/h5core/h5t_tags.c index 73d61f3..a14c128 100644 --- a/src/h5core/h5t_tags.c +++ b/src/h5core/h5t_tags.c @@ -14,7 +14,6 @@ */ static inline h5_err_t release_tagset ( - h5_file_t* const f, h5t_tagset_t* tagset ) { H5_PRIV_FUNC_ENTER (h5_err_t); @@ -37,12 +36,11 @@ release_tagset ( */ static h5_err_t release_tagset2 ( - h5_file_t* const f, const void* __tagset ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5t_tagset_t* tagset = *(h5t_tagset_t**)__tagset; - H5_PRIV_FUNC_RETURN (release_tagset (f, tagset)); + H5_PRIV_FUNC_RETURN (release_tagset (tagset)); } @@ -51,13 +49,12 @@ release_tagset2 ( */ static inline h5_err_t init_container ( - h5_file_t* const f, const size_t ntags, h5t_tagcontainer_t* ctn ) { H5_PRIV_FUNC_ENTER (h5_err_t); TRY (ctn->names = h5_calloc (ntags, sizeof(char*))); - TRY (h5priv_hcreate_string_keyed (f, ntags, &ctn->sets, + TRY (h5priv_hcreate_string_keyed (ntags, &ctn->sets, release_tagset2)); H5_PRIV_FUNC_RETURN (H5_SUCCESS); } @@ -67,13 +64,12 @@ init_container ( */ static inline h5_err_t release_container ( - h5_file_t* const f, h5t_tagcontainer_t* ctn ) { H5_PRIV_FUNC_ENTER (h5_err_t); if (ctn->num_sets == 0) H5_PRIV_FUNC_LEAVE (H5_SUCCESS); - TRY (h5priv_hdestroy (f, &ctn->sets)); + TRY (h5priv_hdestroy (&ctn->sets)); TRY (h5_free (ctn->names)); memset (ctn, 0, sizeof (*ctn)); H5_PRIV_FUNC_RETURN (H5_SUCCESS); @@ -88,21 +84,19 @@ h5tpriv_release_tags ( ) { H5_PRIV_API_ENTER (h5_err_t); h5t_fdata_t* t = f->t; - TRY (release_container (f, &t->mtags)); + TRY (release_container (&t->mtags)); H5_PRIV_API_RETURN (H5_SUCCESS); } static inline h5_err_t tagset_exists ( - h5_file_t* const f, h5t_tagcontainer_t* ctn, char* name ) { H5_PRIV_FUNC_ENTER (h5_err_t); h5t_tagset_t tagset; tagset.name = name; - H5_PRIV_FUNC_RETURN ( - h5priv_hsearch (f, &tagset, H5_FIND, NULL, &ctn->sets)); + H5_PRIV_FUNC_RETURN (h5priv_hsearch (&tagset,H5_FIND,NULL,&ctn->sets)); } h5_err_t @@ -112,7 +106,7 @@ h5t_mtagset_exists ( char* name ) { H5_CORE_API_ENTER (h5_err_t); - H5_CORE_API_RETURN (tagset_exists (f, &f->t->mtags, name)); + H5_CORE_API_RETURN (tagset_exists (&f->t->mtags, name)); } /*! @@ -138,7 +132,7 @@ add_tagset ( // Initialize data structure for m-tagsets, if not already done. if (ctn->names == NULL) { - TRY (init_container (f, 521, ctn)); + TRY (init_container (521, ctn)); } // TODO: Resize if we have more then 80% of 521 filled! @@ -156,7 +150,7 @@ add_tagset ( // check if a tagset with given name already exists h5_err_t h5err; - TRY (h5err = tagset_exists (f, ctn, name) ); + TRY (h5err = tagset_exists (ctn, name) ); if (h5err == H5_SUCCESS) { H5_PRIV_FUNC_LEAVE ( h5_error (H5_ERR_INVAL, @@ -177,7 +171,7 @@ add_tagset ( tagset->scope.max_level = -1; // add tagset to hash of tagsets - TRY (h5priv_hsearch (f, tagset, H5_ENTER, NULL, &ctn->sets)); + TRY (h5priv_hsearch (tagset, H5_ENTER, NULL, &ctn->sets)); t->mtags.changed = 1; t->mtags.names[t->mtags.num_sets] = tagset->name; @@ -216,12 +210,12 @@ remove_tagset ( H5_PRIV_FUNC_ENTER (h5_err_t); // remove tagset with NAME from m-tagsets dictionary void* __retval = NULL; - TRY (h5priv_hsearch (f, &name, H5_REMOVE, &__retval, &ctn->sets)); + TRY (h5priv_hsearch (&name, H5_REMOVE, &__retval, &ctn->sets)); h5t_tagset_t* tagset = (h5t_tagset_t*)__retval; if (tagset == NULL) { H5_PRIV_FUNC_LEAVE (H5_SUCCESS); } - TRY (release_tagset (f, tagset)); + TRY (release_tagset (tagset)); // remove HDF5 datasets and group for this tagset hid_t loc_id; @@ -293,7 +287,7 @@ h5t_open_mtagset ( H5_CORE_API_ENTER (h5_err_t); h5t_fdata_t* t = f->t; void* __retval = NULL; - TRY (h5priv_hsearch (f, &name, H5_FIND, &__retval, &t->mtags.sets)); + TRY (h5priv_hsearch (&name, H5_FIND, &__retval, &t->mtags.sets)); *retval = (h5t_tagset_t*)__retval; H5_CORE_API_RETURN (H5_SUCCESS); } @@ -336,7 +330,7 @@ h5t_get_mtagset_info ( h5t_fdata_t* t = f->t; *name = t->mtags.names[idx]; void* __retval = NULL; - TRY (h5priv_hsearch (f, t->mtags.names[idx], H5_FIND, &__retval, + TRY (h5priv_hsearch (t->mtags.names[idx], H5_FIND, &__retval, &t->mtags.sets)); h5t_tagset_t* retval = (h5t_tagset_t*)__retval; *type = retval->type; @@ -367,7 +361,6 @@ find_face_id ( static inline h5_err_t tag_nexists_warn ( - h5_file_t* const f, const char* name, const h5_loc_idx_t face_id, const h5_loc_idx_t elem_idx @@ -381,7 +374,6 @@ tag_nexists_warn ( static h5_err_t remove_tag ( - h5_file_t* const f, h5t_tagset_t* tagset, const h5_loc_idx_t face_id, const h5_loc_idx_t elem_idx @@ -389,7 +381,7 @@ remove_tag ( H5_PRIV_FUNC_ENTER (h5_err_t); if (tagset->elems[elem_idx] == NULL) { H5_PRIV_FUNC_LEAVE ( - tag_nexists_warn (f, tagset->name, face_id, elem_idx)); + tag_nexists_warn (tagset->name, face_id, elem_idx)); } h5t_tageleminfo_t* eleminfo = tagset->elems[elem_idx]; @@ -397,7 +389,7 @@ remove_tag ( int idx = find_face_id (eleminfo, face_id); if (idx < 0) { H5_PRIV_FUNC_LEAVE ( - tag_nexists_warn (f, tagset->name, face_id, elem_idx)); + tag_nexists_warn (tagset->name, face_id, elem_idx)); } h5t_taginfo_t* ti = &eleminfo->ti[idx]; @@ -417,7 +409,6 @@ remove_tag ( static h5_err_t add_tag ( - h5_file_t* const f, h5t_tagset_t *tagset, const int idx, const h5_loc_idx_t face_id, @@ -437,7 +428,7 @@ add_tag ( ti, (eleminfo->num_tags - idx) * sizeof(*ti)); eleminfo->num_tags++; - ti->face_id = face_id; + ti->face_id = (short)face_id; ti->val_dim = dim; // append values @@ -495,12 +486,12 @@ set_tag ( This is a very unusual case! So the processing can be a bit more expensive ... */ - TRY (remove_tag (f, tagset, face_id, elem_idx)); - TRY (add_tag (f, tagset, i, face_id, elem_idx, dim, val)); + TRY (remove_tag (tagset, face_id, elem_idx)); + TRY (add_tag (tagset, i, face_id, elem_idx, dim, val)); } else if (i >= 0 && dim == ti->val_dim) { TRY (overwrite_tag (f, tagset, i, elem_idx, val)); } else { // i < 0 - TRY (add_tag (f, tagset, -i-1, face_id, elem_idx, dim, val)); + TRY (add_tag (tagset, -i-1, face_id, elem_idx, dim, val)); tagset->num_entities++; } if (f->t->leaf_level < tagset->scope.min_level) { @@ -513,6 +504,88 @@ set_tag ( H5_PRIV_FUNC_RETURN (H5_SUCCESS); } +/* + Inheritance: + - to coarser level only + - if entity has tagged parrent, tag of parent + - else: not tagged + + Parent of entity in tetrahedral grid: + - tetrahedron: parent ID + - triangles: + face child parent face + 0 0 0 + 1 0 1 + 2 0 2 + 3 0 -1 + 0 1 0 + 1 1 1 + 2 1 -1 + 3 1 3 + 0 2 0 + 1 2 -1 + 2 2 2 + 3 2 3 + 0 3 -1 + 1 3 1 + 2 3 2 + 3 3 3 + 0 4 -1 + 1 4 1 + 2 4 -1 + 3 4 -1 + 0 5 0 + 1 5 -1 + 2 5 -1 + 3 5 -1 + 0 6 -1 + 1 6 -1 + 2 6 -1 + 3 6 3 + 0 7 -1 + 1 7 -1 + 2 7 2 + 3 7 -1 +*/ +int map_tri_to_parent_face[8][4] = { + {0,1,2,-1}, + {0,1,-1,3}, + {0,-1,2,3}, + {-1,1,2,3}, + {-1,1,-1,-1}, + {0,-1,-1,-1}, + {-1,-1,-1,3}, + {-1,-1,2,-1}}; +/* + - edges: + 0 0-3 0 + 1 0-3 1 + 2 0-3 2 + 3 0-3 3 + 4 0-3 4 + 5 0-3 5 + 0-5 4-7 -1 +*/ +int map_edge_to_parent_face[8][6] = { + +}; +/* + - vertex: + 0 0 0 + 1-3 0 -1 + 0 1 -1 + 1 1 1 + 2,3 1 -1 + 0,1 2 -1 + 2 2 2 + 3 2 -1 + 0-2 3 -1 + 3 3 3 + 0-3 4 -1 + 0-3 5 -1 + 0-3 6 -1 +*/ + static inline h5_err_t get_idx_of_tagval ( const h5t_tagset_t* tagset, @@ -522,6 +595,9 @@ get_idx_of_tagval ( h5_loc_idx_t* val_idx ) { h5t_tageleminfo_t* eleminfo = tagset->elems[elem_idx]; + if (eleminfo == NULL) { + return H5_NOK; + } *taginfo_idx = find_face_id (eleminfo, face_id); if (*taginfo_idx < 0) { return H5_NOK; // not tagged @@ -539,13 +615,8 @@ get_tag ( size_t* const dim, void* const values ) { - if (f->t->leaf_level < tagset->scope.min_level || - f->t->leaf_level > tagset->scope.max_level) { - return H5_NOK; - } - if (tagset->elems[elem_idx] == NULL) { - tag_nexists_warn (f, tagset->name, face_id, elem_idx); - return H5_NOK; + if (f->t->leaf_level < tagset->scope.min_level) { + return H5_NOK; // entity not tagged } h5_loc_idx_t val_idx = 0; int ti_idx = 0; @@ -656,10 +727,11 @@ h5t_remove_mtag ( h5t_tagset_t* tagset, const h5_loc_id_t entity_id ) { + UNUSED_ARGUMENT (f); H5_CORE_API_ENTER (h5_err_t); h5_loc_idx_t face_id = h5tpriv_get_face_id (entity_id); h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id); - H5_CORE_API_RETURN (remove_tag (f, tagset, face_id, elem_idx)); + H5_CORE_API_RETURN (remove_tag (tagset, face_id, elem_idx)); } /*! @@ -680,7 +752,7 @@ h5t_remove_mtag_by_name ( TRY (h5t_open_mtagset (f, name, &tagset)); h5_loc_idx_t face_id = h5tpriv_get_face_id (entity_id); h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id); - H5_CORE_API_RETURN (remove_tag (f, tagset, face_id, elem_idx)); + H5_CORE_API_RETURN (remove_tag (tagset, face_id, elem_idx)); } static hid_t @@ -811,9 +883,9 @@ write_tagset ( open_space_all, open_space_all, values)); h5_int64_t scope = tagset->scope.min_level; - TRY (h5priv_write_attrib (f, group_id, "__scope_min__", H5_INT64_T, &scope, 1)); + TRY (h5priv_write_attrib (group_id, "__scope_min__", H5_INT64_T, &scope, 1)); scope = tagset->scope.max_level; - TRY (h5priv_write_attrib (f, group_id, "__scope_max__", H5_INT64_T, &scope, 1)); + TRY (h5priv_write_attrib (group_id, "__scope_max__", H5_INT64_T, &scope, 1)); TRY (hdf5_close_group (group_id)); TRY (h5_free (elems)); @@ -834,11 +906,11 @@ write_container ( size_t idx; for (idx = 0; idx < ctn->num_sets; idx++) { void *__retval; - TRY (h5priv_hsearch ( f, - &ctn->names[idx], - H5_FIND, - &__retval, - &ctn->sets)); + TRY (h5priv_hsearch ( + &ctn->names[idx], + H5_FIND, + &__retval, + &ctn->sets)); h5t_tagset_t *tagset = (h5t_tagset_t*)__retval; if (tagset->changed) { TRY(write_tagset ( @@ -932,7 +1004,7 @@ read_tagset ( open_space_all, open_space_all, vals)); TRY (hdf5_close_dataset (dset_id )); - type = h5_normalize_h5_type (f, dsinfo.type_id); + type = h5_normalize_h5_type (dsinfo.type_id); /* add tagset and set values */ @@ -940,9 +1012,9 @@ read_tagset ( TRY (add_tagset (f, ctn, name, type, &tagset) ); h5_int64_t scope; - TRY (h5priv_read_attrib (f, group_id, "__scope_min__", H5_INT64_T, &scope)); + TRY (h5priv_read_attrib (group_id, "__scope_min__", H5_INT64_T, &scope)); tagset->scope.min_level = scope; - TRY (h5priv_read_attrib (f, group_id, "__scope_max__", H5_INT64_T, &scope)); + TRY (h5priv_read_attrib (group_id, "__scope_max__", H5_INT64_T, &scope)); tagset->scope.max_level = scope; for (ent_idx = 0; ent_idx < num_entities; ent_idx++) { @@ -1002,7 +1074,6 @@ h5tpriv_read_tag_container ( */ static h5_ssize_t get_tagset_names_of_entity ( - h5_file_t* const f, h5t_tagcontainer_t* ctn, h5_loc_id_t entity_id, char* names[], @@ -1016,20 +1087,20 @@ get_tagset_names_of_entity ( for (idx = 0; idx < ctn->num_sets; idx++) { void* __retval; - TRY (h5priv_hsearch (f, - &ctn->names[idx], - H5_FIND, - &__retval, - &ctn->sets)); + TRY (h5priv_hsearch ( + &ctn->names[idx], + H5_FIND, + &__retval, + &ctn->sets)); h5t_tagset_t* tagset = (h5t_tagset_t*)__retval; int tagset_idx = 0; h5_loc_idx_t val_idx; - if (0 > get_idx_of_tagval (tagset, + if (0 < get_idx_of_tagval (tagset, face_id, elem_idx, &tagset_idx, &val_idx) ) { continue; // not tagged } - if (names != NULL && dim <= dim) { + if (names != NULL && _dim <= dim) { names[_dim] = ctn->names[idx]; } _dim++; @@ -1049,5 +1120,5 @@ h5t_get_mtagset_names_of_entity ( ) { H5_CORE_API_ENTER (h5_ssize_t); H5_CORE_API_RETURN ( - get_tagset_names_of_entity (f, &f->t->mtags, entity_id, names, dim)); + get_tagset_names_of_entity (&f->t->mtags, entity_id, names, dim)); } diff --git a/src/h5core/h5u_model.c b/src/h5core/h5u_model.c index 0fa1f2b..cfd92d4 100644 --- a/src/h5core/h5u_model.c +++ b/src/h5core/h5u_model.c @@ -137,9 +137,9 @@ h5u_set_num_particles ( acquire the number of particles to be written from each MPI process */ - TRY( h5priv_mpi_sum(f, + TRY( h5priv_mpi_sum( &(u->nparticles), &total, 1, MPI_LONG_LONG, f->comm ) ); - TRY( h5priv_mpi_prefix_sum(f, + TRY( h5priv_mpi_prefix_sum( &(u->nparticles), &start, 1, MPI_LONG_LONG, f->comm ) ); start -= u->nparticles; diff --git a/src/h5core/h5u_readwrite.c b/src/h5core/h5u_readwrite.c index ac2d607..af0f9b5 100644 --- a/src/h5core/h5u_readwrite.c +++ b/src/h5core/h5u_readwrite.c @@ -22,7 +22,7 @@ h5u_read_data ( } char name2[H5_DATANAME_LEN]; - TRY (h5_normalize_dataset_name (f, name, name2)); + TRY (h5_normalize_dataset_name (name, name2)); TRY (dataset_id = hdf5_open_dataset (f->step_gid, name2)); @@ -114,7 +114,7 @@ h5u_write_data ( hid_t dset_id; char name2[H5_DATANAME_LEN]; - TRY (h5_normalize_dataset_name (f, name, name2)); + TRY (h5_normalize_dataset_name (name, name2)); if ( u->shape == H5S_ALL ) h5_warn("The view is unset or invalid."); diff --git a/src/include/h5core/h5_core.h b/src/include/h5core/h5_core.h index 24d9c6d..21623fb 100644 --- a/src/include/h5core/h5_core.h +++ b/src/include/h5core/h5_core.h @@ -125,6 +125,13 @@ done: \ goto done; \ } +#define TRY3( expr, ret_val ) \ + if ((int64_t)(ptrdiff_t)(expr) <= (int64_t)H5_ERR) { \ + ret_value = ret_val; \ + goto done; \ + } +#define ON_ERROR + #include "h5_types.h" #include "h5_errno.h" diff --git a/src/include/h5core/h5_errorhandling.h b/src/include/h5core/h5_errorhandling.h index 48af9ca..5fd62e0 100644 --- a/src/include/h5core/h5_errorhandling.h +++ b/src/include/h5core/h5_errorhandling.h @@ -64,17 +64,17 @@ h5_initialize ( H5_ERR_INVAL, \ "Time step is invalid! Have you set the time step?"); -#define h5_error_not_implemented( file, func, lino ) \ +#define h5_error_not_implemented() \ h5_error( \ H5_ERR_NOT_IMPLEMENTED, \ "%s: Function \"%s\", line %d not yet implemented!", \ - file, func, lino ); + __FILE__, __func__, __LINE__); -#define h5_error_internal( file, func, lino ) \ +#define h5_error_internal() \ h5_error( \ H5_ERR_INTERNAL, \ "%s: Internal error: %s line %d!", \ - file, func, lino ) + __FILE__, __func__, __LINE__) h5_err_t diff --git a/src/include/h5core/h5_readwrite.h b/src/include/h5core/h5_readwrite.h index ba6ef6d..e6f12eb 100644 --- a/src/include/h5core/h5_readwrite.h +++ b/src/include/h5core/h5_readwrite.h @@ -9,7 +9,6 @@ h5_set_step ( h5_int64_t h5_normalize_h5_type ( - h5_file_t * const f, hid_t type ); @@ -28,7 +27,6 @@ h5_has_index ( h5_err_t h5_normalize_dataset_name ( - h5_file_t *const f, const char *name, char *name2 );