- level_idx removed from element structure

- mesh type specific read methods
This commit is contained in:
2010-07-22 20:02:48 +00:00
parent a1a90c8af0
commit b920c0f9e8
9 changed files with 94 additions and 18 deletions
+1
View File
@@ -445,6 +445,7 @@ src/h5core/h5t_openclose.c -text
src/h5core/h5t_openclose_private.h -text
src/h5core/h5t_readwrite.c -text
src/h5core/h5t_readwrite_private.h -text
src/h5core/h5t_readwrite_tetm.c -text
src/h5core/h5t_readwrite_trim.c -text
src/h5core/h5t_ref_elements.c -text
src/h5core/h5t_retrieve.c -text
+2
View File
@@ -99,6 +99,8 @@ libH5hut_a_SOURCES = \
h5t_map.c \
h5t_openclose.c \
h5t_readwrite.c \
h5t_readwrite_trim.c \
h5t_readwrite_tetm.c \
h5t_ref_elements.c \
h5t_retrieve.c \
h5t_retrieve_tetm.c \
+4 -4
View File
@@ -69,7 +69,7 @@ get_loc_elem_level_idx (
h5_file_t* const f,
const h5_id_t elem_idx
) {
return f->t->loc_elems.tets[elem_idx].level_idx;
return f->t->loc_elems.tets[elem_idx].idx;
}
static h5_id_t
@@ -78,7 +78,7 @@ set_loc_elem_level_idx (
const h5_id_t elem_idx,
const h5_id_t level_idx
) {
f->t->loc_elems.tets[elem_idx].level_idx = level_idx;
f->t->loc_elems.tets[elem_idx].idx = level_idx;
return level_idx;
}
@@ -207,7 +207,7 @@ get_glb_elem_level_idx (
h5_file_t* const f,
const h5_id_t elem_idx
) {
return f->t->glb_elems.tets[elem_idx].level_idx;
return f->t->loc_elems.tets[elem_idx].idx;
}
static h5_id_t
@@ -216,7 +216,7 @@ set_glb_elem_level_idx (
const h5_id_t elem_idx,
const h5_id_t level_idx
) {
f->t->glb_elems.tets[elem_idx].level_idx = level_idx;
f->t->loc_elems.tets[elem_idx].idx = level_idx;
return level_idx;
}
+4 -4
View File
@@ -69,7 +69,7 @@ get_loc_elem_level_idx (
h5_file_t* const f,
const h5_id_t elem_idx
) {
return f->t->loc_elems.tris[elem_idx].level_idx;
return f->t->loc_elems.tris[elem_idx].idx;
}
static h5_id_t
@@ -78,7 +78,7 @@ set_loc_elem_level_idx (
const h5_id_t elem_idx,
const h5_id_t level_idx
) {
f->t->loc_elems.tris[elem_idx].level_idx = level_idx;
f->t->loc_elems.tris[elem_idx].idx = level_idx;
return level_idx;
}
@@ -207,7 +207,7 @@ get_glb_elem_level_idx (
h5_file_t* const f,
const h5_id_t elem_idx
) {
return f->t->glb_elems.tris[elem_idx].level_idx;
return f->t->loc_elems.tris[elem_idx].idx;
}
static h5_id_t
@@ -216,7 +216,7 @@ set_glb_elem_level_idx (
const h5_id_t elem_idx,
const h5_id_t level_idx
) {
f->t->glb_elems.tris[elem_idx].level_idx = level_idx;
f->t->loc_elems.tris[elem_idx].idx = level_idx;
return level_idx;
}
+75
View File
@@ -0,0 +1,75 @@
#include "h5core/h5_core.h"
#include "h5_core_private.h"
/*
setup structure "elems_ldta" with local indices for each element:
- translate the global vertex id's of each element to their
local id's
- translate the global parent id of each element to the
corresponding local id.
*/
static h5_err_t
init_loc_elems_struct (
h5_file_t* const f
) {
h5t_fdata_t* const t = f->t;
h5_id_t idx = 0;
const h5_id_t num_elems = t->num_elems[t->num_levels-1];
h5_id_t level_id = 0;
int num_vertices = t->ref_elem->num_faces[0];
h5_triangle_t* loc_elems = t->loc_elems.tris;
h5_triangle_t* glb_elems = t->glb_elems.tris;
for (idx = 0; idx < num_elems; idx++) {
// local idx
// local parent index
// level idx
// vertex indices
// neighbor indices
}
return H5_SUCCESS;
}
#if 0
static h5_err_t
init_struct_elems_ldta (
h5_file_t* const f
) {
h5t_fdata_t* t = f->t;
h5_id_t idx = 0;
h5_id_t num_elems = t->num_elems[t->num_levels-1];
h5_id_t level_id = 0;
for (local_eid=0;
local_eid < num_elems;
local_eid++, elp+=h5tpriv_sizeof_elem[t->mesh_type], el_ldta++) {
el = (h5_elem_t*)elp;
TRY( h5t_map_global_vertex_indices2local (
f,
el->global_vertex_indices,
num_vertices,
el_ldta->local_vertex_indices) );
if (el->global_parent_idx >= 0)
TRY( el_ldta->local_parent_idx =
h5t_map_global_elem_idx2local (
f, el->global_parent_idx) );
if (el->global_child_idx >= 0)
TRY( el_ldta->local_child_idx =
h5t_map_global_elem_idx2local (
f, el->global_child_idx) );
if (local_eid >= t->num_elems[level_id]) {
level_id++;
}
el_ldta->level_id = level_id;
}
return H5_SUCCESS;
}
#endif
struct h5t_read_methods h5tpriv_read_tetm_methods = {
init_loc_elems_struct
};
+5 -4
View File
@@ -32,6 +32,7 @@ init_loc_elems_struct (
return H5_SUCCESS;
}
#if 0
static h5_err_t
init_struct_elems_ldta (
h5_file_t* const f
@@ -67,8 +68,8 @@ init_struct_elems_ldta (
}
return H5_SUCCESS;
}
#endif
struct h5t_read_methods {
init_loc_elems_struct;
} h5t_read_trim_methods;
struct h5t_read_methods h5tpriv_read_trim_methods = {
init_loc_elems_struct
};
+2 -2
View File
@@ -33,10 +33,10 @@ h5tpriv_skip_to_next_elem_on_level (
h5_err_t
h5tpriv_elem_is_on_cur_level (
h5_file_t* const f,
h5_generic_elem_t *el
h5_generic_elem_t *el // ptr to local element
) {
h5t_fdata_t* t = f->t;
if ( (el->level_idx > t->cur_level) ||
if ( (el->idx > t->cur_level) ||
(el->child_idx >= 0 && el->child_idx < num_elems_on_cur_level) ) {
return H5_NOK;
}
+1 -1
View File
@@ -31,7 +31,7 @@ begin_iterate_entities (
}
}
struct h5t_retrieve_methods h5tpriv_trim_retrieve_methods = {
struct h5t_retrieve_methods h5tpriv_tetm_retrieve_methods = {
begin_iterate_entities,
};
-3
View File
@@ -14,7 +14,6 @@ typedef struct h5_triangle {
h5_id_t idx;
h5_id_t parent_idx;
h5_id_t child_idx;
h5_id_t level_idx;
h5_3id_t vertex_indices;
h5_3id_t neighbor_indices;
} h5_triangle_t;
@@ -23,7 +22,6 @@ typedef struct h5_tetrahedron {
h5_id_t idx;
h5_id_t parent_idx;
h5_id_t child_idx;
h5_id_t level_idx;
h5_4id_t vertex_indices;
h5_4id_t neighbor_indices;
} h5_tetrahedron_t;
@@ -33,7 +31,6 @@ typedef struct h5_generic_elem {
h5_id_t idx;
h5_id_t parent_idx;
h5_id_t child_idx;
h5_id_t level_idx;
h5_id_t indices[1];
} h5_generic_elem_t;