edge traversing added
This commit is contained in:
+2
-2
@@ -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__ );
|
||||
}
|
||||
|
||||
+11
-1
@@ -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 );
|
||||
}
|
||||
|
||||
+8
-1
@@ -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
|
||||
|
||||
|
||||
+26
-2
@@ -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 );
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
+32
-11
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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__ );
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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__ );
|
||||
}
|
||||
|
||||
+11
-2
@@ -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__ );
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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__ );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user