From 8c8de6e523963de08d65acb2bc65d9eaf0f5b1e1 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 22 Jul 2010 12:06:06 +0000 Subject: [PATCH] added --- .gitattributes | 5 + src/h5core/h5t_access_private.h | 98 +++++++++ src/h5core/h5t_access_tetm.c | 311 +++++++++++++++++++++++++++ src/h5core/h5t_access_trim.c | 311 +++++++++++++++++++++++++++ src/h5core/h5t_adjacencies_private.h | 7 + src/h5core/h5t_readwrite_trim.c | 74 +++++++ 6 files changed, 806 insertions(+) create mode 100644 src/h5core/h5t_access_private.h create mode 100644 src/h5core/h5t_access_tetm.c create mode 100644 src/h5core/h5t_access_trim.c create mode 100644 src/h5core/h5t_adjacencies_private.h create mode 100644 src/h5core/h5t_readwrite_trim.c diff --git a/.gitattributes b/.gitattributes index 7159fb1..e5f9da4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -424,7 +424,11 @@ src/h5core/h5b_model.c -text src/h5core/h5b_model_private.h -text src/h5core/h5b_readwrite.c -text src/h5core/h5b_types_private.h -text +src/h5core/h5t_access_private.h -text +src/h5core/h5t_access_tetm.c -text +src/h5core/h5t_access_trim.c -text src/h5core/h5t_adjacencies.c -text +src/h5core/h5t_adjacencies_private.h -text src/h5core/h5t_adjacencies_tetm.c -text src/h5core/h5t_adjacencies_tetm_private.h -text src/h5core/h5t_adjacencies_trim.c -text @@ -443,6 +447,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_trim.c -text src/h5core/h5t_ref_elements.c -text src/h5core/h5t_retrieve.c -text src/h5core/h5t_retrieve_private.h -text diff --git a/src/h5core/h5t_access_private.h b/src/h5core/h5t_access_private.h new file mode 100644 index 0000000..c5488b2 --- /dev/null +++ b/src/h5core/h5t_access_private.h @@ -0,0 +1,98 @@ +#ifndef __H5T_ACCESS_PRIVATE_H +#define __H5T_ACCESS_PRIVATE_H + +extern struct h5t_access_methods h5tpriv_access_trim_methods; +extern struct h5t_access_methods h5tpriv_access_tetm_methods; + +#define h5tpriv_get_loc_elem(f, elem_idx) \ + (*f->t->methods.access->get_loc_elem)(f, elem_idx) + +#define h5tpriv_get_loc_elem_idx(f, elem_idx) \ + (*f->t->methods.access->get_loc_elem_idx)(f, elem_idx) + +#define h5tpriv_set_loc_elem_idx(f, elem_idx, idx) \ + (*f->t->methods.access->set_loc_elem_idx)(f, elem_idx, idx) + +#define h5tpriv_get_loc_elem_parent_idx(f, elem_idx) \ + (*f->t->methods.access->get_loc_elem_parent_idx)(f, elem_idx) + +#define h5tpriv_set_loc_elem_parent_idx(f, elem_idx, idx) \ + (*f->t->methods.access->set_loc_elem_parent_idx)(f, elem_idx, idx) + +#define h5tpriv_get_loc_elem_child_idx(f, elem_idx) \ + (*f->t->methods.access->get_loc_elem_child_idx)(f, elem_idx) + +#define h5tpriv_set_loc_elem_child_idx(f, elem_idx, idx) \ + (*f->t->methods.access->set_loc_elem_child_idx)(f, elem_idx, idx) + +#define h5tpriv_get_loc_elem_level_idx(f, elem_idx) \ + (*f->t->methods.access->get_loc_elem_level_idx)(f, elem_idx) + +#define h5tpriv_set_loc_elem_level_idx(f, elem_idx, idx) \ + (*f->t->methods.access->set_loc_elem_level_idx)(f, elem_idx, idx) + +#define h5tpriv_get_loc_elem_vertex_indices(f, elem_idx) \ + (*f->t->methods.access->get_loc_elem_vertex_indices)(f, elem_idx) + +#define h5tpriv_get_loc_elem_vertex_idx(f, elem_idx, face_idx) \ + (*f->t->methods.access->get_loc_elem_vertex_idx)(f, elem_idx, face_idx) + +#define h5tpriv_set_loc_elem_vertex_idx(f, elem_idx, face_idx, idx) \ + (*f->t->methods.access->get_loc_elem_vertex_idx)(f, elem_idx, face_idx, idx) + +#define h5tpriv_get_loc_elem_neighbor_indices(f, elem_idx) \ + (*f->t->methods.access->get_loc_elem_neighbor_indices)(f, elem_idx) + +#define h5tpriv_get_loc_elem_neighbor_idx(f, elem_idx, face_idx) \ + (*f->t->methods.access->get_loc_elem_neighbor_idx)(f, elem_idx, face_idx) + +#define h5tpriv_set_loc_elem_neighbor_idx(f, elem_idx, face_idx, idx) \ + (*f->t->methods.access->get_loc_elem_neighbor_idx)(f, elem_idx, face_idx, idx) + +#define h5tpriv_get_glb_elem(f, elem_idx) \ + (*f->t->methods.access->get_glb_elem)(f, elem_idx) + +#define h5tpriv_get_glb_elem_idx(f, elem_idx) \ + (*f->t->methods.access->get_glb_elem_idx)(f, elem_idx) + +#define h5tpriv_set_glb_elem_idx(f, elem_idx, idx) \ + (*f->t->methods.access->set_glb_elem_idx)(f, elem_idx, idx) + +#define h5tpriv_get_glb_elem_parent_idx(f, elem_idx) \ + (*f->t->methods.access->get_glb_elem_parent_idx)(f, elem_idx) + +#define h5tpriv_set_glb_elem_parent_idx(f, elem_idx, idx) \ + (*f->t->methods.access->set_glb_elem_parent_idx)(f, elem_idx, idx) + +#define h5tpriv_get_glb_elem_child_idx(f, elem_idx) \ + (*f->t->methods.access->get_glb_elem_child_idx)(f, elem_idx) + +#define h5tpriv_set_glb_elem_child_idx(f, elem_idx, idx) \ + (*f->t->methods.access->set_glb_elem_child_idx)(f, elem_idx, idx) + +#define h5tpriv_get_glb_elem_level_idx(f, elem_idx) \ + (*f->t->methods.access->get_glb_elem_level_idx)(f, elem_idx) + +#define h5tpriv_set_glb_elem_level_idx(f, elem_idx, idx) \ + (*f->t->methods.access->set_glb_elem_level_idx)(f, elem_idx, idx) + +#define h5tpriv_get_glb_elem_vertex_indices(f, elem_idx) \ + (*f->t->methods.access->get_glb_elem_vertex_indices)(f, elem_idx) + +#define h5tpriv_get_glb_elem_vertex_idx(f, elem_idx, face_idx) \ + (*f->t->methods.access->get_glb_elem_vertex_idx)(f, elem_idx, face_idx) + +#define h5tpriv_set_glb_elem_vertex_idx(f, elem_idx, face_idx, idx) \ + (*f->t->methods.access->get_glb_elem_vertex_idx)(f, elem_idx, face_idx, idx) + +#define h5tpriv_get_glb_elem_neighbor_indices(f, elem_idx) \ + (*f->t->methods.access->get_glb_elem_neighbor_indices)(f, elem_idx) + +#define h5tpriv_get_glb_elem_neighbor_idx(f, elem_idx, face_idx) \ + (*f->t->methods.access->get_glb_elem_neighbor_idx)(f, elem_idx, face_idx) + +#define h5tpriv_set_glb_elem_neighbor_idx(f, elem_idx, face_idx, idx) \ + (*f->t->methods.access->get_glb_elem_neighbor_idx)(f, elem_idx, face_idx, idx) + + +#endif diff --git a/src/h5core/h5t_access_tetm.c b/src/h5core/h5t_access_tetm.c new file mode 100644 index 0000000..4c4b33b --- /dev/null +++ b/src/h5core/h5t_access_tetm.c @@ -0,0 +1,311 @@ +#include "h5core/h5_core.h" +#include "h5_core_private.h" + +/*** op's on local elements ***/ +static h5_generic_elem_t* +get_loc_elem ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return (h5_generic_elem_t*)&f->t->loc_elems.tets[elem_idx]; +} + +static h5_id_t +get_loc_elem_idx ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->loc_elems.tets[elem_idx].idx; +} + +static h5_id_t +set_loc_elem_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t idx + ) { + f->t->loc_elems.tets[elem_idx].idx = idx; + return idx; +} + +static h5_id_t +get_loc_elem_parent_idx ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->loc_elems.tets[elem_idx].parent_idx; +} + +static h5_id_t +set_loc_elem_parent_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t parent_idx + ) { + f->t->loc_elems.tets[elem_idx].parent_idx = parent_idx; + return parent_idx; +} + +static h5_id_t +get_loc_elem_child_idx ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->loc_elems.tets[elem_idx].child_idx; +} + +static h5_id_t +set_loc_elem_child_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t child_idx + ) { + f->t->loc_elems.tets[elem_idx].child_idx = child_idx; + return child_idx; +} + +static h5_id_t +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; +} + +static h5_id_t +set_loc_elem_level_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t level_idx + ) { + f->t->loc_elems.tets[elem_idx].level_idx = level_idx; + return level_idx; +} + +static h5_id_t* +get_loc_elem_vertex_indices ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->loc_elems.tets[elem_idx].vertex_indices; +} + +static h5_id_t +get_loc_elem_vertex_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx + ) { + return f->t->loc_elems.tets[elem_idx].vertex_indices[face_idx]; +} + +static h5_id_t +set_loc_elem_vertex_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx, + const h5_id_t vertex_idx + ) { + f->t->loc_elems.tets[elem_idx].vertex_indices[face_idx] = vertex_idx; + return vertex_idx; +} + +static h5_id_t* +get_loc_elem_neighbor_indices ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->loc_elems.tets[elem_idx].neighbor_indices; +} + +static h5_id_t +get_loc_elem_neighbor_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx + ) { + return f->t->loc_elems.tets[elem_idx].neighbor_indices[face_idx]; +} + +static h5_id_t +set_loc_elem_neighbor_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx, + const h5_id_t neighbor_idx + ) { + f->t->loc_elems.tets[elem_idx].neighbor_indices[face_idx] = neighbor_idx; + return neighbor_idx; +} + + +/*** op's on global elements ***/ +static h5_generic_elem_t* +get_glb_elem ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return (h5_generic_elem_t*)&f->t->glb_elems.tets[elem_idx]; +} + +static h5_id_t +get_glb_elem_idx ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->glb_elems.tets[elem_idx].idx; +} + +static h5_id_t +set_glb_elem_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t idx + ) { + f->t->glb_elems.tets[elem_idx].idx = idx; + return idx; +} + +static h5_id_t +get_glb_elem_parent_idx ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->glb_elems.tets[elem_idx].parent_idx; +} + +static h5_id_t +set_glb_elem_parent_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t parent_idx + ) { + f->t->glb_elems.tets[elem_idx].parent_idx = parent_idx; + return parent_idx; +} + +static h5_id_t +get_glb_elem_child_idx ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->glb_elems.tets[elem_idx].child_idx; +} + +static h5_id_t +set_glb_elem_child_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t child_idx + ) { + f->t->glb_elems.tets[elem_idx].child_idx = child_idx; + return child_idx; +} + +static h5_id_t +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; +} + +static h5_id_t +set_glb_elem_level_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t level_idx + ) { + f->t->glb_elems.tets[elem_idx].level_idx = level_idx; + return level_idx; +} + +static h5_id_t* +get_glb_elem_vertex_indices ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->glb_elems.tets[elem_idx].vertex_indices; +} + +static h5_id_t +get_glb_elem_vertex_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx + ) { + return f->t->glb_elems.tets[elem_idx].vertex_indices[face_idx]; +} + +static h5_id_t +set_glb_elem_vertex_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx, + const h5_id_t vertex_idx + ) { + f->t->glb_elems.tets[elem_idx].vertex_indices[face_idx] = vertex_idx; + return vertex_idx; +} + +static h5_id_t* +get_glb_elem_neighbor_indices ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->glb_elems.tets[elem_idx].neighbor_indices; +} + +static h5_id_t +get_glb_elem_neighbor_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx + ) { + return f->t->glb_elems.tets[elem_idx].neighbor_indices[face_idx]; +} + +static h5_id_t +set_glb_elem_neighbor_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx, + const h5_id_t neighbor_idx + ) { + f->t->glb_elems.tets[elem_idx].neighbor_indices[face_idx] = neighbor_idx; + return neighbor_idx; +} + +struct h5t_access_methods h5tpriv_access_tetm_methods = { + get_loc_elem, + get_loc_elem_idx, + set_loc_elem_idx, + get_loc_elem_parent_idx, + set_loc_elem_parent_idx, + get_loc_elem_child_idx, + set_loc_elem_child_idx, + get_loc_elem_level_idx, + set_loc_elem_level_idx, + get_loc_elem_vertex_indices, + get_loc_elem_vertex_idx, + set_loc_elem_vertex_idx, + get_loc_elem_neighbor_indices, + get_loc_elem_neighbor_idx, + set_loc_elem_neighbor_idx, + get_glb_elem, + get_glb_elem_idx, + set_glb_elem_idx, + get_glb_elem_parent_idx, + set_glb_elem_parent_idx, + get_glb_elem_child_idx, + set_glb_elem_child_idx, + get_glb_elem_level_idx, + set_glb_elem_level_idx, + get_glb_elem_vertex_indices, + get_glb_elem_vertex_idx, + set_glb_elem_vertex_idx, + get_glb_elem_neighbor_indices, + get_glb_elem_neighbor_idx, + set_glb_elem_neighbor_idx, +}; + diff --git a/src/h5core/h5t_access_trim.c b/src/h5core/h5t_access_trim.c new file mode 100644 index 0000000..4fcb5e5 --- /dev/null +++ b/src/h5core/h5t_access_trim.c @@ -0,0 +1,311 @@ +#include "h5core/h5_core.h" +#include "h5_core_private.h" + +/*** op's on local elements ***/ +static h5_generic_elem_t* +get_loc_elem ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return (h5_generic_elem_t*)&f->t->loc_elems.tris[elem_idx]; +} + +static h5_id_t +get_loc_elem_idx ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->loc_elems.tris[elem_idx].idx; +} + +static h5_id_t +set_loc_elem_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t idx + ) { + f->t->loc_elems.tris[elem_idx].idx = idx; + return idx; +} + +static h5_id_t +get_loc_elem_parent_idx ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->loc_elems.tris[elem_idx].parent_idx; +} + +static h5_id_t +set_loc_elem_parent_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t parent_idx + ) { + f->t->loc_elems.tris[elem_idx].parent_idx = parent_idx; + return parent_idx; +} + +static h5_id_t +get_loc_elem_child_idx ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->loc_elems.tris[elem_idx].child_idx; +} + +static h5_id_t +set_loc_elem_child_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t child_idx + ) { + f->t->loc_elems.tris[elem_idx].child_idx = child_idx; + return child_idx; +} + +static h5_id_t +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; +} + +static h5_id_t +set_loc_elem_level_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t level_idx + ) { + f->t->loc_elems.tris[elem_idx].level_idx = level_idx; + return level_idx; +} + +static h5_id_t* +get_loc_elem_vertex_indices ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->loc_elems.tris[elem_idx].vertex_indices; +} + +static h5_id_t +get_loc_elem_vertex_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx + ) { + return f->t->loc_elems.tris[elem_idx].vertex_indices[face_idx]; +} + +static h5_id_t +set_loc_elem_vertex_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx, + const h5_id_t vertex_idx + ) { + f->t->loc_elems.tris[elem_idx].vertex_indices[face_idx] = vertex_idx; + return vertex_idx; +} + +static h5_id_t* +get_loc_elem_neighbor_indices ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->loc_elems.tris[elem_idx].neighbor_indices; +} + +static h5_id_t +get_loc_elem_neighbor_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx + ) { + return f->t->loc_elems.tris[elem_idx].neighbor_indices[face_idx]; +} + +static h5_id_t +set_loc_elem_neighbor_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx, + const h5_id_t neighbor_idx + ) { + f->t->loc_elems.tris[elem_idx].neighbor_indices[face_idx] = neighbor_idx; + return neighbor_idx; +} + + +/*** op's on global elements ***/ +static h5_generic_elem_t* +get_glb_elem ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return (h5_generic_elem_t*)&f->t->glb_elems.tris[elem_idx]; +} + +static h5_id_t +get_glb_elem_idx ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->glb_elems.tris[elem_idx].idx; +} + +static h5_id_t +set_glb_elem_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t idx + ) { + f->t->glb_elems.tris[elem_idx].idx = idx; + return idx; +} + +static h5_id_t +get_glb_elem_parent_idx ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->glb_elems.tris[elem_idx].parent_idx; +} + +static h5_id_t +set_glb_elem_parent_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t parent_idx + ) { + f->t->glb_elems.tris[elem_idx].parent_idx = parent_idx; + return parent_idx; +} + +static h5_id_t +get_glb_elem_child_idx ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->glb_elems.tris[elem_idx].child_idx; +} + +static h5_id_t +set_glb_elem_child_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t child_idx + ) { + f->t->glb_elems.tris[elem_idx].child_idx = child_idx; + return child_idx; +} + +static h5_id_t +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; +} + +static h5_id_t +set_glb_elem_level_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t level_idx + ) { + f->t->glb_elems.tris[elem_idx].level_idx = level_idx; + return level_idx; +} + +static h5_id_t* +get_glb_elem_vertex_indices ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->glb_elems.tris[elem_idx].vertex_indices; +} + +static h5_id_t +get_glb_elem_vertex_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx + ) { + return f->t->glb_elems.tris[elem_idx].vertex_indices[face_idx]; +} + +static h5_id_t +set_glb_elem_vertex_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx, + const h5_id_t vertex_idx + ) { + f->t->glb_elems.tris[elem_idx].vertex_indices[face_idx] = vertex_idx; + return vertex_idx; +} + +static h5_id_t* +get_glb_elem_neighbor_indices ( + h5_file_t* const f, + const h5_id_t elem_idx + ) { + return f->t->glb_elems.tris[elem_idx].neighbor_indices; +} + +static h5_id_t +get_glb_elem_neighbor_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx + ) { + return f->t->glb_elems.tris[elem_idx].neighbor_indices[face_idx]; +} + +static h5_id_t +set_glb_elem_neighbor_idx ( + h5_file_t* const f, + const h5_id_t elem_idx, + const h5_id_t face_idx, + const h5_id_t neighbor_idx + ) { + f->t->glb_elems.tris[elem_idx].neighbor_indices[face_idx] = neighbor_idx; + return neighbor_idx; +} + +struct h5t_access_methods h5tpriv_access_trim_methods = { + get_loc_elem, + get_loc_elem_idx, + set_loc_elem_idx, + get_loc_elem_parent_idx, + set_loc_elem_parent_idx, + get_loc_elem_child_idx, + set_loc_elem_child_idx, + get_loc_elem_level_idx, + set_loc_elem_level_idx, + get_loc_elem_vertex_indices, + get_loc_elem_vertex_idx, + set_loc_elem_vertex_idx, + get_loc_elem_neighbor_indices, + get_loc_elem_neighbor_idx, + set_loc_elem_neighbor_idx, + get_glb_elem, + get_glb_elem_idx, + set_glb_elem_idx, + get_glb_elem_parent_idx, + set_glb_elem_parent_idx, + get_glb_elem_child_idx, + set_glb_elem_child_idx, + get_glb_elem_level_idx, + set_glb_elem_level_idx, + get_glb_elem_vertex_indices, + get_glb_elem_vertex_idx, + set_glb_elem_vertex_idx, + get_glb_elem_neighbor_indices, + get_glb_elem_neighbor_idx, + set_glb_elem_neighbor_idx, +}; + diff --git a/src/h5core/h5t_adjacencies_private.h b/src/h5core/h5t_adjacencies_private.h new file mode 100644 index 0000000..ea9f81c --- /dev/null +++ b/src/h5core/h5t_adjacencies_private.h @@ -0,0 +1,7 @@ +#ifndef __H5T_ADJACENCIES_PRIVATE_H +#define __H5T_ADJACENCIES_PRIVATE_H + +extern struct h5t_adjacency_methods h5tpriv_trim_adjacency_methods; +extern struct h5t_adjacency_methods h5tpriv_tetm_adjacency_methods; + +#endif diff --git a/src/h5core/h5t_readwrite_trim.c b/src/h5core/h5t_readwrite_trim.c new file mode 100644 index 0000000..aeab75c --- /dev/null +++ b/src/h5core/h5t_readwrite_trim.c @@ -0,0 +1,74 @@ +#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; +} + +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; +} + + +struct h5t_read_methods { + init_loc_elems_struct; +} h5t_read_trim_methods;