- introducing types for local and globale IDs and indices

- different structurs for local elements and stored elements in file
- interator for border facets added
This commit is contained in:
2010-11-12 08:23:00 +00:00
parent 1dd75f48e6
commit 0de4641ec5
50 changed files with 998 additions and 667 deletions
+13 -13
View File
@@ -38,7 +38,7 @@
/*!
\ingroup h5hut_file
Open file with name \c filename. This function is available in the parallel
Open file with name \c filbename. This function is available in the parallel
and serial version. In the serial case \c comm may have any value.
\return File handle.
@@ -64,7 +64,7 @@ h5_err_t
H5CloseFile (
h5_file_t* const f /*!< file handle */
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5_close_file (f);
}
@@ -79,7 +79,7 @@ h5_err_t
H5CheckFile (
h5_file_t* const f /*!< file handle */
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5_check_filehandle (f);
}
@@ -99,7 +99,7 @@ H5SetStepNameFormat (
const char* name, /*!< Prefix */
const h5_int64_t width /*!< Width of the number */
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5_set_stepname_fmt (f, name, width);
}
@@ -119,7 +119,7 @@ H5GetStepNameFormat (
const h5_size_t l_name, /*!< length of buffer name */
int* width /*!< OUT: Width of the number */
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5_get_stepname_fmt (f, name, l_name, width);
}
@@ -137,7 +137,7 @@ H5SetStep (
const h5_id_t step /*!< [in] Step to set. */
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5_set_step (f, step);
}
@@ -153,7 +153,7 @@ H5GetStep (
h5_file_t* const f /*!< Handle to open file */
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5_get_step (f);
}
@@ -171,7 +171,7 @@ int
H5GetNumProcs (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5_get_num_procs(f);
}
@@ -193,7 +193,7 @@ H5GetNumSteps (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5_get_num_steps(f);
}
@@ -214,7 +214,7 @@ H5HasStep (
h5_id_t stepno
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5_has_step (f, stepno);
}
@@ -231,7 +231,7 @@ H5StartTraverseSteps (
h5_file_t* const f /*!< Handle to open file */
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5_start_traverse_steps (f);
}
@@ -248,7 +248,7 @@ H5TraverseSteps (
h5_file_t* const f /*!< Handle to open file */
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5_traverse_steps (f);
}
@@ -276,7 +276,7 @@ H5SetThrottle (
int factor
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_set_throttle( f, factor );
}
+17 -17
View File
@@ -73,7 +73,7 @@ H5Block3dHasView (
h5_file_t *const f /*!< IN: File handle */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_3d_has_view(f);
}
@@ -102,7 +102,7 @@ H5Block3dSetView (
const h5_int64_t k_end /*!< IN: end index of \c k */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_3d_set_view(f, i_start, i_end, j_start, j_end, k_start, k_end);
}
@@ -125,7 +125,7 @@ H5Block3dGetView (
h5_size_t *k_end /*!< OUT: end index of \c k */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_3d_get_view(f, i_start, i_end, j_start, j_end, k_start, k_end);
}
@@ -148,7 +148,7 @@ H5Block3dGetReducedView (
h5_size_t *const k_end /*!< OUT: end index of \c j */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_3d_get_reduced_view(f, i_start, i_end, j_start, j_end, k_start, k_end);
}
@@ -169,7 +169,7 @@ H5Block3dSetChunk (
const h5_size_t k /*!< IN: size of \c k */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_3d_set_chunk(f, i, j, k);
}
@@ -190,7 +190,7 @@ H5Block3dGetChunk (
h5_size_t *const k /*!< OUT: size of \c k */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_3d_get_chunk(f, field_name, i, j, k);
}
@@ -218,7 +218,7 @@ H5Block3dSetGrid (
const h5_size_t k /*!< IN: dimension in \c k */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_3d_set_grid(f, i, j, k);
}
@@ -240,7 +240,7 @@ H5Block3dGetGridCoords (
h5_int64_t *k /*!< OUT: index in \c k */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_3d_get_grid_coords(f, proc, i, j, k);
}
@@ -264,7 +264,7 @@ H5Block3dSetDims (
const h5_size_t k /*!< IN: dimension in \c k */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_3d_set_dims(f, i, j, k);
}
@@ -290,7 +290,7 @@ H5Block3dSetHalo (
const h5_size_t k /*!< IN: radius in \c k */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_3d_set_halo(f, i, j, k);
}
@@ -307,7 +307,7 @@ H5BlockGetNumFields (
h5_file_t *const f /*!< IN: file handle */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_get_num_fields(f);
}
@@ -341,7 +341,7 @@ H5BlockGetFieldInfo (
h5_int64_t *type /*!< OUT: datatype */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_get_field_info (f,
idx, name, len_name, field_rank, field_dims, elem_rank, type);
@@ -365,7 +365,7 @@ H5BlockGetFieldInfoByName (
h5_int64_t *type /*!< OUT: datatype */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_get_field_info_by_name (f,
name, field_rank, field_dims, elem_rank, type );
@@ -389,7 +389,7 @@ H5BlockWriteFieldAttribString (
const char *value /*!< IN: attribute value */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_field_attrib (
f,
@@ -416,7 +416,7 @@ H5BlockReadFieldAttribString (
char *buffer /*!< OUT: attribute value */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_field_attrib (
f,
@@ -439,7 +439,7 @@ H5BlockGetNumFieldAttribs (
const char *field_name /*<! IN: field name */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_get_num_field_attribs(f, field_name);
}
@@ -470,7 +470,7 @@ H5BlockGetFieldAttribInfo (
h5_size_t *attrib_nelem /*<! OUT: Number of elements */
) {
SET_FNAME ( f, __func__ );
H5_ENTER_API ( f, __func__ );
return h5b_get_field_attrib_info (
f,
+24 -24
View File
@@ -20,7 +20,7 @@ H5Block3dWriteScalarFieldFloat64 (
const h5_float64_t *data /*!< IN: scalar data to write */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_write_scalar_data(f, name, (void*)data, H5T_NATIVE_DOUBLE );
}
@@ -43,7 +43,7 @@ H5Block3dReadScalarFieldFloat64 (
h5_float64_t *data /*!< OUT: ptr to read buffer */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_read_scalar_data(f, name, (void*)data, H5T_NATIVE_DOUBLE);
}
@@ -70,7 +70,7 @@ H5Block3dWriteVector3dFieldFloat64 (
const h5_float64_t *z_data /*!< IN: Z axis data */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_write_vector3d_data(f, name,
(void*)x_data, (void*)y_data, (void*)z_data, H5T_NATIVE_DOUBLE);
@@ -98,7 +98,7 @@ H5Block3dReadVector3dFieldFloat64 (
h5_float64_t *z_data /*!< OUT: Z axis data */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_read_vector3d_data(f, name,
(void*)x_data, (void*)y_data, (void*)z_data, H5T_NATIVE_DOUBLE);
@@ -122,7 +122,7 @@ H5Block3dWriteScalarFieldFloat32 (
const h5_float32_t *data /*!< IN: scalar data to write */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_write_scalar_data(f, name, (void*)data, H5T_NATIVE_FLOAT );
}
@@ -145,7 +145,7 @@ H5Block3dReadScalarFieldFloat32 (
h5_float32_t *data /*!< OUT: ptr to read buffer */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_read_scalar_data(f, name, (void*)data, H5T_NATIVE_FLOAT);
}
@@ -172,7 +172,7 @@ H5Block3dWriteVector3dFieldFloat32 (
const h5_float32_t *z_data /*!< IN: Z axis data */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_write_vector3d_data(f, name,
(void*)x_data, (void*)y_data, (void*)z_data, H5T_NATIVE_FLOAT);
@@ -200,7 +200,7 @@ H5Block3dReadVector3dFieldFloat32 (
h5_float32_t *z_data /*!< OUT: Z axis data */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_read_vector3d_data(f, name,
(void*)x_data, (void*)y_data, (void*)z_data, H5T_NATIVE_FLOAT);
@@ -224,7 +224,7 @@ H5Block3dWriteScalarFieldInt64 (
const h5_int64_t *data /*!< IN: scalar data to write */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_write_scalar_data(f, name, (void*)data, H5T_NATIVE_INT64 );
}
@@ -247,7 +247,7 @@ H5Block3dReadScalarFieldInt64 (
h5_int64_t *data /*!< OUT: ptr to read buffer */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_read_scalar_data(f, name, (void*)data, H5T_NATIVE_INT64);
}
@@ -274,7 +274,7 @@ H5Block3dWriteVector3dFieldInt64 (
const h5_int64_t *z_data /*!< IN: Z axis data */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_write_vector3d_data(f, name,
(void*)x_data, (void*)y_data, (void*)z_data, H5T_NATIVE_INT64);
@@ -302,7 +302,7 @@ H5Block3dReadVector3dFieldInt64 (
h5_int64_t *z_data /*!< OUT: Z axis data */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_read_vector3d_data(f, name,
(void*)x_data, (void*)y_data, (void*)z_data, H5T_NATIVE_INT64);
@@ -326,7 +326,7 @@ H5Block3dWriteScalarFieldInt32 (
const h5_int32_t *data /*!< IN: scalar data to write */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_write_scalar_data(f, name, (void*)data, H5T_NATIVE_INT32 );
}
@@ -349,7 +349,7 @@ H5Block3dReadScalarFieldInt32 (
h5_int32_t *data /*!< OUT: ptr to read buffer */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_read_scalar_data(f, name, (void*)data, H5T_NATIVE_INT32);
}
@@ -376,7 +376,7 @@ H5Block3dWriteVector3dFieldInt32 (
const h5_int32_t *z_data /*!< IN: Z axis data */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_write_vector3d_data(f, name,
(void*)x_data, (void*)y_data, (void*)z_data, H5T_NATIVE_INT32);
@@ -404,7 +404,7 @@ H5Block3dReadVector3dFieldInt32 (
h5_int32_t *z_data /*!< OUT: Z axis data */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5b_read_vector3d_data(f, name,
(void*)x_data, (void*)y_data, (void*)z_data, H5T_NATIVE_INT32);
@@ -427,7 +427,7 @@ H5BlockWriteFieldAttribFloat64 (
const h5_size_t nvalues /*!< IN: number of elements */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_field_attrib (
f,
@@ -454,7 +454,7 @@ H5BlockReadFieldAttribFloat64 (
h5_float64_t *buffer /*!< OUT: attribute values */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_field_attrib (
f,
@@ -481,7 +481,7 @@ H5BlockWriteFieldAttribFloat32 (
const h5_size_t nvalues /*!< IN: number of elements */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_field_attrib (
f,
@@ -508,7 +508,7 @@ H5BlockReadFieldAttribFloat32 (
h5_float32_t *buffer /*!< OUT: attribute values */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_field_attrib (
f,
@@ -535,7 +535,7 @@ H5BlockWriteFieldAttribInt64 (
const h5_size_t nvalues /*!< IN: number of elements */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_field_attrib (
f,
@@ -562,7 +562,7 @@ H5BlockReadFieldAttribInt64 (
h5_int64_t *buffer /*!< OUT: attribute values */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_field_attrib (
f,
@@ -589,7 +589,7 @@ H5BlockWriteFieldAttribInt32 (
const h5_size_t nvalues /*!< IN: number of elements */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_field_attrib (
f,
@@ -616,7 +616,7 @@ H5BlockReadFieldAttribInt32 (
h5_int32_t *buffer /*!< OUT: attribute values */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_field_attrib (
f,
+3 -3
View File
@@ -21,7 +21,7 @@ H5FedOpenMesh (
const h5_id_t mesh_id,
const h5_oid_t mesh_type_id
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_open_mesh (f, mesh_id, mesh_type_id);
}
@@ -29,7 +29,7 @@ h5_err_t
H5FedCloseMesh (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_close_mesh (f);
}
@@ -38,7 +38,7 @@ H5FedSetLevel (
h5_file_t* const f,
const h5_id_t level_id
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_set_level (f, level_id);
}
+2 -2
View File
@@ -28,7 +28,7 @@ H5FedGetAdjacencies (
const h5_int32_t dim,
h5_idlist_t** list
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_adjacencies (f, entity_id, dim, list);
}
@@ -37,6 +37,6 @@ H5FedReleaseListOfAdjacencies (
h5_file_t* const f,
h5_idlist_t** list
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_release_list_of_adjacencies (f, list);
}
+9 -9
View File
@@ -33,7 +33,7 @@ H5FedGetNumMeshes (
h5_file_t* const f,
const h5_oid_t type_id
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_num_meshes (f, type_id);
}
@@ -48,7 +48,7 @@ h5_size_t
H5FedGetNumLevels (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_num_levels (f);
}
@@ -63,7 +63,7 @@ h5_id_t
H5FedGetLevel (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_level (f);
}
@@ -79,7 +79,7 @@ h5_size_t
H5FedGetNumVertices (
h5_file_t* const f /*!< file handle */
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
// MLH: can't use field from opaque h5_file_t!
//return h5t_get_num_vertices (f, f->myproc);
return h5t_get_num_vertices (f, -1);
@@ -99,7 +99,7 @@ H5FedGetNumVerticesCnode (
h5_file_t* const f,
const h5_id_t cnode
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_num_vertices (f, cnode);
}
@@ -115,7 +115,7 @@ h5_size_t
H5FedGetNumVerticesTotal (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_num_vertices (f, -1);
}
@@ -131,7 +131,7 @@ h5_size_t
H5FedGetNumElements (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
// MLH: can't use field from opaque h5_file_t!
//return h5t_get_num_elems (f, f->myproc);
return h5t_get_num_elems (f, -1);
@@ -151,7 +151,7 @@ H5FedGetNumElementsCnode (
h5_file_t* const f,
const h5_id_t cnode
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_num_elems (f, cnode);
}
/*!
@@ -166,6 +166,6 @@ h5_size_t
H5FedGetNumElementsTotal (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_num_elems (f, -1);
}
+23 -10
View File
@@ -34,16 +34,29 @@
h5t_entity_iterator_t*
H5FedBeginTraverseEntities (
h5_file_t* const f,
int codim
const int codim
) {
h5t_entity_iterator_t* iter;
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
if (h5t_alloc_entity_iterator (f, &iter, codim) < 0) {
return (void*)H5_ERR;
}
return iter;
}
h5t_entity_iterator_t*
H5FedBeginTraverseBoundaryFaces (
h5_file_t* const f,
const int codim
) {
h5t_entity_iterator_t* iter;
H5_ENTER_API (f, __func__);
if (h5t_alloc_boundary_face_iterator (f, &iter, codim) < 0) {
return (void*)H5_ERR;
}
return iter;
}
/*!
Get next local entity ID.
@@ -59,7 +72,7 @@ H5FedTraverseEntities (
h5_file_t* const f,
h5t_entity_iterator_t* iter
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_iterate_entities (f, iter);
}
@@ -76,7 +89,7 @@ H5FedEndTraverseEntities (
h5_file_t* const f,
h5t_entity_iterator_t* iter
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_release_entity_iterator (f, iter);
}
@@ -96,7 +109,7 @@ H5FedGetVertexCoordsByIndex (
h5_id_t vertex_index,
h5_float64_t P[3]
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_vertex_coords_by_index (f, vertex_index, P);
}
@@ -106,7 +119,7 @@ H5FedGetVertexCoordsByID (
h5_id_t vertex_id,
h5_float64_t P[3]
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_vertex_coords_by_id (f, vertex_id, P);
}
@@ -116,7 +129,7 @@ H5FedGetVertexIndicesOfEdge (
h5_id_t entity_id,
h5_id_t* vertex_indices
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_vertex_indices_of_edge (f, entity_id, vertex_indices);
}
@@ -126,7 +139,7 @@ H5FedGetVertexIndicesOfTriangle (
h5_id_t entity_id,
h5_id_t* vertex_indices
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_vertex_indices_of_triangle (f, entity_id, vertex_indices);
}
@@ -136,7 +149,7 @@ H5FedGetVertexIndicesOfTet (
h5_id_t entity_id,
h5_id_t* vertex_indices
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_vertex_indices_of_tet (f, entity_id, vertex_indices);
}
@@ -146,7 +159,7 @@ H5FedGetVertexIndicesOfEntity (
h5_id_t entity_id,
h5_id_t* vertex_indices
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_vertex_indices_of_entity (f, entity_id, vertex_indices);
}
+11 -11
View File
@@ -22,7 +22,7 @@ H5FedAddMesh (
h5_file_t* const f,
const h5_oid_t mesh_type_id
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_add_mesh (f, mesh_type_id);
}
@@ -50,7 +50,7 @@ h5_id_t
H5FedAddLevel (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_add_level (f);
}
@@ -59,7 +59,7 @@ H5FedBeginStoreVertices (
h5_file_t* const f,
const h5_size_t num
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_begin_store_vertices (f, num);
}
@@ -79,7 +79,7 @@ H5FedStoreVertex (
const h5_float64_t P[3] /*!< coordinates */
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
if (h5t_get_level (f) != 0) {
return h5_error (
f,
@@ -93,7 +93,7 @@ h5_err_t
H5FedEndStoreVertices (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_end_store_vertices (f);
}
@@ -102,7 +102,7 @@ H5FedBeginStoreElements (
h5_file_t* const f,
const h5_size_t num
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_begin_store_elems (f, num);
}
@@ -125,7 +125,7 @@ H5FedStoreElement (
h5_file_t* const f, /*!< file handle */
const h5_id_t local_vids[] /*!< tuple with vertex id's */
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
if (h5t_get_level (f) != 0) {
return h5_error (
f,
@@ -139,7 +139,7 @@ h5_err_t
H5FedEndStoreElements (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_end_store_elems (f);
}
@@ -147,7 +147,7 @@ h5_err_t
H5FedBeginRefineElements (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_begin_refine_elems (f);
}
@@ -156,7 +156,7 @@ H5FedRefineElement (
h5_file_t* const f, /*!< file handle */
const h5_id_t local_eid /*!< local element id */
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_mark_entity (f, local_eid);
}
@@ -164,6 +164,6 @@ h5_err_t
H5FedEndRefineElements (
h5_file_t* const f
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_end_refine_elems (f);
}
+7 -7
View File
@@ -29,7 +29,7 @@ H5FedAddMTagset (
char* name,
h5_id_t type
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_add_mtagset (f, name, type);
}
@@ -46,7 +46,7 @@ H5FedRemoveMTagset (
h5_file_t* const f,
char name[]
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_remove_mtagset (f, name );
}
@@ -63,7 +63,7 @@ H5FedGetMTagsets (
h5_file_t* const f,
char** names[]
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_mtagsets (f, names);
}
@@ -80,7 +80,7 @@ H5FedGetTypeOfMTagset (
h5_file_t* const f,
char name[]
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_mtagset_type_by_name (f, name);
}
@@ -103,7 +103,7 @@ H5FedSetMTag (
const size_t dims,
void* val
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_set_mtag_by_name (f, name, id, dims, val);
}
@@ -126,7 +126,7 @@ H5FedGetMTag (
size_t* dim,
void* vals
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_get_mtag_by_name (f, name, id, dim, vals);
}
@@ -143,6 +143,6 @@ H5FedRemoveMTag (
const char name[],
const h5_id_t id
) {
SET_FNAME (f, __func__);
H5_ENTER_API (f, __func__);
return h5t_remove_mtag_by_name (f, name, id);
}
+21 -21
View File
@@ -50,7 +50,7 @@ H5PartSetNumParticles (
h5_size_t nparticles /*!< [in] Number of particles */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
h5_size_t stride = 1;
return h5u_set_num_particles( f, nparticles, stride );
@@ -90,7 +90,7 @@ H5PartSetNumParticlesStrided (
h5_size_t stride /*!< [in] Stride value (e.g. number of fields in the particle array) */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_set_num_particles( f, nparticles, stride );
}
@@ -114,7 +114,7 @@ H5PartSetChunk (
h5_size_t size
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_set_chunk( f, size );
}
@@ -152,7 +152,7 @@ H5PartWriteDataFloat64 (
const h5_float64_t *data /*!< [in] Array to commit to disk */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_write_data( f, name, (void*)data, H5T_NATIVE_DOUBLE );
}
@@ -190,7 +190,7 @@ H5PartWriteDataFloat32 (
const h5_float32_t *data /*!< [in] Array to commit to disk */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_write_data( f, name, (void*)data, H5T_NATIVE_FLOAT );
}
@@ -228,7 +228,7 @@ H5PartWriteDataInt64 (
const h5_int64_t *data /*!< [in] Array to commit to disk */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_write_data ( f, name, (void*)data, H5T_NATIVE_INT64 );
}
@@ -266,7 +266,7 @@ H5PartWriteDataInt32 (
const h5_int32_t *data /*!< [in] Array to commit to disk */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_write_data ( f, name, (void*)data, H5T_NATIVE_INT32 );
}
@@ -290,7 +290,7 @@ H5PartReadDataFloat64 (
h5_float64_t *data /*!< [out] Array of data */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_read_data ( f, name, data, H5T_NATIVE_DOUBLE );
}
@@ -314,7 +314,7 @@ H5PartReadDataFloat32 (
h5_float32_t *data /*!< [out] Array of data */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_read_data ( f, name, data, H5T_NATIVE_FLOAT );
}
@@ -338,7 +338,7 @@ H5PartReadDataInt64 (
h5_int64_t *data /*!< [out] Array of data */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_read_data ( f, name, data, H5T_NATIVE_INT64 );
}
@@ -362,7 +362,7 @@ H5PartReadDataInt32 (
h5_int32_t *data /*!< [out] Array of data */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_read_data ( f, name, data, H5T_NATIVE_INT32 );
}
@@ -380,7 +380,7 @@ H5PartGetNumDatasets (
h5_file_t *f /*!< [in] Handle to open file */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_get_num_datasets(f);
}
@@ -403,7 +403,7 @@ H5PartGetDatasetName (
const h5_size_t len /*!< [in] Size of buffer \c name */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_get_dataset_info(f, idx, name, len, NULL, NULL);
}
@@ -434,7 +434,7 @@ H5PartGetDatasetInfo (
h5_size_t *nelem /*!< [out] Number of elements. */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_get_dataset_info(f, idx, dataset_name, len_dataset_name, type, nelem);
}
@@ -465,7 +465,7 @@ H5PartGetNumParticles (
h5_file_t *f /*!< [in] Handle to open file */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
CHECK_FILEHANDLE( f );
@@ -484,7 +484,7 @@ H5PartResetView (
h5_file_t *f /*!< [in] Handle to open file */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_reset_view ( f );
}
@@ -503,7 +503,7 @@ H5PartHasView (
h5_file_t *f /*!< [in] Handle to open file */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_has_view ( f );
}
@@ -536,7 +536,7 @@ H5PartSetView (
h5_int64_t end /*!< [in] End particle */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_set_view ( f, start, end );
}
@@ -566,7 +566,7 @@ H5PartSetViewIndices (
h5_size_t nelems /*!< [in] Size of list */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_set_view_indices ( f, indices, nelems );
}
@@ -588,7 +588,7 @@ H5PartGetView (
h5_int64_t *end /*!< [out] End particle */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_get_view( f, start, end );
}
@@ -608,7 +608,7 @@ H5PartSetCanonicalView (
h5_file_t *f /*!< [in] Handle to open file */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5u_set_canonical_view( f );
}
+24 -24
View File
@@ -21,7 +21,7 @@ H5WriteFileAttribString (
const char *value /*!< [in] Value of attribute */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_attrib (
f,
@@ -47,7 +47,7 @@ H5WriteStepAttribString (
const char *value /*!< [in] Value of attribute */
) {
SET_FNAME ( f, __func__ );
H5_ENTER_API ( f, __func__ );
return h5_write_attrib (
f,
@@ -74,7 +74,7 @@ H5WriteFileAttribFloat32 (
const h5_size_t nelems /*!< [in] Number of values */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_attrib (
f,
@@ -101,7 +101,7 @@ H5WriteStepAttribFloat32 (
const h5_size_t nelems /*!< [in] Number of values */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_attrib (
f,
@@ -128,7 +128,7 @@ H5WriteFileAttribFloat64 (
const h5_size_t nelems /*!< [in] Number of values */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_attrib (
f,
@@ -155,7 +155,7 @@ H5WriteStepAttribFloat64 (
const h5_size_t nelems /*!< [in] Number of values */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_attrib (
f,
@@ -182,7 +182,7 @@ H5WriteFileAttribInt32 (
const h5_size_t nelems /*!< [in] Number of values */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_attrib (
f,
@@ -209,7 +209,7 @@ H5WriteStepAttribInt32 (
const h5_size_t nelems /*!< [in] Number of values */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_attrib (
f,
@@ -236,7 +236,7 @@ H5WriteFileAttribInt64 (
const h5_size_t nelems /*!< [in] Number of values */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_attrib (
f,
@@ -263,7 +263,7 @@ H5WriteStepAttribInt64 (
const h5_size_t nelems /*!< [in] Number of values */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_write_attrib (
f,
@@ -291,7 +291,7 @@ H5ReadFileAttribString (
char *buffer /*!< [out] Value of attribute */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_attrib (
f,
@@ -316,7 +316,7 @@ H5ReadStepAttribString (
char *buffer /*!< [out] Value of attribute */
) {
SET_FNAME ( f, __func__ );
H5_ENTER_API ( f, __func__ );
return h5_read_attrib (
f,
@@ -341,7 +341,7 @@ H5ReadFileAttribInt32 (
h5_int32_t *buffer /*!< [out] Values of attribute */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_attrib (
f,
@@ -366,7 +366,7 @@ H5ReadStepAttribInt32 (
h5_int32_t *buffer /*!< [out] Values of attribute */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_attrib (
f,
@@ -391,7 +391,7 @@ H5ReadFileAttribInt64 (
h5_int64_t *buffer /*!< [out] Values of attribute */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_attrib (
f,
@@ -416,7 +416,7 @@ H5ReadStepAttribInt64 (
h5_int64_t *buffer /*!< [out] Values of attribute */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_attrib (
f,
@@ -441,7 +441,7 @@ H5ReadFileAttribFloat32 (
h5_float32_t *buffer /*!< [out] Values of attribute */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_attrib (
f,
@@ -466,7 +466,7 @@ H5ReadStepAttribFloat32 (
h5_float32_t *buffer /*!< [out] Values of attribute */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_attrib (
f,
@@ -491,7 +491,7 @@ H5ReadFileAttribFloat64 (
h5_float64_t *buffer /*!< [out] Values of attribute */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_attrib (
f,
@@ -516,7 +516,7 @@ H5ReadStepAttribFloat64 (
h5_float64_t *buffer /*!< [out] Values of attribute */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_read_attrib (
f,
@@ -539,7 +539,7 @@ h5_int64_t
H5GetNumFileAttribs (
h5_file_t *const f /*!< [in] Handle to open file */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_get_num_attribs ( f, H5_ATTRIB_FILE );
}
@@ -555,7 +555,7 @@ h5_int64_t
H5GetNumStepAttribs (
h5_file_t *const f /*!< [in] Handle to open file */
) {
SET_FNAME( f, __func__ );
H5_ENTER_API( f, __func__ );
return h5_get_num_attribs ( f, H5_ATTRIB_STEP );
}
@@ -587,7 +587,7 @@ H5GetFileAttribInfo (
h5_size_t *attrib_nelem /*!< [out] Number of elements */
) {
SET_FNAME ( f, __func__ );
H5_ENTER_API ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno ( f );
@@ -627,7 +627,7 @@ H5GetStepAttribInfo (
h5_size_t *attrib_nelem /*!< [out] Number of elements */
) {
SET_FNAME ( f, __func__ );
H5_ENTER_API ( f, __func__ );
if ( h5_check_filehandle ( f ) != H5_SUCCESS )
return h5_get_errno( f );
+6 -44
View File
@@ -37,8 +37,10 @@ h5_err_t
h5_set_debuglevel (
const h5_id_t level /*!< debug level */
) {
if (level < 0 || level > 5) return H5_ERR_INVAL;
h5priv_debug_level = level;
if (level < 0)
h5priv_debug_level = 0;
else
h5priv_debug_level = level;
return H5_SUCCESS;
}
@@ -168,15 +170,9 @@ h5priv_vprintf (
const char* fmt,
va_list ap
) {
size_t size = strlen (prefix); // to avoid remark #981 with Intel CC
size += strlen (fmt);
size += strlen (__funcname) + 16;
char *fmt2 = (char*)malloc (size);
if (fmt2 == NULL) return;
sprintf (fmt2, "%s: %s: %s\n", prefix, __funcname, fmt);
char fmt2[2048];
snprintf (fmt2, sizeof(fmt2), "%s: %s: %s\n", prefix, __funcname, fmt);
vfprintf (f, fmt2, ap);
free (fmt2);
}
/*!
@@ -219,40 +215,6 @@ h5_verror (
h5priv_vprintf (stderr, "E", f->__funcname, fmt, ap);
}
/*!
\ingroup h5_core_errorhandling
Print a warning message to \c stderr.
*/
void
h5_vwarn (
const h5_file_t* const f,
const char* fmt,
va_list ap
) {
if (h5priv_debug_level < 2) return;
h5priv_vprintf (stderr, "W", f->__funcname, fmt, ap);
}
/*!
\ingroup h5_core_errorhandling
Print a warning message to \c stderr.
*/
void
h5_warn (
const h5_file_t* const f,
const char* fmt,
...
) {
va_list ap;
va_start (ap, fmt);
h5_vwarn (f, fmt, ap);
va_end (ap);
}
/*!
\ingroup h5_core_errorhandling
+28 -2
View File
@@ -97,13 +97,13 @@ h5priv_close_hdf5_group (
h5_file_t* const f,
const hid_t group_id
) {
if (group_id == 0 || group_id == -1) return H5_SUCCESS;
h5_debug (f, "%s (group_id=%lld, group_name=\"%s\")",
__func__,
(long long)group_id,
h5_get_objname (group_id));
h5_debug (f, "%s (group_id=%lld)", __func__, (long long)group_id);
if (group_id <= 0) return H5_SUCCESS;
if (H5Gclose (group_id) < 0 ) {
return h5_error (
f,
@@ -1184,7 +1184,21 @@ h5priv_hdf5_link_exists (
const hid_t loc_id,
const char* name
) {
/* Save old error handler */
H5E_auto2_t old_func;
void *old_client_data;
H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data);
/* Turn off error handling */
H5Eset_auto(H5E_DEFAULT, NULL, NULL);
/* Probe. Likely to fail, but thats okay */
htri_t exists = H5Lexists ( loc_id, name, H5P_DEFAULT );
/* Restore previous error handler */
H5Eset_auto(H5E_DEFAULT, old_func, old_client_data);
if (exists < 0 )
return h5_error (f,
H5_ERR_HDF5,
@@ -1484,3 +1498,15 @@ h5_get_objname (
return objname;
}
#if 0
herr_t
h5priv_get_objinfo_by_name (
hid_t loc_id,
const char *object_name,
H5O_info_t *object_info
) {
herr_t herr = H5Oget_info_by_name (
loc_id, object_name, object_info, H5P_DEFAULT);
}
#endif
+2 -2
View File
@@ -295,6 +295,7 @@ h5upriv_close_file (
h5_file_t* const f /*!< file handle */
) {
struct h5u_fdata* u = f->u;
h5_debug (f, "%s ()", __func__);
f->__errno = H5_SUCCESS;
TRY( h5priv_close_hdf5_dataspace (f, u->shape) );
@@ -322,7 +323,7 @@ h5bpriv_close_file (
h5_file_t* const f /*!< IN: file handle */
) {
struct h5b_fdata* b = f->b;
h5_debug (f, "%s ()", __func__);
TRY( h5priv_close_hdf5_group (f, b->block_gid) );
TRY( h5priv_close_hdf5_group (f, b->field_gid) );
TRY( h5priv_close_hdf5_dataspace (f, b->shape) );
@@ -362,7 +363,6 @@ h5_close_file (
#ifndef PARALLEL_IO
TRY( h5tpriv_close_file (f) );
#endif
TRY( h5priv_close_hdf5_group (f, f->step_gid) );
TRY( h5priv_close_hdf5_property (f, f->xfer_prop) );
TRY( h5priv_close_hdf5_property (f, f->access_prop) );
TRY( h5priv_close_hdf5_property (f, f->create_prop) );
+9 -5
View File
@@ -24,14 +24,18 @@ h5priv_write_dataset_by_name (
h5_info (f, "Writing dataset %s/%s.",
h5_get_objname (loc_id), dsinfo->name);
#if 0
H5O_info_t obj_info;
herr_t herr = H5Oget_info_by_name(
loc_id,
dsinfo->name,
&obj_info,
H5P_DEFAULT);
if ((herr >= 0) && ((f->mode==H5_O_WRONLY) || (f->mode==H5_O_APPEND))) {
#else
h5_err_t exists;
TRY( exists = h5priv_hdf5_link_exists (f, loc_id, dsinfo->name) );
#endif
if ((exists > 0) && ((f->mode==H5_O_WRONLY) || (f->mode==H5_O_APPEND))) {
h5_warn (f,
"Dataset %s/%s already exist.",
h5_get_objname (loc_id), dsinfo->name);
@@ -46,7 +50,7 @@ h5priv_write_dataset_by_name (
hid_t diskspace_id;
hid_t memspace_id;
if (herr >= 0) {
if (exists) {
/* overwrite dataset */
TRY( dset_id = h5priv_open_hdf5_dataset (
f,
@@ -158,8 +162,8 @@ h5_err_t
h5priv_close_step (
h5_file_t* const f
) {
if (f->step_gid < 0) return H5_SUCCESS;
h5_debug (f, "%s ()", __func__);
if (f->step_gid <= 0) return H5_SUCCESS;
TRY( h5tpriv_close_step (f) );
TRY( h5priv_close_hdf5_group (f, f->step_gid) );
+8 -4
View File
@@ -10,12 +10,13 @@ h5priv_alloc (
void* ptr,
const size_t size
) {
h5_debug (f, "Allocating %lu bytes.", size);
h5_debug (f, "%s (ptr=%p, size=%lu)", __func__, ptr, size);
ptr = realloc (ptr, size);
if (ptr == NULL) {
h5_error (f, H5_ERR_NOMEM, "Out of memory.");
return (void*)(H5_ERR);
}
h5_debug (f, "%s (): return address: 0x%p", __func__, ptr);
return ptr;
}
@@ -25,12 +26,13 @@ h5priv_calloc (
const size_t count,
const size_t size
) {
h5_debug (f, "Allocating %lu * %lu bytes.", count, size);
h5_debug (f, "%s (count=%lu , size=%lu)", __func__, count, size);
void* ptr = calloc (count, size);
if (ptr == NULL) {
h5_error (f, H5_ERR_NOMEM, "Out of memory.");
return (void*)(H5_ERR);
}
h5_debug (f, "%s (): return address: 0x%p", __func__, ptr);
return ptr;
}
@@ -39,8 +41,10 @@ h5priv_free (
h5_file_t* const f,
void* ptr
) {
#pragma unused f
if (ptr) free (ptr);
if (ptr) {
h5_debug (f, "%s (%p)", __func__, ptr);
free (ptr);
}
return H5_SUCCESS;
}
+46 -3
View File
@@ -48,7 +48,7 @@ h5tpriv_set_loc_elem_child_idx (
f, elem_idx, child_idx);
}
static inline h5_id_t
static inline h5t_lvl_idx_t
h5tpriv_get_loc_elem_level_idx (
h5_file_t* const f,
h5_loc_idx_t elem_idx
@@ -57,11 +57,11 @@ h5tpriv_get_loc_elem_level_idx (
f, elem_idx);
}
static inline h5_id_t
static inline h5t_lvl_idx_t
h5tpriv_set_loc_elem_level_idx (
h5_file_t* const f,
h5_loc_idx_t elem_idx,
h5_id_t lvl_idx
h5t_lvl_idx_t lvl_idx
) {
return (*f->t->methods.access->set_loc_elem_level_idx)(
f, elem_idx, lvl_idx);
@@ -253,4 +253,47 @@ h5tpriv_set_glb_elem_neighbor_idx (
f, elem_idx, face_idx, idx);
}
static inline h5_err_t
h5tpriv_set_boundary_elem_flag (
h5_file_t* const f,
h5_loc_idx_t elem_idx
) {
return (*f->t->methods.access->set_boundary_elem_flag)(f, elem_idx);
}
static inline h5_err_t
h5tpriv_clear_boundary_elem_flag (
h5_file_t* const f,
h5_loc_idx_t elem_idx
) {
return (*f->t->methods.access->clear_boundary_elem_flag)(f, elem_idx);
}
static inline int
h5tpriv_is_boundary_elem (
h5_file_t* const f,
h5_loc_idx_t elem_idx
) {
return (*f->t->methods.access->is_boundary_elem)(f, elem_idx);
}
static inline int
h5tpriv_is_boundary_facet (
h5_file_t* const f,
h5_loc_idx_t elem_idx,
h5_loc_idx_t facet_idx
) {
return (*f->t->methods.access->is_boundary_facet)(f, elem_idx, facet_idx);
}
static inline int
h5tpriv_is_boundary_face (
h5_file_t* const f,
const int dim,
const h5_loc_idx_t elem_idx,
const h5_loc_idx_t facet_idx
) {
return (*f->t->methods.access->is_boundary_face)(f, dim, elem_idx, facet_idx);
}
#endif
+60 -5
View File
@@ -46,21 +46,21 @@ set_loc_elem_child_idx (
return child_idx;
}
static h5_id_t
static h5t_lvl_idx_t
get_loc_elem_level_idx (
h5_file_t* const f,
const h5_loc_idx_t elem_idx
) {
return f->t->loc_elems.tets[elem_idx].idx;
return f->t->loc_elems.tets[elem_idx].level_idx;
}
static h5_id_t
static h5t_lvl_idx_t
set_loc_elem_level_idx (
h5_file_t* const f,
const h5_loc_idx_t elem_idx,
const h5_id_t level_idx
const h5t_lvl_idx_t level_idx
) {
f->t->loc_elems.tets[elem_idx].idx = level_idx;
f->t->loc_elems.tets[elem_idx].level_idx = level_idx;
return level_idx;
}
@@ -240,6 +240,56 @@ set_glb_elem_neighbor_idx (
return neighbor_idx;
}
static h5_err_t
set_boundary_elem_flag (
h5_file_t* const f,
h5_loc_idx_t elem_idx
) {
f->t->loc_elems.tets[elem_idx].flags |= H5T_BOUNDARY_ELEM_FLAG;
return H5_SUCCESS;
}
static h5_err_t
clear_boundary_elem_flag (
h5_file_t* const f,
h5_loc_idx_t elem_idx
) {
f->t->loc_elems.tets[elem_idx].flags &= ~H5T_BOUNDARY_ELEM_FLAG;
return H5_SUCCESS;
}
static int
is_boundary_elem (
h5_file_t* const f,
const h5_loc_idx_t elem_idx
) {
return (f->t->loc_elems.tets[elem_idx].flags & H5T_BOUNDARY_ELEM_FLAG) ? 1 : 0;
}
static int
is_boundary_facet (
h5_file_t* const f,
const h5_loc_idx_t elem_idx,
const h5_loc_idx_t facet_idx
) {
return (f->t->loc_elems.tets[elem_idx].neighbor_indices[facet_idx] == -1);
}
static int
is_boundary_face (
h5_file_t* const f,
const int dim,
const h5_loc_idx_t elem_idx,
const h5_loc_idx_t facet_idx
) {
#pragma unused f
#pragma unused dim
#pragma unused elem_idx
#pragma unused facet_idx
return h5_error_internal (f, __FILE__, __func__, __LINE__);
}
struct h5t_access_methods h5tpriv_access_tetm_methods = {
get_loc_elem,
get_loc_elem_parent_idx,
@@ -267,5 +317,10 @@ struct h5t_access_methods h5tpriv_access_tetm_methods = {
get_glb_elem_neighbor_indices,
get_glb_elem_neighbor_idx,
set_glb_elem_neighbor_idx,
set_boundary_elem_flag,
clear_boundary_elem_flag,
is_boundary_elem,
is_boundary_facet,
is_boundary_face,
};
+61 -5
View File
@@ -46,21 +46,21 @@ set_loc_elem_child_idx (
return child_idx;
}
static h5_id_t
static h5t_lvl_idx_t
get_loc_elem_level_idx (
h5_file_t* const f,
const h5_loc_idx_t elem_idx
) {
return f->t->loc_elems.tris[elem_idx].idx;
return f->t->loc_elems.tris[elem_idx].level_idx;
}
static h5_id_t
static h5t_lvl_idx_t
set_loc_elem_level_idx (
h5_file_t* const f,
const h5_loc_idx_t elem_idx,
const h5_loc_idx_t level_idx
const h5t_lvl_idx_t level_idx
) {
f->t->loc_elems.tris[elem_idx].idx = level_idx;
f->t->loc_elems.tris[elem_idx].level_idx = level_idx;
return level_idx;
}
@@ -240,6 +240,57 @@ set_glb_elem_neighbor_idx (
return neighbor_idx;
}
static h5_err_t
set_boundary_elem_flag (
h5_file_t* const f,
h5_loc_idx_t elem_idx
) {
f->t->loc_elems.tris[elem_idx].flags |= H5T_BOUNDARY_ELEM_FLAG;
return H5_SUCCESS;
}
static h5_err_t
clear_boundary_elem_flag (
h5_file_t* const f,
h5_loc_idx_t elem_idx
) {
f->t->loc_elems.tris[elem_idx].flags &= ~H5T_BOUNDARY_ELEM_FLAG;
return H5_SUCCESS;
}
static int
is_boundary_elem (
h5_file_t* const f,
const h5_loc_idx_t elem_idx
) {
return (f->t->loc_elems.tris[elem_idx].flags & H5T_BOUNDARY_ELEM_FLAG) ? 1 : 0;
}
static int
is_boundary_facet (
h5_file_t* const f,
const h5_loc_idx_t elem_idx,
const h5_loc_idx_t facet_idx
) {
return (f->t->loc_elems.tris[elem_idx].neighbor_indices[facet_idx] == -1);
}
static int
is_boundary_face (
h5_file_t* const f,
const int dim,
const h5_loc_idx_t elem_idx,
const h5_loc_idx_t facet_idx
) {
#pragma unused f
#pragma unused dim
#pragma unused elem_idx
#pragma unused facet_idx
return h5_error_internal (f, __FILE__, __func__, __LINE__);
}
struct h5t_access_methods h5tpriv_access_trim_methods = {
get_loc_elem,
get_loc_elem_parent_idx,
@@ -267,5 +318,10 @@ struct h5t_access_methods h5tpriv_access_trim_methods = {
get_glb_elem_neighbor_indices,
get_glb_elem_neighbor_idx,
set_glb_elem_neighbor_idx,
set_boundary_elem_flag,
clear_boundary_elem_flag,
is_boundary_elem,
is_boundary_facet,
is_boundary_face,
};
+2 -2
View File
@@ -31,9 +31,9 @@ h5tpriv_release_adjacency_structs (
static inline h5_err_t
h5tpriv_update_adjacency_structs (
h5_file_t* const f,
const h5_id_t level_id
const h5t_lvl_idx_t level_id
) {
h5_debug (f, "%s (%lld)", __func__, level_id);
h5_debug (f, "%s (%lld)", __func__, (long long)level_id);
return (*f->t->methods.adjacency->update_internal_structs)(f, level_id);
}
+8 -8
View File
@@ -56,7 +56,7 @@ release_tv (
static inline h5_err_t
compute_elems_of_vertices (
h5_file_t* const f,
const h5_id_t from_lvl
const h5t_lvl_idx_t from_lvl
) {
/* expand structure */
TRY( alloc_tv (f) );
@@ -95,7 +95,7 @@ release_te (
static inline h5_err_t
compute_elems_of_edges (
h5_file_t* const f,
const h5_id_t from_lvl
const h5t_lvl_idx_t from_lvl
) {
h5t_fdata_t *t = f->t;
h5_loc_idx_t elem_idx = (from_lvl <= 0) ? 0 : t->num_elems[from_lvl-1];
@@ -125,7 +125,7 @@ release_td (
static inline h5_err_t
compute_elems_of_triangles (
h5_file_t* const f,
const h5_id_t from_lvl
const h5t_lvl_idx_t from_lvl
) {
h5t_fdata_t* t = f->t;
h5_loc_idx_t elem_idx = (from_lvl <= 0) ? 0 : t->num_elems[from_lvl-1];
@@ -266,7 +266,7 @@ compute_direct_children_of_triangle (
{{2,0},{2,2},{2,3},{1,7}},
{{3,1},{3,2},{3,3},{3,6}}
};
int num_faces = h5tpriv_ref_elem_get_num_triangles (f->t);
int num_faces = h5tpriv_ref_elem_get_num_facets (f->t);
if ((face_idx < 0) || (face_idx >= num_faces)) {
return h5_error_internal (f, __FILE__, __func__, __LINE__);
}
@@ -456,11 +456,11 @@ get_triangles_uadj_to_vertex (
continue;
}
h5_loc_idx_t facet_idx;
facet_idx = h5tpriv_get_facet_connected_to_vertex (t->ref_elem, face_idx, 0);
facet_idx = h5tpriv_get_triangles_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);
facet_idx = h5tpriv_get_triangles_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);
facet_idx = h5tpriv_get_triangles_connected_to_vertex (t->ref_elem, face_idx, 2);
TRY( add_triangle (f, *list, facet_idx, elem_idx) );
}
return H5_SUCCESS;
@@ -842,7 +842,7 @@ get_adjacencies (
static h5_err_t
update_internal_structs (
h5_file_t* const f,
const h5_id_t from_lvl
const h5t_lvl_idx_t from_lvl
) {
clock_t t1 = clock();
TRY( compute_elems_of_vertices (f, from_lvl) );
+7 -7
View File
@@ -55,9 +55,9 @@ release_tv (
static inline h5_err_t
compute_elems_of_vertices (
h5_file_t* const f,
const h5_id_t from_lvl
const h5t_lvl_idx_t from_lvl
) {
h5_debug (f, "%s (%lld)", __func__, from_lvl);
h5_debug (f, "%s (%lld)", __func__, (long long)from_lvl);
/* expand structure */
TRY( alloc_tv (f) );
@@ -78,7 +78,7 @@ compute_elems_of_vertices (
face_idx, idx)) );
}
}
h5_debug (f, "%s (%lld): done", __func__, from_lvl);
h5_debug (f, "%s (%lld): done", __func__, (long long)from_lvl);
return H5_SUCCESS;
}
@@ -97,9 +97,9 @@ release_te (
static inline h5_err_t
compute_elems_of_edges (
h5_file_t* const f,
const h5_id_t from_lvl
const h5t_lvl_idx_t from_lvl
) {
h5_debug (f, "%s (%lld)", __func__, from_lvl);
h5_debug (f, "%s (%lld)", __func__, (long long)from_lvl);
h5t_fdata_t *t = f->t;
h5_loc_idx_t elem_idx = (from_lvl <= 0) ? 0 : t->num_elems[from_lvl-1];
h5_loc_idx_t num_elems = t->num_elems[t->num_levels-1];
@@ -113,7 +113,7 @@ compute_elems_of_edges (
f, face_idx, elem_idx, &retval ) );
}
}
h5_debug (f, "%s (%lld): done", __func__, from_lvl);
h5_debug (f, "%s (): done", __func__);
return H5_SUCCESS;
}
@@ -474,7 +474,7 @@ get_adjacencies (
static inline h5_err_t
update_internal_structs (
h5_file_t* const f,
const h5_id_t from_lvl
const h5t_lvl_idx_t from_lvl
) {
h5_debug (f, "%s (%lld)", __func__, (long long)from_lvl);
clock_t t1 = clock();
+72
View File
@@ -20,4 +20,76 @@
#include "h5t_errorhandling_private.h"
#if !(defined(ULLONG_MAX))
#define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
#endif
/*
ID's: 64bit
Vertices:
000100vv tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt
3V TT TT TT TT TT TT
Edges:
00100eee tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt
2E TT TT TT TT TT TT
Trinagles:
001100dd tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt
1D TT TT TT TT TT TT
Tets:
01000000 tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt
00 TT TT TT TT TT TT
*/
#define H5T_ELEM_MASK ( (h5_id_t) (ULLONG_MAX >> 8) )
#define H5T_ETYPE_MASK ( 7ull << (sizeof(h5_id_t)*8-4) )
#define H5T_COMPONENT_MASK (~H5T_ELEM_MASK)
#define H5T_COMPONENT_ID_MASK (15ull << (sizeof(h5_id_t)*7) )
#define H5T_ETYPE_VERTEX (1)
#define H5T_ETYPE_EDGE (2)
#define H5T_ETYPE_TRIANGLE (3)
#define H5T_ETYPE_TET (4)
#define h5tpriv_set_entity_type( type, elem_idx ) \
( \
((h5_id_t)(type) << (sizeof(h5_id_t)*8-4)) | \
((h5_id_t)(elem_idx)) \
)
#define h5tpriv_get_entity_type( entity_id ) \
((entity_id & H5T_ETYPE_MASK) >> (sizeof(h5_id_t)*8-4))
#define h5tpriv_build_id( type, face_idx, elem_idx ) \
( \
((h5_id_t)(type) << (sizeof(h5_id_t)*8-4)) | \
((h5_id_t)(face_idx) << (sizeof(h5_id_t)*7)) | \
((h5_id_t)(elem_idx) & H5T_ELEM_MASK) \
)
#define h5tpriv_build_vertex_id( face_idx, elem_idx ) \
( h5tpriv_build_id ( H5T_ETYPE_VERTEX, face_idx, elem_idx ) )
#define h5tpriv_build_edge_id( face_idx, elem_idx ) \
( h5tpriv_build_id ( H5T_ETYPE_EDGE, face_idx, elem_idx ) )
#define h5tpriv_build_triangle_id( face_idx, elem_idx ) \
( h5tpriv_build_id ( H5T_ETYPE_TRIANGLE, face_idx, elem_idx ) )
#define h5tpriv_build_elem_id( elem_idx ) \
( h5tpriv_build_id ( f->t->mesh_type, 0, elem_idx ) )
#define h5tpriv_get_face_idx( entity_id ) \
( (entity_id & H5T_COMPONENT_ID_MASK) >> (sizeof(h5_id_t)*7) )
#define h5tpriv_get_elem_idx( entity_id ) \
( entity_id & H5T_ELEM_MASK )
#define H5T_BOUNDARY_ELEM_FLAG 1
#endif
+1 -1
View File
@@ -60,7 +60,7 @@ h5t_get_num_levels (
\return Current level ID.
*/
h5_id_t
h5t_lvl_idx_t
h5t_get_level (
h5_file_t* const f
) {
+15 -194
View File
@@ -27,197 +27,6 @@ cmp_vertices (
return 0;
}
static int
qsort_cmp_vertices (
void* _f,
const void* _vertex_idx1,
const void* _vertex_idx2
) {
h5_file_t* f = (h5_file_t*)_f;
h5_loc_idx_t vertex_idx1 = *(h5_loc_idx_t*)_vertex_idx1;
h5_loc_idx_t vertex_idx2 = *(h5_loc_idx_t*)_vertex_idx2;
return cmp_vertices (
f->t->vertices[vertex_idx1].P,
f->t->vertices[vertex_idx2].P );
}
/*!
Sort vertices. Store local id's in a sorted array for binary search.
*/
h5_err_t
h5tpriv_sort_vertices (
h5_file_t* const f
) {
h5t_fdata_t* t = f->t;
if (t->num_levels <= 0) return H5_SUCCESS;
h5_loc_idx_t vertex_idx = t->cur_level > 0 ?
t->num_vertices[t->cur_level-1] : 0;
h5_loc_idx_t num_vertices = t->num_vertices[t->num_levels-1];
for (; vertex_idx < num_vertices; vertex_idx++) {
t->sorted_lvertices.items[vertex_idx] = vertex_idx;
}
t->sorted_lvertices.num_items = num_vertices;
h5priv_qsort_r (
t->sorted_lvertices.items,
num_vertices,
sizeof (t->sorted_lvertices.items[0]),
f,
qsort_cmp_vertices);
return H5_SUCCESS;
}
/*!
Return local vertex index of a vertex given by its coordinates.
\return local vertex idx if found
\return else negativ value
*/
h5_loc_idx_t
h5tpriv_get_local_vid (
h5_file_t* const f,
h5_float64_t P[3]
) {
h5t_fdata_t*t = f->t;
register h5_loc_idx_t low = 0;
register h5_loc_idx_t high = t->sorted_lvertices.num_items - 1;
while (low <= high) {
register h5_loc_idx_t mid = (low + high) / 2;
h5_loc_idx_t vertex_idx = t->sorted_lvertices.items[mid];
h5_float64_t *P1 = t->vertices[vertex_idx].P;
int diff = cmp_vertices ( P, P1 );
if ( diff < 0 )
high = mid - 1;
else if ( diff > 0 )
low = mid + 1;
else
return t->sorted_lvertices.items[mid]; // found
}
return -(low+1); // not found
}
/*!
compare two elems given by their local id
*/
static inline int
cmp_elems (
h5_file_t* const f,
const h5_loc_idx_t elem_idx1,
const h5_loc_idx_t elem_idx2
) {
h5t_fdata_t* t = f->t;
int num_vertices = h5tpriv_ref_elem_get_num_vertices (t);
h5_loc_idx_t* indices1 = h5tpriv_get_loc_elem_vertex_indices (f, elem_idx1);
h5_loc_idx_t* indices2 = h5tpriv_get_loc_elem_vertex_indices (f, elem_idx2);
int i;
for (i = 0; i < num_vertices; i++) {
h5_float64_t* v1 = t->vertices[indices1[i]].P;
h5_float64_t* v2 = t->vertices[indices2[i]].P;
int r = cmp_vertices (v1, v2);
if (r < 0)
return -1;
else if (r > 0)
return 1;
}
return 0;
}
static inline int
cmp_elems1 (
h5_file_t* f,
h5_loc_idx_t elem_idx1,
h5_loc_idx_t elem_idx2
) {
h5t_fdata_t *t = f->t;
int num_vertices = h5tpriv_ref_elem_get_num_vertices (t);
h5_loc_idx_t* indices1 = h5tpriv_get_loc_elem_vertex_indices (f, elem_idx1);
h5_loc_idx_t* indices2 = h5tpriv_get_loc_elem_vertex_indices (f, elem_idx2);
int imap[] = { 1, 0, 2, 3 };
int i;
for ( i = 0; i < num_vertices; i++ ) {
h5_float64_t* v1 = t->vertices[ indices1[imap[i]] ].P;
h5_float64_t* v2 = t->vertices[ indices2[imap[i]] ].P;
int r = cmp_vertices (v1, v2);
if (r < 0)
return -1;
else if (r > 0)
return 1;
}
return 0;
}
static int
qsort_cmp_elems0 (
void* _f,
const void* _elem_idx1,
const void* _elem_idx2
) {
h5_file_t* f = (h5_file_t*)_f;
h5_loc_idx_t elem_idx1 = *(h5_loc_idx_t*)_elem_idx1;
h5_loc_idx_t elem_idx2 = *(h5_loc_idx_t*)_elem_idx2;
return cmp_elems (f, elem_idx1, elem_idx2);
}
static int
qsort_cmp_elems1 (
void* _f,
const void* _elem_idx1,
const void* _elem_idx2
) {
h5_file_t* f = (h5_file_t*)_f;
h5_loc_idx_t elem_idx1 = *(h5_loc_idx_t*)_elem_idx1;
h5_loc_idx_t elem_idx2 = *(h5_loc_idx_t*)_elem_idx2;
return cmp_elems1 (f, elem_idx1, elem_idx2);
}
/*!
Sort elements. Store local id's in a sorted array so we can run a
binary search.
*/
h5_err_t
h5tpriv_sort_loc_elems (
h5_file_t* const f
) {
h5t_fdata_t* t = f->t;
if (t->num_levels <= 0) return H5_SUCCESS;
h5_loc_idx_t elem_idx = t->cur_level > 0 ? t->num_elems[t->cur_level-1] : 0;
h5_loc_idx_t num_elems = t->num_elems[t->num_levels-1];
int k;
h5_loc_idx_t i;
for (k = 0; k < 2; k++) {
TRY( h5priv_alloc_idlist_items (f, &t->sorted_elems[k], num_elems) );
for (i = elem_idx; i < num_elems; i++) {
t->sorted_elems[k].items[i] = i;
}
t->sorted_elems[k].num_items = num_elems;
}
h5priv_qsort_r (
t->sorted_elems[0].items,
num_elems,
sizeof (t->sorted_elems[0].items[0]),
f,
qsort_cmp_elems0);
h5priv_qsort_r (
t->sorted_elems[1].items,
num_elems,
sizeof (t->sorted_elems[1].items[0]),
f,
qsort_cmp_elems1);
return H5_SUCCESS;
}
/*!
Sort (small) array of local vertex indices geometrically.
*/
@@ -385,7 +194,19 @@ h5t_get_vertex_indices_of_entity (
h5_loc_id_t entity_type = h5tpriv_get_entity_type (entity_id);
h5_loc_idx_t face_idx = h5tpriv_get_face_idx (entity_id);
h5_loc_idx_t elem_idx = h5tpriv_get_elem_idx (entity_id);
int dim = map_entity_type_to_dimension[entity_type];
int dim = map_entity_type_to_dimension[entity_type];
return h5t_get_vertex_indices_of_entity2 (f, dim, face_idx, elem_idx, vertex_indices);
}
h5_err_t
h5t_get_vertex_indices_of_entity2 (
h5_file_t* const f, // [in]
const int dim, // [in] dimension
const h5_loc_idx_t face_idx, // [in] vertex index according ref. element
const h5_loc_idx_t elem_idx, // [in] local element index
h5_loc_idx_t* vertex_indices // [out]
) {
h5_loc_idx_t* indices = h5tpriv_get_loc_elem_vertex_indices (f, elem_idx);
const h5t_ref_elem_t* ref_elem = f->t->ref_elem;
int num_vertices = ref_elem->num_vertices_of_face[dim][face_idx];
@@ -436,8 +257,8 @@ h5t_get_vertex_indices_of_edge (
}
/*!
Get local vertex ID's of an edge. The edge is specified by the local
element index and the sub-entity ID of the edge according the reference
Get local vertex indices of an edge. The edge is specified by the local
element index and the face number of the edge according the reference
element.
This function can be used with tetrahedral and triangle meshes.
-10
View File
@@ -8,22 +8,12 @@ h5tpriv_sort_local_vertex_indices (
const h5_size_t size
);
h5_err_t
h5tpriv_sort_vertices (
h5_file_t * const f
);
h5_loc_idx_t
h5tpriv_get_local_vid (
h5_file_t * const f,
h5_float64_t P[3]
);
h5_err_t
h5tpriv_sort_loc_elems (
h5_file_t * const f
);
h5_err_t
h5tpriv_rebuild_vertex_indices_mapping (
h5_file_t * const f
+6 -7
View File
@@ -265,7 +265,7 @@ init_fdata (
t->dsinfo_num_vertices.dims[0] = 0;
t->dsinfo_num_vertices.max_dims[0] = H5S_UNLIMITED;
t->dsinfo_num_vertices.chunk_dims[0] = 4096;
t->dsinfo_num_vertices.type_id = t->dtypes.h5_id_t;
t->dsinfo_num_vertices.type_id = t->dtypes.h5_glb_idx_t;
TRY( t->dsinfo_num_vertices.create_prop = h5priv_create_hdf5_property (
f,
H5P_DATASET_CREATE) );
@@ -298,7 +298,7 @@ init_fdata (
t->dsinfo_num_elems.dims[0] = 0;
t->dsinfo_num_elems.max_dims[0] = H5S_UNLIMITED;
t->dsinfo_num_elems.chunk_dims[0] = 4096;
t->dsinfo_num_elems.type_id = t->dtypes.h5_id_t;
t->dsinfo_num_elems.type_id = t->dtypes.h5_glb_idx_t;
TRY( t->dsinfo_num_elems.create_prop = h5priv_create_hdf5_property (
f,
H5P_DATASET_CREATE) );
@@ -315,7 +315,7 @@ init_fdata (
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_id_t;
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 (
f,
H5P_DATASET_CREATE) );
@@ -347,7 +347,7 @@ h5tpriv_open_file (
TRY( (f->t = h5priv_calloc (f, 1, sizeof (*f->t))) );
h5t_fdata_t* t = f->t;
t->dtypes.h5_id_t = H5_INT64_T;
t->dtypes.h5_glb_idx_t = H5_INT64_T;
t->dtypes.h5_int64_t = H5_INT64_T;
t->dtypes.h5_float64_t = H5_FLOAT64_T;
@@ -549,14 +549,14 @@ h5t_close_mesh (
h5_err_t
h5t_set_level (
h5_file_t* const f,
const h5_id_t level_id
const h5t_lvl_idx_t level_id
) {
h5t_fdata_t* t = f->t;
if ((level_id < 0) || (level_id >= t->num_levels))
return HANDLE_H5_OUT_OF_RANGE_ERR (f, "Level", level_id);
h5_id_t prev_level = t->cur_level;
h5t_lvl_idx_t prev_level = t->cur_level;
t->cur_level = level_id;
if (level_id >= t->num_loaded_levels) {
@@ -578,7 +578,6 @@ h5tpriv_alloc_num_vertices (
ssize_t size = num * sizeof (t->vertices[0]);
TRY( t->vertices = h5priv_alloc (f, t->vertices, size) );
TRY( h5priv_alloc_idxmap (f, &t->map_vertex_g2l, num) );
TRY( h5priv_alloc_idlist_items (f, &t->sorted_lvertices, num) );
return H5_SUCCESS;
}
+7 -9
View File
@@ -176,8 +176,6 @@ read_vertices (
open_mem_space_vertices,
open_file_space_vertices,
t->vertices) );
TRY( h5tpriv_sort_vertices (f) );
TRY( h5tpriv_rebuild_vertex_indices_mapping (f) );
return H5_SUCCESS;
}
@@ -235,8 +233,6 @@ open_file_space_elems (
return H5S_ALL;
}
static h5_err_t
read_elems (
h5_file_t* const f
@@ -251,11 +247,6 @@ read_elems (
open_mem_space_elems,
open_file_space_elems,
t->glb_elems.data) );
TRY( h5tpriv_sort_loc_elems (f) );
TRY( h5tpriv_rebuild_elem_indices_mapping (f) );
TRY( h5tpriv_init_loc_elems_struct (f) );
return H5_SUCCESS;
}
@@ -284,9 +275,16 @@ h5tpriv_read_mesh (
TRY( read_num_levels (f) );
TRY( read_num_vertices (f) );
TRY( read_num_elems (f) );
TRY( read_vertices (f) );
TRY( h5tpriv_rebuild_vertex_indices_mapping (f) );
TRY( read_elems (f) );
TRY( h5tpriv_rebuild_elem_indices_mapping (f) );
TRY( h5tpriv_init_loc_elems_struct (f) );
TRY( h5tpriv_update_adjacency_structs (f, 0) );
TRY( h5tpriv_init_geom_boundary_info (f, 0) );
TRY( read_mtags (f) );
t->num_loaded_levels = t->num_levels;
return H5_SUCCESS;
+8
View File
@@ -32,4 +32,12 @@ h5tpriv_init_loc_elems_struct (
return (*f->t->methods.read->init_loc_elems_struct) (f);
}
static inline h5_err_t
h5tpriv_init_geom_boundary_info (
h5_file_t* const f,
const h5t_lvl_idx_t from_lvl
) {
return (*f->t->methods.read->init_geom_boundary_info) (f, from_lvl);
}
#endif
+90 -6
View File
@@ -11,13 +11,16 @@ init_loc_elems_struct (
h5t_fdata_t* const t = f->t;
h5_loc_idx_t elem_idx = 0;
const h5_loc_idx_t num_elems = t->num_elems[t->num_levels-1];
h5_id_t level_idx = 0;
h5t_lvl_idx_t level_idx = 0;
int num_vertices = h5tpriv_ref_elem_get_num_vertices (t);
int num_edges = h5tpriv_ref_elem_get_num_edges (t);
int num_facets = h5tpriv_ref_elem_get_num_faces (t, 2);
h5_loc_tet_t* loc_elem = t->loc_elems.tets;
h5_glb_tet_t* glb_elem = t->glb_elems.tets;
for (elem_idx = 0; elem_idx < num_elems; elem_idx++, loc_elem++, glb_elem++) {
for (elem_idx = 0;
elem_idx < num_elems; elem_idx++, loc_elem++, glb_elem++) {
// global element index
loc_elem->glb_idx = glb_elem->idx;
// local parent index
TRY( loc_elem->parent_idx =
h5t_map_glb_elem_idx2loc (f, glb_elem->parent_idx) );
@@ -30,7 +33,7 @@ init_loc_elems_struct (
if (elem_idx >= t->num_elems[level_idx]) {
level_idx++;
}
loc_elem->idx = level_idx;
loc_elem->level_idx = level_idx;
// vertex indices
TRY( h5t_map_global_vertex_indices2local (
@@ -43,12 +46,93 @@ init_loc_elems_struct (
TRY( h5t_map_glb_elem_indices2loc (
f,
glb_elem->neighbor_indices,
num_edges,
num_facets,
loc_elem->neighbor_indices) );
// 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;
}
}
}
return H5_SUCCESS;
}
static h5_err_t
init_geom_boundary_info (
h5_file_t* const f,
const h5t_lvl_idx_t from_lvl
) {
h5t_fdata_t* const t = f->t;
h5_loc_idx_t elem_idx = 0;
const h5_loc_idx_t num_elems = t->num_elems[t->num_levels-1];
int num_facets = h5tpriv_ref_elem_get_num_faces (t, 2);
h5_loc_tet_t* loc_elem = t->loc_elems.tets;
h5_glb_tet_t* glb_elem = t->glb_elems.tets;
for (elem_idx = (from_lvl <= 0) ? 0 : t->num_elems[from_lvl-1];
elem_idx < num_elems; elem_idx++, loc_elem++, glb_elem++) {
// 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;
}
}
if (i == num_facets) {
continue; // no facet on boundary
}
#if 0
// mark elements which are edge- or vertex- adjacent to the boundary
// are there more facets on the boundary?
int j;
for (j = i+1; j < num_facets; j++) {
if (loc_elem->neighbor_indices[j] == -1) {
break; // found another boundary facet
}
}
// get vertex ID's of vertices on boundary
h5_loc_idx_t vertex_indices[4];
if (j < num_facets) {
// all vertices on boundary
vertex_indices[0] = h5tpriv_build_vertex_id (0, elem_idx);
vertex_indices[1] = h5tpriv_build_vertex_id (1, elem_idx);
vertex_indices[2] = h5tpriv_build_vertex_id (2, elem_idx);
vertex_indices[3] = h5tpriv_build_vertex_id (3, elem_idx);
num_vertices = 4;
} else {
// three vertices on boundary
// get vertices of edge i
h5_loc_idx_t face_idx;
face_idx = t->ref_elem->map[2][i][0];
vertex_indices[0] = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, face_idx);
face_idx = t->ref_elem->map[2][i][1];
vertex_indices[1] = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, face_idx);
face_idx = t->ref_elem->map[2][i][2];
vertex_indices[2] = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, face_idx);
num_vertices = 3;
}
// mark elements
for (i = 0; i < num_vertices; i++) {
const h5_loc_idx_t vertex_idx = vertex_indices[i];
h5_idlist_t* list = &t->adjacencies.tv.v[vertex_idx];
// set flag
for (j=0; j < list->num_items; j++) {
h5_loc_idx_t idx = h5tpriv_get_elem_idx (list->items[j]);
t->loc_elems.tris[idx].flags |= H5T_BOUNDARY_ELEM_FLAG;
}
}
#endif
}
return H5_SUCCESS;
}
struct h5t_read_methods h5tpriv_read_tetm_methods = {
init_loc_elems_struct
init_loc_elems_struct,
init_geom_boundary_info,
};
+85 -5
View File
@@ -11,13 +11,15 @@ init_loc_elems_struct (
h5t_fdata_t* const t = f->t;
h5_loc_idx_t idx = 0;
const h5_loc_idx_t num_elems = t->num_elems[t->num_levels-1];
h5_id_t level_idx = 0;
h5t_lvl_idx_t level_idx = 0;
int num_vertices = h5tpriv_ref_elem_get_num_vertices (t);
int num_edges = h5tpriv_ref_elem_get_num_edges (t);
int num_facets = h5tpriv_ref_elem_get_num_faces (t,1);
h5_loc_triangle_t* loc_elem = t->loc_elems.tris;
h5_glb_triangle_t* glb_elem = t->glb_elems.tris;
for (idx = 0; idx < num_elems; idx++, loc_elem++, glb_elem++) {
// global element index
loc_elem->glb_idx = glb_elem->idx;
// local parent index
TRY( loc_elem->parent_idx =
h5t_map_glb_elem_idx2loc (f, glb_elem->parent_idx) );
@@ -30,7 +32,7 @@ init_loc_elems_struct (
if (idx >= t->num_elems[level_idx]) {
level_idx++;
}
loc_elem->idx = level_idx;
loc_elem->level_idx = level_idx;
// vertex indices
TRY( h5t_map_global_vertex_indices2local (
@@ -43,12 +45,90 @@ init_loc_elems_struct (
TRY( h5t_map_glb_elem_indices2loc (
f,
glb_elem->neighbor_indices,
num_edges,
num_facets,
loc_elem->neighbor_indices) );
// 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;
}
}
}
return H5_SUCCESS;
}
static h5_err_t
init_geom_boundary_info (
h5_file_t* const f,
const h5t_lvl_idx_t from_lvl
) {
h5t_fdata_t* const t = f->t;
h5_loc_idx_t elem_idx = 0;
const h5_loc_idx_t num_elems = t->num_elems[t->num_levels-1];
int num_facets = h5tpriv_ref_elem_get_num_faces (t, 1);
h5_loc_triangle_t* loc_elem = t->loc_elems.tris;
h5_glb_triangle_t* glb_elem = t->glb_elems.tris;
for (elem_idx = (from_lvl <= 0) ? 0 : t->num_elems[from_lvl-1];
elem_idx < num_elems; elem_idx++, loc_elem++, glb_elem++) {
// 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;
}
}
if (i == num_facets) {
continue; // no facet on boundary
}
#if 0
// mark elements which are edge- or vertex- adjacent to the boundary
// are there more facets on the boundary?
int j;
for (j = i+1; j < num_facets; j++) {
if (loc_elem->neighbor_indices[j] == -1) {
break; // found another boundary facet
}
}
// get vertex ID's of vertices on boundary
h5_loc_idx_t vertex_indices[4];
if (j < num_facets) {
// all vertices on boundary
vertex_indices[0] = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, 0);
vertex_indices[1] = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, 1);
vertex_indices[2] = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, 2);
num_vertices = 3;
} else {
// two vertices on boundary
// get vertices of edge i
h5_loc_idx_t face_idx;
face_idx = t->ref_elem->map[1][i][0];
vertex_indices[0] = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, face_idx);
face_idx = t->ref_elem->map[1][i][1];
vertex_indices[1] = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, face_idx);
num_vertices = 2;
}
// mark elements
for (i = 0; i < num_vertices; i++) {
// get upward adjacent elements
const h5_loc_idx_t vertex_idx = vertex_indices[i];
h5_idlist_t* list = &t->adjacencies.tv.v[vertex_idx];
// set flag
for (j=0; j < list->num_items; j++) {
h5_loc_idx_t idx = h5tpriv_get_elem_idx (list->items[j]);
t->loc_elems.tris[idx].flags |= H5T_BOUNDARY_ELEM_FLAG;
}
}
#endif
}
return H5_SUCCESS;
}
struct h5t_read_methods h5tpriv_read_trim_methods = {
init_loc_elems_struct
init_loc_elems_struct,
init_geom_boundary_info,
};
+13 -1
View File
@@ -1,4 +1,5 @@
#include "h5core/h5_core.h"
#include "h5_core_private.h"
/*
@@ -30,6 +31,11 @@
const h5t_ref_elem_t h5t_tri_ref_elem = {
2, // dimension
{
H5T_ETYPE_VERTEX,
H5T_ETYPE_EDGE,
H5T_ETYPE_TRIANGLE,
},
{
3, // #vertices
3, // #edges
@@ -87,6 +93,12 @@ const h5t_ref_elem_t h5t_tri_ref_elem = {
const h5t_ref_elem_t h5t_tet_ref_elem = {
3, // dimension
{
H5T_ETYPE_VERTEX,
H5T_ETYPE_EDGE,
H5T_ETYPE_TRIANGLE,
H5T_ETYPE_TET,
},
{
4, // #vertices
6, // #edges
@@ -99,7 +111,7 @@ const h5t_ref_elem_t h5t_tet_ref_elem = {
[2] = {3,3,3,3}, // #vertices of trinagles
[3] = {4} // #vertices of tets
},
{ // map sub-elements to vertices
{ // map faces 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
+13 -3
View File
@@ -3,11 +3,21 @@
#define h5tpriv_ref_elem_get_num_vertices(this) (this->ref_elem->num_faces[0])
#define h5tpriv_ref_elem_get_num_edges(this) (this->ref_elem->num_faces[1])
#define h5tpriv_ref_elem_get_num_triangles(this) (this->ref_elem->num_faces[2])
#define h5tpriv_ref_elem_get_num_facets(this) \
(this->ref_elem->num_faces[this->ref_elem->dim - 1])
#define h5tpriv_ref_elem_get_num_faces(this, dim) (this->ref_elem->num_faces[dim])
#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])
#define h5tpriv_get_edge_connected_to_vertex(this,face_idx, i) \
(this->edges_connected_to_vertex[face_idx][i])
#define h5tpriv_get_triangles_connected_to_vertex(this,face_idx, i) \
(this->triangles_connected_to_vertex[face_idx][i])
#define h5tpriv_ref_elem_get_entity_type(this,dim) \
(this->entity_types[dim])
#endif
+179 -58
View File
@@ -36,13 +36,149 @@ h5tpriv_elem_is_on_cur_level (
h5_generic_loc_elem_t *el // ptr to local element
) {
h5t_fdata_t* t = f->t;
if ( (el->idx > t->cur_level) ||
if ( (el->level_idx > t->cur_level) ||
(el->child_idx >= 0 && el->child_idx < num_elems_on_cur_level) ) {
return H5_NOK;
}
return H5_SUCCESS;
}
static h5_loc_id_t
iterate_elems (
h5_file_t* const f,
h5t_entity_iterator_t* iter
) {
if ( h5tpriv_skip_to_next_elem_on_level (f, iter) == H5_NOK) {
h5_debug ( f, "Traversing done!" );
return H5_NOK;
}
return h5tpriv_build_elem_id ( iter->elem_idx );
}
static h5_loc_id_t
iterate_boundary_elems (
h5_file_t* const f,
h5t_entity_iterator_t* iter
) {
do {
if ( h5tpriv_skip_to_next_elem_on_level (f, iter) == H5_NOK) {
h5_debug ( f, "Traversing done!" );
return H5_NOK;
}
} while (!h5tpriv_is_boundary_elem (f, iter->elem_idx));
return h5tpriv_build_elem_id ( iter->elem_idx );
}
/*
Iterate boundary facets (co-dim 1 entities).
*/
static h5_loc_id_t
iterate_boundary_facets (
h5_file_t* const f,
h5t_entity_iterator_t* iter
) {
int num_facets = h5tpriv_ref_elem_get_num_facets (iter) - 1;
int dim = h5tpriv_ref_elem_get_dim (iter) - iter->codim;
do {
if (iter->face_idx >= num_facets) {
h5_loc_id_t elem_id;
TRY( elem_id = iterate_boundary_elems (f, iter) );
if (elem_id == H5_NOK) {
return H5_NOK; // done!
}
iter->elem_idx = h5tpriv_get_elem_idx (elem_id);
iter->face_idx = 0;
} else {
iter->face_idx++;
}
} while (! h5tpriv_is_boundary_facet (f, iter->elem_idx, iter->face_idx));
int type = h5tpriv_ref_elem_get_entity_type (iter->ref_elem, dim);
return h5tpriv_build_id (type, iter->face_idx, iter->elem_idx );
}
/*!
Travere entities with co-dim > 0
*/
static h5_loc_id_t
iterate_faces (
h5_file_t* const f,
h5t_entity_iterator_t* iter
) {
h5_idlist_t* entry;
int dim = h5tpriv_ref_elem_get_dim (iter) - iter->codim;
int num_faces = h5tpriv_ref_elem_get_num_faces (iter, dim) - 1;
int i = -1;
do {
if (iter->face_idx >= num_faces) {
if (h5tpriv_skip_to_next_elem_on_level (f, iter) == H5_NOK) {
h5_debug (f, "Traversing done!");
return H5_NOK;
}
iter->face_idx = 0;
} else {
iter->face_idx++;
}
// Skip already visited faces:
// 1. Get list of all elements with this face. Actually we
// retrieve a list of entities sorted by the element index.
TRY( (iter->find)(f, iter->face_idx, iter->elem_idx, &entry) );
// 2. Go to first element in list which is on current level
i = -1;
h5_generic_loc_elem_t *el;
do {
i++;
h5_loc_idx_t idx = h5tpriv_get_elem_idx (entry->items[i]);
el = h5tpriv_get_loc_elem (f, idx);
} while (h5tpriv_elem_is_on_cur_level (f, el) == H5_NOK);
// 3. Face already visited if
} while (iter->elem_idx > h5tpriv_get_elem_idx(entry->items[i]));
/*
note: in above test iter->elem_idx is always greater or equal to the
compared index. It cannot be smaller since iter->elem_idx is on the
current level and the element index of entry->items[i] is the smallest
element index with the given face on the current level.
*/
return entry->items[0];
}
/*
Iterate boundary faces
*/
static h5_loc_id_t
iterate_boundary_faces (
h5_file_t* const f,
h5t_entity_iterator_t* iter
) {
// TODO!!!
int dim = h5tpriv_ref_elem_get_dim (iter) - iter->codim;
int num_faces = h5tpriv_ref_elem_get_num_faces (iter, dim) - 1;
do {
// iterate to next boundary face
do {
// first iterate over all faces of element, if done
// goto next element
if (iter->face_idx >= num_faces) {
h5_loc_id_t elem_id;
TRY( elem_id = iterate_boundary_elems (f, iter) );
if (elem_id == H5_NOK) {
return H5_NOK; // done!
}
iter->face_idx = 0;
} else {
iter->face_idx++;
}
} while (! h5tpriv_is_boundary_face (f, dim, iter->elem_idx, iter->face_idx));
// Skip already visited faces
} while (0);
return h5_error_internal (f, __FILE__, __func__, __LINE__);
}
h5_err_t
h5t_alloc_entity_iterator (
h5_file_t* f,
@@ -53,6 +189,16 @@ h5t_alloc_entity_iterator (
return h5t_begin_iterate_entities (f, *iter, codim);
}
h5_err_t
h5t_alloc_boundary_face_iterator (
h5_file_t* f,
h5t_entity_iterator_t** iter,
int codim
) {
TRY( *iter = h5priv_alloc (f, NULL, sizeof (h5t_entity_iterator_t)) );
return h5t_begin_iterate_boundary_faces (f, *iter, codim);
}
h5_err_t
h5t_release_entity_iterator (
h5_file_t* const f,
@@ -61,67 +207,47 @@ h5t_release_entity_iterator (
return h5priv_free (f, iter);
}
h5_err_t
h5t_begin_iterate_entities (
h5_file_t* f,
h5t_entity_iterator_t* iter,
const int codim
) {
iter->face_idx = -1;
iter->elem_idx = -1;
iter->codim = codim;
iter->ref_elem = f->t->ref_elem;
if (iter->codim > 0) {
iter->iter = iterate_faces;
} else if (iter->codim == 0) {
iter->iter = iterate_elems;
}
return h5tpriv_init_iterator (f, iter, codim);
}
/*!
Travere entities with co-dim > 0
*/
static h5_loc_id_t
iterate_faces (
h5_file_t* const f,
h5t_entity_iterator_t* iter
h5_err_t
h5t_begin_iterate_boundary_faces (
h5_file_t* f,
h5t_entity_iterator_t* iter,
const int codim
) {
h5_idlist_t* entry;
h5_size_t i;
int dim = h5tpriv_ref_elem_get_dim (iter) - iter->codim;
int num_faces = h5tpriv_ref_elem_get_num_faces (iter, dim) - 1;
do {
if (iter->face_idx >= num_faces) {
if (h5tpriv_skip_to_next_elem_on_level (f, iter) == H5_NOK) {
h5_debug (f, "Traversing done!");
return H5_NOK;
}
iter->face_idx = 0;
} else {
iter->face_idx++;
}
/*
get list of all elements with this face
and skip to first element in list which is on
current level
*/
TRY( (iter->find)(f, iter->face_idx,
iter->elem_idx, &entry) );
i = -1;
h5_generic_loc_elem_t *el;
do {
i++;
h5_loc_idx_t idx = h5tpriv_get_elem_idx (entry->items[i]);
el = h5tpriv_get_loc_elem (f, idx);
} while (h5tpriv_elem_is_on_cur_level (f, el) == H5_NOK);
} while (iter->elem_idx != h5tpriv_get_elem_idx(entry->items[i]));
return entry->items[0];
}
iter->face_idx = 999; // just a high enough number
iter->elem_idx = -1;
iter->codim = codim;
iter->ref_elem = f->t->ref_elem;
static h5_loc_id_t
iterate_elems (
h5_file_t* const f,
h5t_entity_iterator_t*iter
) {
if ( h5tpriv_skip_to_next_elem_on_level (f, iter) == H5_NOK) {
h5_debug ( f, "Traversing done!" );
return H5_NOK;
if (iter->codim <= 0 || iter->codim > iter->ref_elem->dim) {
return h5_error (f, H5_ERR_INVAL,
"Co-dimension requested %d, but must be between %d and %d",
codim, 1, iter->ref_elem->dim);
} else if (iter->codim == 1) {
iter->iter = iterate_boundary_facets;
}
return h5tpriv_build_elem_id ( iter->elem_idx );
else if (iter->codim > 1) {
iter->iter = iterate_boundary_faces;
}
return H5_SUCCESS;
}
h5_loc_id_t
@@ -129,13 +255,7 @@ h5t_iterate_entities (
h5_file_t* const f,
h5t_entity_iterator_t* iter
) {
if (iter->codim > 0) {
return iterate_faces (f, iter);
} else if (iter->codim == 0) {
return iterate_elems (f, iter);
} else {
return h5_error_internal (f, __FILE__, __func__, __LINE__);
}
return (iter->iter (f, iter));
}
h5_err_t
@@ -149,9 +269,10 @@ h5t_end_iterate_entities (
iter->codim = -1;
iter->ref_elem = NULL;
iter->find = NULL;
iter->iter = NULL;
return H5_SUCCESS;
}
h5_err_t
h5t_get_vertex_coords_by_index (
h5_file_t* const f,
-4
View File
@@ -9,10 +9,6 @@ begin_iterate_entities (
h5t_entity_iterator_t* const iter,
const int codim
) {
iter->face_idx = -1;
iter->elem_idx = -1;
iter->codim = codim;
iter->ref_elem = f->t->ref_elem;
switch (iter->ref_elem->dim - codim) {
case 0: // iterate vertices
iter->find = h5tpriv_find_tv2;
-4
View File
@@ -9,10 +9,6 @@ begin_iterate_entities (
h5t_entity_iterator_t* iter,
const int codim
) {
iter->face_idx = -1;
iter->elem_idx = -1;
iter->codim = codim;
iter->ref_elem = f->t->ref_elem;
switch (h5tpriv_ref_elem_get_dim (iter) - codim) {
case 0: // iterate vertices
iter->find = h5tpriv_find_tv2;
+1 -4
View File
@@ -121,7 +121,7 @@ assign_glb_elem_data (
}
h5_id_t
h5t_lvl_idx_t
h5t_add_level (
h5_file_t* const f
) {
@@ -216,7 +216,6 @@ h5t_end_store_vertices (
t->num_vertices[t->cur_level] = t->last_stored_vid+1;
TRY( assign_global_vertex_indices (f) );
TRY( h5tpriv_sort_vertices (f) );
TRY( h5tpriv_rebuild_vertex_indices_mapping (f) );
return H5_SUCCESS;
}
@@ -326,8 +325,6 @@ h5t_end_store_elems (
t->num_elems[t->cur_level] = t->last_stored_eid+1;
TRY( h5tpriv_sort_loc_elems (f) );
/* assign global indices to new indices */
TRY( assign_glb_elem_indices (f) );
+13 -10
View File
@@ -244,7 +244,7 @@ compute_neighbor_of_face (
f, __FILE__, __func__, __LINE__);
}
if (td->num_items == 1) {
// neighbor is coarser or face is on the border
// neighbor is coarser or face is on the boundary
elem_idx = t->loc_elems.tets[elem_idx].parent_idx;
if (elem_idx == -1) {
// we are on the level of the macro grid
@@ -267,19 +267,21 @@ compute_neighbor_of_face (
}
/*
New level has been added, compute neighbores for new elements.
Compute neighbors for elements on given level.
*/
static inline h5_err_t
compute_neighbors_of_new_elems (
h5_file_t* const f
compute_neighbors_of_elems (
h5_file_t* const f,
h5t_lvl_idx_t level
) {
h5t_fdata_t * const t = f->t;
if (t->cur_level < 0) {
// or should we consider this as an error?
return H5_SUCCESS;
if (level < 0 || level >= t->num_levels) {
return h5_error (f, H5_ERR_INVAL,
"level idx %lld out of bound, must be in [%lld,%lld]",
(long long)level, (long long)0, (long long)t->num_levels);
}
h5_loc_idx_t elem_idx = t->cur_level == 0 ? 0 : t->num_elems[t->cur_level-1];
const h5_loc_idx_t last_idx = t->num_elems[t->cur_level] - 1;
h5_loc_idx_t elem_idx = level == 0 ? 0 : t->num_elems[level-1];
const h5_loc_idx_t last_idx = t->num_elems[level] - 1;
h5_loc_tet_t *el = &t->loc_elems.tets[elem_idx];
while (elem_idx <= last_idx) {
h5_loc_idx_t face_idx = 0;
@@ -300,7 +302,8 @@ end_store_elems (
) {
h5t_fdata_t* const t = f->t;
TRY( h5tpriv_update_adjacency_structs (f, t->cur_level) );
TRY( compute_neighbors_of_new_elems (f) );
TRY( compute_neighbors_of_elems (f, t->cur_level) );
TRY( h5tpriv_init_geom_boundary_info (f, t->cur_level) );
return H5_SUCCESS;
}
+14 -11
View File
@@ -27,7 +27,7 @@ alloc_triangles (
t->loc_elems.tris,
new * sizeof (t->loc_elems.tris[0]) ) );
memset (
t->glb_elems.tris + cur,
t->loc_elems.tris + cur,
-1,
(new-cur) * sizeof (t->loc_elems.tris[0]) );
@@ -208,7 +208,7 @@ compute_neighbor_of_face (
f, __FILE__, __func__, __LINE__);
}
if (te->num_items == 1) {
// neighbor is coarser or face is on the border
// neighbor is coarser or face is on the boundary
elem_idx = t->loc_elems.tris[elem_idx].parent_idx;
if (elem_idx == -1) {
// we are on the level of the macro grid
@@ -231,20 +231,22 @@ compute_neighbor_of_face (
}
/*
New level has been added, compute neighbores for new elements.
Compute neighbors for elements on given level.
*/
static inline h5_err_t
compute_neighbors_of_new_elems (
h5_file_t* const f
compute_neighbors_of_elems (
h5_file_t* const f,
h5t_lvl_idx_t level
) {
h5_debug (f, "%s()", __func__);
h5t_fdata_t * const t = f->t;
if (t->cur_level < 0) {
// or should we consider this as an error?
return H5_SUCCESS;
if (level < 0 || level >= t->num_levels) {
return h5_error (f, H5_ERR_INVAL,
"level idx %lld out of bound, must be in [%lld,%lld]",
(long long)level, (long long)0, (long long)t->num_levels);
}
h5_loc_idx_t elem_idx = t->cur_level == 0 ? 0 : t->num_elems[t->cur_level-1];
const h5_loc_idx_t last_idx = t->num_elems[t->cur_level] - 1;
h5_loc_idx_t elem_idx = level == 0 ? 0 : t->num_elems[level-1];
const h5_loc_idx_t last_idx = t->num_elems[level] - 1;
h5_loc_triangle_t *el = &t->loc_elems.tris[elem_idx];
while (elem_idx <= last_idx) {
h5_loc_idx_t face_idx = 0;
@@ -267,7 +269,8 @@ end_store_elems (
h5t_fdata_t* t = f->t;
TRY( h5tpriv_update_adjacency_structs (f, t->cur_level) );
TRY( compute_neighbors_of_new_elems (f) );
TRY( compute_neighbors_of_elems (f, t->cur_level) );
TRY( h5tpriv_init_geom_boundary_info (f, t->cur_level) );
return H5_SUCCESS;
}
+23 -23
View File
@@ -20,9 +20,11 @@ typedef struct h5_glb_triangle {
} h5_glb_triangle_t;
typedef struct h5_loc_triangle {
h5_loc_idx_t idx;
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_elem_flags_t flags;
h5_loc_idx_t vertex_indices[3];
h5_loc_idx_t neighbor_indices[3];
} h5_loc_triangle_t;
@@ -37,9 +39,11 @@ typedef struct h5_glb_tetrahedron {
typedef h5_glb_tetrahedron_t h5_glb_tet_t;
typedef struct h5_loc_tetrahedron {
h5_loc_idx_t idx;
h5_loc_idx_t glb_idx;
h5_loc_idx_t parent_idx;
h5_loc_idx_t child_idx;
h5t_lvl_idx_t level_idx;
h5t_elem_flags_t flags;
h5_loc_idx_t vertex_indices[4];
h5_loc_idx_t neighbor_indices[4];
} h5_loc_tetrahedron_t;
@@ -53,9 +57,11 @@ typedef struct h5_generic_glb_elem {
} h5_generic_glb_elem_t;
typedef struct h5_generic_loc_elem {
h5_loc_idx_t idx;
h5_glb_idx_t glb_idx;
h5_loc_idx_t parent_idx;
h5_loc_idx_t child_idx;
h5_int32_t level_idx;
h5_int32_t flags;
h5_loc_idx_t indices[1];
} h5_generic_loc_elem_t;
@@ -73,9 +79,6 @@ typedef union h5_loc_elems {
/*** type ids' for compound types ***/
typedef struct h5_dtypes {
hid_t h5_id_t; /* ID's */
hid_t h5_glb_id_t; /* ID's */
hid_t h5_glb_idx_t; /* ID's */
hid_t h5_int64_t; /* 64 bit signed integer */
@@ -123,10 +126,10 @@ struct h5t_access_methods {
h5_file_t* const, const h5_loc_idx_t);
h5_loc_id_t (*set_loc_elem_child_idx)(
h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t);
h5_id_t (*get_loc_elem_level_idx)(
h5t_lvl_idx_t (*get_loc_elem_level_idx)(
h5_file_t* const, const h5_loc_idx_t);
h5_id_t (*set_loc_elem_level_idx)(
h5_file_t* const, const h5_loc_idx_t, const h5_id_t);
h5t_lvl_idx_t (*set_loc_elem_level_idx)(
h5_file_t* const, const h5_loc_idx_t, const h5t_lvl_idx_t);
h5_loc_idx_t* (*get_loc_elem_vertex_indices)(
h5_file_t* const, const h5_loc_idx_t);
h5_loc_idx_t (*get_loc_elem_vertex_idx)(
@@ -170,14 +173,20 @@ struct h5t_access_methods {
h5_glb_idx_t (*set_glb_elem_neighbor_idx)(
h5_file_t* const,
const h5_loc_idx_t, const h5_loc_idx_t, const h5_glb_idx_t);
h5_err_t (*set_boundary_elem_flag)(h5_file_t* const, const h5_loc_idx_t);
h5_err_t (*clear_boundary_elem_flag)(h5_file_t* const, const h5_loc_idx_t);
int (*is_boundary_elem)(h5_file_t* const, const h5_loc_idx_t);
int (*is_boundary_facet)(h5_file_t* const, const h5_loc_idx_t, const h5_loc_idx_t);
int (*is_boundary_face)(h5_file_t* const, const int, const h5_loc_idx_t, const h5_loc_idx_t);
};
struct h5t_read_methods {
h5_err_t (*init_loc_elems_struct)(h5_file_t* const);
h5_err_t (*init_geom_boundary_info)(h5_file_t* const, h5t_lvl_idx_t);
};
struct h5t_adjacency_methods {
h5_err_t (*update_internal_structs)(h5_file_t* const, h5_id_t);
h5_err_t (*update_internal_structs)(h5_file_t* const, h5t_lvl_idx_t);
h5_err_t (*release_internal_structs)(h5_file_t* const);
h5_err_t (*get_adjacencies)(
h5_file_t * const,
@@ -202,9 +211,9 @@ typedef struct h5t_fdata {
h5_id_t cur_mesh; /* id of current mesh */
h5_id_t mesh_changed; /* true if new or has been changed */
h5_id_t num_meshes; /* number of meshes */
h5_id_t cur_level; /* id of current level */
h5_size_t num_levels; /* number of levels */
h5_id_t num_loaded_levels;
h5t_lvl_idx_t cur_level; /* idx of current level */
h5t_lvl_idx_t num_levels; /* number of levels */
h5t_lvl_idx_t num_loaded_levels;
/*** HDF5 IDs ***/
hid_t topo_gid; /* grp id of mesh in current
@@ -222,8 +231,7 @@ typedef struct h5t_fdata {
h5_loc_vertex_t *vertices;
h5_size_t *num_vertices;
h5_idxmap_t map_vertex_g2l; /* map global to local idx */
h5_idlist_t sorted_lvertices;
h5_loc_idx_t last_stored_vid;
h5_loc_idx_t last_stored_vid;
h5_dsinfo_t dsinfo_vertices;
h5_dsinfo_t dsinfo_num_vertices;
@@ -236,14 +244,6 @@ typedef struct h5t_fdata {
h5_size_t *num_elems_on_level;
h5_idxmap_t map_elem_g2l; /* map global id to local id */
/*
array with geometrically sorted local entitiy ids
[0]: 0,1,2,3 sorted
[1]: 1,0,2,3 sorted
...
*/
h5_idlist_t sorted_elems[H5_MAX_VERTICES_PER_ELEM];
h5_loc_idx_t last_stored_eid;
h5_dsinfo_t dsinfo_elems;
h5_dsinfo_t dsinfo_num_elems;
+5
View File
@@ -20,6 +20,11 @@ H5FedBeginTraverseEntities (
h5_file_t* const f,
int codim
);
h5t_entity_iterator_t*
H5FedBeginTraverseBoundaryFaces (
h5_file_t* const f,
int codim
);
h5_loc_id_t
H5FedTraverseEntities (
h5_file_t* const f,
+22 -10
View File
@@ -118,19 +118,18 @@ h5_error (
void
h5_verror (
const h5_file_t * const f,
const char *fmt,
const h5_file_t* const f,
const char* fmt,
va_list ap
);
void
h5_vwarn (
const h5_file_t * const f,
const char *fmt,
va_list ap
);
/*!
\ingroup h5_core_errorhandling
void
Print a warning message to \c stderr.
*/
static inline void
h5_warn (
const h5_file_t * const f,
const char *fmt,
@@ -140,6 +139,19 @@ h5_warn (
__attribute__ ((format (printf, 2, 3)))
#endif
;
static inline void
h5_warn (
const h5_file_t* const f,
const char* fmt,
...
) {
if (h5priv_debug_level >= 2) {
va_list ap;
va_start (ap, fmt);
h5priv_vprintf (stderr, "W", h5_get_funcname(f), fmt, ap);
va_end (ap);
}
}
/*!
\ingroup h5_core_errorhandling
@@ -214,7 +226,7 @@ h5_set_funcname (
);
static inline void
SET_FNAME (
H5_ENTER_API (
h5_file_t* const f,
const char* const fname
) {
+2
View File
@@ -39,6 +39,8 @@ typedef __int64 int64_t;
typedef int64_t h5_int64_t;
typedef int32_t h5_int32_t;
typedef int64_t h5_id_t;
typedef h5_int32_t h5t_lvl_idx_t;
typedef h5_int32_t h5t_elem_flags_t;
typedef int64_t h5_glb_idx_t; // type for a global index
typedef int64_t h5_loc_idx_t; // type for a local index
typedef int64_t h5_glb_id_t; // type for a global ID
-69
View File
@@ -14,73 +14,4 @@
#include "h5t_storemesh.h"
#include "h5t_tags.h"
#if !(defined(ULLONG_MAX))
#define ULLONG_MAX (ULONG_MAX * 2ULL + 1ULL)
#endif
/*
ID's: 64bit
Vertices:
000100vv tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt
3V TT TT TT TT TT TT
Edges:
00100eee tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt
2E TT TT TT TT TT TT
Trinagles:
001100dd tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt
1D TT TT TT TT TT TT
Tets:
01000000 tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt tttttttt
00 TT TT TT TT TT TT
*/
#define H5T_ELEM_MASK ( (h5_id_t) (ULLONG_MAX >> 8) )
#define H5T_ETYPE_MASK ( 7ull << (sizeof(h5_id_t)*8-4) )
#define H5T_COMPONENT_MASK (~H5T_ELEM_MASK)
#define H5T_COMPONENT_ID_MASK (15ull << (sizeof(h5_id_t)*7) )
#define H5T_ETYPE_VERTEX ((h5_id_t)1)
#define H5T_ETYPE_EDGE ((h5_id_t)2)
#define H5T_ETYPE_TRIANGLE ((h5_id_t)3)
#define H5T_ETYPE_TET ((h5_id_t)4)
#define h5tpriv_set_entity_type( type, elem_idx ) \
( \
((h5_id_t)(type) << (sizeof(h5_id_t)*8-4)) | \
((h5_id_t)(elem_idx)) \
)
#define h5tpriv_get_entity_type( entity_id ) \
((entity_id & H5T_ETYPE_MASK) >> (sizeof(h5_id_t)*8-4))
#define h5tpriv_build_id( type, comp_idx, elem_idx ) \
( \
((h5_id_t)(type) << (sizeof(h5_id_t)*8-4)) | \
((h5_id_t)(comp_idx) << (sizeof(h5_id_t)*7)) | \
((h5_id_t)(elem_idx) & H5T_ELEM_MASK) \
)
#define h5tpriv_build_vertex_id( comp_idx, elem_idx ) \
( h5tpriv_build_id ( H5T_ETYPE_VERTEX, comp_idx, elem_idx ) )
#define h5tpriv_build_edge_id( comp_idx, elem_idx ) \
( h5tpriv_build_id ( H5T_ETYPE_EDGE, comp_idx, elem_idx ) )
#define h5tpriv_build_triangle_id( comp_idx, elem_idx ) \
( h5tpriv_build_id ( H5T_ETYPE_TRIANGLE, comp_idx, elem_idx ) )
#define h5tpriv_build_elem_id( elem_idx ) \
( h5tpriv_build_id ( f->t->mesh_type, 0, elem_idx ) )
#define h5tpriv_get_face_idx( entity_id ) \
( (entity_id & H5T_COMPONENT_ID_MASK) >> (sizeof(h5_id_t)*7) )
#define h5tpriv_get_elem_idx( entity_id ) \
( entity_id & H5T_ELEM_MASK )
#endif
+1 -1
View File
@@ -24,7 +24,7 @@ h5t_get_num_vertices (
const h5_id_t cnode
);
h5_id_t
h5t_lvl_idx_t
h5t_get_level (
h5_file_t * const f
);
+9
View File
@@ -88,4 +88,13 @@ h5t_get_vertex_indices_of_entity (
h5_loc_idx_t *vertex_indices
);
h5_err_t
h5t_get_vertex_indices_of_entity2 (
h5_file_t* const f,
const int dim,
const h5_loc_idx_t face_idx,
const h5_loc_idx_t elem_idx,
h5_loc_idx_t* vertex_indices
);
#endif
+1 -1
View File
@@ -8,7 +8,7 @@ h5_err_t h5t_open_mesh (
);
h5_err_t h5t_set_level (
h5_file_t * const f,
const h5_id_t id
const h5t_lvl_idx_t id
);
h5_err_t h5t_close_mesh (
h5_file_t * const f
+1
View File
@@ -7,6 +7,7 @@
typedef struct {
int dim;
int entity_types[H5T_MAX_DIM+1];
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];
+25 -7
View File
@@ -1,22 +1,33 @@
#ifndef __H5T_RETRIEVE_H
#define __H5T_RETRIEVE_H
typedef struct {
typedef struct h5t_entity_iterator {
h5_id_t elem_idx; // local element id
h5_id_t face_idx; // face id according reference element
int codim; // dimension of entities to traverse
const h5t_ref_elem_t* ref_elem; // pointer to reference element
h5_err_t (*find)(h5_file_t *const f,
h5_id_t face_idx,
h5_id_t elem_idx,
h5_idlist_t **retval);
h5_err_t (*find)(
h5_file_t *const f,
h5_id_t face_idx,
h5_id_t elem_idx,
h5_idlist_t **retval);
h5_loc_id_t (*iter)(
h5_file_t *const f,
struct h5t_entity_iterator* iter);
} h5t_entity_iterator_t;
h5_err_t
h5t_alloc_entity_iterator (
h5_file_t* f,
h5t_entity_iterator_t** iter,
int codim
const int codim
);
h5_err_t
h5t_alloc_boundary_face_iterator (
h5_file_t* f,
h5t_entity_iterator_t** iter,
const int codim
);
h5_err_t
@@ -29,7 +40,14 @@ h5_err_t
h5t_begin_iterate_entities (
h5_file_t* f,
h5t_entity_iterator_t* iter,
int codim
const int codim
);
h5_err_t
h5t_begin_iterate_boundary_faces (
h5_file_t* f,
h5t_entity_iterator_t* iter,
const int codim
);
h5_id_t
+1 -1
View File
@@ -7,7 +7,7 @@ h5t_add_mesh (
const h5_oid_t mesh_type
);
h5_id_t
h5t_lvl_idx_t
h5t_add_level (
h5_file_t * const f
);