From 91b05438667dea39e51ec704516b1ddc82d547bd Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Fri, 12 Jun 2009 23:56:07 +0000 Subject: [PATCH] edge traversing added --- src/H5Fed.c | 4 +- src/H5Fed_map.c | 12 ++- src/H5Fed_map.h | 9 +- src/H5Fed_retrieve.c | 28 +++++- src/H5Fed_retrieve.h | 43 ++++++--- src/h5_core/Makefile.am | 3 + src/h5_core/h5_core.h | 1 + src/h5_core/h5_core_private.h | 1 + src/h5_core/h5_errno.h | 4 +- src/h5_core/h5_openclose.c | 8 +- src/h5_core/h5_syscall.c | 6 +- src/h5_core/h5t_adjacencies.c | 67 +++++-------- src/h5_core/h5t_adjacencies_private.h | 9 ++ src/h5_core/h5t_boundaries.c | 20 ++-- src/h5_core/h5t_map.c | 13 ++- src/h5_core/h5t_map.h | 7 ++ src/h5_core/h5t_openclose.c | 5 +- src/h5_core/h5t_readwrite.c | 133 -------------------------- src/h5_core/h5t_readwrite.h | 81 ---------------- src/h5_core/h5t_storemesh.c | 13 ++- src/h5_core/h5t_types_private.h | 44 +++++++-- 21 files changed, 203 insertions(+), 308 deletions(-) diff --git a/src/H5Fed.c b/src/H5Fed.c index 1d5d491..5747078 100644 --- a/src/H5Fed.c +++ b/src/H5Fed.c @@ -33,7 +33,7 @@ h5_err_t H5FedCloseMesh ( h5_file_t * const f ) { - return -1; + return h5_error_not_implemented ( f, __FILE__, __func__, __LINE__ ); } h5_err_t @@ -50,5 +50,5 @@ H5FedLinkMeshToStep ( h5_file_t * f, const h5_id_t mesh_id ) { - return -1; + return h5_error_not_implemented ( f, __FILE__, __func__, __LINE__ ); } diff --git a/src/H5Fed_map.c b/src/H5Fed_map.c index b194075..f2d63b7 100644 --- a/src/H5Fed_map.c +++ b/src/H5Fed_map.c @@ -42,7 +42,7 @@ H5FedMapTriangle2GlobalID ( } h5_err_t -H5FedMapEntityID2LocalVids ( +H5FedMapEntity2LocalVids ( h5_file_t * const f, h5_id_t local_id, h5_id_t *local_vids @@ -50,3 +50,13 @@ H5FedMapEntityID2LocalVids ( SET_FNAME ( f, __func__ ); return h5t_get_local_vids_of_entity ( f, local_id, local_vids ); } + +h5_id_t +H5FedMapLocalVids2Entity ( + h5_file_t * const f, + h5_id_t *local_vids, + h5_oid_t etype + ) { + SET_FNAME ( f, __func__ ); + return h5t_map_local_vids_to_entity_id ( f, local_vids, etype ); +} diff --git a/src/H5Fed_map.h b/src/H5Fed_map.h index 92896a5..775575d 100644 --- a/src/H5Fed_map.h +++ b/src/H5Fed_map.h @@ -32,10 +32,17 @@ H5FedMapTriangle2GlobalID ( ); h5_err_t -H5FedMapEntityID2LocalVids ( +H5FedMapEntity2LocalVids ( h5_file_t * const f, h5_id_t local_id, h5_id_t *localvids ); + +h5_id_t +H5FedMapLocalVids2Entity ( + h5_file_t * const f, + h5_id_t *local_vids, + h5_oid_t etype + ); #endif diff --git a/src/H5Fed_retrieve.c b/src/H5Fed_retrieve.c index 88b9bc3..ae458fa 100644 --- a/src/H5Fed_retrieve.c +++ b/src/H5Fed_retrieve.c @@ -24,7 +24,7 @@ H5FedBeginTraverseVertices ( h5_file_t * const f /*!< file handle */ ) { SET_FNAME ( f, __func__ ); - return h5t_start_traverse_vertices ( f ); + return h5t_begin_traverse_vertices ( f ); } /*! @@ -54,13 +54,37 @@ H5FedEndTraverseVertices ( return h5t_end_traverse_vertices ( f ); } +h5_err_t +H5FedBeginTraverseEdges ( + h5_file_t * const f /*!< file handle */ + ) { + SET_FNAME ( f, __func__ ); + return h5t_begin_traverse_edges ( f ); +} + +h5_id_t +H5FedTraverseEdges ( + h5_file_t * const f, + h5_id_t * const local_vids + ) { + SET_FNAME ( f, __func__ ); + return h5t_traverse_edges ( f, local_vids ); +} + +h5_err_t +H5FedEndTraverseEdges ( + h5_file_t * const f /*!< file handle */ + ) { + SET_FNAME ( f, __func__ ); + return h5t_end_traverse_edges ( f ); +} h5_err_t H5FedBeginTraverseElements ( h5_file_t * const f /*!< file handle */ ) { SET_FNAME ( f, __func__ ); - return h5t_start_traverse_elems ( f ); + return h5t_begin_traverse_elems ( f ); } /*! diff --git a/src/H5Fed_retrieve.h b/src/H5Fed_retrieve.h index 69998a2..0aac703 100644 --- a/src/H5Fed_retrieve.h +++ b/src/H5Fed_retrieve.h @@ -17,36 +17,57 @@ h5_err_t H5FedBeginTraverseVertices ( - h5_file_t * f + h5_file_t * const f ); h5_id_t H5FedTraverseVertices ( - h5_file_t * f, + h5_file_t * const f, h5_id_t * const id, h5_float64_t P[3] ); h5_err_t H5FedEndTraverseVertices ( - h5_file_t * f + h5_file_t * const f ); h5_err_t -H5FedBeginTraverseElements ( - h5_file_t * f +H5FedBeginTraverseEdges ( + h5_file_t * const f ); h5_id_t -H5FedTraverseElements ( - h5_file_t * f, - h5_id_t * const id, - h5_id_t * const parent_id, - h5_id_t * const vertex_ids +H5FedTraverseEdges ( + h5_file_t * const f, + h5_id_t * const local_vids + ); + +h5_err_t +H5FedEndTraverseEdges ( + h5_file_t * const f ); h5_err_t H5FedEndTraverseElements ( - h5_file_t * f + h5_file_t * const f + ); + +h5_err_t +H5FedBeginTraverseElements ( + h5_file_t * const f + ); + +h5_id_t +H5FedTraverseElements ( + h5_file_t * const f, + h5_id_t * const id, + h5_id_t * const parent_id, + h5_id_t * const local_vids + ); + +h5_err_t +H5FedEndTraverseElements ( + h5_file_t * const f ); #endif diff --git a/src/h5_core/Makefile.am b/src/h5_core/Makefile.am index ea9b867..61b93e8 100644 --- a/src/h5_core/Makefile.am +++ b/src/h5_core/Makefile.am @@ -56,6 +56,8 @@ EXTRA_HEADERS = \ h5t_openclose.h \ h5t_readwrite.h \ h5t_readwrite_private.h \ + h5t_retrieve.h \ + h5t_retrieve_private.h \ h5t_storemesh.h \ h5t_storemesh_private.h \ h5u_errorhandling_private.h \ @@ -98,6 +100,7 @@ libH5_core_a_SOURCES = \ h5t_map.c \ h5t_openclose.c \ h5t_readwrite.c \ + h5t_retrieve.c \ h5t_storemesh.c \ h5u_readwrite.c \ hdf5_misc.c diff --git a/src/h5_core/h5_core.h b/src/h5_core/h5_core.h index 008cad3..e76018d 100644 --- a/src/h5_core/h5_core.h +++ b/src/h5_core/h5_core.h @@ -15,6 +15,7 @@ #include "h5t_map.h" #include "h5t_openclose.h" #include "h5t_readwrite.h" +#include "h5t_retrieve.h" #include "h5t_storemesh.h" #include "h5u_readwrite.h" #include "hdf5_misc.h" diff --git a/src/h5_core/h5_core_private.h b/src/h5_core/h5_core_private.h index c0cf92c..763f98f 100644 --- a/src/h5_core/h5_core_private.h +++ b/src/h5_core/h5_core_private.h @@ -22,6 +22,7 @@ #include "h5t_errorhandling_private.h" #include "h5t_map_private.h" #include "h5t_readwrite_private.h" +#include "h5t_retrieve_private.h" #include "h5t_storemesh_private.h" #include "h5u_errorhandling_private.h" diff --git a/src/h5_core/h5_errno.h b/src/h5_core/h5_errno.h index dd494bd..e535dd8 100644 --- a/src/h5_core/h5_errno.h +++ b/src/h5_core/h5_errno.h @@ -2,7 +2,9 @@ #define __H5_ERRNO_H #define H5_SUCCESS 0 -#define H5_ERR -1 +#define H5_OK H5_SUCCESS +#define H5_NOK -1 +#define H5_ERR -2 #define H5_ERR_BADF -9 #define H5_ERR_NOMEM -12 #define H5_ERR_INVAL -22 diff --git a/src/h5_core/h5_openclose.c b/src/h5_core/h5_openclose.c index 4c216b1..db93fe8 100644 --- a/src/h5_core/h5_openclose.c +++ b/src/h5_core/h5_openclose.c @@ -390,7 +390,7 @@ h5_get_stepname_fmt ( const h5_size_t l_name, /*!< length of buffer name */ h5_size_t *width /*!< OUT: Width of the number */ ) { - return -1; + return h5_error_not_implemented ( f, __FILE__, __func__, __LINE__ ); } /*! @@ -404,7 +404,7 @@ h5_id_t h5_get_step ( h5_file_t * f /*!< file handle */ ) { - return -1; + return h5_error_not_implemented ( f, __FILE__, __func__, __LINE__ ); } /*! @@ -437,7 +437,7 @@ h5_err_t h5_start_traverse_steps ( h5_file_t * f /*!< file handle */ ) { - return -1; + return h5_error_not_implemented ( f, __FILE__, __func__, __LINE__ ); } /*! @@ -451,5 +451,5 @@ h5_err_t h5_traverse_steps ( h5_file_t * f /*!< file handle */ ) { - return -1; + return h5_error_not_implemented ( f, __FILE__, __func__, __LINE__ ); } diff --git a/src/h5_core/h5_syscall.c b/src/h5_core/h5_syscall.c index ca22c03..9c9c010 100644 --- a/src/h5_core/h5_syscall.c +++ b/src/h5_core/h5_syscall.c @@ -16,7 +16,7 @@ _h5_alloc ( f, H5_ERR_NOMEM, "Out of memory." ); - return (void*)(-1); + return (void*)(H5_ERR); } return ptr; } @@ -43,7 +43,7 @@ _h5_tsearch ( f, H5_ERR_NOMEM, "Out of memory." ); - return (void*)(-1); + return (void*)(H5_ERR); } return ptr; } @@ -57,7 +57,7 @@ _h5_tfind ( ) { void *ptr = tfind ( key, rootp, compar ); if ( ptr == NULL ) { - return (void*)(-1); + return (void*)(H5_ERR); } return ptr; } diff --git a/src/h5_core/h5t_adjacencies.c b/src/h5_core/h5t_adjacencies.c index ea17bc2..b86f3fe 100644 --- a/src/h5_core/h5t_adjacencies.c +++ b/src/h5_core/h5t_adjacencies.c @@ -18,12 +18,6 @@ #include "h5_core/h5_core.h" #include "h5_core/h5_core_private.h" -static h5_err_t -_compute_children_of_edge ( - h5_file_t * const f, - h5_id_t local_kid, - h5_idlist_t *children - ); /* compute T(V) @@ -140,17 +134,8 @@ _find_te ( return H5_SUCCESS; } -/* - pass edge by: - edge ID - vertices - face and element ID - - -*/ - -static h5_err_t -_find_te2 ( +h5_err_t +_h5t_find_te2 ( h5_file_t * const f, h5_te_node_t **rnode, h5_id_t face_id, @@ -521,7 +506,7 @@ _compute_children_of_edge ( h5_te_node_t *te; int i,k; - TRY ( _find_te2 ( + TRY ( _h5t_find_te2 ( f, &te, _h5t_get_face_id ( local_kid ), @@ -686,28 +671,6 @@ _add_edge ( return H5_SUCCESS; } -h5_err_t -_h5t_tet_is_on_level ( - h5_file_t * const f, - h5_tet_data_t *tet_dta - ) { - h5t_fdata_t *t = f->t; - - if ( tet_dta->level_id > t->cur_level ) { - /* No. Tetrahedron has been defined on higher level */ - return H5_ERR; - } - - h5_id_t local_child_eid = tet_dta->local_child_eid; - if ( ( local_child_eid >= 0 ) && - ( t->elems_data.tets[local_child_eid].level_id <= t->cur_level ) ) { - /* No. Tetrahedron has children an a level <= current level */ - return H5_ERR; - } - - return H5_SUCCESS; -} - h5_id_t * _h5t_get_edge_of_tet ( const h5_tet_data_t *tet, @@ -738,7 +701,7 @@ h5t_get_edges_upadjacent_to_vertex ( h5_id_t vertex_id = _h5t_get_face_id ( tv->items[i] ); h5_tet_data_t *tet = &t->elems_data.tets[local_eid]; - if ( _h5t_tet_is_on_level ( f, tet ) == H5_ERR ) { + if ( _h5t_elem_is_on_cur_level ( f, (h5_element_data_t*)tet ) == H5_NOK ) { continue; } int map[4][3] = { { 0, 2, 3 }, { 0, 1, 4 }, { 2, 1, 5 }, { 3, 4, 5} }; @@ -783,7 +746,7 @@ h5t_get_triangles_upadjacent_to_vertex ( h5_id_t vertex_id = _h5t_get_face_id ( tv->items[i] ); h5_tet_data_t *tet = &t->elems_data.tets[local_eid]; - if ( _h5t_tet_is_on_level ( f, tet ) == H5_ERR ) { + if ( _h5t_elem_is_on_cur_level ( f, (h5_element_data_t*)tet ) == H5_NOK ) { continue; } int map[4][3] = { { 1, 2, 3 }, { 0, 2, 3 }, { 0, 1, 3 }, { 0, 1, 2} }; @@ -817,7 +780,7 @@ h5t_get_tets_upadjacent_to_vertex ( h5_id_t local_eid = _h5t_get_elem_id ( tv->items[i] ); h5_tet_data_t *tet = &t->elems_data.tets[local_eid]; - if ( _h5t_tet_is_on_level ( f, tet ) == H5_ERR ) { + if ( _h5t_elem_is_on_cur_level ( f, (h5_element_data_t*)tet ) == H5_NOK ) { continue; } TRY ( _h5_search_idlist ( f, *list, local_eid ) ); @@ -825,6 +788,24 @@ h5t_get_tets_upadjacent_to_vertex ( return H5_SUCCESS; } +h5_err_t +h5t_get_tets_upadjacent_to_edge ( + h5_file_t * const f, + const h5_id_t local_kid, + h5_idlist_t **list + ) { + h5_idlist_t children; + memset ( &children, 0, sizeof(children) ); + TRY ( _h5_alloc_idlist ( f, list, 8 ) ); + TRY( _compute_children_of_edge ( f, local_kid, &children ) ); + int i; + for ( i = 0; i < children.num_items; i++ ) { + h5_id_t local_eid = _h5t_get_elem_id ( children.items[i] ); + TRY ( _h5_search_idlist ( f, *list, local_eid ) ); + } + return H5_SUCCESS; +} + h5_err_t h5t_release_list_of_adjacencies ( h5_file_t * const f, diff --git a/src/h5_core/h5t_adjacencies_private.h b/src/h5_core/h5t_adjacencies_private.h index 27bfbd3..03f2531 100644 --- a/src/h5_core/h5t_adjacencies_private.h +++ b/src/h5_core/h5t_adjacencies_private.h @@ -5,4 +5,13 @@ h5_err_t _h5t_rebuild_adj_data ( h5_file_t * const f ); + +h5_err_t +_h5t_find_te2 ( + h5_file_t * const f, + h5_te_node_t **rnode, + h5_id_t face_id, + h5_id_t local_eid + ); + #endif diff --git a/src/h5_core/h5t_boundaries.c b/src/h5_core/h5t_boundaries.c index 2fe3386..171b724 100644 --- a/src/h5_core/h5t_boundaries.c +++ b/src/h5_core/h5t_boundaries.c @@ -60,15 +60,16 @@ h5t_set_boundary_label ( h5_file_t * const f, const char * const bname ) { - return -1; + return h5_error_not_implemented ( f, __FILE__, __func__, __LINE__ ); } + h5_err_t h5t_get_boundary_label ( h5_file_t * const f, char * const boundary_name, const size_t size ) { - return -1; + return h5_error_not_implemented ( f, __FILE__, __func__, __LINE__ ); } h5_err_t @@ -105,7 +106,7 @@ h5t_open_boundary_with_label ( h5_file_t * const f, const char * const boundary_label ) { - return -1; + return h5_error_not_implemented ( f, __FILE__, __func__, __LINE__ ); } h5_err_t @@ -228,7 +229,7 @@ h5_id_t h5t_get_num_boundaryfaces ( h5_file_t * const f ) { - return -1; + return h5_error_not_implemented ( f, __FILE__, __func__, __LINE__ ); } h5_id_t @@ -254,7 +255,8 @@ h5t_store_boundaryface ( return h5t_store_boundaryface_local_id ( f, local_tid ); } default: - return -1; + return h5_error_not_implemented ( + f, __FILE__, __func__, __LINE__ ); } } @@ -273,7 +275,8 @@ h5t_store_boundaryface_global_id ( return h5t_store_boundaryface_local_id ( f, local_tid ); } default: - return -1; + return h5_error_not_implemented ( + f, __FILE__, __func__, __LINE__ ); } } @@ -310,7 +313,8 @@ h5t_store_boundaryface_local_id ( return H5_SUCCESS; } default: - return -1; + return h5_error_not_implemented ( + f, __FILE__, __func__, __LINE__ ); } } @@ -335,5 +339,5 @@ h5t_traverse_boundary_faces ( h5_id_t * const parent_id, h5_id_t vids[] ) { - return -1; + return h5_error_not_implemented ( f, __FILE__, __func__, __LINE__ ); } diff --git a/src/h5_core/h5t_map.c b/src/h5_core/h5t_map.c index cc5dbc4..0bd1e59 100644 --- a/src/h5_core/h5t_map.c +++ b/src/h5_core/h5t_map.c @@ -566,7 +566,7 @@ _tetm_contain_triangle ( int i, h5_id_t local_eid ) { - struct h5t_fdata *t = f->t; + h5t_fdata_t *t = f->t; h5_id_t *local_vids_of_elem = t->elems_data.tets[local_eid].local_vids; if ( i == 0 && @@ -585,7 +585,7 @@ _tetm_contain_triangle ( local_vids[1] == local_vids_of_elem[2] && local_vids[2] == local_vids_of_elem[3] ) return 3; - return -1; + return H5_NOK; } /*! @@ -973,3 +973,12 @@ h5t_get_local_vids_of_entity ( } return H5_SUCCESS; } + +h5_id_t +h5t_map_local_vids_to_entity_id ( + h5_file_t * const f, + h5_id_t *local_vids, + h5_oid_t etype + ) { + return h5_error_not_implemented ( f, __FILE__, __func__, __LINE__ ); +} diff --git a/src/h5_core/h5t_map.h b/src/h5_core/h5t_map.h index e455c35..d65f948 100644 --- a/src/h5_core/h5t_map.h +++ b/src/h5_core/h5t_map.h @@ -81,4 +81,11 @@ h5t_get_local_vids_of_entity ( h5_id_t local_id, h5_id_t *local_vids ); + +h5_id_t +h5t_map_local_vids_to_entity_id ( + h5_file_t * const f, + h5_id_t *local_vids, + h5_oid_t etype + ); #endif diff --git a/src/h5_core/h5t_openclose.c b/src/h5_core/h5t_openclose.c index 125ce8b..3d1a7c7 100644 --- a/src/h5_core/h5t_openclose.c +++ b/src/h5_core/h5t_openclose.c @@ -440,7 +440,8 @@ h5t_open_mesh ( t->elem_tid = t->dtypes.h5_triangle_t; break; default: - return -1; + return h5_error_internal ( + f, __FILE__, __func__, __LINE__ ); } TRY( _h5t_open_mesh_group ( f ) ); @@ -518,8 +519,6 @@ h5t_open_level ( if ( (id < 0) || (id >= t->num_levels) ) return HANDLE_H5_OUT_OF_RANGE_ERR ( f, "Level", id ); t->cur_level = id; - t->last_retrieved_vid = -1; - t->last_retrieved_eid = -1; return H5_SUCCESS; } diff --git a/src/h5_core/h5t_readwrite.c b/src/h5_core/h5t_readwrite.c index ae9abd2..f526327 100644 --- a/src/h5_core/h5t_readwrite.c +++ b/src/h5_core/h5t_readwrite.c @@ -174,48 +174,6 @@ _h5t_read_vertices ( } -h5_err_t -h5t_start_traverse_vertices ( - h5_file_t * f - ) { - struct h5t_fdata *t = f->t; - - t->last_retrieved_vid = -1; - return H5_SUCCESS; -} - -h5_id_t -h5t_traverse_vertices ( - h5_file_t * f, /*!< file handle */ - h5_id_t * const id, /*!< OUT: global vertex id */ - h5_float64_t P[3] /*!< OUT: coordinates */ - ) { - struct h5t_fdata *t = f->t; - - if ( t->vertices == NULL ) { - TRY ( _h5t_read_mesh ( f ) ); - } - if ( t->last_retrieved_vid+1 >= t->num_vertices[t->cur_level] ) { - h5_debug ( f, "Traversing done!" ); - return 0; - } - h5_vertex_t *vertex = &t->vertices[++t->last_retrieved_vid]; - *id = vertex->global_vid; - memcpy ( P, &vertex->P, sizeof ( vertex->P ) ); - - return t->last_retrieved_vid; -} - -h5_err_t -h5t_end_traverse_vertices ( - h5_file_t * f - ) { - struct h5t_fdata *t = f->t; - - t->last_retrieved_vid = -1; - return H5_SUCCESS; -} - h5_err_t _h5t_read_num_elems ( @@ -294,97 +252,6 @@ _h5t_read_elems ( return H5_SUCCESS; } -h5_err_t -h5t_start_traverse_elems ( - h5_file_t * f - ) { - h5t_fdata_t *t = f->t; - t->last_retrieved_eid = -1; - return H5_SUCCESS; -} - -/*! - \param[in] f file handle - \param[out] global_eid Global element id - \param[out] local_parent_id Local parent id - \param[out] vids Local vertex id -*/ -h5_id_t -h5t_traverse_elems ( - h5_file_t * const f, - h5_id_t * const global_eid, - h5_id_t * const local_parent_id, - h5_id_t *local_vids - ) { - h5t_fdata_t *t = f->t; - h5_element_t *elem; - h5_element_data_t *elem_data; - h5_id_t local_child_eid; - h5_id_t refined_on_level = -1; - - if ( t->elems.data == NULL ) { - TRY ( _h5t_read_elems ( f ) ); - } - if ( t->last_retrieved_eid+1 >= t->num_elems[t->cur_level] ) { - h5_debug ( f, "Traversing done!" ); - return 0; - } - - /* - Skip elements which have been refined on a level less than the current one. - */ - do { - switch ( t->mesh_type ) { - case H5_OID_TETRAHEDRON: - elem = (h5_element_t*) - &t->elems.tets[++t->last_retrieved_eid]; - elem_data = (h5_element_data_t*) - &t->elems_data.tets[t->last_retrieved_eid]; - local_child_eid = elem_data->local_child_eid; - refined_on_level = ( local_child_eid >= 0 ) ? - t->elems_data.tets[local_child_eid].level_id : - t->cur_level+1; /* this means "not refined" */ - break; - case H5_OID_TRIANGLE: - elem = (h5_element_t*) - &t->elems.tris[++t->last_retrieved_eid]; - elem_data = (h5_element_data_t*) - &t->elems_data.tris[t->last_retrieved_eid]; - local_child_eid = elem_data->local_child_eid; - refined_on_level = ( elem_data->local_child_eid >= 0 ) ? - t->elems_data.tris[local_child_eid].level_id : - t->cur_level+1; /* this means "not refined" */ - break; - default: - return h5_error_internal ( - f, __FILE__, __func__, __LINE__ ); - } - if ( t->last_retrieved_eid >= t->num_elems[t->cur_level] ) { - return h5_error_internal ( - f, __FILE__, __func__, __LINE__ ); - } - } - while ( refined_on_level <= t->cur_level ); - - *global_eid = elem->global_eid; - *local_parent_id = elem_data->local_parent_eid; - memcpy ( - local_vids, - &elem_data->local_vids, - sizeof ( elem_data->local_vids[0] ) * t->mesh_type ); - - return t->last_retrieved_eid; -} - -h5_err_t -h5t_end_traverse_elems ( - h5_file_t * f - ) { - h5t_fdata_t *t = f->t; - t->last_retrieved_eid = -1; - return H5_SUCCESS; -} - h5_err_t _h5t_read_mesh ( h5_file_t *f diff --git a/src/h5_core/h5t_readwrite.h b/src/h5_core/h5t_readwrite.h index c49e90d..e20d093 100644 --- a/src/h5_core/h5t_readwrite.h +++ b/src/h5_core/h5t_readwrite.h @@ -11,90 +11,9 @@ _h5t_read_vertices ( h5_file_t * f ); -h5_err_t -h5t_start_traverse_vertices ( - h5_file_t * f - ); - -h5_id_t -h5t_traverse_vertices ( - h5_file_t * f, - h5_id_t * const id, - h5_float64_t P[3] - ); - -h5_err_t -h5t_end_traverse_vertices ( - h5_file_t * f - ); - -h5_err_t -h5t_end_traverse_elems ( - h5_file_t * const f - ); - -h5_size_t -h5t_add_num_tets ( - h5_file_t * f, - const h5_size_t num - ) ; - -h5_size_t -h5t_add_num_triangles ( - h5_file_t * f, - const h5_size_t num - ) ; - -h5_size_t -h5t_begin_store_elems ( - h5_file_t * f, - const h5_size_t num - ) ; - h5_err_t _h5t_read_elems ( h5_file_t * f ); -h5_err_t -h5t_start_traverse_elems ( - h5_file_t * f - ); - -h5_id_t -h5t_traverse_elems ( - h5_file_t * f, - h5_id_t * const id, - h5_id_t * const parent_id, - h5_id_t * vids - ); - - -h5_err_t -h5t_start_traverse_tets ( - h5_file_t * f - ); - -h5_id_t -h5t_traverse_tets ( - h5_file_t * f, - h5_id_t * const id, - h5_id_t * const parent_id, - h5_id_t vids[4] - ); - - -h5_err_t -h5t_start_traverse_triangles ( - h5_file_t * f - ); - -h5_id_t -h5t_traverse_triangles ( - h5_file_t * f, - h5_id_t * const id, - h5_id_t * const parent_id, - h5_id_t vids[3] - ); - #endif diff --git a/src/h5_core/h5t_storemesh.c b/src/h5_core/h5t_storemesh.c index 4c80807..b5b4108 100644 --- a/src/h5_core/h5t_storemesh.c +++ b/src/h5_core/h5t_storemesh.c @@ -80,7 +80,9 @@ h5t_add_level ( /* t->num_levels will be set to zero on file creation(!) */ if ( t->num_levels == -1 ) { /* unknown number of levels */ /* determine number of levels */ - return -1; /* not implemented */ + return h5_error_not_implemented ( + f, __FILE__, __func__, __LINE__ ); + } t->cur_level = t->num_levels++; t->dsinfo_num_vertices.dims[0] = t->num_levels; @@ -209,7 +211,8 @@ _h5t_alloc_num_elems ( sizeof_lelem = sizeof ( t->elems_data.tris[0] ); break; default: - return -1; + return h5_error_internal ( + f, __FILE__, __func__, __LINE__ ); } size_t size = new_num_elems * sizeof_elem; @@ -288,7 +291,8 @@ h5t_store_elem ( case H5_OID_TRIANGLE: return _h5t_store_triangle ( f, local_parent_eid, local_vids ); default: - return -1; + return h5_error_internal ( + f, __FILE__, __func__, __LINE__ ); } } @@ -449,7 +453,8 @@ h5t_refine_elem ( case H5_OID_TRIANGLE: return _h5t_refine_triangle ( f, local_eid ); default: - return -1; + return h5_error_internal ( + f, __FILE__, __func__, __LINE__ ); } } diff --git a/src/h5_core/h5t_types_private.h b/src/h5_core/h5t_types_private.h index 7e44989..74a8b42 100644 --- a/src/h5_core/h5t_types_private.h +++ b/src/h5_core/h5t_types_private.h @@ -157,6 +157,31 @@ struct h5t_adjacencies { }; typedef struct h5t_adjacencies h5t_adjacencies_t; +struct h5t_elem_iterator { + h5_id_t cur_eid; +}; +typedef struct h5t_elem_iterator h5t_elem_iterator_t; + +struct h5t_vertex_iterator { + h5_id_t cur_vid; +}; +typedef struct h5t_vertex_iterator h5t_vertex_iterator_t; + +struct h5t_entity_iterator { + h5_id_t cur_fid; + h5_id_t cur_eid; +}; +typedef struct h5t_entity_iterator h5t_entity_iterator_t; + +struct h5t_iterators { + h5t_vertex_iterator_t vertex; + h5t_entity_iterator_t edge; + h5t_entity_iterator_t triangle; + h5t_elem_iterator_t elem; +}; + +typedef struct h5t_iterators h5t_iterators_t; + struct h5t_fdata { /*** book-keeping ***/ char mesh_name[16]; @@ -172,13 +197,22 @@ struct h5t_fdata { h5_id_t level_changed; h5_id_t storing_data; + hid_t topo_gid; /* grp id of mesh in current + level */ + hid_t meshes_gid; + hid_t mesh_gid; + + /*** type ids' for base & compound data types ***/ + h5_dtypes_t dtypes; + + h5t_iterators_t iters; + /*** vertices ***/ h5_vertex_t *vertices; h5_vertex_data_t *vertices_data; h5_size_t *num_vertices; h5_idmap_t map_vertex_g2l; /* map global id to local id */ h5_idlist_t sorted_lvertices; - h5_id_t last_retrieved_vid; h5_id_t last_stored_vid; h5_dataset_info_t dsinfo_vertices; h5_dataset_info_t dsinfo_num_vertices; @@ -199,7 +233,6 @@ struct h5t_fdata { */ h5_idlist_t sorted_elems[H5_MAX_VERTICES_PER_ELEM]; - h5_id_t last_retrieved_eid; h5_id_t last_stored_eid; h5_dataset_info_t dsinfo_elems; h5_dataset_info_t dsinfo_num_elems; @@ -212,14 +245,7 @@ struct h5t_fdata { boundary_t boundary; h5t_adjacencies_t adjacencies; - /*** HDF5 objects ***/ - hid_t topo_gid; /* grp id of mesh in current - level */ - hid_t meshes_gid; - hid_t mesh_gid; - /*** type ids' for base & compound data types ***/ - h5_dtypes_t dtypes; }; typedef struct h5t_fdata h5t_fdata_t;