This commit is contained in:
2010-08-25 16:32:35 +00:00
parent 6d0600febf
commit de20cdd032
15 changed files with 345 additions and 103 deletions
-1
View File
@@ -49,7 +49,6 @@ EXTRA_HEADERS = \
h5t_core_private.h \
h5t_errorhandling_private.h \
h5t_hsearch_private.h \
h5t_inquiry_private.h \
h5t_map_private.h \
h5t_openclose_private.h \
h5t_readwrite_private.h \
+6 -6
View File
@@ -147,23 +147,23 @@ h5priv_get_hdf5_objname_by_idx (
char *name,
size_t size
) {
ssize_t ssize;
ssize_t len;
if (name == NULL) {
ssize = H5Lget_name_by_idx (loc_id, ".",
len = H5Lget_name_by_idx (loc_id, ".",
H5_INDEX_NAME, H5_ITER_INC,
idx,
NULL, 0,
H5P_DEFAULT);
if (ssize < 0) goto error;
if (len < 0) goto error;
} else {
ssize = H5Lget_name_by_idx (loc_id, ".",
len = H5Lget_name_by_idx (loc_id, ".",
H5_INDEX_NAME, H5_ITER_INC,
idx,
name, size,
H5P_DEFAULT);
if (ssize < 0) goto error;
if (len < 0) goto error;
}
return size;
return len;
error:
return h5_error (
f,
+122 -36
View File
@@ -13,35 +13,88 @@
#include <time.h>
#include <string.h>
#include "h5core/h5_core.h"
#include "h5_core_private.h"
static inline h5_err_t
alloc_tv (
h5_file_t* const f,
const h5_loc_idx_t level_idx
) {
h5t_fdata_t* t = f->t;
h5_loc_idx_t idx = (level_idx <= 0) ? 0 : t->num_vertices[level_idx-1];
h5_loc_idx_t last = t->num_vertices[t->num_levels-1];
h5t_adjacencies_t* adj = &t->adjacencies;
adj->tv.size = last;
size_t size = last * sizeof(adj->tv.v[0]);
TRY( adj->tv.v = h5priv_alloc (f, adj->tv.v, size) );
size = (last-idx) * sizeof(adj->tv.v[0]);
memset (&adj->tv.v[idx], 0, size);
return H5_SUCCESS;
}
static inline h5_err_t
release_tv (
h5_file_t* const f
) {
h5t_fdata_t* t = f->t;
h5t_adjacencies_t* adj = &t->adjacencies;
if (adj->tv.v == NULL) return H5_SUCCESS;
h5_loc_idx_t idx = 0;
h5_loc_idx_t last = t->num_vertices[t->num_levels-1];
for (; idx < last; idx++) {
TRY( h5priv_free_idlist_items (f, &adj->tv.v[idx]) );
}
TRY( h5priv_free (f, adj->tv.v) );
adj->tv.v = NULL;
return H5_SUCCESS;
}
/*
compute T(V) from current level up to highest levels.
*/
static inline h5_err_t
compute_elems_of_vertices (
h5_file_t* const f,
const h5_id_t level_idx
const h5_id_t from_lvl
) {
/* expand structure */
TRY( alloc_tv (f, from_lvl) );
/* loop over all elements in current level */
h5t_fdata_t* t = f->t;
h5_id_t idx = (level_idx <= 0) ? 0 : t->num_elems[level_idx-1];
h5_loc_idx_t idx = (from_lvl <= 0) ? 0 : t->num_elems[from_lvl-1];
h5_loc_idx_t last = t->num_elems[t->num_levels-1];
h5_tet_t *el = &t->loc_elems.tets[idx];
h5_id_t num_elems = t->num_elems[t->num_levels-1];
for (;idx < num_elems; idx++, el++) {
for (;idx < last; idx++, el++) {
int face_idx;
int num_faces = h5tpriv_ref_elem_get_num_vertices(t);
for (face_idx = 0; face_idx < num_faces; face_idx++) {
h5_id_t vidx = el->vertex_indices[face_idx];
TRY( h5priv_append_to_idlist (
f,
&t->vertices_data[vidx].tv,
&t->adjacencies.tv.v[vidx],
h5tpriv_build_vertex_id (face_idx, idx)) );
}
}
return H5_SUCCESS;
}
static inline h5_err_t
release_te (
h5_file_t* const f
) {
#pragma unused f
// @@@ TBD @@@
return H5_SUCCESS;
}
/*
Compute T(E) from current level up to highest levels.
*/
@@ -66,6 +119,15 @@ compute_elems_of_edges (
return H5_SUCCESS;
}
static inline h5_err_t
release_td (
h5_file_t* const f
) {
#pragma unused f
// @@@ TBD @@@
return H5_SUCCESS;
}
static inline h5_err_t
compute_elems_of_triangles (
h5_file_t* const f,
@@ -311,41 +373,48 @@ static inline h5_err_t
add_edge (
h5_file_t* const f,
h5_idlist_t* list,
h5_id_t face_idx,
h5_id_t eid
h5_loc_idx_t face_idx,
h5_loc_idx_t elem_idx
) {
h5_idlist_t* te;
TRY( h5tpriv_find_te2 (f, face_idx, eid, &te) );
TRY( h5tpriv_find_te2 (f, face_idx, elem_idx, &te) );
TRY( h5priv_search_idlist (f, list, te->items[0]) );
return H5_SUCCESS;
}
/*
Get upward adjacent edges to vertex given by ID.
*/
static inline h5_err_t
get_edges_uadj_to_vertex (
h5_file_t* const f,
const h5_id_t vid,
const h5_loc_id_t id,
h5_idlist_t** list
) {
TRY( h5priv_alloc_idlist (f, list, 8) );
h5t_fdata_t* t = f->t;
h5_idlist_t* tv = &t->vertices_data[vid].tv;
h5t_fdata_t* const t = f->t;
h5_loc_idx_t idx;
TRY( h5t_get_vertex_index_of_vertex (f, id, &idx) );
h5_idlist_t* tv = &t->adjacencies.tv.v[idx];
h5_size_t i;
h5_id_t* vidp = tv->items;
h5_id_t* vidp = tv->items; // ptr to upward adjacent elements
for (i = 0; i < tv->num_items; i++, vidp++) {
h5_id_t eid = h5tpriv_get_elem_idx (*vidp);
h5_id_t face = h5tpriv_get_face_idx (*vidp);
h5_generic_elem_t* tet = (h5_generic_elem_t*)&t->loc_elems.tets[eid];
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (*vidp);
h5_loc_idx_t face_idx = h5tpriv_get_face_idx (*vidp);
h5_generic_elem_t* tet = (h5_generic_elem_t*)&t->loc_elems.tets[elem_idx];
if (h5tpriv_elem_is_on_cur_level (f, tet) == H5_NOK ) {
continue;
}
int map[4][3] = { {0,2,3}, {0,1,4}, {2,1,5}, {3,4,5} };
TRY( add_edge (f, *list, map[face][0], eid) );
TRY( add_edge (f, *list, map[face][1], eid) );
TRY( add_edge (f, *list, map[face][2], eid) );
h5_loc_idx_t edge_idx;
edge_idx = h5tpriv_get_edge_connected_to_vertex (t->ref_elem, face_idx, 0);
TRY( add_edge (f, *list, edge_idx, elem_idx) );
edge_idx = h5tpriv_get_edge_connected_to_vertex (t->ref_elem, face_idx, 1);
TRY( add_edge (f, *list, edge_idx, elem_idx) );
edge_idx = h5tpriv_get_edge_connected_to_vertex (t->ref_elem, face_idx, 2);
TRY( add_edge (f, *list, edge_idx, elem_idx) );
}
return H5_SUCCESS;
}
@@ -367,27 +436,38 @@ add_triangle (
static inline h5_err_t
get_triangles_uadj_to_vertex (
h5_file_t * const f,
const h5_id_t vid,
const h5_loc_id_t id,
h5_idlist_t **list
) {
/*
Pre-allocate a list with 8 items. Why 8? Why not?
;-)
We should change it when we have something better.
*/
TRY ( h5priv_alloc_idlist ( f, list, 8 ) );
h5t_fdata_t* t = f->t;
h5_idlist_t* tv = &t->vertices_data[vid].tv;
h5_loc_idx_t idx;
TRY( h5t_get_vertex_index_of_vertex (f, id, &idx) );
h5_idlist_t* tv = &t->adjacencies.tv.v[idx];
h5_size_t i;
h5_id_t* vidp = tv->items;
for (i = 0; i < tv->num_items; i++, vidp++) {
h5_id_t eid = h5tpriv_get_elem_idx (*vidp);
h5_id_t face = h5tpriv_get_face_idx (*vidp);
h5_generic_elem_t* tet = (h5_generic_elem_t*)&t->loc_elems.tets[eid];
h5_id_t elem_idx = h5tpriv_get_elem_idx (*vidp);
h5_id_t face_idx = h5tpriv_get_face_idx (*vidp);
h5_generic_elem_t* tet = (h5_generic_elem_t*)&t->loc_elems.tets[elem_idx];
if (h5tpriv_elem_is_on_cur_level (f, tet) == H5_NOK) {
continue;
}
int map[4][3] = { {1,2,3}, {0,2,3}, {0,1,3}, {0,1,2} };
TRY( add_triangle (f, *list, map[face][0], eid) );
TRY( add_triangle (f, *list, map[face][1], eid) );
TRY( add_triangle (f, *list, map[face][2], eid) );
h5_loc_idx_t facet_idx;
facet_idx = h5tpriv_get_facet_connected_to_vertex (t->ref_elem, face_idx, 0);
TRY( add_triangle (f, *list, facet_idx, elem_idx) );
facet_idx = h5tpriv_get_facet_connected_to_vertex (t->ref_elem, face_idx, 1);
TRY( add_triangle (f, *list, facet_idx, elem_idx) );
facet_idx = h5tpriv_get_facet_connected_to_vertex (t->ref_elem, face_idx, 2);
TRY( add_triangle (f, *list, facet_idx, elem_idx) );
}
return H5_SUCCESS;
}
@@ -395,23 +475,27 @@ get_triangles_uadj_to_vertex (
static inline h5_err_t
get_tets_uadj_to_vertex (
h5_file_t* const f,
const h5_id_t vid,
const h5_loc_id_t id,
h5_idlist_t** list
) {
TRY( h5priv_alloc_idlist (f, list, 8) );
h5t_fdata_t* t = f->t;
h5_idlist_t* tv = &t->vertices_data[vid].tv;
h5_loc_idx_t idx;
TRY( h5t_get_vertex_index_of_vertex (f, id, &idx) );
h5_idlist_t* tv = &t->adjacencies.tv.v[idx];
h5_size_t i;
h5_id_t* vidp = tv->items;
for (i = 0; i < tv->num_items; i++, vidp++) {
h5_id_t eid = h5tpriv_get_elem_idx (*vidp);
h5_generic_elem_t* tet = (h5_generic_elem_t*)&t->loc_elems.tets[eid];
h5_id_t elem_idx = h5tpriv_get_elem_idx (*vidp);
h5_generic_elem_t* tet = (h5_generic_elem_t*)&t->loc_elems.tets[elem_idx];
if (h5tpriv_elem_is_on_cur_level (f, tet) == H5_NOK) {
continue;
}
TRY( h5priv_search_idlist (f, *list, eid) );
// add to result
TRY( h5priv_search_idlist (f, *list, elem_idx) );
}
return H5_SUCCESS;
}
@@ -786,8 +870,10 @@ static h5_err_t
release_internal_structs (
h5_file_t * const f
) {
#pragma unused f
/* TO BE WRITTEN @@@ */
TRY( release_tv (f) );
TRY( release_te (f) );
TRY( release_td (f) );
return H5_SUCCESS;
}
+79 -25
View File
@@ -12,10 +12,49 @@
*/
#include <time.h>
#include <string.h>
#include "h5core/h5_core.h"
#include "h5_core_private.h"
static inline h5_err_t
alloc_tv (
h5_file_t* const f,
const h5_loc_idx_t level_idx
) {
h5t_fdata_t* t = f->t;
h5_loc_idx_t idx = (level_idx <= 0) ? 0 : t->num_vertices[level_idx-1];
h5_loc_idx_t last = t->num_vertices[t->num_levels-1];
h5t_adjacencies_t* adj = &t->adjacencies;
adj->tv.size = last;
size_t size = last * sizeof(adj->tv.v[0]);
TRY( adj->tv.v = h5priv_alloc (f, adj->tv.v, size) );
size = (last-idx) * sizeof(adj->tv.v[0]);
memset (&adj->tv.v[idx], 0, size);
return H5_SUCCESS;
}
static inline h5_err_t
release_tv (
h5_file_t* const f
) {
h5t_fdata_t* t = f->t;
h5t_adjacencies_t* adj = &t->adjacencies;
if (adj->tv.v == NULL) return H5_SUCCESS;
h5_loc_idx_t idx = 0;
h5_loc_idx_t last = t->num_vertices[t->num_levels-1];
for (; idx < last; idx++) {
TRY( h5priv_free_idlist_items (f, &adj->tv.v[idx]) );
}
TRY( h5priv_free (f, adj->tv.v) );
adj->tv.v = NULL;
return H5_SUCCESS;
}
/*
compute T(V) from current level up to highest levels.
*/
@@ -24,25 +63,38 @@ compute_elems_of_vertices (
h5_file_t* const f,
const h5_id_t from_lvl
) {
/* expand structure */
TRY( alloc_tv (f, from_lvl) );
/* loop over all elements in current level */
h5t_fdata_t *t = f->t;
h5_id_t elem_idx = (from_lvl <= 0) ? 0 : t->num_elems[from_lvl-1];
h5_triangle_t *el = &t->loc_elems.tris[elem_idx];
h5_id_t num_elems = t->num_elems[t->num_levels-1];
for (;elem_idx < num_elems; elem_idx++, el++) {
h5_loc_idx_t idx = (from_lvl <= 0) ? 0 : t->num_elems[from_lvl-1];
h5_loc_idx_t last = t->num_elems[t->num_levels-1];
h5_triangle_t *el = &t->loc_elems.tris[idx];
for (;idx < last; idx++, el++) {
int face_idx;
int num_faces = h5tpriv_ref_elem_get_num_vertices (t);
for (face_idx = 0; face_idx < num_faces; face_idx++) {
h5_id_t vidx = el->vertex_indices[face_idx];
TRY( h5priv_append_to_idlist (
f,
&t->vertices_data[vidx].tv,
&t->adjacencies.tv.v[vidx],
h5tpriv_build_vertex_id (
face_idx, elem_idx)) );
face_idx, idx)) );
}
}
return H5_SUCCESS;
}
static inline h5_err_t
release_te (
h5_file_t* const f
) {
#pragma unused f
// @@@ TBD @@@
return H5_SUCCESS;
}
/*
Compute T(E) from current level up to highest levels.
*/
@@ -181,9 +233,11 @@ get_edges_uadj_to_vertex (
TRY ( h5priv_alloc_idlist ( f, list, 8 ) );
h5t_fdata_t* t = f->t;
h5_idlist_t* tv = &t->vertices_data[entity_id].tv;
h5_size_t i;
h5_loc_idx_t idx;
TRY( h5t_get_vertex_index_of_vertex (f, entity_id, &idx) );
h5_idlist_t* tv = &t->adjacencies.tv.v[idx];
h5_size_t i;
h5_id_t* vertex_idp = tv->items;
for ( i = 0; i < tv->num_items; i++, vertex_idp++ ) {
h5_id_t elem_idx = h5tpriv_get_elem_idx ( *vertex_idp );
@@ -193,15 +247,11 @@ get_edges_uadj_to_vertex (
if ( h5tpriv_elem_is_on_cur_level ( f, el ) == H5_NOK ) {
continue;
}
/*
upward adjacend edges to vertices according reference element
*/
int map[3][2] = { {0,1}, // edge 0, 1 are adjacent to vertex 0
{0,2}, // edge 0, 2 are adjacent to vertex 1
{1,2} // edge 1, 2 are adjacent to vertex 2
};
TRY ( add_edge ( f, *list, map[face_idx][0], elem_idx ) );
TRY ( add_edge ( f, *list, map[face_idx][1], elem_idx ) );
h5_loc_idx_t edge_idx;
edge_idx = h5tpriv_get_edge_connected_to_vertex (t->ref_elem, face_idx, 0);
TRY ( add_edge ( f, *list, edge_idx, elem_idx ) );
edge_idx = h5tpriv_get_edge_connected_to_vertex (t->ref_elem, face_idx, 1);
TRY ( add_edge ( f, *list, edge_idx, elem_idx ) );
}
return H5_SUCCESS;
}
@@ -215,17 +265,20 @@ get_triangles_uadj_to_vertex (
TRY ( h5priv_alloc_idlist ( f, list, 8 ) );
h5t_fdata_t *t = f->t;
h5_idlist_t *tv = &t->vertices_data[entity_id].tv;
h5_loc_idx_t idx;
TRY( h5t_get_vertex_index_of_vertex (f, entity_id, &idx) );
h5_idlist_t* tv = &t->adjacencies.tv.v[idx];
h5_size_t i;
h5_id_t *vertex_id = tv->items;
for ( i = 0; i < tv->num_items; i++, vertex_id++ ) {
h5_id_t elem_id = h5tpriv_get_elem_idx ( *vertex_id );
h5_generic_elem_t* el = (h5_generic_elem_t*)&t->loc_elems.tris[elem_id];
h5_id_t *vertex_idp = tv->items;
for ( i = 0; i < tv->num_items; i++, vertex_idp++ ) {
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx ( *vertex_idp );
h5_generic_elem_t* el = (h5_generic_elem_t*)&t->loc_elems.tris[elem_idx];
if ( h5tpriv_elem_is_on_cur_level ( f, el ) == H5_NOK ) {
continue;
}
TRY ( h5priv_search_idlist ( f, *list, elem_id ) );
TRY ( h5priv_search_idlist ( f, *list, elem_idx ) );
}
return H5_SUCCESS;
}
@@ -443,8 +496,9 @@ static inline h5_err_t
release_internal_structs (
h5_file_t* const f
) {
#pragma unused f
/* TO BE WRITTEN @@@ */
TRY( release_tv (f) );
TRY( release_te (f) );
return H5_SUCCESS;
}
-1
View File
@@ -10,7 +10,6 @@
#include "h5t_access_private.h"
#include "h5t_adjacencies_private.h"
#include "h5t_consts_private.h"
#include "h5t_inquiry_private.h"
#include "h5t_errorhandling_private.h"
#include "h5t_hsearch_private.h"
#include "h5t_map_private.h"
+1 -1
View File
@@ -315,7 +315,7 @@ h5tpriv_find_tv2 (
) {
h5_id_t idx = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, face_idx);
*retval = &f->t->vertices_data[idx].tv;
*retval = &f->t->adjacencies.tv.v[idx];
return H5_SUCCESS;
}
+2 -2
View File
@@ -105,7 +105,7 @@ h5tpriv_get_local_vid (
/*!
compare two elems given by their local id
*/
static int
static inline int
cmp_elems (
h5_file_t* const f,
const h5_id_t elem_idx1,
@@ -129,7 +129,7 @@ cmp_elems (
return 0;
}
static int
static inline int
cmp_elems1 (
h5_file_t* f,
h5_id_t elem_idx1,
+8 -10
View File
@@ -254,7 +254,6 @@ init_fdata (
t->num_elems_on_level = NULL;
t->map_elem_g2l.items = NULL;
t->vertices = NULL;
t->vertices_data = NULL;
t->num_vertices = NULL;
t->map_vertex_g2l.items = NULL;
t->mtags.names = NULL;
@@ -527,8 +526,7 @@ release_vertices (
h5_file_t* const f
) {
h5t_fdata_t* t = f->t;
TRY( h5priv_free (f, t->vertices) );
TRY( h5priv_free (f, t->vertices_data) );
TRY( h5priv_free (f, t->vertices) );
TRY( h5priv_free (f, t->num_vertices) );
TRY( h5priv_free (f, t->map_vertex_g2l.items) );
@@ -579,19 +577,20 @@ h5t_set_level (
return H5_SUCCESS;
}
/*
Allocate \c num additional vertices.
*/
h5_err_t
h5tpriv_alloc_num_vertices (
h5_file_t* const f,
const h5_size_t num_vertices
const h5_size_t num
) {
h5t_fdata_t* t = f->t;
ssize_t size = num_vertices * sizeof (t->vertices[0]);
ssize_t size = num * sizeof (t->vertices[0]);
TRY( t->vertices = h5priv_alloc (f, t->vertices, size) );
size = num_vertices * sizeof (t->vertices_data[0]);
TRY( t->vertices_data = h5priv_alloc (f, t->vertices_data, size) );
TRY( h5priv_alloc_idmap (f, &t->map_vertex_g2l, num_vertices) );
TRY( h5priv_alloc_idlist_items (f, &t->sorted_lvertices, num_vertices) );
TRY( h5priv_alloc_idmap (f, &t->map_vertex_g2l, num) );
TRY( h5priv_alloc_idlist_items (f, &t->sorted_lvertices, num) );
return H5_SUCCESS;
}
@@ -610,7 +609,6 @@ h5_err_t
h5tpriv_close_file (
h5_file_t* const f /*!< IN: file handle */
) {
TRY( release_memory (f) );
TRY( h5t_close_mesh (f) );
return H5_SUCCESS;
+7 -2
View File
@@ -263,8 +263,13 @@ read_mtags (
h5_file_t* const f
) {
h5t_fdata_t* t = f->t;
TRY( t->mtags.group_id = h5priv_open_group (f, t->mesh_gid, "Tags") );
return h5tpriv_read_tag_container (f, &f->t->mtags);
h5_err_t exists;
TRY( exists = h5priv_hdf5_link_exists (f, t->mesh_gid, "Tags") );
if (exists) {
TRY( t->mtags.group_id = h5priv_open_group (f, t->mesh_gid, "Tags") );
TRY( h5tpriv_read_tag_container (f, &f->t->mtags) );
}
return H5_SUCCESS;
}
h5_err_t
+101 -12
View File
@@ -1,37 +1,126 @@
#include "h5core/h5_core.h"
/*
face: All kinds of sub-elements: vertices, edges, triangles ...
facet: co-dim 1 face
entities: all elements and faces of a grid
*/
/*
2
**
* *
* *
* *
* *
* *
* *
1 2
* *
* *
* *
* *
* *
* *
* *
0 * * * * * * * 0 * * * * * * *1
*/
const h5t_ref_elem_t h5t_tri_ref_elem = {
2,
{3, 3, 1}, // #vertices, #edges, #triangles
2, // dimension
{
3, // #vertices
3, // #edges
1 // #triangles
},
{ // number of vertices per sub-element
[0] = {1, 1, 1}, // #vertices of vertices
[1] = {2, 2, 2}, // #vertices of edges
[2] = {3} // #vertices of trinagles
},
{
{ // map sub-elements to vertices
[0] = {{0}, {1}, {2}}, // 3 vertices
[1] = {{0,1}, {0,2}, {1,2}}, // 3 edges
[2] = {{0,1,2}} // 1 triangles
},
{{0.0, 0.0}, {1.0, 0.0}, {0.0, 1.0}},
{ // edges connected to vertex
[0] = {0,1},
[1] = {0,2},
[2] = {1,2}
},
{ // triangles connected to vertex
[0] = {0},
[1] = {0},
[2] = {0}
},
{ // coordinates
{0.0, 0.0},
{1.0, 0.0},
{0.0, 1.0}
}
};
/*
3
**
** *
* * *
* * *
* * *
* 5 *
* * *
3 * 4
* 2 * 3 *
* 2 *
* * * *
* * * *
* 1 0 2 *
* * * *
** **
0 * * * * * * * 0 * * * * * * *1
Front face is {0,1,3} with id 1
*/
const h5t_ref_elem_t h5t_tet_ref_elem = {
3,
{4, 6, 4, 1}, // #vertices, #edges, #triangles, #tetrahedra
3, // dimension
{
4, // #vertices
6, // #edges
4, // #triangles
1 // #tetrahedra
},
{ // number of vertices per sub-element
[0] = {1,1,1,1}, // #vertices of vertices
[1] = {2,2,2,2,2,2}, // #vertices of edges
[2] = {3,3,3,3}, // #vertices of trinagles
[2] = {3,3,3,3}, // #vertices of trinagles
[3] = {4} // #vertices of tets
},
{
{ // map sub-elements to vertices
[0] = {{0}, {1}, {2}, {3}}, // 4 vertices
[1] = {{0,1}, {0,2}, {1,2}, {0,3}, {1,3}, {2,3}}, // 6 edges
[2] = {{0,1,2}, {0,1,3}, {0,2,3}, {1,2,3}}, // 4 triangles
[3] = {{0,1,2,3}} // 1 tets
[3] = {{0,1,2,3}} // 1 tets
},
{{0.0, 0.0, 0.0}, {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}},
{ // edges connected to vertex
[0] = {0,1,3},
[1] = {0,2,4},
[2] = {1,2,5},
[3] = {3,4,5}
},
{ // triangles connected to vertex
[0] = {0,1,2},
[1] = {0,1,3},
[2] = {0,2,3},
[3] = {1,2,3}
},
{ // coordinates
{0.0, 0.0, 0.0},
{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}
}
};
+2
View File
@@ -8,4 +8,6 @@
#define h5tpriv_ref_elem_get_dim(this) (this->ref_elem->dim)
#define h5tpriv_get_edge_connected_to_vertex(this,face_idx, i) (this->edges_connected_to_vertex[face_idx][i])
#define h5tpriv_get_facet_connected_to_vertex(this,face_idx, i) (this->edges_connected_to_vertex[face_idx][i])
#endif
+9
View File
@@ -93,6 +93,15 @@ assign_glb_elem_data (
h5_generic_elem_t *glb_elem = h5tpriv_get_glb_elem (f, loc_idx);
glb_elem->parent_idx = loc_elem->parent_idx;
if (loc_elem->parent_idx >= 0) {
h5_generic_elem_t *loc_parent = h5tpriv_get_loc_elem (
f, loc_elem->parent_idx);
h5_generic_elem_t *glb_parent = h5tpriv_get_glb_elem (
f, glb_elem->parent_idx);
glb_parent->child_idx = loc_parent->child_idx;
}
glb_elem->child_idx = loc_elem->child_idx;
h5_id_t* glb_indices = h5tpriv_get_glb_elem_vertex_indices (f, loc_idx);
+2 -2
View File
@@ -79,7 +79,7 @@ release_container (
if (ctn->num_sets == 0) return H5_SUCCESS;
TRY ( h5priv_hwalk ( f, &ctn->sets, release_tagset ) );
TRY ( h5priv_free ( f, ctn->names ) );
memset (ctn, 0, sizeof (*ctn));
return H5_SUCCESS;
}
@@ -805,7 +805,7 @@ read_tagset (
hid_t dset_id;
ssize_t ssize;
TRY( (ssize = h5priv_get_hdf5_objname_by_idx (f, loc_id, idx, NULL, 0)) );
TRY( (name = h5priv_calloc (f, 1, ssize)) );
TRY( (name = h5priv_calloc (f, 1, ++ssize)) );
TRY( h5priv_get_hdf5_objname_by_idx (f, loc_id, idx, name, ssize) );
TRY( group_id = h5priv_open_hdf5_group (f, loc_id, name) );
+4 -5
View File
@@ -6,10 +6,6 @@ typedef struct h5_vertex {
h5_coord3d_t P;
} h5_vertex_t;
typedef struct h5_vertex_data {
h5_idlist_t tv;
} h5_vertex_data_t;
typedef struct h5_triangle {
h5_id_t idx;
h5_id_t parent_idx;
@@ -56,6 +52,10 @@ typedef struct h5_dtypes {
} h5_dtypes_t;
typedef struct h5t_adjacencies {
struct {
h5_size_t size;
h5_idlist_t *v;
} tv;
h5_hashtable_t te_hash;
h5_hashtable_t td_hash;
} h5t_adjacencies_t;
@@ -174,7 +174,6 @@ typedef struct h5t_fdata {
/*** vertices ***/
h5_vertex_t *vertices;
h5_vertex_data_t *vertices_data;
h5_size_t *num_vertices;
h5_idmap_t map_vertex_g2l; /* map global to local idx */
h5_idlist_t sorted_lvertices;
+2
View File
@@ -10,6 +10,8 @@ typedef struct {
int num_faces[H5T_MAX_DIM+1];
int num_vertices_of_face[H5T_MAX_DIM+1][H5T_MAX_FACES];
int map[H5T_MAX_DIM+1][H5T_MAX_FACES][H5T_MAX_VERTICES];
int edges_connected_to_vertex[H5T_MAX_VERTICES][H5T_MAX_FACES];
int triangles_connected_to_vertex[H5T_MAX_VERTICES][H5T_MAX_FACES];
h5_float64_t coords[H5T_MAX_VERTICES][H5T_MAX_DIM];
} h5t_ref_elem_t;