- refactored 'num_elems_on_level' to 'num_elems_on_leaf_level'

- introduced new refinement level
This commit is contained in:
2010-12-16 12:25:28 +00:00
parent b8a7e0686d
commit cb35755cf5
10 changed files with 53 additions and 57 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ h5t_get_num_elems (
if (t->cur_level < 0) {
return h5tpriv_error_undef_level (f);
}
return t->num_elems_on_level[t->cur_level];
return t->num_elems_on_leaf_level[t->cur_level];
}
/*!
+13 -13
View File
@@ -235,7 +235,7 @@ init_fdata (
t->glb_elems.data = NULL;
t->loc_elems.data = NULL;
t->num_elems = NULL;
t->num_elems_on_level = NULL;
t->num_elems_on_leaf_level = NULL;
t->map_elem_g2l.items = NULL;
t->vertices = NULL;
t->num_vertices = NULL;
@@ -310,21 +310,21 @@ init_fdata (
t->dsinfo_num_elems.access_prop = H5P_DEFAULT;
/* NumElemsOnLevel */
strcpy (t->dsinfo_num_elems_on_level.name, "NumElemsOnLevel");
t->dsinfo_num_elems_on_level.rank = 1;
t->dsinfo_num_elems_on_level.dims[0] = 0;
t->dsinfo_num_elems_on_level.max_dims[0] = H5S_UNLIMITED;
t->dsinfo_num_elems_on_level.chunk_dims[0] = 4096;
t->dsinfo_num_elems_on_level.type_id = t->dtypes.h5_glb_idx_t;
TRY( t->dsinfo_num_elems_on_level.create_prop = h5priv_create_hdf5_property (
strcpy (t->dsinfo_num_elems_on_leaf_level.name, "NumElemsOnLeafLevel");
t->dsinfo_num_elems_on_leaf_level.rank = 1;
t->dsinfo_num_elems_on_leaf_level.dims[0] = 0;
t->dsinfo_num_elems_on_leaf_level.max_dims[0] = H5S_UNLIMITED;
t->dsinfo_num_elems_on_leaf_level.chunk_dims[0] = 4096;
t->dsinfo_num_elems_on_leaf_level.type_id = t->dtypes.h5_glb_idx_t;
TRY( t->dsinfo_num_elems_on_leaf_level.create_prop = h5priv_create_hdf5_property (
f,
H5P_DATASET_CREATE) );
TRY( h5priv_set_hdf5_chunk_property (
f,
t->dsinfo_num_elems_on_level.create_prop,
t->dsinfo_num_elems_on_level.rank,
t->dsinfo_num_elems_on_level.chunk_dims) );
t->dsinfo_num_elems_on_level.access_prop = H5P_DEFAULT;
t->dsinfo_num_elems_on_leaf_level.create_prop,
t->dsinfo_num_elems_on_leaf_level.rank,
t->dsinfo_num_elems_on_leaf_level.chunk_dims) );
t->dsinfo_num_elems_on_leaf_level.access_prop = H5P_DEFAULT;
return H5_SUCCESS;
}
@@ -499,7 +499,7 @@ release_elems (
TRY( h5_free (f, t->glb_elems.data) );
TRY( h5_free (f, t->loc_elems.data) );
TRY( h5_free (f, t->num_elems) );
TRY( h5_free (f, t->num_elems_on_level) );
TRY( h5_free (f, t->num_elems_on_leaf_level) );
TRY( h5_free (f, t->map_elem_g2l.items) );
return H5_SUCCESS;
+6 -6
View File
@@ -73,10 +73,10 @@ write_elems (
TRY( h5priv_write_dataset_by_name (
f,
t->mesh_gid,
&t->dsinfo_num_elems_on_level,
&t->dsinfo_num_elems_on_leaf_level,
open_space_all,
open_space_all,
t->num_elems_on_level) );
t->num_elems_on_leaf_level) );
return H5_SUCCESS;
}
@@ -192,8 +192,8 @@ read_num_elems (
return h5_error_internal (f, __FILE__, __func__, __LINE__);
}
size_t size = t->num_levels * sizeof (t->num_elems[0]);
TRY( t->num_elems = h5_alloc (f, NULL, size) );
TRY( t->num_elems_on_level = h5_alloc (f, NULL, size) );
TRY( t->num_elems = h5_calloc (f, 1, size) );
TRY( t->num_elems_on_leaf_level = h5_calloc (f, 1, size) );
TRY( h5priv_read_dataset_by_name (
f,
t->mesh_gid,
@@ -205,10 +205,10 @@ read_num_elems (
TRY( h5priv_read_dataset_by_name (
f,
t->mesh_gid,
&t->dsinfo_num_elems_on_level,
&t->dsinfo_num_elems_on_leaf_level,
open_space_all,
open_space_all,
t->num_elems_on_level) );
t->num_elems_on_leaf_level) );
return H5_SUCCESS;
}
+8 -11
View File
@@ -36,6 +36,14 @@ init_loc_elems_struct (
}
loc_elem->level_idx = level_idx;
// refinement level
loc_elem->refinement_level = 0;
h5_loc_tet_t* elem = loc_elem;
while (elem->parent_idx > 0) {
elem = t->loc_elems.tets + elem->parent_idx;
loc_elem->refinement_level++;
}
// vertex indices
TRY( h5t_map_global_vertex_indices2local (
f,
@@ -49,17 +57,6 @@ init_loc_elems_struct (
glb_elem->neighbor_indices,
num_facets,
loc_elem->neighbor_indices) );
#if 0
// done in function below
// on boundary?
int i;
for (i=0; i < num_facets; i++) {
if (loc_elem->neighbor_indices[i] == -1) {
loc_elem->flags |= H5T_BOUNDARY_ELEM_FLAG;
break;
}
}
#endif
}
return H5_SUCCESS;
}
+9 -10
View File
@@ -36,6 +36,14 @@ init_loc_elems_struct (
}
loc_elem->level_idx = level_idx;
// refinement level
loc_elem->refinement_level = 0;
h5_loc_triangle_t* elem = loc_elem;
while (elem->parent_idx > 0) {
elem = t->loc_elems.tris + elem->parent_idx;
loc_elem->refinement_level++;
}
// vertex indices
TRY( h5t_map_global_vertex_indices2local (
f,
@@ -49,16 +57,7 @@ init_loc_elems_struct (
glb_elem->neighbor_indices,
num_facets,
loc_elem->neighbor_indices) );
#if 0
// on boundary?
int i;
for (i=0; i < num_facets; i++) {
if (loc_elem->neighbor_indices[i] == -1) {
loc_elem->flags |= H5T_BOUNDARY_ELEM_FLAG;
break;
}
}
#endif
}
return H5_SUCCESS;
}
+1 -1
View File
@@ -220,7 +220,7 @@ h5t_init_boundary_face_iterator (
H5_CORE_API_ENTER;
h5_err_t h5err = H5_SUCCESS;
h5t_leaf_iterator_t* it;
it->face_idx = 999; // just a high enough number
it->face_idx = 999; // something > max number of faces
it->elem_idx = -1;
it->codim = codim;
it->leaf_level = f->t->cur_level;
+6 -6
View File
@@ -139,7 +139,7 @@ h5t_add_level (
t->num_loaded_levels = t->num_levels;
t->dsinfo_num_vertices.dims[0] = t->num_levels;
t->dsinfo_num_elems.dims[0] = t->num_levels;
t->dsinfo_num_elems_on_level.dims[0] = t->num_levels;
t->dsinfo_num_elems_on_leaf_level.dims[0] = t->num_levels;
ssize_t num_bytes = t->num_levels*sizeof (h5_size_t);
TRY( t->num_vertices = h5_alloc (f, t->num_vertices, num_bytes) );
@@ -147,9 +147,9 @@ h5t_add_level (
TRY( t->num_elems = h5_alloc (f, t->num_elems, num_bytes) );
t->num_elems[t->cur_level] = -1;
TRY( t->num_elems_on_level = h5_alloc (
f, t->num_elems_on_level, num_bytes) );
t->num_elems_on_level[t->cur_level] = -1;
TRY( t->num_elems_on_leaf_level = h5_alloc (
f, t->num_elems_on_leaf_level, num_bytes) );
t->num_elems_on_leaf_level[t->cur_level] = -1;
if (t->cur_level == 0) {
/* nothing stored yet */
@@ -238,8 +238,8 @@ h5t_begin_store_elems (
t->num_elems[t->cur_level] = new;
t->dsinfo_elems.dims[0] = new;
t->num_elems_on_level[t->cur_level] = t->cur_level > 0 ?
num + t->num_elems_on_level[t->cur_level-1] : num;
t->num_elems_on_leaf_level[t->cur_level] = t->cur_level > 0 ?
num + t->num_elems_on_leaf_level[t->cur_level-1] : num;
/*
We allocate a hash table for a minimum of 2^21 edges to
avoid resizing.
+1 -1
View File
@@ -217,7 +217,7 @@ refine_tet (
// t->glb_elems.tets[elem_idx].child_idx = elem_idx_of_first_child;
t->loc_elems.tets[elem_idx].child_idx = elem_idx_of_first_child;
t->num_elems_on_level[t->cur_level]--;
t->num_elems_on_leaf_level[t->cur_level]--;
return elem_idx_of_first_child;
}
+1 -1
View File
@@ -181,7 +181,7 @@ refine_triangle (
t->glb_elems.tris[elem_idx].child_idx = elem_idx_of_first_child;
t->loc_elems.tris[elem_idx].child_idx = elem_idx_of_first_child;
t->num_elems_on_level[t->cur_level]--;
t->num_elems_on_leaf_level[t->cur_level]--;
return elem_idx_of_first_child;
}
+7 -7
View File
@@ -20,11 +20,11 @@ typedef struct h5_glb_triangle {
} h5_glb_triangle_t;
typedef struct h5_loc_triangle {
h5_glb_idx_t glb_idx;
h5_loc_idx_t parent_idx;
h5_loc_idx_t child_idx;
h5t_lvl_idx_t level_idx;
h5t_lvl_idx_t refinement_level;
h5_glb_idx_t glb_idx; // global index of element
h5_loc_idx_t parent_idx; // index of parent element
h5_loc_idx_t child_idx; // index of (first) children
h5t_lvl_idx_t level_idx; // leaf level on which this element has been created
h5t_lvl_idx_t refinement_level; // refinements of father in macro-grid
h5t_elem_flags_t flags;
h5_loc_idx_t vertex_indices[3];
h5_loc_idx_t neighbor_indices[3];
@@ -158,13 +158,13 @@ typedef struct h5t_fdata {
h5_loc_elems_t loc_elems;
h5_size_t *num_elems;
h5_size_t *num_elems_on_level;
h5_size_t *num_elems_on_leaf_level;
h5_idxmap_t map_elem_g2l; /* map global id to local id */
h5_loc_idx_t last_stored_eid;
h5_dsinfo_t dsinfo_elems;
h5_dsinfo_t dsinfo_num_elems;
h5_dsinfo_t dsinfo_num_elems_on_level;
h5_dsinfo_t dsinfo_num_elems_on_leaf_level;
h5_idlist_t marked_entities;