From bc84ce205a0f24179faa7dad2350c45729e6474b Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 27 Oct 2011 12:16:24 +0000 Subject: [PATCH] API to retrieve local neighbor indicies of an element added --- src/h5core/h5t_retrieve.c | 19 +++++++++++++++++++ src/include/H5Fed_retrieve.h | 13 +++++++++++++ src/include/h5core/h5t_retrieve.h | 2 ++ 3 files changed, 34 insertions(+) diff --git a/src/h5core/h5t_retrieve.c b/src/h5core/h5t_retrieve.c index 39c6511..3ac344e 100644 --- a/src/h5core/h5t_retrieve.c +++ b/src/h5core/h5t_retrieve.c @@ -310,3 +310,22 @@ h5t_get_vertex_coords_by_id ( H5_CORE_API_RETURN (H5_SUCCESS); } +h5_err_t +h5t_get_neighbor_indices ( + h5t_mesh_t* const m, + h5_loc_id_t entity_id, + h5_loc_idx_t* neighbor_indices + ) { + H5_CORE_API_ENTER (h5_err_t, + "m=%p, entity_id=%llu, neighbor_indices=%p", + m, + (long long unsigned)entity_id, + neighbor_indices); + h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id); + h5_loc_idx_t* indices = h5tpriv_get_loc_elem_neighbor_indices (m, elem_idx); + int num_facets = h5tpriv_ref_elem_get_num_facets (m); + for (int i = 0; i < num_facets; i++) { + neighbor_indices[i] = indices[i]; + } + H5_CORE_API_RETURN (H5_SUCCESS); +} diff --git a/src/include/H5Fed_retrieve.h b/src/include/H5Fed_retrieve.h index 0144c17..d09aab4 100644 --- a/src/include/H5Fed_retrieve.h +++ b/src/include/H5Fed_retrieve.h @@ -173,6 +173,19 @@ H5FedGetVertexIndicesOfEntity ( H5_API_RETURN (h5t_get_vertex_indices_of_entity (m, entity_id, vertex_indices)); } +static inline h5_err_t +H5FedGetNeighborIndicesOfElement ( + h5t_mesh_t* const m, + h5_loc_id_t entity_id, + h5_loc_idx_t* neighbor_indices + ) { + H5_API_ENTER (h5_err_t, + "m=%p, entity_id=%lld, neighbor_indices=%p", + m, (long long)entity_id, neighbor_indices); + H5_API_RETURN (h5t_get_neighbor_indices (m, entity_id, neighbor_indices)); +} + + #ifdef __cplusplus } #endif diff --git a/src/include/h5core/h5t_retrieve.h b/src/include/h5core/h5t_retrieve.h index 1d6e88d..1b19bc3 100644 --- a/src/include/h5core/h5t_retrieve.h +++ b/src/include/h5core/h5t_retrieve.h @@ -78,6 +78,8 @@ h5t_get_vertex_coords_by_index (h5t_mesh_t* const, h5_loc_idx_t, h5_float64_t[3] h5_err_t h5t_get_vertex_coords_by_id (h5t_mesh_t* const, h5_loc_id_t, h5_float64_t[3]); +h5_err_t +h5t_get_neighbor_indices (h5t_mesh_t* const, h5_loc_id_t, h5_loc_idx_t*); #ifdef __cplusplus } #endif