From 8d212362648681ba6a821005d54f9cdce6adc391 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 14 Dec 2010 10:24:33 +0000 Subject: [PATCH] - boundary mesh iterators implemented - #pragma replaced with macro - several minor changes --- src/C/H5Fed.c | 2 +- src/C/H5Fed_retrieve.c | 26 +- src/h5core/h5_core_private.h | 2 + src/h5core/h5_hdf5.c | 2 +- src/h5core/h5_hsearch.c | 24 +- src/h5core/h5_maps.c | 6 +- src/h5core/h5_openclose.c | 12 +- src/h5core/h5_syscall.c | 16 +- src/h5core/h5_syscall_private.h | 5 + src/h5core/h5t_access_private.h | 67 ++ src/h5core/h5t_access_tetm.c | 28 +- src/h5core/h5t_access_trim.c | 28 +- src/h5core/h5t_adjacencies_private.h | 8 + src/h5core/h5t_adjacencies_tetm.c | 12 +- src/h5core/h5t_adjacencies_trim.c | 43 +- src/h5core/h5t_core_private.h | 44 +- src/h5core/h5t_errorhandling_private.h | 13 + src/h5core/h5t_inquiry.c | 4 +- src/h5core/h5t_map.c | 16 + src/h5core/h5t_openclose.c | 4 +- src/h5core/h5t_readwrite.c | 22 +- src/h5core/h5t_readwrite_private.h | 15 +- src/h5core/h5t_readwrite_tetm.c | 19 +- src/h5core/h5t_readwrite_trim.c | 12 +- src/h5core/h5t_ref_elements.c | 14 +- src/h5core/h5t_retrieve.c | 219 +++--- src/h5core/h5t_retrieve_private.h | 97 ++- src/h5core/h5t_retrieve_tetm.c | 11 +- src/h5core/h5t_retrieve_trim.c | 9 +- src/h5core/h5t_store.c | 23 +- src/h5core/h5t_store_private.h | 9 + src/h5core/h5t_tags.c | 994 +++++++++++++------------ src/h5core/h5t_tags_private.h | 55 +- src/h5core/h5t_types_private.h | 105 +-- src/h5core/h5u_model.c | 2 +- src/include/H5Fed_retrieve.h | 15 +- src/include/h5core/h5_types.h | 2 +- src/include/h5core/h5t_map.h | 7 + src/include/h5core/h5t_retrieve.h | 57 +- src/include/h5core/h5t_tags.h | 20 +- 40 files changed, 1208 insertions(+), 861 deletions(-) diff --git a/src/C/H5Fed.c b/src/C/H5Fed.c index 1709d3b..63f7e5d 100644 --- a/src/C/H5Fed.c +++ b/src/C/H5Fed.c @@ -47,6 +47,6 @@ H5FedLinkMeshToStep ( h5_file_t* const f, const h5_id_t mesh_id ) { -#pragma unused mesh_id + UNUSED_ARGUMENT (mesh_id); return h5_error_not_implemented (f, __FILE__, __func__, __LINE__); } diff --git a/src/C/H5Fed_retrieve.c b/src/C/H5Fed_retrieve.c index 00e2e69..08bf376 100644 --- a/src/C/H5Fed_retrieve.c +++ b/src/C/H5Fed_retrieve.c @@ -31,27 +31,27 @@ \return H5_SUCCESS or error code */ -h5t_entity_iterator_t* +h5t_iterator_t* H5FedBeginTraverseEntities ( h5_file_t* const f, const int codim ) { - h5t_entity_iterator_t* iter; + h5t_iterator_t* iter; H5_ENTER_API (f, __func__); - if (h5t_alloc_entity_iterator (f, &iter, codim) < 0) { + if (h5t_create_mesh_iterator (f, &iter, codim) < 0) { return (void*)H5_ERR; } return iter; } -h5t_entity_iterator_t* +h5t_iterator_t* H5FedBeginTraverseBoundaryFaces ( h5_file_t* const f, const int codim ) { - h5t_entity_iterator_t* iter; + h5t_iterator_t* iter; H5_ENTER_API (f, __func__); - if (h5t_alloc_boundary_face_iterator (f, &iter, codim) < 0) { + if (h5t_create_boundary_face_iterator (f, &iter, codim) < 0) { return (void*)H5_ERR; } return iter; @@ -70,7 +70,7 @@ H5FedBeginTraverseBoundaryFaces ( h5_id_t H5FedTraverseEntities ( h5_file_t* const f, - h5t_entity_iterator_t* iter + h5t_iterator_t* iter ) { H5_ENTER_API (f, __func__); return h5t_iterate_entities (f, iter); @@ -87,7 +87,7 @@ H5FedTraverseEntities ( h5_err_t H5FedEndTraverseEntities ( h5_file_t* const f, - h5t_entity_iterator_t* iter + h5t_iterator_t* iter ) { H5_ENTER_API (f, __func__); return h5t_release_entity_iterator (f, iter); @@ -143,6 +143,16 @@ H5FedGetVertexIndicesOfTriangle ( return h5t_get_vertex_indices_of_triangle (f, entity_id, vertex_indices); } +h5_err_t +H5FedGetVertexIndicesOfTriangleCClockwise ( + h5_file_t* const f, + h5_id_t entity_id, + h5_id_t* vertex_indices + ) { + H5_ENTER_API (f, __func__); + return h5t_get_vertex_indices_of_triangle_cclockwise (f, entity_id, vertex_indices); +} + h5_err_t H5FedGetVertexIndicesOfTet ( h5_file_t* const f, diff --git a/src/h5core/h5_core_private.h b/src/h5core/h5_core_private.h index 7f46180..eeb62e3 100644 --- a/src/h5core/h5_core_private.h +++ b/src/h5core/h5_core_private.h @@ -42,6 +42,8 @@ if ((int64_t)(ptrdiff_t)(func) <= (int64_t)H5_ERR) \ return H5_ERR; +#define UNUSED_ARGUMENT(x) (void)x + #ifdef IPL_XT3 # define SEEK_END 2 #endif diff --git a/src/h5core/h5_hdf5.c b/src/h5core/h5_hdf5.c index 5c043bd..d7904e7 100644 --- a/src/h5core/h5_hdf5.c +++ b/src/h5core/h5_hdf5.c @@ -620,7 +620,7 @@ get_class_type_name ( h5_file_t* const f, hid_t base_type_id ) { -#pragma unused f + UNUSED_ARGUMENT(f); if (base_type_id == H5_COMPOUND_T) return "H5_COMPOUND_T"; return "[unknown]"; diff --git a/src/h5core/h5_hsearch.c b/src/h5core/h5_hsearch.c index 25559cf..c0cf4f1 100644 --- a/src/h5core/h5_hsearch.c +++ b/src/h5core/h5_hsearch.c @@ -175,7 +175,7 @@ h5priv_hsearch ( unsigned int hval; unsigned int idx; - /* Compute an value for the given string. Perhaps use a better method. */ + /* Compute an value for the given key. Perhaps use a better method. */ hval = (*htab->compute_hash)(item); /* First hash function: simply take the modul but prevent zero. */ @@ -186,8 +186,10 @@ h5priv_hsearch ( value. */ if (htab->table[idx].used == hval && ((*htab->compare) (item, htab->table[idx].entry) == 0) ) { - *retval = htab->table[idx].entry; - return H5_SUCCESS; + if (retval && *retval) { + *retval = htab->table[idx].entry; + } + return H5_SUCCESS; } /* Second hash function, as suggested in [Knuth] */ @@ -211,7 +213,9 @@ h5priv_hsearch ( if (htab->table[idx].used == hval && ((*htab->compare) ( item, htab->table[idx].entry) == 0) ) { - *retval = htab->table[idx].entry; + if (retval && *retval) { + *retval = htab->table[idx].entry; + } return H5_SUCCESS; } } while (htab->table[idx].used); @@ -223,7 +227,9 @@ h5priv_hsearch ( with error. */ if (htab->filled == htab->size) { h5_error_internal (f, __FILE__, __func__, __LINE__); - *retval = NULL; + if (retval) { + *retval = NULL; + } return H5_ERR; } @@ -232,7 +238,9 @@ h5priv_hsearch ( ++htab->filled; - *retval = htab->table[idx].entry; + if (retval && *retval) { + *retval = htab->table[idx].entry; + } return H5_SUCCESS; } else if (action == H5_REMOVE) { htab->table[idx].used = 0; /* mark as unused, but */ @@ -240,8 +248,8 @@ h5priv_hsearch ( return H5_SUCCESS; } *retval = NULL; - h5_error (f, H5_ERR_INVAL, "Key not found in hash table."); - return H5_ERR; + h5_debug (f, "Key not found in hash table."); + return H5_NOK; } h5_err_t diff --git a/src/h5core/h5_maps.c b/src/h5core/h5_maps.c index 256b586..df4847a 100644 --- a/src/h5core/h5_maps.c +++ b/src/h5core/h5_maps.c @@ -23,7 +23,7 @@ h5priv_free_idlist_items ( h5_file_t* const f, h5_idlist_t* list ) { -#pragma unused f + UNUSED_ARGUMENT (f); if (list->items != NULL) free (list->items); list->items = NULL; list->size = 0; @@ -107,7 +107,7 @@ h5priv_sort_idlist_by_eid ( h5_file_t* const f, h5_idlist_t* list ) { -#pragma unused f + UNUSED_ARGUMENT (f); qsort ( list->items, list->num_items, @@ -126,7 +126,7 @@ h5priv_find_idlist ( h5_idlist_t* list, h5_loc_id_t item ) { -#pragma unused f + UNUSED_ARGUMENT (f); register h5_loc_idx_t low = 0; register h5_loc_idx_t high = list->num_items - 1; while (low <= high) { diff --git a/src/h5core/h5_openclose.c b/src/h5core/h5_openclose.c index 325a2f4..1b2da3c 100644 --- a/src/h5core/h5_openclose.c +++ b/src/h5core/h5_openclose.c @@ -45,7 +45,7 @@ h5priv_error_handler ( hid_t estack_id, void* __f ) { -#pragma unused __f + UNUSED_ARGUMENT (__f); if (h5_get_debuglevel() >= 5) { H5Eprint (estack_id, stderr); } @@ -145,7 +145,7 @@ open_file ( ) { #if !defined(PARALLEL_IO) -#pragma unused comm + UNUSED_ARGUMENT (f); #endif h5_info (f, "Opening file %s.", filename); @@ -415,10 +415,10 @@ h5_get_stepname_fmt ( int l_name, /*!< length of buffer name */ int* width /*!< OUT: Width of the number */ ) { -#pragma unused f -#pragma unused name -#pragma unused l_name -#pragma unused width + UNUSED_ARGUMENT (f); + UNUSED_ARGUMENT (name); + UNUSED_ARGUMENT (l_name); + UNUSED_ARGUMENT (width); return h5_error_not_implemented (f, __FILE__, __func__, __LINE__); } diff --git a/src/h5core/h5_syscall.c b/src/h5core/h5_syscall.c index 642e135..3a3a299 100644 --- a/src/h5core/h5_syscall.c +++ b/src/h5core/h5_syscall.c @@ -1,5 +1,6 @@ #include #include +#include #include "h5core/h5_core.h" #include "h5_core_private.h" @@ -36,6 +37,19 @@ h5priv_calloc ( return ptr; } +char* +h5priv_strdup ( + h5_file_t* const f, + const char* s1 + ) { + char* s2 = strdup (s1); + if (s2 == NULL) { + h5_error (f, H5_ERR_NOMEM, "Out of memory."); + return (void*)(H5_ERR); + } + return s2; +} + h5_err_t h5priv_free ( h5_file_t* const f, @@ -70,7 +84,7 @@ h5priv_tfind ( void* const* rootp, int (*compar) (const void* key1, const void* key2) ) { -#pragma unused f + UNUSED_ARGUMENT (f); void* ptr = tfind (key, rootp, compar); if (ptr == NULL) { return (void*)(H5_ERR); diff --git a/src/h5core/h5_syscall_private.h b/src/h5core/h5_syscall_private.h index b44b9cb..e78e55d 100644 --- a/src/h5core/h5_syscall_private.h +++ b/src/h5core/h5_syscall_private.h @@ -21,6 +21,11 @@ h5priv_free ( void* ptr ); +char* +h5priv_strdup ( + h5_file_t* const f, + const char* s1 + ); void* h5priv_tsearch ( h5_file_t* const f, diff --git a/src/h5core/h5t_access_private.h b/src/h5core/h5t_access_private.h index 286bdec..b4c93af 100644 --- a/src/h5core/h5t_access_private.h +++ b/src/h5core/h5t_access_private.h @@ -1,6 +1,73 @@ #ifndef __H5T_ACCESS_PRIVATE_H #define __H5T_ACCESS_PRIVATE_H +struct h5t_access_methods { + h5_generic_loc_elem_t* (*get_loc_elem)( + h5_file_t* const, const h5_loc_idx_t); + h5_loc_idx_t (*get_loc_elem_parent_idx)( + h5_file_t* const, const h5_loc_idx_t); + h5_loc_idx_t (*set_loc_elem_parent_idx)( + h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); + h5_loc_id_t (*get_loc_elem_child_idx)( + h5_file_t* const, const h5_loc_idx_t); + h5_loc_id_t (*set_loc_elem_child_idx)( + h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); + h5t_lvl_idx_t (*get_loc_elem_level_idx)( + h5_file_t* const, const h5_loc_idx_t); + h5t_lvl_idx_t (*set_loc_elem_level_idx)( + h5_file_t* const, const h5_loc_idx_t, const h5t_lvl_idx_t); + h5_loc_idx_t* (*get_loc_elem_vertex_indices)( + h5_file_t* const, const h5_loc_idx_t); + h5_loc_idx_t (*get_loc_elem_vertex_idx)( + h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); + h5_loc_idx_t (*set_loc_elem_vertex_idx)( + h5_file_t* const, + const h5_loc_idx_t, const h5_loc_idx_t, const h5_loc_idx_t); + h5_loc_idx_t* (*get_loc_elem_neighbor_indices)( + h5_file_t* const, const h5_loc_idx_t); + h5_loc_idx_t (*get_loc_elem_neighbor_idx)( + h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); + h5_loc_idx_t (*set_loc_elem_neighbor_idx)( + h5_file_t* const, + const h5_loc_idx_t, const h5_loc_idx_t, const h5_loc_idx_t); + + h5_generic_glb_elem_t* (*get_glb_elem)( + h5_file_t* const, const h5_loc_idx_t); + h5_glb_id_t (*get_glb_elem_idx)( + h5_file_t* const, const h5_loc_id_t); + h5_glb_id_t (*set_glb_elem_idx)( + h5_file_t* const, const h5_loc_idx_t, const h5_glb_idx_t); + h5_glb_idx_t (*get_glb_elem_parent_idx)( + h5_file_t* const, const h5_loc_id_t); + h5_glb_idx_t (*set_glb_elem_parent_idx)( + h5_file_t* const, const h5_loc_idx_t, const h5_glb_idx_t); + h5_glb_idx_t (*get_glb_elem_child_idx)( + h5_file_t* const, const h5_loc_idx_t); + h5_glb_idx_t (*set_glb_elem_child_idx)( + h5_file_t* const, const h5_loc_idx_t, const h5_glb_idx_t); + h5_glb_idx_t* (*get_glb_elem_vertex_indices)( + h5_file_t* const, const h5_loc_idx_t); + h5_glb_idx_t (*get_glb_elem_vertex_idx)( + h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); + h5_glb_id_t (*set_glb_elem_vertex_idx)( + h5_file_t* const, + const h5_loc_idx_t, const h5_loc_idx_t, const h5_glb_idx_t); + h5_glb_idx_t* (*get_glb_elem_neighbor_indices)( + h5_file_t* const, const h5_loc_idx_t); + h5_glb_idx_t (*get_glb_elem_neighbor_idx)( + h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); + h5_glb_idx_t (*set_glb_elem_neighbor_idx)( + h5_file_t* const, + const h5_loc_idx_t, const h5_loc_idx_t, const h5_glb_idx_t); + h5_err_t (*set_boundary_elem_flag)(h5_file_t* const, const h5_loc_idx_t); + h5_err_t (*clear_boundary_elem_flag)(h5_file_t* const, const h5_loc_idx_t); + h5_err_t (*set_boundary_facet_flag)(h5_file_t* const, const h5_loc_idx_t); + h5_err_t (*clear_boundary_facet_flag)(h5_file_t* const, const h5_loc_idx_t); + int (*is_boundary_elem)(h5_file_t* const, const h5_loc_idx_t); + int (*is_boundary_facet)(h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); + int (*is_boundary_face)(h5_file_t* const, const int, const h5_loc_idx_t, const h5_loc_idx_t); +}; + extern struct h5t_access_methods h5tpriv_access_trim_methods; extern struct h5t_access_methods h5tpriv_access_tetm_methods; diff --git a/src/h5core/h5t_access_tetm.c b/src/h5core/h5t_access_tetm.c index 7ccbebe..fad1662 100644 --- a/src/h5core/h5t_access_tetm.c +++ b/src/h5core/h5t_access_tetm.c @@ -249,6 +249,15 @@ set_boundary_elem_flag ( return H5_SUCCESS; } +static h5_err_t +set_boundary_facet_flag ( + h5_file_t* const f, + h5_loc_idx_t elem_idx + ) { + f->t->loc_elems.tets[elem_idx].flags |= H5T_BOUNDARY_FACET_FLAG; + return H5_SUCCESS; +} + static h5_err_t clear_boundary_elem_flag ( h5_file_t* const f, @@ -258,6 +267,14 @@ clear_boundary_elem_flag ( return H5_SUCCESS; } +static h5_err_t +clear_boundary_facet_flag ( + h5_file_t* const f, + h5_loc_idx_t elem_idx + ) { + f->t->loc_elems.tets[elem_idx].flags &= ~H5T_BOUNDARY_FACET_FLAG; + return H5_SUCCESS; +} static int is_boundary_elem ( @@ -283,10 +300,11 @@ is_boundary_face ( const h5_loc_idx_t elem_idx, const h5_loc_idx_t facet_idx ) { -#pragma unused f -#pragma unused dim -#pragma unused elem_idx -#pragma unused facet_idx + UNUSED_ARGUMENT (f); + UNUSED_ARGUMENT (dim); + UNUSED_ARGUMENT (elem_idx); + UNUSED_ARGUMENT (facet_idx); + return h5_error_internal (f, __FILE__, __func__, __LINE__); } @@ -319,6 +337,8 @@ struct h5t_access_methods h5tpriv_access_tetm_methods = { set_glb_elem_neighbor_idx, set_boundary_elem_flag, clear_boundary_elem_flag, + set_boundary_facet_flag, + clear_boundary_facet_flag, is_boundary_elem, is_boundary_facet, is_boundary_face, diff --git a/src/h5core/h5t_access_trim.c b/src/h5core/h5t_access_trim.c index 0451431..30dba11 100644 --- a/src/h5core/h5t_access_trim.c +++ b/src/h5core/h5t_access_trim.c @@ -240,7 +240,6 @@ set_glb_elem_neighbor_idx ( return neighbor_idx; } - static h5_err_t set_boundary_elem_flag ( h5_file_t* const f, @@ -250,6 +249,15 @@ set_boundary_elem_flag ( return H5_SUCCESS; } +static h5_err_t +set_boundary_facet_flag ( + h5_file_t* const f, + h5_loc_idx_t elem_idx + ) { + f->t->loc_elems.tris[elem_idx].flags |= H5T_BOUNDARY_FACET_FLAG; + return H5_SUCCESS; +} + static h5_err_t clear_boundary_elem_flag ( h5_file_t* const f, @@ -259,6 +267,14 @@ clear_boundary_elem_flag ( return H5_SUCCESS; } +static h5_err_t +clear_boundary_facet_flag ( + h5_file_t* const f, + h5_loc_idx_t elem_idx + ) { + f->t->loc_elems.tris[elem_idx].flags &= ~H5T_BOUNDARY_FACET_FLAG; + return H5_SUCCESS; +} static int is_boundary_elem ( @@ -284,10 +300,10 @@ is_boundary_face ( const h5_loc_idx_t elem_idx, const h5_loc_idx_t facet_idx ) { -#pragma unused f -#pragma unused dim -#pragma unused elem_idx -#pragma unused facet_idx + UNUSED_ARGUMENT (f); + UNUSED_ARGUMENT (dim); + UNUSED_ARGUMENT (elem_idx); + UNUSED_ARGUMENT (facet_idx); return h5_error_internal (f, __FILE__, __func__, __LINE__); } @@ -320,6 +336,8 @@ struct h5t_access_methods h5tpriv_access_trim_methods = { set_glb_elem_neighbor_idx, set_boundary_elem_flag, clear_boundary_elem_flag, + set_boundary_facet_flag, + clear_boundary_facet_flag, is_boundary_elem, is_boundary_facet, is_boundary_face, diff --git a/src/h5core/h5t_adjacencies_private.h b/src/h5core/h5t_adjacencies_private.h index 03148d6..32b3e9b 100644 --- a/src/h5core/h5t_adjacencies_private.h +++ b/src/h5core/h5t_adjacencies_private.h @@ -1,6 +1,14 @@ #ifndef __H5T_ADJACENCIES_PRIVATE_H #define __H5T_ADJACENCIES_PRIVATE_H +struct h5t_adjacency_methods { + h5_err_t (*update_internal_structs)(h5_file_t* const, h5t_lvl_idx_t); + h5_err_t (*release_internal_structs)(h5_file_t* const); + h5_err_t (*get_adjacencies)( + h5_file_t * const, + const h5_loc_id_t, const h5_int32_t, h5_idlist_t**); +}; + extern struct h5t_adjacency_methods h5tpriv_trim_adjacency_methods; extern struct h5t_adjacency_methods h5tpriv_tetm_adjacency_methods; diff --git a/src/h5core/h5t_adjacencies_tetm.c b/src/h5core/h5t_adjacencies_tetm.c index 89be9c3..c208723 100644 --- a/src/h5core/h5t_adjacencies_tetm.c +++ b/src/h5core/h5t_adjacencies_tetm.c @@ -84,7 +84,7 @@ static inline h5_err_t release_te ( h5_file_t* const f ) { -#pragma unused f + UNUSED_ARGUMENT (f); // @@@ TBD @@@ return H5_SUCCESS; } @@ -117,7 +117,7 @@ static inline h5_err_t release_td ( h5_file_t* const f ) { -#pragma unused f + UNUSED_ARGUMENT (f); // @@@ TBD @@@ return H5_SUCCESS; } @@ -824,13 +824,13 @@ get_adjacencies ( ) { h5_loc_id_t entity_type = h5tpriv_get_entity_type (entity_id); switch (entity_type) { - case H5T_ETYPE_VERTEX: + case H5T_TYPE_VERTEX: return get_adjacencies_to_vertex (f, entity_id, dim, list); - case H5T_ETYPE_EDGE: + case H5T_TYPE_EDGE: return get_adjacencies_to_edge (f, entity_id, dim, list); - case H5T_ETYPE_TRIANGLE: + case H5T_TYPE_TRIANGLE: return get_adjacencies_to_triangle (f, entity_id, dim, list); - case H5T_ETYPE_TET: + case H5T_TYPE_TET: return get_adjacencies_to_tet (f, entity_id, dim, list); default: break; diff --git a/src/h5core/h5t_adjacencies_trim.c b/src/h5core/h5t_adjacencies_trim.c index 1290cbf..8b53dd5 100644 --- a/src/h5core/h5t_adjacencies_trim.c +++ b/src/h5core/h5t_adjacencies_trim.c @@ -86,7 +86,7 @@ static inline h5_err_t release_te ( h5_file_t* const f ) { -#pragma unused f + UNUSED_ARGUMENT (f); // @@@ TBD @@@ return H5_SUCCESS; } @@ -276,7 +276,9 @@ get_triangles_uadj_to_vertex ( if ( h5tpriv_elem_is_on_cur_level ( f, el ) == H5_NOK ) { continue; } - TRY ( h5priv_search_idlist ( f, *list, elem_idx ) ); + TRY( h5priv_search_idlist (f, *list, + h5tpriv_build_entity_id ( + H5T_TYPE_TRIANGLE, 0, elem_idx)) ); } return H5_SUCCESS; } @@ -295,13 +297,40 @@ get_triangles_uadj_to_edge ( h5_loc_id_t *end = children->items+children->num_items; for ( ; edge_id < end; edge_id++ ) { h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx ( *edge_id ); - TRY ( h5priv_search_idlist ( f, *list, elem_idx ) ); + TRY( h5priv_search_idlist (f, *list, + h5tpriv_build_entity_id( + H5T_TYPE_TRIANGLE, 0, elem_idx)) ); } TRY ( h5priv_free_idlist( f, &children ) ); return H5_SUCCESS; } +static inline h5_err_t +get_edges_adj_to_edge ( + h5_file_t * const f, + const h5_loc_id_t entity_id, + h5_idlist_t **list + ) { + TRY( h5priv_alloc_idlist (f, list, 8) ); + h5_idlist_t *children; + TRY( h5priv_alloc_idlist (f, &children, 8) ); + TRY( compute_sections_of_edge ( f, entity_id, children ) ); + TRY( h5priv_alloc_idlist (f, list, 8) ); + h5_loc_id_t* edge_id = children->items; + h5_loc_id_t* end = children->items+children->num_items; + h5_idlist_t* te; + for (; edge_id < end; edge_id++) { + h5_loc_idx_t face_idx = h5tpriv_get_face_idx(*edge_id); + h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx(*edge_id); + TRY( h5tpriv_find_te2 (f, face_idx, elem_idx, &te) ); + TRY( h5priv_search_idlist (f, *list, te->items[0]) ); + } + + TRY( h5priv_free_idlist(f, &children) ); + return H5_SUCCESS; +} + static inline h5_err_t get_vertices_dadj_to_edge ( h5_file_t * const f, @@ -426,6 +455,8 @@ get_adjacencies_to_edge ( switch (dim) { case 0: return get_vertices_dadj_to_edge(f, entity_id, list); + case 1: + return get_edges_adj_to_edge(f, entity_id, list); case 2: return get_triangles_uadj_to_edge(f, entity_id, list); default: @@ -459,11 +490,11 @@ get_adjacencies ( ) { h5_loc_id_t entity_type = h5tpriv_get_entity_type (entity_id); switch (entity_type) { - case H5T_ETYPE_VERTEX: + case H5T_TYPE_VERTEX: return get_adjacencies_to_vertex (f, entity_id, dim, list); - case H5T_ETYPE_EDGE: + case H5T_TYPE_EDGE: return get_adjacencies_to_edge (f, entity_id, dim, list); - case H5T_ETYPE_TRIANGLE: + case H5T_TYPE_TRIANGLE: return get_adjacencies_to_triangle (f, entity_id, dim, list); default: break; diff --git a/src/h5core/h5t_core_private.h b/src/h5core/h5t_core_private.h index fc01535..d2221fa 100644 --- a/src/h5core/h5t_core_private.h +++ b/src/h5core/h5t_core_private.h @@ -46,14 +46,13 @@ */ #define H5T_ELEM_MASK ( (h5_id_t) (ULLONG_MAX >> 8) ) -#define H5T_ETYPE_MASK ( 7ull << (sizeof(h5_id_t)*8-4) ) -#define H5T_COMPONENT_MASK (~H5T_ELEM_MASK) -#define H5T_COMPONENT_ID_MASK (15ull << (sizeof(h5_id_t)*7) ) +#define H5T_TYPE_MASK ( 7ull << (sizeof(h5_id_t)*7+4) ) +#define H5T_FACE_MASK (15ull << (sizeof(h5_id_t)*7) ) -#define H5T_ETYPE_VERTEX (1) -#define H5T_ETYPE_EDGE (2) -#define H5T_ETYPE_TRIANGLE (3) -#define H5T_ETYPE_TET (4) +#define H5T_TYPE_VERTEX (1) +#define H5T_TYPE_EDGE (2) +#define H5T_TYPE_TRIANGLE (3) +#define H5T_TYPE_TET (4) #define h5tpriv_set_entity_type( type, elem_idx ) \ ( \ @@ -61,35 +60,48 @@ ((h5_id_t)(elem_idx)) \ ) #define h5tpriv_get_entity_type( entity_id ) \ - ((entity_id & H5T_ETYPE_MASK) >> (sizeof(h5_id_t)*8-4)) + ((entity_id & H5T_TYPE_MASK) >> (sizeof(h5_id_t)*8-4)) -#define h5tpriv_build_id( type, face_idx, elem_idx ) \ +#define h5tpriv_build_entity_id( type, face_idx, elem_idx ) \ ( \ ((h5_id_t)(type) << (sizeof(h5_id_t)*8-4)) | \ ((h5_id_t)(face_idx) << (sizeof(h5_id_t)*7)) | \ ((h5_id_t)(elem_idx) & H5T_ELEM_MASK) \ ) +#define h5tpriv_build_entity_id2( face_id, elem_idx ) \ + ( \ + ((h5_id_t)(face_id) << (sizeof(h5_id_t)*7)) | \ + ((h5_id_t)(elem_idx) & H5T_ELEM_MASK) \ + ) + +#define h5tpriv_build_face_id( type_id, face_idx ) \ + (type_id << 4 | face_idx) + #define h5tpriv_build_vertex_id( face_idx, elem_idx ) \ - ( h5tpriv_build_id ( H5T_ETYPE_VERTEX, face_idx, elem_idx ) ) + ( h5tpriv_build_entity_id ( H5T_TYPE_VERTEX, face_idx, elem_idx ) ) #define h5tpriv_build_edge_id( face_idx, elem_idx ) \ - ( h5tpriv_build_id ( H5T_ETYPE_EDGE, face_idx, elem_idx ) ) + ( h5tpriv_build_entity_id ( H5T_TYPE_EDGE, face_idx, elem_idx ) ) #define h5tpriv_build_triangle_id( face_idx, elem_idx ) \ - ( h5tpriv_build_id ( H5T_ETYPE_TRIANGLE, face_idx, elem_idx ) ) + ( h5tpriv_build_entity_id ( H5T_TYPE_TRIANGLE, face_idx, elem_idx ) ) #define h5tpriv_build_elem_id( elem_idx ) \ - ( h5tpriv_build_id ( f->t->mesh_type, 0, elem_idx ) ) + ( h5tpriv_build_entity_id ( f->t->mesh_type, 0, elem_idx ) ) #define h5tpriv_get_face_idx( entity_id ) \ - ( (entity_id & H5T_COMPONENT_ID_MASK) >> (sizeof(h5_id_t)*7) ) + ( (entity_id & H5T_FACE_MASK) >> (sizeof(h5_id_t)*7) ) -#define h5tpriv_get_elem_idx( entity_id ) \ +#define h5tpriv_get_face_id( entity_id ) \ + ( (entity_id & (H5T_TYPE_MASK|H5T_FACE_MASK)) >> (sizeof(h5_id_t)*7) ) + +#define h5tpriv_get_elem_idx( entity_id ) \ ( entity_id & H5T_ELEM_MASK ) - #define H5T_BOUNDARY_ELEM_FLAG 1 +#define H5T_BOUNDARY_FACET_FLAG 2 + #endif diff --git a/src/h5core/h5t_errorhandling_private.h b/src/h5core/h5t_errorhandling_private.h index 733b45c..378797a 100644 --- a/src/h5core/h5t_errorhandling_private.h +++ b/src/h5core/h5t_errorhandling_private.h @@ -28,6 +28,19 @@ h5tpriv_error_local_elem_nexist ( return h5_error (f, H5_ERR_NOENTRY, ERR_ELEM_NEXIST, s); } +static inline h5_err_t +h5tpriv_inval_codim ( + h5_file_t * const f, + int codim, + int min_codim, + int max_codim + ) { + return h5_error (f, H5_ERR_INVAL, + "Co-dimension %d requested, " + "but must be between %d and %d", + codim, min_codim, max_codim); +} + #define h5tpriv_error_undef_mesh( f ) \ h5_error( \ f, \ diff --git a/src/h5core/h5t_inquiry.c b/src/h5core/h5t_inquiry.c index ee3a35c..f2b8cee 100644 --- a/src/h5core/h5t_inquiry.c +++ b/src/h5core/h5t_inquiry.c @@ -85,7 +85,7 @@ h5t_get_num_elems ( h5_file_t* const f, const h5_id_t cnode ) { -#pragma unused cnode + UNUSED_ARGUMENT (cnode); h5t_fdata_t* t = f->t; if (t->cur_mesh < 0) { @@ -115,7 +115,7 @@ h5t_get_num_vertices ( h5_file_t* const f, h5_id_t cnode ) { -#pragma unused cnode + UNUSED_ARGUMENT (cnode); h5t_fdata_t* t = f->t; if (t->cur_mesh < 0) { diff --git a/src/h5core/h5t_map.c b/src/h5core/h5t_map.c index 8afd7ef..071e7e0 100644 --- a/src/h5core/h5t_map.c +++ b/src/h5core/h5t_map.c @@ -290,6 +290,22 @@ h5t_get_vertex_indices_of_triangle ( f, face_idx, elem_idx, vertex_indices); } +h5_err_t +h5t_get_vertex_indices_of_triangle_cclockwise ( + h5_file_t* const f, + const h5_loc_id_t entity_id, + h5_loc_idx_t* vertex_indices + ) { + TRY( h5t_get_vertex_indices_of_triangle (f, entity_id, vertex_indices) ); + h5_float64_t P0[3]; + h5_float64_t P1[3]; + h5_float64_t P2[3]; + TRY( h5t_get_vertex_coords_by_index (f, vertex_indices[0], P0) ); + TRY( h5t_get_vertex_coords_by_index (f, vertex_indices[1], P1) ); + TRY( h5t_get_vertex_coords_by_index (f, vertex_indices[2], P2) ); + +} + h5_err_t h5t_get_vertex_indices_of_triangle2 ( h5_file_t* const f, diff --git a/src/h5core/h5t_openclose.c b/src/h5core/h5t_openclose.c index a7b55f7..2c36b91 100644 --- a/src/h5core/h5t_openclose.c +++ b/src/h5core/h5t_openclose.c @@ -365,7 +365,7 @@ h5_err_t h5tpriv_init_step ( h5_file_t* const f ) { -#pragma unused f + UNUSED_ARGUMENT (f); return H5_SUCCESS; } @@ -378,7 +378,7 @@ h5_err_t h5tpriv_close_step ( h5_file_t* const f ) { -#pragma unused f + UNUSED_ARGUMENT (f); return H5_SUCCESS; } diff --git a/src/h5core/h5t_readwrite.c b/src/h5core/h5t_readwrite.c index b8c13c4..283a249 100644 --- a/src/h5core/h5t_readwrite.c +++ b/src/h5core/h5t_readwrite.c @@ -6,8 +6,8 @@ open_space_all ( h5_file_t* const f, const hid_t dataset_id ) { -#pragma unused f -#pragma unused dataset_id + UNUSED_ARGUMENT (f); + UNUSED_ARGUMENT (dataset_id); return H5S_ALL; } @@ -125,8 +125,8 @@ open_mem_space_vertices ( h5_file_t* const f, hid_t dataset_id ) { -#pragma unused f -#pragma unused dataset_id + UNUSED_ARGUMENT (f); + UNUSED_ARGUMENT (dataset_id); return H5S_ALL; } @@ -135,8 +135,8 @@ open_file_space_vertices ( h5_file_t* const f, hid_t dataset_id ) { -#pragma unused f -#pragma unused dataset_id + UNUSED_ARGUMENT (f); + UNUSED_ARGUMENT (dataset_id); return H5S_ALL; } @@ -218,8 +218,8 @@ open_mem_space_elems ( h5_file_t* const f, hid_t dataset_id ) { -#pragma unused f -#pragma unused dataset_id + UNUSED_ARGUMENT (f); + UNUSED_ARGUMENT (dataset_id); return H5S_ALL; } @@ -228,8 +228,8 @@ open_file_space_elems ( h5_file_t* const f, hid_t dataset_id ) { -#pragma unused f -#pragma unused dataset_id + UNUSED_ARGUMENT (f); + UNUSED_ARGUMENT (dataset_id); return H5S_ALL; } @@ -281,7 +281,7 @@ h5tpriv_read_mesh ( TRY( read_elems (f) ); TRY( h5tpriv_rebuild_elem_indices_mapping (f) ); - TRY( h5tpriv_init_loc_elems_struct (f) ); + TRY( h5tpriv_init_loc_elems_struct (f, 0) ); TRY( h5tpriv_update_adjacency_structs (f, 0) ); TRY( h5tpriv_init_geom_boundary_info (f, 0) ); diff --git a/src/h5core/h5t_readwrite_private.h b/src/h5core/h5t_readwrite_private.h index 1a90777..b36e9e2 100644 --- a/src/h5core/h5t_readwrite_private.h +++ b/src/h5core/h5t_readwrite_private.h @@ -1,6 +1,14 @@ #ifndef __H5T_READWRITE_PRIVATE_H #define __H5T_READWRITE_PRIVATE_H +struct h5t_read_methods { + h5_err_t (*init_loc_elems_struct)(h5_file_t* const, h5t_lvl_idx_t); + h5_err_t (*init_geom_boundary_info)(h5_file_t* const, h5t_lvl_idx_t); +}; + +extern struct h5t_read_methods h5tpriv_read_trim_methods; +extern struct h5t_read_methods h5tpriv_read_tetm_methods; + h5_err_t h5tpriv_write_obj ( h5_file_t * f, @@ -22,14 +30,13 @@ h5tpriv_write_mesh ( h5_file_t * const f ); -extern struct h5t_read_methods h5tpriv_read_trim_methods; -extern struct h5t_read_methods h5tpriv_read_tetm_methods; static inline h5_err_t h5tpriv_init_loc_elems_struct ( - h5_file_t* const f + h5_file_t* const f, + const h5t_lvl_idx_t from_lvl ) { - return (*f->t->methods.read->init_loc_elems_struct) (f); + return (*f->t->methods.read->init_loc_elems_struct) (f, from_lvl); } static inline h5_err_t diff --git a/src/h5core/h5t_readwrite_tetm.c b/src/h5core/h5t_readwrite_tetm.c index 887e526..9f7817d 100644 --- a/src/h5core/h5t_readwrite_tetm.c +++ b/src/h5core/h5t_readwrite_tetm.c @@ -6,7 +6,8 @@ */ static h5_err_t init_loc_elems_struct ( - h5_file_t* const f + h5_file_t* const f, + const h5t_lvl_idx_t from_lvl ) { h5t_fdata_t* const t = f->t; h5_loc_idx_t elem_idx = 0; @@ -17,7 +18,7 @@ init_loc_elems_struct ( h5_loc_tet_t* loc_elem = t->loc_elems.tets; h5_glb_tet_t* glb_elem = t->glb_elems.tets; - for (elem_idx = 0; + for (elem_idx = (from_lvl <= 0) ? 0 : t->num_elems[from_lvl-1]; elem_idx < num_elems; elem_idx++, loc_elem++, glb_elem++) { // global element index loc_elem->glb_idx = glb_elem->idx; @@ -48,7 +49,9 @@ init_loc_elems_struct ( glb_elem->neighbor_indices, num_facets, loc_elem->neighbor_indices) ); - // on boundary? +#if 0 + // done in function below + // on boundary? int i; for (i=0; i < num_facets; i++) { if (loc_elem->neighbor_indices[i] == -1) { @@ -56,6 +59,7 @@ init_loc_elems_struct ( break; } } +#endif } return H5_SUCCESS; } @@ -109,11 +113,14 @@ init_geom_boundary_info ( // get vertices of edge i h5_loc_idx_t face_idx; face_idx = t->ref_elem->map[2][i][0]; - vertex_indices[0] = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, face_idx); + vertex_indices[0] = h5tpriv_get_loc_elem_vertex_idx ( + f, elem_idx, face_idx); face_idx = t->ref_elem->map[2][i][1]; - vertex_indices[1] = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, face_idx); + vertex_indices[1] = h5tpriv_get_loc_elem_vertex_idx ( + f, elem_idx, face_idx); face_idx = t->ref_elem->map[2][i][2]; - vertex_indices[2] = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, face_idx); + vertex_indices[2] = h5tpriv_get_loc_elem_vertex_idx ( + f, elem_idx, face_idx); num_vertices = 3; } // mark elements diff --git a/src/h5core/h5t_readwrite_trim.c b/src/h5core/h5t_readwrite_trim.c index e00e278..20b6699 100644 --- a/src/h5core/h5t_readwrite_trim.c +++ b/src/h5core/h5t_readwrite_trim.c @@ -6,10 +6,11 @@ */ static h5_err_t init_loc_elems_struct ( - h5_file_t* const f + h5_file_t* const f, + const h5t_lvl_idx_t from_lvl ) { h5t_fdata_t* const t = f->t; - h5_loc_idx_t idx = 0; + h5_loc_idx_t elem_idx = 0; const h5_loc_idx_t num_elems = t->num_elems[t->num_levels-1]; h5t_lvl_idx_t level_idx = 0; int num_vertices = h5tpriv_ref_elem_get_num_vertices (t); @@ -17,7 +18,8 @@ init_loc_elems_struct ( h5_loc_triangle_t* loc_elem = t->loc_elems.tris; h5_glb_triangle_t* glb_elem = t->glb_elems.tris; - for (idx = 0; idx < num_elems; idx++, loc_elem++, glb_elem++) { + for (elem_idx = (from_lvl <= 0) ? 0 : t->num_elems[from_lvl-1]; + elem_idx < num_elems; elem_idx++, loc_elem++, glb_elem++) { // global element index loc_elem->glb_idx = glb_elem->idx; // local parent index @@ -29,7 +31,7 @@ init_loc_elems_struct ( h5t_map_glb_elem_idx2loc (f, glb_elem->child_idx) ); // level idx - if (idx >= t->num_elems[level_idx]) { + if (elem_idx >= t->num_elems[level_idx]) { level_idx++; } loc_elem->level_idx = level_idx; @@ -47,6 +49,7 @@ init_loc_elems_struct ( glb_elem->neighbor_indices, num_facets, loc_elem->neighbor_indices) ); +#if 0 // on boundary? int i; for (i=0; i < num_facets; i++) { @@ -55,6 +58,7 @@ init_loc_elems_struct ( break; } } +#endif } return H5_SUCCESS; } diff --git a/src/h5core/h5t_ref_elements.c b/src/h5core/h5t_ref_elements.c index c677346..63e4837 100644 --- a/src/h5core/h5t_ref_elements.c +++ b/src/h5core/h5t_ref_elements.c @@ -32,9 +32,9 @@ const h5t_ref_elem_t h5t_tri_ref_elem = { 2, // dimension { - H5T_ETYPE_VERTEX, - H5T_ETYPE_EDGE, - H5T_ETYPE_TRIANGLE, + H5T_TYPE_VERTEX, + H5T_TYPE_EDGE, + H5T_TYPE_TRIANGLE, }, { 3, // #vertices @@ -94,10 +94,10 @@ const h5t_ref_elem_t h5t_tri_ref_elem = { const h5t_ref_elem_t h5t_tet_ref_elem = { 3, // dimension { - H5T_ETYPE_VERTEX, - H5T_ETYPE_EDGE, - H5T_ETYPE_TRIANGLE, - H5T_ETYPE_TET, + H5T_TYPE_VERTEX, + H5T_TYPE_EDGE, + H5T_TYPE_TRIANGLE, + H5T_TYPE_TET, }, { 4, // #vertices diff --git a/src/h5core/h5t_retrieve.c b/src/h5core/h5t_retrieve.c index 3bcc98d..d84c2d6 100644 --- a/src/h5core/h5t_retrieve.c +++ b/src/h5core/h5t_retrieve.c @@ -3,53 +3,31 @@ #include "h5core/h5_core.h" #include "h5_core_private.h" -#define num_elems_on_cur_level f->t->num_elems[f->t->cur_level] - /* Skip elements which have been refined on a level <= the current one. */ -h5_err_t -h5tpriv_skip_to_next_elem_on_level ( +static h5_err_t +skip_to_next_elem_on_level ( h5_file_t* f, - h5t_entity_iterator_t* iter + h5t_mesh_iterator_t* iter ) { h5_generic_loc_elem_t* el; do { iter->elem_idx++; - if (iter->elem_idx >= num_elems_on_cur_level) { + if (iter->elem_idx >= f->t->num_elems[iter->level_idx]) { return H5_NOK; } el = h5tpriv_get_loc_elem (f, iter->elem_idx); - } while (h5tpriv_elem_is_on_cur_level (f, el) == H5_NOK); + } while (h5tpriv_elem_is_on_level (f, el, iter->level_idx) == H5_NOK); return H5_SUCCESS; } - -/* - Test whether given element is on current level. This is the case, if - - the level_id of the element is <= the current level - - and, if any, the direct children is on a level > the current level -*/ -h5_err_t -h5tpriv_elem_is_on_cur_level ( - h5_file_t* const f, - h5_generic_loc_elem_t *el // ptr to local element - ) { - h5t_fdata_t* t = f->t; - if ( (el->level_idx > t->cur_level) || - (el->child_idx >= 0 && el->child_idx < num_elems_on_cur_level) ) { - return H5_NOK; - } - return H5_SUCCESS; -} - - static h5_loc_id_t iterate_elems ( h5_file_t* const f, - h5t_entity_iterator_t* iter + h5t_mesh_iterator_t* iter ) { - if ( h5tpriv_skip_to_next_elem_on_level (f, iter) == H5_NOK) { + if ( skip_to_next_elem_on_level (f, iter) == H5_NOK) { h5_debug ( f, "Traversing done!" ); return H5_NOK; } @@ -59,10 +37,10 @@ iterate_elems ( static h5_loc_id_t iterate_boundary_elems ( h5_file_t* const f, - h5t_entity_iterator_t* iter + h5t_mesh_iterator_t* iter ) { do { - if ( h5tpriv_skip_to_next_elem_on_level (f, iter) == H5_NOK) { + if ( skip_to_next_elem_on_level (f, iter) == H5_NOK) { h5_debug ( f, "Traversing done!" ); return H5_NOK; } @@ -78,7 +56,7 @@ iterate_boundary_elems ( static h5_loc_id_t iterate_boundary_facets ( h5_file_t* const f, - h5t_entity_iterator_t* iter + h5t_mesh_iterator_t* iter ) { int num_facets = h5tpriv_ref_elem_get_num_facets (iter) - 1; int dim = h5tpriv_ref_elem_get_dim (iter) - iter->codim; @@ -96,7 +74,7 @@ iterate_boundary_facets ( } } while (! h5tpriv_is_boundary_facet (f, iter->elem_idx, iter->face_idx)); int type = h5tpriv_ref_elem_get_entity_type (iter->ref_elem, dim); - return h5tpriv_build_id (type, iter->face_idx, iter->elem_idx ); + return h5tpriv_build_entity_id (type, iter->face_idx, iter->elem_idx ); } /*! @@ -105,7 +83,7 @@ iterate_boundary_facets ( static h5_loc_id_t iterate_faces ( h5_file_t* const f, - h5t_entity_iterator_t* iter + h5t_mesh_iterator_t* iter ) { h5_idlist_t* entry; int dim = h5tpriv_ref_elem_get_dim (iter) - iter->codim; @@ -113,7 +91,7 @@ iterate_faces ( int i = -1; do { if (iter->face_idx >= num_faces) { - if (h5tpriv_skip_to_next_elem_on_level (f, iter) == H5_NOK) { + if (skip_to_next_elem_on_level (f, iter) == H5_NOK) { h5_debug (f, "Traversing done!"); return H5_NOK; } @@ -134,7 +112,7 @@ iterate_faces ( i++; h5_loc_idx_t idx = h5tpriv_get_elem_idx (entry->items[i]); el = h5tpriv_get_loc_elem (f, idx); - } while (h5tpriv_elem_is_on_cur_level (f, el) == H5_NOK); + } while (h5tpriv_elem_is_on_level (f, el, iter->level_idx) == H5_NOK); // 3. Face already visited if } while (iter->elem_idx > h5tpriv_get_elem_idx(entry->items[i])); @@ -153,7 +131,7 @@ iterate_faces ( static h5_loc_id_t iterate_boundary_faces ( h5_file_t* const f, - h5t_entity_iterator_t* iter + h5t_mesh_iterator_t* iter ) { // TODO!!! int dim = h5tpriv_ref_elem_get_dim (iter) - iter->codim; @@ -173,87 +151,123 @@ iterate_boundary_faces ( } else { iter->face_idx++; } - } while (! h5tpriv_is_boundary_face (f, dim, iter->elem_idx, iter->face_idx)); + } while (! h5tpriv_is_boundary_face ( + f, dim, iter->elem_idx, iter->face_idx)); // Skip already visited faces } while (0); return h5_error_internal (f, __FILE__, __func__, __LINE__); } -h5_err_t -h5t_alloc_entity_iterator ( - h5_file_t* f, - h5t_entity_iterator_t** iter, - int codim +static h5_loc_id_t +iterate_tags ( + h5_file_t* const f, + h5t_tag_iterator_t* iter ) { - TRY( *iter = h5priv_alloc (f, NULL, sizeof (h5t_entity_iterator_t)) ); - return h5t_begin_iterate_entities (f, *iter, codim); + UNUSED_ARGUMENT (f); +#if 0 + h5t_tagsel_t* tags; + do { + if (iter->subentity_idx >= 14) { + iter->elem_idx++; + iter->subentity_idx = 0; + } else { + iter->subentity_idx++; + } + tags = iter->tagset->elems[iter->elem_idx]; + } while ((tags == NULL) || (tags->idx[iter->subentity_idx])); +#endif + return 0; } h5_err_t -h5t_alloc_boundary_face_iterator ( +h5t_init_mesh_iterator ( h5_file_t* f, - h5t_entity_iterator_t** iter, + h5t_iterator_t* iter, int codim ) { - TRY( *iter = h5priv_alloc (f, NULL, sizeof (h5t_entity_iterator_t)) ); - return h5t_begin_iterate_boundary_faces (f, *iter, codim); + h5t_mesh_iterator_t* it = (h5t_mesh_iterator_t*)iter; + it->face_idx = 999; + it->elem_idx = -1; + it->codim = codim; + it->level_idx = f->t->cur_level; + it->ref_elem = f->t->ref_elem; + + if (it->codim > 0) { + it->iter = iterate_faces; + } else if (it->codim == 0) { + it->iter = iterate_elems; + } + return H5_SUCCESS; +} + +h5_err_t +h5t_create_mesh_iterator ( + h5_file_t* f, + h5t_iterator_t** iter, + int codim + ) { + h5t_mesh_iterator_t* it; + TRY( it = h5priv_calloc (f, 1, sizeof (h5t_mesh_iterator_t)) ); + TRY( h5t_init_mesh_iterator (f, (h5t_iterator_t*)it, codim) ); + *iter = (h5t_iterator_t*)it; + return H5_SUCCESS; +} + +h5_err_t +h5t_create_boundary_face_iterator ( + h5_file_t* f, + h5t_iterator_t** iter, + int codim + ) { + h5t_mesh_iterator_t* it; + TRY( it = h5priv_calloc (f, 1, sizeof (h5t_mesh_iterator_t)) ); + it->face_idx = 999; // just a high enough number + it->elem_idx = -1; + it->codim = codim; + it->level_idx = f->t->cur_level; + it->ref_elem = f->t->ref_elem; + + if (it->codim <= 0 || it->codim > it->ref_elem->dim) { + return h5tpriv_inval_codim (f, codim, 1, it->ref_elem->dim); + } else if (it->codim == 1) { + it->iter = iterate_boundary_facets; + } + else if (it->codim > 1) { + it->iter = iterate_boundary_faces; + } + *iter = (h5t_iterator_t*)it; + return H5_SUCCESS; +} + +h5_err_t +h5t_create_mtag_iterator ( + h5_file_t* f, + h5t_iterator_t** iter, + const char* name + ) { + h5t_tag_iterator_t* it; + TRY( it = h5priv_calloc (f, 1, sizeof (h5t_tag_iterator_t)) ); + h5t_open_mtagset (f, name, &it->tagset); + it->elem_idx = -1; + it->subentity_idx = 999; + it->level_idx = f->t->cur_level; + it->iter = iterate_tags; + *iter = (h5t_iterator_t*)it; + return H5_SUCCESS; } h5_err_t h5t_release_entity_iterator ( h5_file_t* const f, - h5t_entity_iterator_t* iter + h5t_iterator_t* iter ) { return h5priv_free (f, iter); } -h5_err_t -h5t_begin_iterate_entities ( - h5_file_t* f, - h5t_entity_iterator_t* iter, - const int codim - ) { - iter->face_idx = -1; - iter->elem_idx = -1; - iter->codim = codim; - iter->ref_elem = f->t->ref_elem; - - if (iter->codim > 0) { - iter->iter = iterate_faces; - } else if (iter->codim == 0) { - iter->iter = iterate_elems; - } - return h5tpriv_init_iterator (f, iter, codim); -} - -h5_err_t -h5t_begin_iterate_boundary_faces ( - h5_file_t* f, - h5t_entity_iterator_t* iter, - const int codim - ) { - iter->face_idx = 999; // just a high enough number - iter->elem_idx = -1; - iter->codim = codim; - iter->ref_elem = f->t->ref_elem; - - if (iter->codim <= 0 || iter->codim > iter->ref_elem->dim) { - return h5_error (f, H5_ERR_INVAL, - "Co-dimension requested %d, but must be between %d and %d", - codim, 1, iter->ref_elem->dim); - } else if (iter->codim == 1) { - iter->iter = iterate_boundary_facets; - } - else if (iter->codim > 1) { - iter->iter = iterate_boundary_faces; - } - return H5_SUCCESS; -} - h5_loc_id_t h5t_iterate_entities ( h5_file_t* const f, - h5t_entity_iterator_t* iter + h5t_iterator_t* iter ) { return (iter->iter (f, iter)); } @@ -261,15 +275,16 @@ h5t_iterate_entities ( h5_err_t h5t_end_iterate_entities ( h5_file_t* const f, - h5t_entity_iterator_t* iter + h5t_iterator_t* iter ) { -#pragma unused f - iter->face_idx = -1; - iter->elem_idx = -1; - iter->codim = -1; - iter->ref_elem = NULL; - iter->find = NULL; - iter->iter = NULL; + UNUSED_ARGUMENT (f); + h5t_mesh_iterator_t* it = (h5t_mesh_iterator_t*)iter; + it->face_idx = -1; + it->elem_idx = -1; + it->codim = -1; + it->ref_elem = NULL; + it->find = NULL; + it->iter = NULL; return H5_SUCCESS; } diff --git a/src/h5core/h5t_retrieve_private.h b/src/h5core/h5t_retrieve_private.h index 8ca2a14..9b1908a 100644 --- a/src/h5core/h5t_retrieve_private.h +++ b/src/h5core/h5t_retrieve_private.h @@ -1,28 +1,109 @@ #ifndef __H5T_RETRIEVE_PRIVATE_H #define __H5T_RETRIEVE_PRIVATE_H -h5_err_t -h5tpriv_skip_to_next_elem_on_level ( - h5_file_t* f, - h5t_entity_iterator_t* iter - ); +#include +/* + TODO: define as union of iterator types + */ +struct h5t_iterator { + h5_loc_id_t (*iter)( + h5_file_t *const f, + struct h5t_iterator* iter); +/* + const h5t_ref_elem_t* ref_elem; // pointer to reference element + + h5_id_t elem_idx; // local element id + h5_id_t face_idx; // face id according reference element + int codim; // dimension of entities to traverse + h5_err_t (*find)( + h5_file_t *const f, + h5_id_t face_idx, + h5_id_t elem_idx, + h5_idlist_t **retval); + +*/}; + +typedef struct h5t_mesh_iterator { + h5_loc_id_t (*iter)( + h5_file_t *const f, + struct h5t_mesh_iterator* iter); + h5t_lvl_idx_t level_idx; + const h5t_ref_elem_t* ref_elem; + h5_loc_idx_t elem_idx; + h5_loc_idx_t face_idx; // face id according reference element + int codim; // dimension of entities to traverse + h5_err_t (*find)( + h5_file_t *const f, + h5_id_t face_idx, + h5_id_t elem_idx, + h5_idlist_t **retval); +} h5t_mesh_iterator_t; + +typedef struct h5t_tag_iterator { + h5_loc_id_t (*iter)( + h5_file_t *const f, + struct h5t_tag_iterator* iter); + h5t_lvl_idx_t level_idx; + h5t_tagset_t* tagset; + h5_loc_idx_t elem_idx; + int subentity_idx; +} h5t_tag_iterator_t; + +/* h5_err_t h5tpriv_elem_is_on_cur_level ( h5_file_t* const f, h5_generic_loc_elem_t* el ); +*/ +struct h5t_retrieve_methods { + h5_err_t (*init_entity_iterator)( + h5_file_t* const, h5t_mesh_iterator_t*, const int); +}; extern struct h5t_retrieve_methods h5tpriv_trim_retrieve_methods; extern struct h5t_retrieve_methods h5tpriv_tetm_retrieve_methods; +/* + Test whether given element is on current level. This is the case, if + - the level_id of the element is <= the current level + - and, if any, the direct children is on a level > the current level +*/ static inline h5_err_t -h5tpriv_init_iterator ( +h5tpriv_elem_is_on_cur_level ( + h5_file_t* const f, + h5_generic_loc_elem_t *el // ptr to local element + ) { + h5t_fdata_t* t = f->t; + if ( (el->level_idx > t->cur_level) || + (el->child_idx >= 0 && el->child_idx < f->t->num_elems[f->t->cur_level]) ) { + return H5_NOK; + } + return H5_SUCCESS; +} + +static inline h5_err_t +h5tpriv_elem_is_on_level ( + h5_file_t* const f, + h5_generic_loc_elem_t *el, // ptr to local element + const h5t_lvl_idx_t level_idx + ) { + assert ( level_idx < f->t->num_levels ); + if ( (el->level_idx > level_idx) || + (el->child_idx >= 0 && el->child_idx < f->t->num_elems[level_idx]) ) { + return H5_NOK; + } + return H5_SUCCESS; +} + +static inline h5_err_t +h5tpriv_init_entity_iterator ( h5_file_t* f, - h5t_entity_iterator_t* const iter, + h5t_mesh_iterator_t* const iter, const int codim ) { - return (*f->t->methods.retrieve->init_iterator) (f, iter, codim); + return (*f->t->methods.retrieve->init_entity_iterator) (f, iter, codim); } #endif diff --git a/src/h5core/h5t_retrieve_tetm.c b/src/h5core/h5t_retrieve_tetm.c index f61ced5..697b558 100644 --- a/src/h5core/h5t_retrieve_tetm.c +++ b/src/h5core/h5t_retrieve_tetm.c @@ -6,25 +6,26 @@ static h5_err_t begin_iterate_entities ( h5_file_t* f, - h5t_entity_iterator_t* const iter, + h5t_mesh_iterator_t* const iter, const int codim ) { switch (iter->ref_elem->dim - codim) { case 0: // iterate vertices iter->find = h5tpriv_find_tv2; - return h5tpriv_skip_to_next_elem_on_level (f, iter); + break; case 1: // iterate edges iter->find = h5tpriv_find_te2; - return h5tpriv_skip_to_next_elem_on_level (f, iter); + break; case 2: // iterate faces iter->find = h5tpriv_find_td2; - return h5tpriv_skip_to_next_elem_on_level (f, iter); + break; case 3: // iterate elems iter->find = NULL; - return H5_SUCCESS; + break; default: return h5_error_internal (f, __FILE__, __func__, __LINE__); } + return H5_SUCCESS; } struct h5t_retrieve_methods h5tpriv_tetm_retrieve_methods = { diff --git a/src/h5core/h5t_retrieve_trim.c b/src/h5core/h5t_retrieve_trim.c index e55dfde..44fb4aa 100644 --- a/src/h5core/h5t_retrieve_trim.c +++ b/src/h5core/h5t_retrieve_trim.c @@ -6,22 +6,23 @@ static h5_err_t begin_iterate_entities ( h5_file_t* f, - h5t_entity_iterator_t* iter, + h5t_mesh_iterator_t* iter, const int codim ) { switch (h5tpriv_ref_elem_get_dim (iter) - codim) { case 0: // iterate vertices iter->find = h5tpriv_find_tv2; - return h5tpriv_skip_to_next_elem_on_level (f, iter); + break; case 1: // iterate edges iter->find = h5tpriv_find_te2; - return h5tpriv_skip_to_next_elem_on_level (f, iter); + break; case 2: // iterate elems iter->find = NULL; - return H5_SUCCESS; + break; default: return h5_error_internal (f, __FILE__, __func__, __LINE__); } + return H5_SUCCESS; } struct h5t_retrieve_methods h5tpriv_trim_retrieve_methods = { diff --git a/src/h5core/h5t_store.c b/src/h5core/h5t_store.c index fd988b4..d2a2e42 100644 --- a/src/h5core/h5t_store.c +++ b/src/h5core/h5t_store.c @@ -453,8 +453,23 @@ h5t_end_refine_elems ( return H5_SUCCESS; } +h5_err_t +h5t_create_index_set ( + h5_file_t* const f + ) { + int codim; + int dim = h5tpriv_ref_elem_get_dim (f->t); + // todo: check tagset already exist + TRY( h5t_add_mtagset (f, "__IndexSet__", H5_INT64_T) ); - - - - + for (codim = 0; codim <= dim; codim++) { + h5_glb_idx_t idx = 0; + h5t_mesh_iterator_t it; + h5_glb_id_t entity_id; + TRY( h5t_init_mesh_iterator (f, (h5t_iterator_t*)&it, codim) ); + while ((entity_id = it.iter(f,&it)) >= 0) { + TRY( h5t_set_mtag_by_name (f, "__IndexSet__", entity_id, 1, &idx) ); + } + } + return H5_SUCCESS; +} diff --git a/src/h5core/h5t_store_private.h b/src/h5core/h5t_store_private.h index 5b4c12d..cabf254 100644 --- a/src/h5core/h5t_store_private.h +++ b/src/h5core/h5t_store_private.h @@ -1,6 +1,15 @@ #ifndef __H5T_STOREMESH_PRIVATE_H #define __H5T_STOREMESH_PRIVATE_H +struct h5t_store_methods { + h5_err_t (*alloc_elems)(h5_file_t* const, const size_t, const size_t); + h5_loc_idx_t (*refine_elem)(h5_file_t* const, const h5_loc_idx_t); + h5_err_t (*end_store_elems)(h5_file_t* const); + h5_err_t (*get_direct_children_of_edge)( + h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t, + h5_loc_id_t*); +}; + extern struct h5t_store_methods h5tpriv_trim_store_methods; extern struct h5t_store_methods h5tpriv_tetm_store_methods; diff --git a/src/h5core/h5t_tags.c b/src/h5core/h5t_tags.c index 88519a5..5dde496 100644 --- a/src/h5core/h5t_tags.c +++ b/src/h5core/h5t_tags.c @@ -1,3 +1,4 @@ + #include #include "h5core/h5_core.h" @@ -11,40 +12,14 @@ /* Initialize a tag container */ - static h5_err_t init_container ( - h5_file_t * const f, + h5_file_t* const f, const size_t ntags, - h5t_tagcontainer_t * ctn + h5t_tagcontainer_t* ctn ) { - ctn->names = h5priv_calloc ( f, ntags, sizeof(char*) ); - TRY ( h5priv_hcreate_string_keyed ( f, ntags, &ctn->sets ) ); - return H5_SUCCESS; -} -/* - Initialize tag container for current mesh and level. - */ -static h5_err_t -init_mtagsets ( - h5_file_t * const f, - size_t ntags - ) { - return init_container ( f, ntags, &f->t->mtags ); -} - -/* - Release all tag values for a specific element - */ -static h5_err_t -release_tagvals_of_elem ( - h5_file_t * const f, - h5t_tagsel_t *el_vals - ) { - unsigned int i = 0; - for ( i = 0; i < el_vals->size; i++ ) { - TRY ( h5priv_free ( f, el_vals->valp[i] ) ); - } + ctn->names = h5priv_calloc (f, ntags, sizeof(char*)); + TRY( h5priv_hcreate_string_keyed (f, ntags, &ctn->sets)); return H5_SUCCESS; } @@ -53,21 +28,35 @@ release_tagvals_of_elem ( */ static h5_err_t release_tagset ( - h5_file_t * const f, - const void *__set + h5_file_t* const f, + h5t_tagset_t* tagset ) { - H5T_Tagset *set = *(H5T_Tagset**)__set; unsigned int i; - for ( i = 0; i < set->num_elems; i++ ) { - if ( set->elems[i] != NULL ) { - TRY ( release_tagvals_of_elem ( f, set->elems[i] ) ); + // release per element structures + for (i = 0; i < tagset->num_elems; i++) { + if (tagset->elems[i] != NULL) { + TRY( h5priv_free (f, tagset->elems[i]) ); } } - TRY ( h5priv_free ( f, set->name ) ); - TRY ( h5priv_free ( f, set ) ); + // release other memory + TRY( h5priv_free (f, tagset->name) ); + TRY( h5priv_free (f, tagset->values) ); + TRY( h5priv_free (f, tagset) ); return H5_SUCCESS; } +/* + Release a tagset. Special version for releasing a container. + */ +static h5_err_t +release_tagset2 ( + h5_file_t* const f, + const void* __tagset + ) { + h5t_tagset_t* tagset = *(h5t_tagset_t**)__tagset; + return release_tagset (f, tagset); +} + /* Release all sets in given container */ @@ -77,25 +66,45 @@ release_container ( h5t_tagcontainer_t* ctn ) { if (ctn->num_sets == 0) return H5_SUCCESS; - TRY ( h5priv_hwalk ( f, &ctn->sets, release_tagset ) ); - TRY ( h5priv_free ( f, ctn->names ) ); + TRY( h5priv_hwalk (f, &ctn->sets, release_tagset2) ); + TRY( h5priv_free (f, ctn->names) ); memset (ctn, 0, sizeof (*ctn)); return H5_SUCCESS; } /* - Release mesh tag-sets + Release all tagsets */ h5_err_t h5tpriv_release_tags ( - h5_file_t * const f + h5_file_t* const f ) { - h5t_fdata_t *t = f->t; - TRY ( release_container ( f, &t->mtags ) ); + h5t_fdata_t* t = f->t; + TRY( release_container (f, &t->mtags) ); return H5_SUCCESS; } +static inline h5_err_t +tagset_exists ( + h5_file_t* const f, + h5t_tagcontainer_t* ctn, + char* name + ) { + h5t_tagset_t tagset; + tagset.name = name; + return h5priv_hsearch (f, &tagset, H5_FIND, NULL, &ctn->sets); +} + +h5_err_t +h5t_mtagset_exists ( + h5_file_t* const f, + h5t_tagcontainer_t* ctn, + char* name + ) { + return tagset_exists (f, &f->t->mtags, name); +} + /*! Add tag to current mesh. @@ -107,71 +116,69 @@ h5tpriv_release_tags ( \return H5_SUCCESS or error code */ static h5_err_t -add_mtagset ( - h5_file_t * const f, - char * name, +add_tagset ( + h5_file_t* const f, + h5t_tagcontainer_t* ctn, + char* name, h5_id_t type, - H5T_Tagset **rtagset + h5t_tagset_t** rtagset ) { - h5t_fdata_t *t = f->t; + h5t_fdata_t* t = f->t; - /* - Initialize data structure for m-tagsets, if not already done. - */ - if ( t->mtags.names == NULL ) { - TRY( init_mtagsets (f, 521) ); + // Initialize data structure for m-tagsets, if not already done. + if (ctn->names == NULL) { + TRY( init_container (f, 521, ctn) ); } - /* - ToDo: Resize! - */ + // TODO: Resize if we have more then 80% of 521 filled! - if ( ( name == NULL ) || ( name[0] == '\0' ) ) { - return h5_error ( - f, - H5_ERR_INVAL, - "Invalid name" ); + // validate name + if (name == NULL || name[0] == '\0') { + return h5_error (f, H5_ERR_INVAL, "Invalid name" ); } - /* - @TODO@ check: - - tagset with name doesn't already exist - */ - if ( type != H5_INT64_T && type != H5_FLOAT64_T ) { - return h5_error ( f, H5_ERR_INVAL, - "Unsupported data type." ); + + // validate type + if (type != H5_INT64_T && type != H5_FLOAT64_T) { + return h5_error (f, H5_ERR_INVAL, "Unsupported data type." ); } - /* - create new tagset - */ - H5T_Tagset *tagset = NULL; + + // check if a tagset with given name already exists + h5_err_t h5err; + TRY( h5err = tagset_exists (f, ctn, name) ); + if (h5err != H5_SUCCESS) { + return h5_error (f, H5_ERR_INVAL, + "Tagset with name %s already exists!", + name); + } + + // create new tagset + h5t_tagset_t* tagset = NULL; size_t size = (t->num_elems[t->num_levels-1] - 1) * sizeof(*tagset->elems) + sizeof(*tagset); - TRY ( (tagset = h5priv_calloc ( f, 1, size ) ) ); + TRY( tagset = h5priv_calloc (f, 1, size) ); - TRY ( ( tagset->name = h5priv_calloc ( f, 1, strlen(name)+1 ) ) ); - strcpy ( tagset->name, name ); + TRY( tagset->name = h5priv_strdup (f, name) ); tagset->type = type; tagset->num_elems = t->num_elems[t->num_levels-1]; - /* - add tagset to hash of tagsets - */ - void *__retval = NULL; - TRY ( h5priv_hsearch ( f, tagset, H5_ENTER, &__retval, &t->mtags.sets ) ); + + // add tagset to hash of tagsets + TRY( h5priv_hsearch (f, tagset, H5_ENTER, NULL, &ctn->sets) ); t->mtags.changed = 1; t->mtags.names[t->mtags.num_sets] = tagset->name; t->mtags.num_sets++; - if ( rtagset != 0 ) *rtagset = tagset; + if ( rtagset != NULL ) *rtagset = tagset; return H5_SUCCESS; } h5_err_t h5t_add_mtagset ( - h5_file_t * const f, - char * name, + h5_file_t* const f, + char* name, h5_id_t type ) { - return add_mtagset ( f, name, type, 0 ); + h5t_fdata_t* t = f->t; + return add_tagset (f, &t->mtags, name, type, NULL); } @@ -185,49 +192,25 @@ h5t_add_mtagset ( */ static h5_err_t remove_tagset ( - h5_file_t *const f, - h5t_tagcontainer_t *ctn, + h5_file_t* const f, + h5t_tagcontainer_t* ctn, const char name[] ) { - h5t_fdata_t *t = f->t; + // remove tagset with NAME from m-tagsets dictionary + void* __retval = NULL; + TRY( h5priv_hsearch (f, &name, H5_REMOVE, &__retval, &ctn->sets) ); + h5t_tagset_t* tagset = (h5t_tagset_t*)__retval; + if (tagset == NULL) return H5_SUCCESS; + TRY( release_tagset (f, tagset) ); - /* - remove tagset with NAME from m-tagsets dictionary - */ - void *__retval = NULL; - TRY ( h5priv_hsearch ( f, &name, H5_REMOVE, &__retval, &ctn->sets ) ); - H5T_Tagset *tagset = (H5T_Tagset*)__retval; - if ( tagset == NULL ) return H5_SUCCESS; - - size_t el_idx, i; - size_t num_elems = t->num_elems[t->num_levels-1]; - for ( el_idx = 0; el_idx < num_elems; el_idx++ ) { - h5t_tagsel_t *tags_of_elem = tagset->elems[el_idx]; - /* - release all m-tags for this element - */ - for ( i = 0; i < tags_of_elem->size; i++ ) { - TRY ( h5priv_free ( f, tags_of_elem->valp[i] ) ); - } - /* - release m-tag object for this element - */ - TRY ( h5priv_free ( f, tags_of_elem ) ); - } - /* - release tagset object - */ - TRY ( h5priv_free ( f, tagset ) ); - /* - remove HDF5 datasets and group for this tagset - */ + // remove HDF5 datasets and group for this tagset hid_t loc_id; - TRY ( loc_id = h5priv_open_group ( f, ctn->group_id, name ) ); - TRY ( h5priv_delete_hdf5_link ( f, loc_id, "elems", H5P_DEFAULT ) ); - TRY ( h5priv_delete_hdf5_link ( f, loc_id, "entities", H5P_DEFAULT ) ); - TRY ( h5priv_delete_hdf5_link ( f, loc_id, "values", H5P_DEFAULT ) ); - TRY ( h5priv_close_hdf5_group ( f, loc_id ) ); - TRY ( h5priv_delete_hdf5_link ( f, ctn->group_id, name, H5P_DEFAULT ) ); + TRY( loc_id = h5priv_open_group (f, ctn->group_id, name) ); + TRY( h5priv_delete_hdf5_link (f, loc_id, "elems", H5P_DEFAULT) ); + TRY( h5priv_delete_hdf5_link (f, loc_id, "entities", H5P_DEFAULT) ); + TRY( h5priv_delete_hdf5_link (f, loc_id, "values", H5P_DEFAULT) ); + TRY( h5priv_close_hdf5_group (f, loc_id) ); + TRY( h5priv_delete_hdf5_link (f, ctn->group_id, name, H5P_DEFAULT) ); return H5_SUCCESS; } @@ -242,22 +225,22 @@ remove_tagset ( */ h5_err_t h5t_remove_mtagset ( - h5_file_t *const f, + h5_file_t* const f, const char name[] ) { - h5t_fdata_t *t = f->t; + h5t_fdata_t* t = f->t; - TRY ( t->mtags.group_id = h5priv_open_group ( f, t->mesh_gid, "Tags" ) ); - TRY ( remove_tagset ( f, &t->mtags, name ) ); - TRY ( h5priv_close_hdf5_group ( f, t->mtags.group_id ) ); + TRY( t->mtags.group_id = h5priv_open_group (f, t->mesh_gid, "Tags") ); + TRY( remove_tagset (f, &t->mtags, name) ); + TRY( h5priv_close_hdf5_group ( f, t->mtags.group_id) ); return H5_SUCCESS; } h5_ssize_t h5t_get_num_mtagsets ( - h5_file_t *const f + h5_file_t* const f ) { - h5t_fdata_t *t = f->t; + h5t_fdata_t* t = f->t; return t->mtags.num_sets; } @@ -271,25 +254,24 @@ h5t_get_num_mtagsets ( */ h5_ssize_t h5t_get_mtagsets ( - h5_file_t *const f, - char **names[] + h5_file_t* const f, + char** names[] ) { - h5t_fdata_t *t = f->t; + h5t_fdata_t* t = f->t; *names = t->mtags.names; return t->mtags.num_sets; } h5_err_t h5t_open_mtagset ( - h5_file_t *const f, - const char *name, - H5T_Tagset **retval + h5_file_t* const f, + const char* name, + h5t_tagset_t** retval ) { - h5t_fdata_t *t = f->t; - void *__retval = NULL; - TRY ( h5priv_hsearch ( f, &name, H5_FIND, &__retval, - &t->mtags.sets ) ); - *retval = (H5T_Tagset*)__retval; + h5t_fdata_t* t = f->t; + void* __retval = NULL; + TRY( h5priv_hsearch (f, &name, H5_FIND, &__retval, &t->mtags.sets) ); + *retval = (h5t_tagset_t*)__retval; return H5_SUCCESS; } @@ -303,11 +285,11 @@ h5t_open_mtagset ( */ h5_id_t h5t_get_mtagset_type_by_name ( - h5_file_t *const f, - char *name + h5_file_t* const f, + char* name ) { - H5T_Tagset *tagset; - TRY ( h5t_open_mtagset ( f, name, &tagset ) ); + h5t_tagset_t* tagset; + TRY( h5t_open_mtagset (f, name, &tagset) ); return tagset->type; } @@ -321,97 +303,240 @@ h5t_get_mtagset_type_by_name ( */ h5_ssize_t h5t_get_mtagset_info ( - h5_file_t *const f, - h5_id_t idx, - char **name, - h5_id_t *type + h5_file_t* const f, + const h5_id_t idx, + char** name, + h5_id_t* type ) { - h5t_fdata_t *t = f->t; + h5t_fdata_t* t = f->t; *name = t->mtags.names[idx]; - void *__retval = NULL; - h5priv_hsearch ( f, t->mtags.names[idx], H5_FIND, &__retval, - &t->mtags.sets ); - H5T_Tagset *retval = (H5T_Tagset*)__retval; + void* __retval = NULL; + h5priv_hsearch (f, t->mtags.names[idx], H5_FIND, &__retval, + &t->mtags.sets); + h5t_tagset_t* retval = (h5t_tagset_t*)__retval; *type = retval->type; return H5_SUCCESS; } +static int +find_face_id ( + h5t_tageleminfo_t* eleminfo, + h5_loc_idx_t face_id + ) { + if (eleminfo->num_tags == 0) return -1; + h5t_taginfo_t* taginfo = eleminfo->ti; + register int low = 0; + register int high = eleminfo->num_tags-1; + while (low <= high) { + register int mid = (low + high) / 2; + register int diff = taginfo[mid].face_id - face_id; + if (diff > 0) + high = mid -1; + else if (diff < 0) + low = mid + 1; + else + return mid; + } + return -(low+1); +} + +static inline void +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 + ) { + h5_warn (f, "Tag %s not set for face %llx of element %lld", + name, + (long long)face_id, + (long long)elem_idx); +} + +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 + ) { + if (tagset->elems[elem_idx] == NULL) { + tag_nexists_warn (f, tagset->name, face_id, elem_idx); + return H5_NOK; + } + h5t_tageleminfo_t* eleminfo = tagset->elems[elem_idx]; + + // remove values + int idx = find_face_id (eleminfo, face_id); + if (idx < 0) { + tag_nexists_warn (f, tagset->name, face_id, elem_idx); + } + h5t_taginfo_t* ti = &eleminfo->ti[idx]; + + tagset->num_values -= ti->val_dim; + memmove (tagset->values + ti->val_idx, + tagset->values + ti->val_idx + ti->val_dim, + (tagset->num_values - idx) * sizeof (tagset->values[0])); + + // remove tag info for this entity + memmove (ti, + ti + 1, + (eleminfo->num_tags-idx-1)*sizeof (ti[0]) ); + + // we don't resize the eleminfo structure!!! + return H5_SUCCESS; +} + +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, + const h5_loc_idx_t elem_idx, + const size_t dim, + void* val + ) { + // insert new taginfo + h5t_tageleminfo_t* eleminfo = tagset->elems[elem_idx]; + TRY( eleminfo = tagset->elems[elem_idx] = h5priv_alloc ( + f, + tagset->elems[elem_idx], + sizeof (*eleminfo) + + eleminfo->num_tags * sizeof (eleminfo->ti[0])) ); + h5t_taginfo_t* ti = &eleminfo->ti[idx]; + memmove (ti + 1, + ti, + (eleminfo->num_tags - idx) * sizeof(*ti)); + eleminfo->num_tags++; + ti->face_id = face_id; + ti->val_dim = dim; + + // append values + TRY( tagset->values = h5priv_alloc ( + f, + tagset->values, + (tagset->num_values+dim) * sizeof (*tagset->values)) ); + memcpy (tagset->values + tagset->num_values, + val, + dim*sizeof (*tagset->values)); + ti->val_idx = tagset->num_values; + tagset->num_values += dim; + return H5_SUCCESS; +} + +static h5_err_t +overwrite_tag ( + h5_file_t* const f, + h5t_tagset_t* tagset, + const int idx, + const h5_loc_idx_t elem_idx, + void* val + ) { + UNUSED_ARGUMENT (f); + h5t_tageleminfo_t* eleminfo = tagset->elems[elem_idx]; + h5t_taginfo_t* ti = &eleminfo->ti[idx]; + + memcpy (tagset->values + ti->val_idx, + val, + ti->val_dim * sizeof (*ti) ); + return H5_SUCCESS; +} + /*! Set tag for entity in current mesh. - - \param[in] f file handle - \param[in] tagset pointer to tagset - \param[in] id local id of entity - \param[in] size size of value - \param[in] val tag value - - \return H5_SUCCESS or error code */ static h5_err_t -set_mtag ( - h5_file_t *const f, - H5T_Tagset *tagset, - const h5_loc_id_t id, - const size_t size, - void *val +set_tag ( + h5_file_t* const f, + h5t_tagset_t* tagset, + const h5_loc_idx_t face_id, + const h5_loc_idx_t elem_idx, + const size_t dim, + void* val ) { - size_t offs[5] = { 14, 0, 4, 10, 14 }; - h5_loc_idx_t el_idx = h5tpriv_get_elem_idx ( id ); - h5_loc_idx_t eoe_id = h5tpriv_get_face_idx ( id ); - h5_loc_idx_t type_id = h5tpriv_get_entity_type ( id ); - if ( tagset->elems[el_idx] == NULL ) { - /* - alloc new structure to store all tags for this element - and the given name - */ - TRY ( ( tagset->elems[el_idx] = h5priv_calloc ( - f, - 1, - sizeof(*tagset->elems[el_idx] ) ) ) ); - memset ( tagset->elems[el_idx]->idx, -1, - sizeof(tagset->elems[el_idx]->idx) ); + if (tagset->elems[elem_idx] == NULL) { + TRY( tagset->elems[elem_idx] = h5priv_calloc ( + f, 1, sizeof (*tagset->elems)) ); } - h5t_tagsel_t *tagselem = tagset->elems[el_idx]; - size_t i = offs[type_id]+eoe_id; - - /* - new tag value? - */ - if ( tagselem->idx[i] < 0 ) { + h5t_tageleminfo_t* eleminfo = tagset->elems[elem_idx]; + int i = find_face_id (eleminfo, face_id); + h5t_taginfo_t* ti = eleminfo->ti + i; // maybe an invalid pointer!!! + if (i >= 0 && dim != ti->val_dim) { /* - Set new index of pointer to value - and increment number of values. + This is a very unusual case! So the processing can be + a bit more expensive ... */ - size_t k = tagselem->idx[i] = tagselem->size++; - /* - We have to resize (actually not, if this is the first value, - but to keep things simple ...) - */ - size_t num_bytes = sizeof(*tagselem) - + (tagselem->size-1) * sizeof(void*); - TRY ( ( tagset->elems[el_idx] = h5priv_alloc ( - f, tagselem, num_bytes ) ) ); - tagselem = tagset->elems[el_idx]; - /* - we will allocate the memory later. - */ - tagselem->valp[k] = NULL; + TRY( remove_tag (f, tagset, face_id, elem_idx) ); + TRY( add_tag (f, 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) ); + tagset->num_entities++; + } + if (f->t->cur_level < tagset->scope.min_level) { + tagset->scope.min_level = f->t->cur_level; + } + if (f->t->cur_level > tagset->scope.max_level) { + tagset->scope.max_level = f->t->cur_level; } - - /* - (re-)allocate memory for value and assign - */ - size_t num_bytes = (size-1) * sizeof(h5_float64_t) + sizeof(h5t_tagval_t); - size_t k = tagselem->idx[i]; - TRY ( ( tagselem->valp[k] = h5priv_alloc ( - f, tagselem->valp[k], num_bytes ) ) ); - h5t_tagval_t *tagval = tagselem->valp[k]; - tagval->size = size; - memcpy ( &tagval->vals, val, size*sizeof(h5_float64_t) ); tagset->changed = 1; return H5_SUCCESS; } +static h5_err_t +get_idx_of_tagval ( + const h5t_tagset_t* tagset, + const h5_loc_idx_t face_id, + const h5_loc_idx_t elem_idx, + int* taginfo_idx, + h5_loc_idx_t* val_idx + ) { + h5t_tageleminfo_t* eleminfo = tagset->elems[elem_idx]; + *taginfo_idx = find_face_id (eleminfo, face_id); + if (*taginfo_idx < 0) { + return H5_NOK; // not tagged + } + *val_idx = eleminfo->ti[*taginfo_idx].val_idx; + return H5_SUCCESS; +} + +static h5_ssize_t +get_tag ( + h5_file_t* const f, + const h5t_tagset_t *tagset, + const h5_loc_idx_t face_id, + const h5_loc_idx_t elem_idx, + size_t* const dim, + void* const values + ) { + if (f->t->cur_level < tagset->scope.min_level || + f->t->cur_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; + } + h5_loc_idx_t val_idx = 0; + int ti_idx = 0; + h5_err_t h5err = get_idx_of_tagval (tagset, face_id, elem_idx, + &ti_idx, &val_idx); + if (h5err < 0) { + return h5err; + } + h5t_taginfo_t* ti = &tagset->elems[elem_idx]->ti[ti_idx]; + h5t_tagval_t* v = tagset->values; + if (*dim > ti->val_dim || values == NULL) { + *dim = ti->val_dim; + } + if (values != NULL) { + memcpy (values, v + val_idx, *dim*sizeof(*v) ); + } + return H5_SUCCESS; +} + /*! Set tag for entity in current mesh. @@ -425,45 +550,19 @@ set_mtag ( */ h5_err_t h5t_set_mtag_by_name ( - h5_file_t *const f, - char name[], - const h5_loc_id_t id, - const size_t size, - void *val - ) { - H5T_Tagset *tagset; - TRY ( h5t_open_mtagset ( f, name, &tagset ) ); - return set_mtag ( f, tagset, id, size, val ); -} - -static h5_err_t -get_tag_valp ( h5_file_t* const f, - const H5T_Tagset* tagset, + char name[], const h5_loc_id_t entity_id, - h5t_tagval_t** const valp + const size_t dim, + void* val ) { -#pragma unused f - h5_loc_idx_t el_idx = h5tpriv_get_elem_idx ( entity_id ); - h5_loc_idx_t face_idx = h5tpriv_get_face_idx ( entity_id ); - h5_loc_idx_t type_id = h5tpriv_get_entity_type ( entity_id ); + h5t_tagset_t* tagset; + 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); - if ( tagset->elems[el_idx] == NULL ) { - return H5_NOK; /* no tags for this element */ - } - h5t_tagsel_t *tagselem = tagset->elems[el_idx]; - size_t offs[5] = { 14, 0, 4, 10, 14 }; - size_t i = offs[type_id]+face_idx; - - if ( tagselem->idx[i] < 0 ) { - return H5_NOK; /* no value set for this subentity */ - } - size_t k = tagselem->idx[i]; - *valp = tagselem->valp[k]; - - return H5_SUCCESS; + return set_tag (f, tagset, face_id, elem_idx, dim, val); } - /*! Get tag for entity in given tagset. @@ -477,22 +576,15 @@ get_tag_valp ( */ h5_ssize_t h5t_get_tag ( - h5_file_t *const f, - const H5T_Tagset *tagset, + h5_file_t* const f, + const h5t_tagset_t* tagset, const h5_loc_id_t entity_id, size_t* const dim, void* const vals ) { - h5t_tagval_t *tagval; - TRY ( get_tag_valp ( f, tagset, entity_id, &tagval ) ); - - if ( (*dim > tagval->size) || (vals == NULL) ) { - *dim = tagval->size; - } - if ( vals != NULL ) { - memcpy ( vals, &tagval->vals, *dim * sizeof(h5_float64_t) ); - } - return tagval->size; + h5_loc_idx_t face_id = h5tpriv_get_face_id (entity_id); + h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id); + return get_tag (f, tagset, face_id, elem_idx, dim, vals); } /*! @@ -514,9 +606,12 @@ h5t_get_mtag_by_name ( size_t* dim, void* vals ) { - H5T_Tagset* tagset; - TRY ( h5t_open_mtagset ( f, name, &tagset ) ); - return h5t_get_tag ( f, tagset, entity_id, dim, vals ); + h5t_tagset_t* tagset; + 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); + + return get_tag (f, tagset, face_id, elem_idx, dim, vals); } /*! @@ -529,41 +624,13 @@ h5t_get_mtag_by_name ( h5_err_t h5t_remove_mtag ( h5_file_t* const f, - H5T_Tagset* tagset, + h5t_tagset_t* tagset, const h5_loc_id_t entity_id ) { - h5_loc_idx_t el_idx = h5tpriv_get_elem_idx ( entity_id ); - h5_loc_idx_t face_idx = h5tpriv_get_face_idx ( entity_id ); - h5_loc_idx_t type_id = h5tpriv_get_entity_type ( entity_id ); + h5_loc_idx_t face_id = h5tpriv_get_face_id (entity_id); + h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id); - if ( tagset->elems[el_idx] == NULL ) { - return H5_SUCCESS; /* no tags for this element */ - } - h5t_tagsel_t *tagselem = tagset->elems[el_idx]; - size_t offs[5] = { 14, 0, 4, 10, 14 }; - size_t i = offs[type_id]+face_idx; - - if ( tagselem->idx[i] < 0 ) { - return H5_SUCCESS; /* no value set for this subentity */ - } - size_t k = tagselem->idx[i]; - h5t_tagval_t *tagval = tagselem->valp[k]; - TRY ( h5priv_free ( f, tagval ) ); - /* - remove from array - */ - size_t n = ( tagselem->size-k-1) * sizeof(tagselem->valp[0]); - memmove ( tagselem->valp[k], tagselem->valp[k+1], n ); - tagselem->size--; - /* - adapt indices - */ - for ( i = 0; i < tagselem->size; i++ ) { - if ( tagselem->idx[i] > k ) { - tagselem->idx[i]--; - } - } - return H5_SUCCESS; + return remove_tag (f, tagset, face_id, elem_idx); } /*! @@ -575,22 +642,25 @@ h5t_remove_mtag ( */ h5_err_t h5t_remove_mtag_by_name ( - h5_file_t *const f, + h5_file_t* const f, const char name[], const h5_loc_id_t entity_id ) { - H5T_Tagset *tagset; - TRY ( h5t_open_mtagset ( f, name, &tagset ) ); - return h5t_remove_mtag ( f, tagset, entity_id ); + h5t_tagset_t* tagset; + 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); + + return remove_tag (f, tagset, face_id, elem_idx); } static hid_t open_space_all ( - h5_file_t * const f, + h5_file_t* const f, const hid_t dataset_id ) { -#pragma unused f -#pragma unused dataset_id + UNUSED_ARGUMENT (f); + UNUSED_ARGUMENT (dataset_id); return H5S_ALL; } @@ -599,180 +669,153 @@ open_space_all ( */ static h5_err_t write_tagset ( - h5_file_t * const f, - hid_t loc_id, - H5T_Tagset *tagset + h5_file_t* const f, + const hid_t loc_id, + h5t_tagset_t* tagset ) { - h5t_fdata_t *t = f->t; + h5t_fdata_t* t = f->t; + h5t_tageleminfo_t** eleminfos = tagset->elems; hid_t group_id; - /* - alloc memory - */ - h5t_tag_idx_t *elems; - h5_loc_idx_t el_idx; - h5_loc_idx_t num_elems = t->num_elems[t->num_levels-1]; - TRY ( ( elems = h5priv_calloc ( - f, num_elems+1, sizeof(*elems) ) ) ); + h5t_tag_idx_t* elems = NULL; + h5t_tag_idx_t* elem = NULL; + h5_loc_idx_t num_elems = 0; + h5t_tag_idx_t* entities = NULL; + h5t_tag_idx_t* entity = NULL; + h5t_tagval_t* values = NULL; - h5t_tag_idx_t *entities; - size_t ent_idx = 0; - size_t num_entities = 0; - size_t max_entities = num_elems+1; - TRY ( ( entities = h5priv_calloc ( - f, max_entities, sizeof(*entities) ) ) ); + h5_loc_idx_t elem_idx = 0; + h5_loc_idx_t entity_idx = 0; + h5_loc_idx_t val_idx = 0; - h5_int64_t *vals; - size_t val_idx = 0; - size_t num_vals = 0; - size_t max_vals = num_elems; - TRY ( ( vals = h5priv_calloc ( - f, max_vals, sizeof(*vals) ) ) ); + h5_err_t h5err = H5_SUCCESS; - h5_loc_id_t tmap[15] = { H5T_ETYPE_VERTEX, H5T_ETYPE_VERTEX, - H5T_ETYPE_VERTEX, H5T_ETYPE_VERTEX, - H5T_ETYPE_EDGE, H5T_ETYPE_EDGE, - H5T_ETYPE_EDGE, H5T_ETYPE_EDGE, - H5T_ETYPE_EDGE, H5T_ETYPE_EDGE, - H5T_ETYPE_TRIANGLE, H5T_ETYPE_TRIANGLE, - H5T_ETYPE_TRIANGLE, H5T_ETYPE_TRIANGLE, - H5T_ETYPE_TET }; - /* sub-entity indices */ - int smap[15] = { 0, 1, 2, 3, /* vertices */ - 0, 1, 2, 3, 4, 5, /* edges */ - 0, 1, 2, 3, /* triangles */ - 0 }; /* tetrahedron */ - /* - build data structures in memory - */ - for ( el_idx = 0; el_idx < num_elems; el_idx++ ) { - h5t_tagsel_t *tags_of_elem = tagset->elems[el_idx]; - size_t num_subentities = 0; - size_t start_idx_entities = ent_idx; - size_t i; - for ( i = 0; i < 15; i++ ) { - int k = tags_of_elem->idx[i]; - if ( k == -1 ) continue; - h5t_tagval_t *valp = tags_of_elem->valp[k]; - num_subentities++; - /* - append value to array of values - */ - if ( val_idx + valp->size > max_vals ) { - max_vals += num_elems; - TRY ( ( vals = h5priv_alloc ( - f, vals, - max_vals*sizeof(*vals) ) ) ); - } - memcpy ( - vals+val_idx, - &valp->vals[0].i, - valp->size*sizeof(*vals) ); - - /* - append entity descriptor - */ - if ( ent_idx >= max_entities ) { - max_entities += num_elems; - TRY ( ( entities = h5priv_alloc ( - f, entities, - max_entities*sizeof(*entities) ) - ) ); - } - h5_glb_id_t type_id = tmap[i]; - h5_glb_id_t face_idx = smap[i]; - // TODO: map local elem idx to global index - entities[ent_idx].eid = h5tpriv_build_id ( - type_id, face_idx, el_idx ); - entities[ent_idx].idx = val_idx; - val_idx += valp->size; - ent_idx++; - - } - /* append element descriptor */ - elems[el_idx].eid = el_idx; - elems[el_idx].idx = start_idx_entities; - start_idx_entities += num_subentities; + if (t->num_levels <= 0) { + goto cleanup; // nothing to do } - num_entities = ent_idx; - num_vals = val_idx; + num_elems = t->num_elems[t->num_levels-1]; + if (num_elems == 0 || tagset->num_entities == 0) { + goto cleanup; // nothing to do + } + // allocate memory per element (plus 1) + TRY( elems = h5priv_calloc ( + f, num_elems+1, sizeof(*elems)) ); + elem = elems; - elems[num_elems].eid = -1; - elems[num_elems].idx = num_entities; - entities[ent_idx].eid = -1; - entities[ent_idx].idx = num_vals; + // allocate memory per entity (plus 1) + TRY( entities = h5priv_calloc ( + f, tagset->num_entities+1, sizeof(*entities)) ); + entity = entities; - /* - write data - */ - TRY ( group_id = h5priv_open_group ( f, loc_id, tagset->name ) ); + // allocate memory for all values + TRY( values = h5priv_calloc ( + f, tagset->num_values, sizeof(*values)) ); + + // build data structures in memory + while (elem < elems+num_elems) { + elem->eid = elem_idx; + elem->idx = entity_idx; + h5t_tageleminfo_t* eleminfo = *eleminfos; + + // loop over tagged faces of this element + int ti_idx; + for (ti_idx = 0; ti_idx < eleminfo->num_tags; ti_idx++) { + h5t_taginfo_t* ti = eleminfo->ti+ti_idx; + + entity->eid = h5tpriv_build_entity_id2 (ti->face_id, elem_idx); + entity->idx = val_idx; + + // copy values + memcpy (values + val_idx, + &tagset->values[ti->val_idx], + ti->val_dim * sizeof (*values)); + val_idx += ti->val_dim; + entity_idx++; + entity++; + } + elem_idx++; + eleminfos++; + elem++; + } + elem->eid = -1; // last entry + tagset->num_entities = elem->idx = entity_idx; + entity->eid = -1; + tagset->num_values = entity->idx = val_idx; + + // write data + TRY( group_id = h5priv_open_group (f, loc_id, tagset->name) ); h5_dsinfo_t dsinfo; - memset ( &dsinfo, 0, sizeof(dsinfo) ); + memset (&dsinfo, 0, sizeof(dsinfo)); dsinfo.rank = 1; dsinfo.max_dims[0] = H5S_UNLIMITED; dsinfo.chunk_dims[0] = 4096; dsinfo.access_prop = H5P_DEFAULT; - strcpy ( dsinfo.name, "elems" ); + strcpy (dsinfo.name, "elems"); dsinfo.dims[0] = num_elems + 1; dsinfo.type_id = t->dtypes.h5t_tag_idx_t; - TRY( dsinfo.create_prop = h5priv_create_hdf5_property ( f, + TRY( dsinfo.create_prop = h5priv_create_hdf5_property (f, H5P_DATASET_CREATE ) ); - TRY( h5priv_set_hdf5_chunk_property ( f, dsinfo.create_prop, dsinfo.rank, - dsinfo.chunk_dims ) ); + TRY( h5priv_set_hdf5_chunk_property (f, dsinfo.create_prop, dsinfo.rank, + dsinfo.chunk_dims) ); - TRY ( h5priv_write_dataset_by_name ( - f, - group_id, - &dsinfo, - open_space_all, open_space_all, - elems ) ); + TRY( h5priv_write_dataset_by_name ( + f, + group_id, + &dsinfo, + open_space_all, open_space_all, + elems) ); - strcpy ( dsinfo.name, "entities" ); - dsinfo.dims[0] = num_entities + 1; + strcpy (dsinfo.name, "entities"); + dsinfo.dims[0] = tagset->num_entities + 1; - TRY ( h5priv_write_dataset_by_name ( - f, - group_id, - &dsinfo, - open_space_all, open_space_all, - entities ) ); + TRY( h5priv_write_dataset_by_name ( + f, + group_id, + &dsinfo, + open_space_all, open_space_all, + entities) ); - strcpy ( dsinfo.name, "values" ); - dsinfo.dims[0] = num_vals; + strcpy (dsinfo.name, "values"); + dsinfo.dims[0] = tagset->num_values; dsinfo.type_id = t->dtypes.h5_int64_t; - TRY ( h5priv_write_dataset_by_name ( - f, - group_id, - &dsinfo, + TRY( h5priv_write_dataset_by_name ( + f, + group_id, + &dsinfo, open_space_all, open_space_all, - vals ) ); + values) ); - return H5_SUCCESS; +cleanup: + TRY( h5priv_free (f, elems) ); + TRY( h5priv_free (f, entities) ); + TRY( h5priv_free (f, values) ); + + return h5err; } /* Store given tag container. Write only changed tag-sets. */ static h5_err_t -_write_container ( - h5_file_t * const f, - h5t_tagcontainer_t *ctn +write_container ( + h5_file_t* const f, + h5t_tagcontainer_t* ctn ) { size_t idx; - for ( idx = 0; idx < ctn->num_sets; idx++ ) { + for (idx = 0; idx < ctn->num_sets; idx++) { void *__retval; - TRY ( h5priv_hsearch ( f, - &ctn->names[idx], - H5_FIND, - &__retval, - &ctn->sets ) ); - H5T_Tagset *tagset = (H5T_Tagset*)__retval; - if ( tagset->changed ) { - TRY ( write_tagset ( - f, - ctn->group_id, - tagset ) ); + TRY( h5priv_hsearch ( f, + &ctn->names[idx], + H5_FIND, + &__retval, + &ctn->sets) ); + h5t_tagset_t *tagset = (h5t_tagset_t*)__retval; + if (tagset->changed) { + TRY( write_tagset ( + f, + ctn->group_id, + tagset) ); } } return H5_SUCCESS; @@ -784,11 +827,11 @@ _write_container ( */ h5_err_t h5tpriv_write_mtags ( - h5_file_t *const f + h5_file_t* const f ) { - h5t_fdata_t *t = f->t; + h5t_fdata_t* t = f->t; TRY( t->mtags.group_id = h5priv_open_group (f, t->mesh_gid, "Tags") ); - TRY( _write_container (f, &f->t->mtags) ); + TRY( write_container (f, &f->t->mtags) ); TRY( h5priv_close_hdf5_group (f, t->mtags.group_id) ); return H5_SUCCESS; } @@ -796,10 +839,11 @@ h5tpriv_write_mtags ( static h5_err_t read_tagset ( h5_file_t* const f, - hid_t loc_id, + h5t_tagcontainer_t* ctn, hsize_t idx ) { h5t_fdata_t* t = f->t; + hid_t loc_id = ctn->group_id; char* name; h5_id_t type; hid_t group_id; @@ -863,15 +907,16 @@ read_tagset ( /* add tagset and set values */ - H5T_Tagset* tagset; - TRY( add_mtagset (f, name, type, &tagset) ); + h5t_tagset_t* tagset; + TRY( add_tagset (f, ctn, name, type, &tagset) ); for (ent_idx = 0; ent_idx < num_entities; ent_idx++) { h5t_tag_idx_t *entity = &entities[ent_idx]; size_t dim = (entity+1)->idx - entity->idx; - TRY( set_mtag ( + TRY( set_tag ( f, tagset, - entity->eid, + h5tpriv_get_face_id (entity->eid), + h5tpriv_get_elem_idx (entity->eid), dim, &vals[entity->idx] ) ); } @@ -881,16 +926,16 @@ read_tagset ( h5_err_t h5tpriv_read_tag_container ( - h5_file_t * const f, - h5t_tagcontainer_t *ctn + h5_file_t* const f, + h5t_tagcontainer_t* ctn ) { size_t num_sets; - TRY ( ( num_sets = h5priv_get_num_objs_in_hdf5_group ( - f, ctn->group_id ) ) ); + TRY( num_sets = h5priv_get_num_objs_in_hdf5_group ( + f, ctn->group_id) ); hsize_t idx; - for ( idx = 0; idx < num_sets; idx++ ) { - TRY( read_tagset (f, ctn->group_id, idx) ); + for (idx = 0; idx < num_sets; idx++) { + TRY( read_tagset (f, ctn, idx) ); } return H5_SUCCESS; @@ -915,27 +960,33 @@ h5tpriv_read_tag_container ( */ static h5_ssize_t get_tagset_names_of_entity ( - h5_file_t * const f, - h5t_tagcontainer_t *ctn, + h5_file_t* const f, + h5t_tagcontainer_t* ctn, h5_loc_id_t entity_id, - char *names[], + char* names[], h5_size_t dim ) { size_t idx; size_t _dim = 0; + h5_loc_idx_t face_id = h5tpriv_get_face_id (entity_id); + h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id); + for (idx = 0; idx < ctn->num_sets; idx++) { - void *__retval; + void* __retval; TRY (h5priv_hsearch (f, &ctn->names[idx], H5_FIND, &__retval, &ctn->sets)); - H5T_Tagset *tset = (H5T_Tagset*)__retval; - h5t_tagval_t *tval; - if (get_tag_valp (f, tset, entity_id, &tval) != H5_SUCCESS) { - continue; + 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, + 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++; @@ -943,11 +994,14 @@ get_tagset_names_of_entity ( return _dim;; } +/* + Return tag names for given entity. + */ h5_ssize_t h5t_get_mtagset_names_of_entity ( h5_file_t* const f, const h5_loc_id_t entity_id, - char *names[], + char* names[], const h5_size_t dim ) { return get_tagset_names_of_entity (f, &f->t->mtags, entity_id, names, dim); diff --git a/src/h5core/h5t_tags_private.h b/src/h5core/h5t_tags_private.h index 7b2ba6e..2ef50d6 100644 --- a/src/h5core/h5t_tags_private.h +++ b/src/h5core/h5t_tags_private.h @@ -29,53 +29,56 @@ ToDo /* - Structure to store a tag value + All tags of an element are stored in an array of the below defined + structure */ typedef struct { - int32_t subent_id; /* sub-entitiy id */ - int32_t size; union { h5_float64_t f; h5_int64_t i; - } vals[1]; + } item; } h5t_tagval_t; /* - Structure with pointers to the tag values of a given tagset of an element. - We use idx as an index into valp: - valp[idx[0]] ... valp[idx[3]] are pointing to the tag values of vertex 0 ... 3 - valp[idx[4]] ... valp[idx[9]] are pointing to the tag values of edge 0 ... 5 - valp[idx[10]] ... valp[idx[13]] are pointing to the tag values of triangle 0 ... 3 - valp[idx[14]] points to the tag value of the elements itself. - If idx[k] is equal -1, no tag has been assigned to the appropriate entity. */ typedef struct { - signed char idx[15]; - signed char size; /* size of valp */ - h5t_tagval_t *valp[1]; -} h5t_tagsel_t; + int16_t face_id; // face id: type and face index + uint16_t val_dim; // dim of value for this entity + uint32_t val_idx; // index of first value +} h5t_taginfo_t; +typedef struct { + int32_t num_tags; + h5t_taginfo_t ti[1]; +} h5t_tageleminfo_t; struct h5t_tagset { - char * name; - unsigned int changed; /* flag tagset changed, ... */ - unsigned int num_elems; - h5_id_t type; /* int64 or float64 */ - h5t_tagsel_t *elems[1]; + char* name; // name of tagset + unsigned int changed; // flag tagset changed, ... + struct { + h5t_lvl_idx_t min_level; + h5t_lvl_idx_t max_level; + } scope; + h5_id_t type; // int64 or float64 + h5_loc_idx_t num_entities;// number of tagged entities + h5_loc_idx_t num_values;// number of values + h5_loc_idx_t num_elems; // number of elements in tagset + h5t_tagval_t* values; // ptr to array of tag values + h5t_tageleminfo_t* elems[1]; // per element structure }; /* Structure for hash table of tagsets */ -typedef struct { - unsigned int changed; /* flag container changed */ +struct h5t_tagcontainer { + unsigned int changed; // flag container changed hid_t group_id; - hsize_t num_sets; /* number of tagsets */ - char **names; /* fast access via index */ - h5_hashtable_t sets; -} h5t_tagcontainer_t; + hsize_t num_sets; // number of tagsets + char** names; // fast access via index + h5_hashtable_t sets; // hash table +}; typedef struct { diff --git a/src/h5core/h5t_types_private.h b/src/h5core/h5t_types_private.h index 9542918..d26edbe 100644 --- a/src/h5core/h5t_types_private.h +++ b/src/h5core/h5t_types_private.h @@ -24,7 +24,8 @@ typedef struct h5_loc_triangle { h5_loc_idx_t parent_idx; h5_loc_idx_t child_idx; h5t_lvl_idx_t level_idx; - h5t_elem_flags_t flags; + h5t_lvl_idx_t refinement_level; + h5t_elem_flags_t flags; h5_loc_idx_t vertex_indices[3]; h5_loc_idx_t neighbor_indices[3]; } h5_loc_triangle_t; @@ -43,7 +44,8 @@ typedef struct h5_loc_tetrahedron { h5_loc_idx_t parent_idx; h5_loc_idx_t child_idx; h5t_lvl_idx_t level_idx; - h5t_elem_flags_t flags; + h5t_lvl_idx_t refinement_level; + h5t_elem_flags_t flags; h5_loc_idx_t vertex_indices[4]; h5_loc_idx_t neighbor_indices[4]; } h5_loc_tetrahedron_t; @@ -61,7 +63,8 @@ typedef struct h5_generic_loc_elem { h5_loc_idx_t parent_idx; h5_loc_idx_t child_idx; h5_int32_t level_idx; - h5_int32_t flags; + h5t_lvl_idx_t refinement_level; + h5t_elem_flags_t flags; h5_loc_idx_t indices[1]; } h5_generic_loc_elem_t; @@ -101,97 +104,11 @@ typedef struct h5t_adjacencies { h5_hashtable_t td_hash; } h5t_adjacencies_t; -struct h5t_store_methods { - h5_err_t (*alloc_elems)(h5_file_t* const, const size_t, const size_t); - h5_loc_idx_t (*refine_elem)(h5_file_t* const, const h5_loc_idx_t); - h5_err_t (*end_store_elems)(h5_file_t* const); - h5_err_t (*get_direct_children_of_edge)( - h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t, - h5_loc_id_t*); -}; - -struct h5t_retrieve_methods { - h5_err_t (*init_iterator)( - h5_file_t* const, h5t_entity_iterator_t*, const int); -}; - -struct h5t_access_methods { - h5_generic_loc_elem_t* (*get_loc_elem)( - h5_file_t* const, const h5_loc_idx_t); - h5_loc_idx_t (*get_loc_elem_parent_idx)( - h5_file_t* const, const h5_loc_idx_t); - h5_loc_idx_t (*set_loc_elem_parent_idx)( - h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); - h5_loc_id_t (*get_loc_elem_child_idx)( - h5_file_t* const, const h5_loc_idx_t); - h5_loc_id_t (*set_loc_elem_child_idx)( - h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); - h5t_lvl_idx_t (*get_loc_elem_level_idx)( - h5_file_t* const, const h5_loc_idx_t); - h5t_lvl_idx_t (*set_loc_elem_level_idx)( - h5_file_t* const, const h5_loc_idx_t, const h5t_lvl_idx_t); - h5_loc_idx_t* (*get_loc_elem_vertex_indices)( - h5_file_t* const, const h5_loc_idx_t); - h5_loc_idx_t (*get_loc_elem_vertex_idx)( - h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); - h5_loc_idx_t (*set_loc_elem_vertex_idx)( - h5_file_t* const, - const h5_loc_idx_t, const h5_loc_idx_t, const h5_loc_idx_t); - h5_loc_idx_t* (*get_loc_elem_neighbor_indices)( - h5_file_t* const, const h5_loc_idx_t); - h5_loc_idx_t (*get_loc_elem_neighbor_idx)( - h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); - h5_loc_idx_t (*set_loc_elem_neighbor_idx)( - h5_file_t* const, - const h5_loc_idx_t, const h5_loc_idx_t, const h5_loc_idx_t); - - h5_generic_glb_elem_t* (*get_glb_elem)( - h5_file_t* const, const h5_loc_idx_t); - h5_glb_id_t (*get_glb_elem_idx)( - h5_file_t* const, const h5_loc_id_t); - h5_glb_id_t (*set_glb_elem_idx)( - h5_file_t* const, const h5_loc_idx_t, const h5_glb_idx_t); - h5_glb_idx_t (*get_glb_elem_parent_idx)( - h5_file_t* const, const h5_loc_id_t); - h5_glb_idx_t (*set_glb_elem_parent_idx)( - h5_file_t* const, const h5_loc_idx_t, const h5_glb_idx_t); - h5_glb_idx_t (*get_glb_elem_child_idx)( - h5_file_t* const, const h5_loc_idx_t); - h5_glb_idx_t (*set_glb_elem_child_idx)( - h5_file_t* const, const h5_loc_idx_t, const h5_glb_idx_t); - h5_glb_idx_t* (*get_glb_elem_vertex_indices)( - h5_file_t* const, const h5_loc_idx_t); - h5_glb_idx_t (*get_glb_elem_vertex_idx)( - h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); - h5_glb_id_t (*set_glb_elem_vertex_idx)( - h5_file_t* const, - const h5_loc_idx_t, const h5_loc_idx_t, const h5_glb_idx_t); - h5_glb_idx_t* (*get_glb_elem_neighbor_indices)( - h5_file_t* const, const h5_loc_idx_t); - h5_glb_idx_t (*get_glb_elem_neighbor_idx)( - h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); - h5_glb_idx_t (*set_glb_elem_neighbor_idx)( - h5_file_t* const, - const h5_loc_idx_t, const h5_loc_idx_t, const h5_glb_idx_t); - h5_err_t (*set_boundary_elem_flag)(h5_file_t* const, const h5_loc_idx_t); - h5_err_t (*clear_boundary_elem_flag)(h5_file_t* const, const h5_loc_idx_t); - int (*is_boundary_elem)(h5_file_t* const, const h5_loc_idx_t); - int (*is_boundary_facet)(h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t); - int (*is_boundary_face)(h5_file_t* const, const int, const h5_loc_idx_t, const h5_loc_idx_t); -}; - -struct h5t_read_methods { - h5_err_t (*init_loc_elems_struct)(h5_file_t* const); - h5_err_t (*init_geom_boundary_info)(h5_file_t* const, h5t_lvl_idx_t); -}; - -struct h5t_adjacency_methods { - h5_err_t (*update_internal_structs)(h5_file_t* const, h5t_lvl_idx_t); - h5_err_t (*release_internal_structs)(h5_file_t* const); - h5_err_t (*get_adjacencies)( - h5_file_t * const, - const h5_loc_id_t, const h5_int32_t, h5_idlist_t**); -}; +struct h5t_read_methods; +struct h5t_store_methods; +struct h5t_retrieve_methods; +struct h5t_access_methods; +struct h5t_adjacency_methods; typedef struct h5t_methods { struct h5t_read_methods *read; diff --git a/src/h5core/h5u_model.c b/src/h5core/h5u_model.c index bcd9cdd..85916bc 100644 --- a/src/h5core/h5u_model.c +++ b/src/h5core/h5u_model.c @@ -115,7 +115,7 @@ h5u_set_num_particles ( } #ifndef PARALLEL_IO -#pragma unused total + UNUSED_ARGUMENT (total); count = u->nparticles; TRY( u->shape = h5priv_create_hdf5_dataspace(f, 1, &count, NULL) ); u->viewstart = 0; diff --git a/src/include/H5Fed_retrieve.h b/src/include/H5Fed_retrieve.h index fc519d5..dd8397b 100644 --- a/src/include/H5Fed_retrieve.h +++ b/src/include/H5Fed_retrieve.h @@ -15,12 +15,12 @@ #ifndef __H5FED_RETRIEVE_H #define __H5FED_RETRIEVE_H -h5t_entity_iterator_t* +h5t_iterator_t* H5FedBeginTraverseEntities ( h5_file_t* const f, int codim ); -h5t_entity_iterator_t* +h5t_iterator_t* H5FedBeginTraverseBoundaryFaces ( h5_file_t* const f, int codim @@ -28,12 +28,12 @@ H5FedBeginTraverseBoundaryFaces ( h5_loc_id_t H5FedTraverseEntities ( h5_file_t* const f, - h5t_entity_iterator_t* iter + h5t_iterator_t* iter ); h5_err_t H5FedEndTraverseEntities ( h5_file_t* const f, - h5t_entity_iterator_t* iter + h5t_iterator_t* iter ); h5_err_t H5FedGetVertexCoordsByIndex ( @@ -62,6 +62,13 @@ H5FedGetVertexIndicesOfTriangle ( h5_loc_idx_t* const vertex_indices ); +h5_err_t +H5FedGetVertexIndicesOfTriangleCClockwise ( + h5_file_t* const f, + h5_loc_id_t entity_id, + h5_loc_idx_t* const vertex_indices + ); + h5_err_t H5FedGetVertexIndicesOfTet ( h5_file_t* const f, diff --git a/src/include/h5core/h5_types.h b/src/include/h5core/h5_types.h index b733518..0612230 100644 --- a/src/include/h5core/h5_types.h +++ b/src/include/h5core/h5_types.h @@ -39,7 +39,7 @@ typedef __int64 int64_t; typedef int64_t h5_int64_t; typedef int32_t h5_int32_t; typedef int64_t h5_id_t; -typedef h5_int32_t h5t_lvl_idx_t; +typedef int16_t h5t_lvl_idx_t; typedef h5_int32_t h5t_elem_flags_t; typedef int64_t h5_glb_idx_t; // type for a global index typedef int64_t h5_loc_idx_t; // type for a local index diff --git a/src/include/h5core/h5t_map.h b/src/include/h5core/h5t_map.h index 6746a04..b0fc2aa 100644 --- a/src/include/h5core/h5t_map.h +++ b/src/include/h5core/h5t_map.h @@ -66,6 +66,13 @@ h5t_get_vertex_indices_of_triangle ( h5_loc_idx_t* vertex_indices ); +h5_err_t +h5t_get_vertex_indices_of_triangle_cclockwise ( + h5_file_t* const f, + const h5_loc_id_t entity_id, + h5_loc_idx_t* vertex_indices + ); + h5_err_t h5t_get_vertex_indices_of_triangle2 ( h5_file_t* const f, diff --git a/src/include/h5core/h5t_retrieve.h b/src/include/h5core/h5t_retrieve.h index a3af823..354408c 100644 --- a/src/include/h5core/h5t_retrieve.h +++ b/src/include/h5core/h5t_retrieve.h @@ -1,65 +1,52 @@ #ifndef __H5T_RETRIEVE_H #define __H5T_RETRIEVE_H -typedef struct h5t_entity_iterator { - h5_id_t elem_idx; // local element id - h5_id_t face_idx; // face id according reference element - int codim; // dimension of entities to traverse - const h5t_ref_elem_t* ref_elem; // pointer to reference element - h5_err_t (*find)( - h5_file_t *const f, - h5_id_t face_idx, - h5_id_t elem_idx, - h5_idlist_t **retval); - h5_loc_id_t (*iter)( - h5_file_t *const f, - struct h5t_entity_iterator* iter); -} h5t_entity_iterator_t; +typedef struct h5t_iterator h5t_iterator_t; h5_err_t -h5t_alloc_entity_iterator ( +h5t_init_mesh_iterator ( h5_file_t* f, - h5t_entity_iterator_t** iter, + h5t_iterator_t* iter, const int codim ); h5_err_t -h5t_alloc_boundary_face_iterator ( +h5t_create_mesh_iterator ( h5_file_t* f, - h5t_entity_iterator_t** iter, + h5t_iterator_t** iter, const int codim ); +h5_err_t +h5t_create_boundary_face_iterator ( + h5_file_t* f, + h5t_iterator_t** iter, + const int codim + ); + +h5_err_t +h5t_create_mtag_iterator ( + h5_file_t* f, + h5t_iterator_t** iter, + const char* name + ); + h5_err_t h5t_release_entity_iterator ( h5_file_t* const f, - h5t_entity_iterator_t* iter - ); - -h5_err_t -h5t_begin_iterate_entities ( - h5_file_t* f, - h5t_entity_iterator_t* iter, - const int codim - ); - -h5_err_t -h5t_begin_iterate_boundary_faces ( - h5_file_t* f, - h5t_entity_iterator_t* iter, - const int codim + h5t_iterator_t* iter ); h5_id_t h5t_iterate_entities ( h5_file_t * const f, - h5t_entity_iterator_t *iter + h5t_iterator_t *iter ); h5_err_t h5t_end_iterate_entities ( h5_file_t * const f, - h5t_entity_iterator_t *iter + h5t_iterator_t *iter ); diff --git a/src/include/h5core/h5t_tags.h b/src/include/h5core/h5t_tags.h index 2380e06..0dc143a 100644 --- a/src/include/h5core/h5t_tags.h +++ b/src/include/h5core/h5t_tags.h @@ -1,23 +1,31 @@ #ifndef __H5T_TAGS_H #define __H5T_TAGS_H -typedef struct h5t_tagset H5T_Tagset; +typedef struct h5t_tagset h5t_tagset_t; +typedef struct h5t_tagcontainer h5t_tagcontainer_t; +h5_err_t +h5t_mtagset_exists ( + h5_file_t* const f, + h5t_tagcontainer_t* ctn, + char* name + ); h5_err_t h5t_add_mtagset ( h5_file_t* const f, char name[], - h5_id_t id + h5_id_t type ); h5_err_t h5t_remove_mtagset ( h5_file_t* const f, const char name[] ); -h5_err_t h5t_open_mtagset ( +h5_err_t +h5t_open_mtagset ( h5_file_t* const f, const char *name, - H5T_Tagset** retval + h5t_tagset_t** retval ); h5_ssize_t h5t_get_num_mtagsets ( @@ -68,7 +76,7 @@ h5t_remove_mtag_by_name ( h5_ssize_t h5t_get_tag ( h5_file_t *const f, - const H5T_Tagset *tagset, + const h5t_tagset_t *tagset, const h5_loc_id_t entity_id, size_t* const dim, void* const vals @@ -77,7 +85,7 @@ h5t_get_tag ( h5_err_t h5t_remove_mtag ( h5_file_t* const f, - H5T_Tagset* tagset, + h5t_tagset_t* tagset, const h5_loc_id_t entity_id );