rename several variables, functions and struct members to make clear that deal with indices and not IDs

This commit is contained in:
2010-05-28 15:55:39 +00:00
parent 15455ad905
commit 3a87865fc3
16 changed files with 163 additions and 160 deletions
+5 -5
View File
@@ -32,7 +32,7 @@ compute_elems_of_vertices (
int face_idx;
int num_faces = t->ref_element->num_faces[0];
for (face_idx = 0; face_idx < num_faces; face_idx++) {
h5_id_t vidx = el->local_vids[face_idx];
h5_id_t vidx = el->local_vertex_indices[face_idx];
TRY( h5priv_append_to_idlist (
f,
&t->vertices_data[vidx].tv,
@@ -118,7 +118,7 @@ compute_children_of_edge (
TRY( t->methods.store->get_direct_children_of_edge (
f,
face_idx,
tet->local_child_eid,
tet->local_child_idx,
kids) );
TRY( compute_children_of_edge (f, kids[0], children) );
TRY( compute_children_of_edge (f, kids[1], children) );
@@ -157,7 +157,7 @@ compute_sections_of_edge (
TRY( t->methods.store->get_direct_children_of_edge (
f,
face_id,
tet->local_child_eid,
tet->local_child_idx,
kids) );
TRY( compute_sections_of_edge (f, kids[0], children) );
TRY( compute_sections_of_edge (f, kids[1], children) );
@@ -256,7 +256,7 @@ compute_children_of_triangle (
TRY( compute_direct_children_of_triangle (
f,
face_idx,
tet->local_child_eid,
tet->local_child_idx,
dids) );
TRY( compute_children_of_triangle (f, dids[0], children) );
TRY( compute_children_of_triangle (f, dids[1], children) );
@@ -293,7 +293,7 @@ compute_sections_of_triangle (
TRY( compute_direct_children_of_triangle (
f,
face_idx,
tet->local_child_eid,
tet->local_child_idx,
dids) );
TRY( compute_sections_of_triangle (f, dids[0], children) );
TRY( compute_sections_of_triangle (f, dids[1], children) );
+3 -3
View File
@@ -32,7 +32,7 @@ compute_elems_of_vertices (
int face_idx;
int num_faces = t->ref_element->num_faces[0];
for (face_idx = 0; face_idx < num_faces; face_idx++) {
h5_id_t vidx = el->local_vids[face_idx];
h5_id_t vidx = el->local_vertex_indices[face_idx];
TRY( h5priv_append_to_idlist (
f,
&t->vertices_data[vidx].tv,
@@ -98,7 +98,7 @@ compute_children_of_edge (
TRY ( t->methods.store->get_direct_children_of_edge (
f,
face_idx,
el->local_child_eid,
el->local_child_idx,
kids ) );
TRY ( compute_children_of_edge (
f, kids[0], children ) );
@@ -140,7 +140,7 @@ compute_sections_of_edge (
TRY ( t->methods.store->get_direct_children_of_edge (
f,
face_id,
el->local_child_eid,
el->local_child_idx,
kids ) );
TRY ( compute_sections_of_edge (
f, kids[0], children ) );
+8 -7
View File
@@ -4,18 +4,19 @@
#define H5T_CONTAINER_GRPNAME "Topo"
#include "h5t_openclose_private.h"
#include "h5t_tetm_adjacencies_private.h"
#include "h5t_tetm_retrieve_private.h"
#include "h5t_tetm_store_private.h"
#include "h5t_trim_adjacencies_private.h"
#include "h5t_trim_retrieve_private.h"
#include "h5t_trim_store_private.h"
#include "h5t_adjacencies_tetm_private.h"
#include "h5t_adjacencies_trim_private.h"
#include "h5t_consts_private.h"
#include "h5t_errorhandling_private.h"
#include "h5t_hsearch_private.h"
#include "h5t_map_private.h"
#include "h5t_readwrite_private.h"
#include "h5t_storemesh_private.h"
#include "h5t_retrieve_tetm_private.h"
#include "h5t_retrieve_trim_private.h"
#include "h5t_store_private.h"
#include "h5t_store_tetm_private.h"
#include "h5t_store_trim_private.h"
#include "h5t_tags_private.h"
#include "h5t_types_private.h"
+4 -3
View File
@@ -10,18 +10,19 @@ const char* ERR_ELEM_NEXIST = "Element with local vertex IDs (%s) doesn't exist!
h5_err_t
h5tpriv_error_local_elem_nexist (
h5_file_t* const f,
h5_id_t local_vids[]
h5_id_t local_vertex_indices[]
) {
h5t_fdata_t* t = f->t;
char s[1024];
int num_chars_printed = snprintf (s, sizeof(s), "%lld,", local_vids[0]);
int num_chars_printed = snprintf (s, sizeof(s), "%lld,",
local_vertex_indices[0]);
int i;
int num_vertices = t->ref_element->num_faces[0];
for (i = 1; i < num_vertices; i++) {
num_chars_printed += snprintf (
s + num_chars_printed, sizeof (s) - num_chars_printed,
"%lld,", local_vids[i]);
"%lld,", local_vertex_indices[i]);
if ((sizeof (s) - num_chars_printed) < 32) {
// buffer to small
return h5_error_internal (f, __FILE__, __func__, __LINE__);
+3 -3
View File
@@ -4,7 +4,7 @@
h5_err_t
h5tpriv_error_local_elem_nexist (
h5_file_t * const f,
h5_id_t local_vids[]
h5_id_t local_vertex_indices[]
);
#define h5tpriv_error_undef_mesh( f ) \
@@ -41,12 +41,12 @@ h5tpriv_error_local_elem_nexist (
"Triangle with global vertex ids (%lld,%lld,%lld) doesn't exist!", \
vids[0], vids[1], vids[2] );
#define h5tpriv_error_local_triangle_nexist( f, local_vids ) \
#define h5tpriv_error_local_triangle_nexist( f, indices ) \
h5_error( \
f, \
H5_ERR_NOENTRY, \
"Triangle with global vertex ids (%lld,%lld,%lld) doesn't exist!", \
local_vids[0], local_vids[1], local_vids[2] );
indices[0], indices[1], indices[2] );
#define h5tpriv_error_store_boundaryface_local_id( f, local_fid ) \
+1 -1
View File
@@ -305,7 +305,7 @@ h5tpriv_find_tv2 (
/*
map (cid,el_idx) to local index of vertex
*/
h5_id_t vertex_idx = f->t->elems_ldta[elem_idx].local_vids[face_idx];
h5_id_t vertex_idx = f->t->elems_ldta[elem_idx].local_vertex_indices[face_idx];
*retval = &f->t->vertices_data[vertex_idx].tv;
return H5_SUCCESS;
+49 -49
View File
@@ -107,10 +107,10 @@ h5tpriv_get_local_vid (
element id. For triangles \c i is in \c [0,1,2], for tetraheda \c i is in
\c [0,1,2,3].
t->elems_ldta[local_eid].local_vids[i]
*/
#define get_vertex_of_elem( f, i, eid ) \
(f->t->vertices[ f->t->elems_ldta[eid].local_vids[i] ].P)
(f->t->vertices[ f->t->elems_ldta[eid].local_vertex_indices[i] ].P)
@@ -245,29 +245,29 @@ h5tpriv_sort_elems (
}
/*!
Sort (small) array of local vertex ids geometrically.
Sort (small) array of local vertex indices geometrically.
*/
h5_err_t
h5tpriv_sort_local_vids (
h5tpriv_sort_local_vertex_indices (
h5_file_t* const f,
h5_id_t* const local_vids, /* IN/OUT: local vertex ids */
const h5_size_t size /* size of array */
h5_id_t* const indices, /* IN/OUT: local vertex indices */
const h5_size_t size /* size of array */
) {
h5t_fdata_t* t = f->t;
h5_size_t i;
for (i = 1; i < size; ++i) {
h5_id_t local_vid = local_vids[i];
h5_id_t idx = indices[i];
h5_id_t j = i;
while ((j >= 1 ) && cmp_vertices (
t->vertices[local_vid].P,
t->vertices[local_vids[j-1]].P
t->vertices[idx].P,
t->vertices[indices[j-1]].P
) < 0 ) {
local_vids[j] = local_vids[j-1];
indices[j] = indices[j-1];
--j;
}
local_vids[j] = local_vid;
indices[j] = idx;
}
return H5_SUCCESS;
}
@@ -280,20 +280,20 @@ h5tpriv_sort_local_vids (
static h5_id_t
search_elem (
h5_file_t* const f,
h5_id_t* const local_vids /* local vertex ids */
h5_id_t* const vertex_indices /* local vertex ids */
) {
h5t_fdata_t* t = f->t;
int num_vertices = t->ref_element->num_faces[0];
h5tpriv_sort_local_vids ( f, local_vids, num_vertices );
h5tpriv_sort_local_vertex_indices ( f, vertex_indices, num_vertices );
register h5_id_t low = 0;
register h5_id_t high = t->sorted_elems[0].num_items - 1;
register h5_id_t *elem1 = local_vids;
register h5_id_t *elem1 = vertex_indices;
while (low <= high) {
register int mid = (low + high) / 2;
h5_id_t local_eid = t->sorted_elems[0].items[mid];
h5_id_t *elem2 = t->elems_ldta[local_eid].local_vids;
h5_id_t *elem2 = t->elems_ldta[local_eid].local_vertex_indices;
int diff = vcmp_elems ( f, elem1, elem2 );
if (diff < 0)
high = mid - 1;
@@ -302,58 +302,58 @@ search_elem (
else
return mid; // found
}
return h5tpriv_error_local_elem_nexist (f, local_vids);
return h5tpriv_error_local_elem_nexist (f, vertex_indices);
}
/*!
Map a global vertex id to corresponding local vertex id.
Map a global vertex index to corresponding local index.
*/
h5_id_t
h5t_map_global_vid2local (
h5t_map_global_vertex_idx2local (
h5_file_t* const f,
const h5_id_t global_id
const h5_id_t global_idx
) {
h5t_fdata_t* t = f->t;
h5_id_t local_id = h5priv_search_idmap (&t->map_vertex_g2l, global_id);
if (local_id < 0)
return h5tpriv_error_global_id_nexist (f, "vertex", global_id);
return local_id;
h5_id_t local_idx = h5priv_search_idmap (&t->map_vertex_g2l, global_idx);
if (local_idx < 0)
return h5tpriv_error_global_id_nexist (f, "vertex", global_idx);
return local_idx;
}
h5_err_t
h5t_map_global_vids2local (
h5t_map_global_vertex_indices2local (
h5_file_t* const f,
const h5_id_t* const global_vids,
const h5_id_t* const global_indices,
const h5_id_t size,
h5_id_t* const local_vids
h5_id_t* const local_indices
) {
h5_id_t i;
for (i = 0; i < size; i++) {
TRY( (local_vids[i] = h5t_map_global_vid2local (
f, global_vids[i])) );
TRY( (local_indices[i] = h5t_map_global_vertex_idx2local (
f, global_indices[i])) );
}
return H5_SUCCESS;
}
/*!
Get local element id for an element given by its global id.
Get local element idx of element given by its global idx.
\param[in] f File handle
\param[in] global_eid Global element id
\param[in] global_idx Global element id
\return Local element id or error code.
*/
h5_id_t
h5t_map_global_eid2local (
h5t_map_global_elem_idx2local (
h5_file_t* const f,
const h5_id_t global_eid
const h5_id_t global_idx
) {
h5t_fdata_t* t = f->t;
h5_id_t local_eid = h5priv_search_idmap (&t->map_elem_g2l, global_eid);
if (local_eid < 0)
return h5tpriv_error_global_id_nexist (f, "elem", global_eid);
return local_eid;
h5_id_t local_idx = h5priv_search_idmap (&t->map_elem_g2l, global_idx);
if (local_idx < 0)
return h5tpriv_error_global_id_nexist (f, "elem", global_idx);
return local_idx;
}
h5_err_t
@@ -366,7 +366,7 @@ h5tpriv_rebuild_global_2_local_map_of_vertices (
t->num_vertices[t->cur_level-1] : 0;
for (; local_vid < t->num_vertices[t->num_levels-1]; local_vid++) {
t->map_vertex_g2l.items[local_vid].global_id =
t->vertices[local_vid].global_vid;
t->vertices[local_vid].global_idx;
t->map_vertex_g2l.items[local_vid].local_id = local_vid;
t->map_vertex_g2l.num_items++;
}
@@ -393,7 +393,7 @@ h5tpriv_rebuild_global_2_local_map_of_elems (
elemp+=offset) {
h5_elem_t* elem = (h5_elem_t*)elemp;
item->global_id = elem->global_eid;
item->global_id = elem->global_idx;
item->local_id = local_eid;
t->map_elem_g2l.num_items++;
}
@@ -426,7 +426,7 @@ h5t_get_vertex_indices_of_entity (
int i;
for (i = 0; i < num_vertices; i++) {
int idx = ref_element->map[dim][face_idx][i];
vertex_indices[i] = el->local_vids[idx];
vertex_indices[i] = el->local_vertex_indices[idx];
}
return H5_SUCCESS;
}
@@ -453,7 +453,7 @@ h5t_get_vertex_index_of_vertex2 (
const h5t_ref_element_t* ref_element = f->t->ref_element;
h5_elem_ldta_t *el = &f->t->elems_ldta[elem_idx];
vertex_indices[0] = el->local_vids[ref_element->map[0][face_idx][0]];
vertex_indices[0] = el->local_vertex_indices[ref_element->map[0][face_idx][0]];
return H5_SUCCESS;
}
@@ -489,8 +489,8 @@ h5t_get_vertex_indices_of_edge2 (
const h5t_ref_element_t* ref_element = f->t->ref_element;
h5_elem_ldta_t* el = &f->t->elems_ldta[elem_idx];
vertex_indices[0] = el->local_vids[ref_element->map[1][face_idx][0]];
vertex_indices[1] = el->local_vids[ref_element->map[1][face_idx][1]];
vertex_indices[0] = el->local_vertex_indices[ref_element->map[1][face_idx][0]];
vertex_indices[1] = el->local_vertex_indices[ref_element->map[1][face_idx][1]];
return H5_SUCCESS;
}
@@ -516,9 +516,9 @@ h5t_get_vertex_indices_of_triangle2 (
const h5t_ref_element_t* ref_element = f->t->ref_element;
h5_elem_ldta_t* el = &f->t->elems_ldta[elem_idx];
vertex_indices[0] = el->local_vids[ref_element->map[2][face_idx][0]];
vertex_indices[1] = el->local_vids[ref_element->map[2][face_idx][1]];
vertex_indices[2] = el->local_vids[ref_element->map[2][face_idx][2]];
vertex_indices[0] = el->local_vertex_indices[ref_element->map[2][face_idx][0]];
vertex_indices[1] = el->local_vertex_indices[ref_element->map[2][face_idx][1]];
vertex_indices[2] = el->local_vertex_indices[ref_element->map[2][face_idx][2]];
return H5_SUCCESS;
}
@@ -533,10 +533,10 @@ h5t_get_vertex_indices_of_tet (
const h5t_ref_element_t* ref_element = f->t->ref_element;
h5_elem_ldta_t* el = &f->t->elems_ldta[elem_idx];
vertex_indices[0] = el->local_vids[ref_element->map[3][0][0]];
vertex_indices[1] = el->local_vids[ref_element->map[3][0][1]];
vertex_indices[2] = el->local_vids[ref_element->map[3][0][2]];
vertex_indices[3] = el->local_vids[ref_element->map[3][0][3]];
vertex_indices[0] = el->local_vertex_indices[ref_element->map[3][0][0]];
vertex_indices[1] = el->local_vertex_indices[ref_element->map[3][0][1]];
vertex_indices[2] = el->local_vertex_indices[ref_element->map[3][0][2]];
vertex_indices[3] = el->local_vertex_indices[ref_element->map[3][0][3]];
return H5_SUCCESS;
}
+2 -2
View File
@@ -2,9 +2,9 @@
#define __H5T_MAP_PRIVATE_H
h5_err_t
h5tpriv_sort_local_vids (
h5tpriv_sort_local_vertex_indices (
h5_file_t * const f,
h5_id_t * const local_vids,
h5_id_t * const indices,
const h5_size_t size
);
+18 -18
View File
@@ -67,8 +67,8 @@ _create_vertex_type (
h5priv_insert_hdf5_type (
f,
dtypes->h5_vertex_t,
"global_vid",
HOFFSET (struct h5_vertex, global_vid),
"global_idx",
HOFFSET (struct h5_vertex, global_idx),
H5_ID_T) );
TRY(
h5priv_insert_hdf5_type (
@@ -96,29 +96,29 @@ _create_triangle_type (
h5priv_insert_hdf5_type (
f,
dtypes->h5_triangle_t,
"global_eid",
HOFFSET (struct h5_triangle, global_eid),
"global_idx",
HOFFSET (struct h5_triangle, global_idx),
H5_ID_T) );
TRY(
h5priv_insert_hdf5_type (
f,
dtypes->h5_triangle_t,
"global_parent_eid",
HOFFSET (struct h5_triangle, global_parent_eid),
"global_parent_idx",
HOFFSET (struct h5_triangle, global_parent_idx),
H5_ID_T) );
TRY(
h5priv_insert_hdf5_type (
f,
dtypes->h5_triangle_t,
"global_child_eid",
HOFFSET(struct h5_triangle, global_child_eid),
"global_child_idx",
HOFFSET(struct h5_triangle, global_child_idx),
H5_ID_T) );
TRY(
h5priv_insert_hdf5_type (
f,
dtypes->h5_triangle_t,
"global_vids",
HOFFSET (struct h5_triangle, global_vids),
"global_vertex_indices",
HOFFSET (struct h5_triangle, global_vertex_indices),
dtypes->h5_3id_t) );
return H5_SUCCESS;
@@ -168,29 +168,29 @@ _create_tet_type (
h5priv_insert_hdf5_type (
f,
dtypes->h5_tet_t,
"global_eid",
HOFFSET (struct h5_tetrahedron, global_eid),
"global_idx",
HOFFSET (struct h5_tetrahedron, global_idx),
H5_ID_T) );
TRY(
h5priv_insert_hdf5_type (
f,
dtypes->h5_tet_t,
"global_parent_eid",
HOFFSET (struct h5_tetrahedron, global_parent_eid),
"global_parent_idx",
HOFFSET (struct h5_tetrahedron, global_parent_idx),
H5_ID_T) );
TRY(
h5priv_insert_hdf5_type (
f,
dtypes->h5_tet_t,
"global_child_eid",
HOFFSET (struct h5_tetrahedron, global_child_eid),
"global_child_idx",
HOFFSET (struct h5_tetrahedron, global_child_idx),
H5T_NATIVE_INT32) );
TRY(
h5priv_insert_hdf5_type (
f,
dtypes->h5_tet_t,
"global_vids",
HOFFSET (struct h5_tetrahedron, global_vids),
"global_vertex_indices",
HOFFSET (struct h5_tetrahedron, global_vertex_indices),
dtypes->h5_4id_t) );
return H5_SUCCESS;
+11 -11
View File
@@ -255,20 +255,20 @@ build_elems_ldta (
local_eid < num_elems;
local_eid++, elp+=h5tpriv_sizeof_elem[t->mesh_type], el_data++) {
el = (h5_elem_t*)elp;
TRY( h5t_map_global_vids2local (
TRY( h5t_map_global_vertex_indices2local (
f,
el->global_vids,
el->global_vertex_indices,
num_vertices,
el_data->local_vids) );
if (el->global_parent_eid >= 0)
TRY( el_data->local_parent_eid =
h5t_map_global_eid2local (
f, el->global_parent_eid) );
el_data->local_vertex_indices) );
if (el->global_parent_idx >= 0)
TRY( el_data->local_parent_idx =
h5t_map_global_elem_idx2local (
f, el->global_parent_idx) );
if (el->global_child_eid >= 0)
TRY( el_data->local_child_eid =
h5t_map_global_eid2local (
f, el->global_child_eid) );
if (el->global_child_idx >= 0)
TRY( el_data->local_child_idx =
h5t_map_global_elem_idx2local (
f, el->global_child_idx) );
if (local_eid >= t->num_elems[level_id]) {
level_id++;
+2 -2
View File
@@ -36,8 +36,8 @@ h5tpriv_elem_is_on_cur_level (
) {
h5t_fdata_t* t = f->t;
if ( (el_dta->level_id > t->cur_level) ||
( (el_dta->local_child_eid >= 0) &&
(el_dta->local_child_eid < t->num_elems[t->cur_level]) ) ) {
( (el_dta->local_child_idx >= 0) &&
(el_dta->local_child_idx < t->num_elems[t->cur_level]) ) ) {
return H5_NOK;
}
return H5_SUCCESS;
+15 -14
View File
@@ -42,7 +42,7 @@ assign_global_vertex_indices (
for (local_idx = 0;
local_idx < t->num_vertices[t->num_levels-1];
local_idx++) {
t->vertices[local_idx].global_vid = local_idx;
t->vertices[local_idx].global_idx = local_idx;
}
return H5_SUCCESS;
@@ -77,13 +77,13 @@ assign_global_elem_indices (
default:
return h5_error_internal (f,__FILE__,__func__,__LINE__);
}
elem->global_eid = local_idx;
elem->global_parent_eid = elem_ldta->local_parent_eid;
elem->global_child_eid = elem_ldta->local_child_eid;
elem->global_idx = local_idx;
elem->global_parent_idx = elem_ldta->local_parent_idx;
elem->global_child_idx = elem_ldta->local_child_idx;
int i;
int num_vertices = t->ref_element->num_faces[0];
for (i = 0; i < num_vertices; i++) {
elem->global_vids[i] = elem_ldta->local_vids[i];
elem->global_vertex_indices[i] = elem_ldta->local_vertex_indices[i];
}
}
@@ -152,7 +152,7 @@ h5t_begin_store_vertices (
h5_id_t
h5t_store_vertex (
h5_file_t* const f, /*!< file handle */
const h5_id_t global_vid, /*!< global vertex id or -1 */
const h5_id_t global_idx, /*!< global vertex id or -1 */
const h5_float64_t P[3] /*!< coordinates */
) {
h5t_fdata_t* const t = f->t;
@@ -170,11 +170,11 @@ h5t_store_vertex (
if (t->cur_level < 0)
return h5tpriv_error_undef_level(f);
h5_id_t local_id = ++t->last_stored_vid;
h5_vertex_t *vertex = &t->vertices[local_id];
vertex->global_vid = global_vid; /* ID from mesher, replaced later!*/
h5_id_t local_idx = ++t->last_stored_vid;
h5_vertex_t *vertex = &t->vertices[local_idx];
vertex->global_idx = global_idx; /* ID from mesher, replaced later!*/
memcpy (&vertex->P, P, sizeof (vertex->P));
return local_id;
return local_idx;
}
h5_err_t
@@ -261,13 +261,14 @@ h5t_store_elem (
h5_id_t elem_idx = ++t->last_stored_eid;
h5_elem_ldta_t* elem_ldta = &t->elems_ldta[elem_idx];
elem_ldta->local_parent_eid = elem_idx_of_parent;
elem_ldta->local_child_eid = -1;
elem_ldta->local_parent_idx = elem_idx_of_parent;
elem_ldta->local_child_idx = -1;
elem_ldta->level_id = t->cur_level;
int num_vertices = t->ref_element->num_faces[0];
memcpy (elem_ldta->local_vids, vertices,
memcpy (elem_ldta->local_vertex_indices, vertices,
sizeof (*vertices) * num_vertices);
h5tpriv_sort_local_vids (f, elem_ldta->local_vids, num_vertices);
h5tpriv_sort_local_vertex_indices (f, elem_ldta->local_vertex_indices,
num_vertices);
h5_id_t face_idx;
int num_faces = t->ref_element->num_faces[1];
h5_idlist_t* retval;
+10 -10
View File
@@ -46,7 +46,7 @@ alloc_tets (
h5_id_t *p = t->elems_lvids;
h5_id_t id;
for ( id = 0; id < new; id++, p+=nvertices ) {
t->elems_ldta[id].local_vids = p;
t->elems_ldta[id].local_vertex_indices = p;
}
/* alloc mem for global to local ID mapping */
@@ -110,7 +110,7 @@ bisect_edge (
for ( i = 0; i < retval->num_items; i++ ) {
h5_id_t local_id = h5tpriv_get_elem_idx ( retval->items[i] );
h5_elem_ldta_t *tet = &t->elems_ldta[local_id];
if ( tet->local_child_eid >= 0 ) {
if ( tet->local_child_idx >= 0 ) {
/*
this element has been refined!
return bisecting point
@@ -121,7 +121,7 @@ bisect_edge (
TRY( get_direct_children_of_edge (
f,
face_id,
tet->local_child_eid,
tet->local_child_idx,
kids) );
TRY( h5t_get_vertex_indices_of_edge (f, kids[0], edge0) );
TRY( h5t_get_vertex_indices_of_edge (f, kids[1], edge1) );
@@ -160,16 +160,16 @@ refine_tet (
h5_id_t elem_idx_of_first_child;
h5_elem_ldta_t *tet = &t->elems_ldta[elem_idx];
if ( tet->local_child_eid >= 0 )
if ( tet->local_child_idx >= 0 )
return h5_error (
f,
H5_ERR_INVAL,
"Tetrahedron %lld already refined.",
elem_idx );
vertices[0] = tet->local_vids[0];
vertices[1] = tet->local_vids[1];
vertices[2] = tet->local_vids[2];
vertices[3] = tet->local_vids[3];
vertices[0] = tet->local_vertex_indices[0];
vertices[1] = tet->local_vertex_indices[1];
vertices[2] = tet->local_vertex_indices[2];
vertices[3] = tet->local_vertex_indices[3];
vertices[4] = bisect_edge (f, 0, elem_idx);
vertices[5] = bisect_edge (f, 1, elem_idx);
@@ -231,8 +231,8 @@ refine_tet (
new_elem[3] = vertices[9];
TRY( h5t_store_elem (f, elem_idx, new_elem) );
t->elems.tets[elem_idx].global_child_eid = elem_idx_of_first_child;
t->elems_ldta[elem_idx].local_child_eid = elem_idx_of_first_child;
t->elems.tets[elem_idx].global_child_idx = elem_idx_of_first_child;
t->elems_ldta[elem_idx].local_child_idx = elem_idx_of_first_child;
t->num_elems_on_level[t->cur_level]--;
return elem_idx_of_first_child;
+9 -9
View File
@@ -46,7 +46,7 @@ alloc_triangles (
h5_id_t *p = t->elems_lvids;
h5_id_t id;
for ( id = 0; id < new; id++, p+=nvertices ) {
t->elems_ldta[id].local_vids = p;
t->elems_ldta[id].local_vertex_indices = p;
}
/* alloc mem for global to local ID mapping */
@@ -106,7 +106,7 @@ bisect_edge (
for ( i = 0; i < retval->num_items; i++ ) {
h5_id_t local_id = h5tpriv_get_elem_idx ( retval->items[i] );
h5_elem_ldta_t *tet = &t->elems_ldta[local_id];
if ( tet->local_child_eid >= 0 ) {
if ( tet->local_child_idx >= 0 ) {
/*
this element has been refined!
return bisecting point
@@ -117,7 +117,7 @@ bisect_edge (
TRY ( get_direct_children_of_edge (
f,
face_id,
tet->local_child_eid,
tet->local_child_idx,
kids ) );
TRY ( h5t_get_vertex_indices_of_edge ( f, kids[0], edge0 ) );
TRY ( h5t_get_vertex_indices_of_edge ( f, kids[1], edge1 ) );
@@ -158,16 +158,16 @@ refine_triangle (
h5_id_t elem_idx_of_first_child;
h5_elem_ldta_t *el = &t->elems_ldta[elem_idx];
if ( el->local_child_eid >= 0 )
if ( el->local_child_idx >= 0 )
return h5_error (
f,
H5_ERR_INVAL,
"Element %lld already refined.",
elem_idx );
vertices[0] = el->local_vids[0];
vertices[1] = el->local_vids[1];
vertices[2] = el->local_vids[2];
vertices[0] = el->local_vertex_indices[0];
vertices[1] = el->local_vertex_indices[1];
vertices[2] = el->local_vertex_indices[2];
vertices[3] = bisect_edge( f, 0, elem_idx );
vertices[4] = bisect_edge( f, 1, elem_idx );
@@ -195,8 +195,8 @@ refine_triangle (
new_elem[2] = vertices[5];
TRY( h5t_store_elem (f, elem_idx, new_elem) );
t->elems.tris[elem_idx].global_child_eid = elem_idx_of_first_child;
t->elems_ldta[elem_idx].local_child_eid = elem_idx_of_first_child;
t->elems.tris[elem_idx].global_child_idx = elem_idx_of_first_child;
t->elems_ldta[elem_idx].local_child_idx = elem_idx_of_first_child;
t->num_elems_on_level[t->cur_level]--;
return elem_idx_of_first_child;
+16 -16
View File
@@ -47,7 +47,7 @@ struct h5t_methods {
};
typedef struct h5_vertex {
h5_id_t global_vid;
h5_id_t global_idx;
h5_coord3d_t P;
} h5_vertex_t;
@@ -56,32 +56,32 @@ typedef struct h5_vertex_data {
} h5_vertex_data_t;
typedef struct h5_triangle {
h5_id_t global_eid;
h5_id_t global_parent_eid;
h5_id_t global_child_eid;
h5_3id_t global_vids;
h5_id_t global_idx;
h5_id_t global_parent_idx;
h5_id_t global_child_idx;
h5_3id_t global_vertex_indices;
} h5_triangle_t;
typedef struct h5_tetrahedron {
h5_id_t global_eid;
h5_id_t global_parent_eid;
h5_id_t global_child_eid;
h5_4id_t global_vids;
h5_id_t global_idx;
h5_id_t global_parent_idx;
h5_id_t global_child_idx;
h5_4id_t global_vertex_indices;
} h5_tetrahedron_t;
typedef h5_tetrahedron_t h5_tet_t;
typedef struct h5_elem {
h5_id_t global_eid;
h5_id_t global_parent_eid;
h5_id_t global_child_eid;
h5_id_t global_vids[1];
h5_id_t global_idx;
h5_id_t global_parent_idx;
h5_id_t global_child_idx;
h5_id_t global_vertex_indices[1];
} h5_elem_t;
typedef struct h5_elem_ldta {
h5_id_t local_parent_eid;
h5_id_t local_child_eid;
h5_id_t local_parent_idx;
h5_id_t local_child_idx;
h5_id_t level_id;
h5_id_t *local_vids;
h5_id_t *local_vertex_indices;
} h5_elem_ldta_t;
+7 -7
View File
@@ -2,17 +2,17 @@
#define __H5T_MAP_H
h5_id_t
h5t_map_global_vid2local (
h5t_map_global_vertex_index2local (
h5_file_t * const f,
h5_id_t global_vid
h5_id_t global_idx
);
h5_err_t
h5t_map_global_vids2local (
h5t_map_global_vertex_indices2local (
h5_file_t *f,
const h5_id_t * const global_vids,
const h5_id_t * const global_indices,
const h5_id_t size,
h5_id_t * const local_vids
h5_id_t * const local_indices
);
h5_id_t
@@ -22,9 +22,9 @@ h5t_map_local_vid2global (
);
h5_id_t
h5t_map_global_eid2local (
h5t_map_global_elem_idx2local (
h5_file_t * const f,
const h5_id_t global_eid
const h5_id_t global_idx
);
h5_id_t