est/H5BlockTestAttributes.c
- adaption to renamed elements in struct h5_file src/H5PartErrors.h src/H5BlockTypes.h src/H5Part.h src/H5Block.c - refactoring src/H5Fed.h src/H5Fed_statistics.c src/Makefile.am src/H5BlockErrors.h src/h5/h5_types.h src/h5/attribs.c src/h5/t_readwrite.c src/h5/u_readwrite.c src/h5/t_openclose.c src/h5/H5.h src/h5/readwrite.c src/h5/openclose.c src/h5/openclose.h src/H5Fed.c - H5Fed write vertices and tets
This commit is contained in:
+7
-8
@@ -49,7 +49,6 @@
|
||||
|
||||
#include "H5BlockTypes.h"
|
||||
#include "H5Block.h"
|
||||
#include "H5BlockPrivate.h"
|
||||
#include "h5/H5.h"
|
||||
#include "H5BlockErrors.h"
|
||||
|
||||
@@ -442,7 +441,7 @@ _dissolve_ghostzones (
|
||||
f->nprocs * sizeof (*f->block->user_layout) );
|
||||
|
||||
p_begin = p_max = p_end = (struct list*) malloc ( sizeof ( *p_begin ) );
|
||||
if ( p_begin == NULL ) return HANDLE_H5PART_NOMEM_ERR;
|
||||
if ( p_begin == NULL ) return HANDLE_H5_NOMEM_ERR;
|
||||
|
||||
memset ( p_begin, 0, sizeof ( *p_begin ) );
|
||||
|
||||
@@ -456,7 +455,7 @@ _dissolve_ghostzones (
|
||||
if ( _have_ghostzone ( p, q ) ) {
|
||||
p_el = (struct list*) malloc ( sizeof ( *p_el ) );
|
||||
if ( p_el == NULL )
|
||||
return HANDLE_H5PART_NOMEM_ERR;
|
||||
return HANDLE_H5_NOMEM_ERR;
|
||||
|
||||
p_el->p = p;
|
||||
p_el->q = q;
|
||||
@@ -596,7 +595,7 @@ H5BlockDefine3DFieldLayout(
|
||||
_get_dimension_sizes ( f );
|
||||
|
||||
herr = _dissolve_ghostzones ( f );
|
||||
if ( herr < 0 ) return HANDLE_H5PART_LAYOUT_ERR;
|
||||
if ( herr < 0 ) return HANDLE_H5_LAYOUT_ERR;
|
||||
|
||||
herr = _release_hyperslab ( f );
|
||||
if ( herr < 0 ) return HANDLE_H5S_CLOSE_ERR;
|
||||
@@ -784,7 +783,7 @@ _open_field_group (
|
||||
if ( h5err < 0 ) return h5err;
|
||||
|
||||
if ( ! _have_object ( b->blockgroup, name ) )
|
||||
return HANDLE_H5PART_NOENT_ERR ( name );
|
||||
return HANDLE_H5_NOENT_ERR ( name );
|
||||
|
||||
herr_t herr = H5Gopen ( b->blockgroup, name );
|
||||
if ( herr < 0 ) return HANDLE_H5G_OPEN_ERR ( name );
|
||||
@@ -847,14 +846,14 @@ _select_hyperslab_for_reading (
|
||||
|
||||
rank = H5Sget_simple_extent_dims ( b->diskshape, NULL, NULL );
|
||||
if ( rank < 0 ) return HANDLE_H5S_GET_SIMPLE_EXTENT_DIMS_ERR;
|
||||
if ( rank != 3 ) return HANDLE_H5PART_DATASET_RANK_ERR ( rank, 3 );
|
||||
if ( rank != 3 ) return HANDLE_H5_DATASET_RANK_ERR ( rank, 3 );
|
||||
|
||||
rank = H5Sget_simple_extent_dims ( b->diskshape, field_dims, NULL );
|
||||
if ( rank < 0 ) return HANDLE_H5S_GET_SIMPLE_EXTENT_DIMS_ERR;
|
||||
|
||||
if ( (field_dims[0] < (hsize_t)b->k_max) ||
|
||||
(field_dims[1] < (hsize_t)b->j_max) ||
|
||||
(field_dims[2] < (hsize_t)b->i_max) ) return HANDLE_H5PART_LAYOUT_ERR;
|
||||
(field_dims[2] < (hsize_t)b->i_max) ) return HANDLE_H5_LAYOUT_ERR;
|
||||
|
||||
H5_print_debug (
|
||||
"PROC[%d]: \n"
|
||||
@@ -1186,7 +1185,7 @@ _create_field_group (
|
||||
if ( h5err < 0 ) return h5err;
|
||||
|
||||
if ( _have_object ( b->blockgroup, name ) )
|
||||
return HANDLE_H5PART_GROUP_EXISTS_ERR ( name );
|
||||
return HANDLE_H5_GROUP_EXISTS_ERR ( name );
|
||||
|
||||
herr_t herr = H5Gcreate ( b->blockgroup, name, 0 );
|
||||
if ( herr < 0 ) return HANDLE_H5G_CREATE_ERR ( name );
|
||||
|
||||
+4
-4
@@ -10,26 +10,26 @@
|
||||
H5PART_ERR_LAYOUT, \
|
||||
"No layout defined." )
|
||||
|
||||
#define HANDLE_H5PART_LAYOUT_ERR \
|
||||
#define HANDLE_H5_LAYOUT_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_LAYOUT, \
|
||||
"Bad layout." );
|
||||
|
||||
#define HANDLE_H5PART_NOENT_ERR( name ) \
|
||||
#define HANDLE_H5_NOENT_ERR( name ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_NOENT, \
|
||||
"Object \"%s\" doesn't exists.", name );
|
||||
|
||||
#define HANDLE_H5PART_DATASET_RANK_ERR( m, n ) \
|
||||
#define HANDLE_H5_DATASET_RANK_ERR( m, n ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_INVAL, \
|
||||
"Wrong rank of dataset: Is %d, but should be %d", \
|
||||
m, n );
|
||||
|
||||
#define HANDLE_H5PART_GROUP_EXISTS_ERR( name ) \
|
||||
#define HANDLE_H5_GROUP_EXISTS_ERR( name ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_INVAL, \
|
||||
|
||||
@@ -1,32 +1,5 @@
|
||||
#ifndef __H5BLOCKTYPES_H
|
||||
#define __H5BLOCKTYPES_H
|
||||
|
||||
struct H5BlockPartition {
|
||||
h5part_int64_t i_start;
|
||||
h5part_int64_t i_end;
|
||||
h5part_int64_t j_start;
|
||||
h5part_int64_t j_end;
|
||||
h5part_int64_t k_start;
|
||||
h5part_int64_t k_end;
|
||||
};
|
||||
|
||||
struct h5b_fdata {
|
||||
h5part_int64_t step_idx;
|
||||
h5part_int64_t i_max;
|
||||
h5part_int64_t j_max;
|
||||
h5part_int64_t k_max;
|
||||
struct H5BlockPartition *user_layout;
|
||||
struct H5BlockPartition *write_layout;
|
||||
int have_layout;
|
||||
|
||||
hid_t shape;
|
||||
hid_t memshape;
|
||||
hid_t diskshape;
|
||||
hid_t blockgroup;
|
||||
hid_t field_group_id;
|
||||
};
|
||||
|
||||
#define H5PART_ERR_LAYOUT -100
|
||||
#define H5PART_ERR_NOENT -101
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#include <hdf5.h>
|
||||
#include "h5/h5_types.h"
|
||||
#include "h5/H5.h"
|
||||
#include "H5Fed.h"
|
||||
|
||||
|
||||
|
||||
+121
-90
@@ -54,11 +54,6 @@ h5_int_t H5FedHasBoundaryMesh(
|
||||
|
||||
/****** VERTEX statistics routines *******************************************/
|
||||
|
||||
h5_size_t H5FedGetNumVertices (
|
||||
h5_file * fh,
|
||||
const h5_id_t level
|
||||
);
|
||||
|
||||
h5_size_t H5FedGetNumVerticesTotal(
|
||||
h5_file * fh,
|
||||
const h5_id_t level
|
||||
@@ -72,17 +67,12 @@ h5_size_t H5FedGetNumVerticesCnode (
|
||||
|
||||
/****** EDGE statistics routines ********************************************/
|
||||
|
||||
h5_size_t H5FedGetNumEdgesInTetrahedralMesh (
|
||||
h5_size_t H5FedGetNumEdgesTotal (
|
||||
h5_file * fh,
|
||||
const h5_id_t level
|
||||
);
|
||||
|
||||
h5_size_t H5FedGetNumEdgesInTetrahedralMeshTotal (
|
||||
h5_file * fh,
|
||||
const h5_id_t level
|
||||
);
|
||||
|
||||
h5_size_t H5FedGetNumEdgeInTetrahedralMeshCnode (
|
||||
h5_size_t H5FedGetNumEdgesCnode (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t cnode
|
||||
@@ -90,17 +80,12 @@ h5_size_t H5FedGetNumEdgeInTetrahedralMeshCnode (
|
||||
|
||||
/****** TRIANGLE statistics routines *****************************************/
|
||||
|
||||
h5_size_t H5FedGetNumTrianglesInTetrahedralMesh (
|
||||
h5_size_t H5FedGetNumTrianglesTotal (
|
||||
h5_file * fh,
|
||||
const h5_id_t level
|
||||
);
|
||||
|
||||
h5_size_t H5FedGetNumTrianglesInTetrahedralMeshTotal (
|
||||
h5_file * fh,
|
||||
const h5_id_t level
|
||||
);
|
||||
|
||||
h5_size_t H5FedGetNumTrianglesInTetrahedralMeshCnode (
|
||||
h5_size_t H5FedGetNumTrianglesCnode (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t cnode
|
||||
@@ -108,11 +93,6 @@ h5_size_t H5FedGetNumTrianglesInTetrahedralMeshCnode (
|
||||
|
||||
/****** TETRAHEDRON statistics routines **************************************/
|
||||
|
||||
h5_size_t H5FedGetNumTetrahedra (
|
||||
h5_file * fh,
|
||||
const h5_id_t level
|
||||
);
|
||||
|
||||
h5_size_t H5FedGetNumTetrahedraTotal(
|
||||
h5_file * fh,
|
||||
const h5_id_t level
|
||||
@@ -126,11 +106,6 @@ h5_size_t H5FedGetNumTetrahedraCnode (
|
||||
|
||||
/****** BOUNDARY statistics routines ****************************************/
|
||||
|
||||
h5_size_t H5FedGetNumBoundaryTriangles (
|
||||
h5_file * fh,
|
||||
const h5_id_t level
|
||||
);
|
||||
|
||||
h5_size_t H5FedGetNumBoundaryTrianglesTotal (
|
||||
h5_file * fh,
|
||||
const h5_id_t level
|
||||
@@ -142,89 +117,145 @@ h5_size_t H5FedGetNumBoundaryTrianglesCnode (
|
||||
const h5_id_t cnode
|
||||
);
|
||||
|
||||
/****** RETRIEVAL routines **************************************************/
|
||||
/****** STORE / RETRIEVAL routines ********************************************/
|
||||
|
||||
h5_vertex * H5FedGetVertexCoordinate (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t vertex_id
|
||||
/* vertices */
|
||||
h5_size_t
|
||||
H5FedSetNumVertices (
|
||||
h5_file * f,
|
||||
const h5_size_t num
|
||||
);
|
||||
|
||||
h5_edge * H5FedGetEdge (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t local_id
|
||||
h5_size_t
|
||||
H5FedGetNumVertices (
|
||||
h5_file * f
|
||||
);
|
||||
|
||||
h5_triangle * H5FedGetTriangle (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t local_id
|
||||
h5_id_t
|
||||
H5FedStoreVertex (
|
||||
h5_file * f,
|
||||
const h5_id_t id,
|
||||
const h5_float64_t P[3]
|
||||
);
|
||||
|
||||
h5_tetrahedron * H5FedGetTetrahedron (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t local_id
|
||||
h5_id_t
|
||||
H5FedGetVertex (
|
||||
h5_file * f,
|
||||
h5_id_t * const id,
|
||||
h5_float64_t * const P[3]
|
||||
);
|
||||
|
||||
h5_triangle * H5FedGetBoundaryTriangle (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t local_id
|
||||
/* edges */
|
||||
h5_size_t
|
||||
H5FedSetNumEdges (
|
||||
h5_file * f,
|
||||
const h5_size_t num
|
||||
);
|
||||
|
||||
/****** STORE routines*****************************************************/
|
||||
|
||||
h5_int_t H5FedSetNumVertices (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_size_t num_vertices
|
||||
h5_size_t
|
||||
H5FedGetNumEdges (
|
||||
h5_file * f
|
||||
);
|
||||
|
||||
h5_int_t H5FedSetNumTetrahedra (
|
||||
h5_id_t
|
||||
H5FedStoreEdge (
|
||||
h5_file * f,
|
||||
const h5_id_t id,
|
||||
const h5_id_t parent_id,
|
||||
const h5_id_t vertex_ids[2]
|
||||
);
|
||||
|
||||
h5_id_t
|
||||
H5FedGetEdge (
|
||||
h5_file * f,
|
||||
h5_id_t * const id,
|
||||
h5_id_t * const parent_id,
|
||||
h5_id_t * const vertex_ids[2]
|
||||
);
|
||||
|
||||
/* triangles */
|
||||
h5_size_t
|
||||
H5FedSetNumTriangles (
|
||||
h5_file * f,
|
||||
const h5_size_t num
|
||||
);
|
||||
|
||||
h5_size_t
|
||||
H5FedGetNumTriangles (
|
||||
h5_file * f
|
||||
);
|
||||
|
||||
h5_int_t
|
||||
H5FedStoreTriangle (
|
||||
h5_file * f,
|
||||
const h5_id_t id,
|
||||
const h5_id_t parent_id,
|
||||
const h5_id_t vertex_ids[3]
|
||||
);
|
||||
|
||||
h5_id_t
|
||||
H5FedGetTriangle (
|
||||
h5_file * f,
|
||||
h5_id_t * const id,
|
||||
h5_id_t * const parent_id,
|
||||
h5_id_t * const vertex_ids[2]
|
||||
);
|
||||
|
||||
/* boundary triangles */
|
||||
h5_size_t
|
||||
H5FedSetNumBoundaryTriangles (
|
||||
h5_file * f,
|
||||
const h5_size_t num
|
||||
);
|
||||
|
||||
h5_size_t
|
||||
H5FedGetNumBoundaryTriangles (
|
||||
h5_file * f
|
||||
);
|
||||
|
||||
|
||||
h5_id_t
|
||||
H5FedStoreBoundaryTriangle (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t id,
|
||||
const h5_id_t parent_id,
|
||||
const h5_id_t vertex_ids[3]
|
||||
);
|
||||
|
||||
h5_id_t
|
||||
H5FedGetBoundaryTriangle (
|
||||
h5_file * f,
|
||||
h5_id_t * const id,
|
||||
h5_id_t * const parent_id,
|
||||
h5_id_t * const vertex_ids[3]
|
||||
);
|
||||
|
||||
/* tetrahedra */
|
||||
h5_size_t
|
||||
H5FedSetNumTetrahedra (
|
||||
h5_file * f,
|
||||
const h5_size_t num_tet
|
||||
);
|
||||
|
||||
h5_int_t H5FedStoreVertexCoordinate (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t vertex_id,
|
||||
const h5_vertex * const vertex
|
||||
h5_size_t
|
||||
H5FedGetNumTetrahedra (
|
||||
h5_file * f
|
||||
);
|
||||
|
||||
h5_int_t H5FedStoreEdge (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t edge_id,
|
||||
h5_id_t
|
||||
H5FedStoreTetrahedron (
|
||||
h5_file * f,
|
||||
const h5_id_t id,
|
||||
const h5_id_t parent_id,
|
||||
const h5_edge * const edge
|
||||
const h5_id_t vertex_ids[4]
|
||||
);
|
||||
|
||||
h5_int_t H5FedStoreTriangle (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t triangle_id,
|
||||
const h5_id_t parent_id,
|
||||
const h5_triangle * const triangle
|
||||
);
|
||||
|
||||
h5_int_t H5FedStoreTetrahedron (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t tet_id,
|
||||
const h5_id_t parent_id,
|
||||
const h5_tetrahedron * const tet/*!< 4-tuple with vertex id's */
|
||||
);
|
||||
|
||||
h5_int_t H5FedStoreBoundaryTriangle (
|
||||
h5_file * fh,
|
||||
const h5_id_t level,
|
||||
const h5_id_t btriangle_id,
|
||||
const h5_id_t parent_id,
|
||||
const h5_triangle * const btriangle
|
||||
h5_id_t
|
||||
H5FedGetTetrahedron (
|
||||
h5_file * f,
|
||||
h5_id_t * const id,
|
||||
h5_id_t * parent_id,
|
||||
h5_id_t * const vertex_ids[4]
|
||||
);
|
||||
|
||||
/****** UPWARD ADJACENCY routines *********************************************/
|
||||
|
||||
+4
-113
@@ -18,21 +18,6 @@
|
||||
#include "h5/h5_types.h"
|
||||
#include "H5Fed.h"
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
Get the number of vertices used for defining a submesh
|
||||
at level \c level for this compute node in current step.
|
||||
|
||||
\return number of vertices
|
||||
\return \c -1 on error.
|
||||
*/
|
||||
h5_size_t H5FedGetNumVertices (
|
||||
h5_file * fh, /*!< file handle */
|
||||
const h5_id_t level /*!< mesh level to query */
|
||||
) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
@@ -69,31 +54,6 @@ h5_size_t H5FedGetNumVerticesCnode (
|
||||
|
||||
/****** EDGE statistics routines ********************************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
Returns the number of edges present in the mesh at level \c level in
|
||||
current time step on this compute node.
|
||||
|
||||
\return number of edges
|
||||
\return \c -1 on error.
|
||||
|
||||
\note
|
||||
It is left to the API implementor how to make this information
|
||||
available; in general he can compute it from the definition of
|
||||
the tetrahedral mesh.
|
||||
|
||||
\note
|
||||
After counting the number for the local cnode we call MPI_Gather()
|
||||
to collect the number from the other cnodes and store them into an
|
||||
array. The inquired number will be provided from this array.
|
||||
*/
|
||||
h5_size_t H5FedGetNumEdgesInTetrahedralMesh (
|
||||
h5_file * fh, /*!< file handle */
|
||||
const h5_id_t level /*!< mesh level to query */
|
||||
) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
@@ -104,7 +64,7 @@ h5_size_t H5FedGetNumEdgesInTetrahedralMesh (
|
||||
\return number of edges
|
||||
\return \c -1 on error.
|
||||
*/
|
||||
h5_size_t H5FedGetNumEdgesInTetrahedralMeshTotal (
|
||||
h5_size_t H5FedGetNumEdgesTotal (
|
||||
h5_file * fh, /*!< file handle */
|
||||
const h5_id_t level /*!< mesh level to query */
|
||||
) {
|
||||
@@ -120,7 +80,7 @@ h5_size_t H5FedGetNumEdgesInTetrahedralMeshTotal (
|
||||
\return number of edges
|
||||
\return \c -1 on error.
|
||||
*/
|
||||
h5_size_t H5FedGetNumEdgeInTetrahedralMeshCnode (
|
||||
h5_size_t H5FedGetNumEdgesCnode (
|
||||
h5_file * fh, /*!< file handle */
|
||||
const h5_id_t level, /*!< mesh level to query */
|
||||
const h5_id_t cnode /*!< compute node */
|
||||
@@ -130,27 +90,6 @@ h5_size_t H5FedGetNumEdgeInTetrahedralMeshCnode (
|
||||
|
||||
/****** TRIANGLE statistics routines *****************************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
Get the number of triangles present in the mesh at level \c level in
|
||||
current time step on this compute note.
|
||||
|
||||
\return Number of triangles
|
||||
\return \c -1 on error.
|
||||
|
||||
\note
|
||||
After counting the number for the local cnode we call MPI_Gather()
|
||||
to collect the number from the other cnodes and store them into an
|
||||
array. The inquired number will be provided from this array.
|
||||
*/
|
||||
h5_size_t H5FedGetNumTrianglesInTetrahedralMesh (
|
||||
h5_file * fh, /*!< file handle */
|
||||
const h5_id_t level /*!< mesh level to query */
|
||||
) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
@@ -160,7 +99,7 @@ h5_size_t H5FedGetNumTrianglesInTetrahedralMesh (
|
||||
\return Number of triangles
|
||||
\return \c -1 on error.
|
||||
*/
|
||||
h5_size_t H5FedGetNumTrianglesInTetrahedralMeshTotal (
|
||||
h5_size_t H5FedGetNumTrianglesTotal (
|
||||
h5_file * fh, /*!< file handle */
|
||||
const h5_id_t level /*!< mesh level to query */
|
||||
) {
|
||||
@@ -176,7 +115,7 @@ h5_size_t H5FedGetNumTrianglesInTetrahedralMeshTotal (
|
||||
\return Number of triangles
|
||||
\return \c -1 on error.
|
||||
*/
|
||||
h5_size_t H5FedGetNumTrianglesInTetrahedralMeshCnode (
|
||||
h5_size_t H5FedGetNumTrianglesCnode (
|
||||
h5_file * fh, /*!< file handle */
|
||||
const h5_id_t level, /*!< mesh level to query */
|
||||
const h5_id_t cnode /*!< compute node */
|
||||
@@ -186,27 +125,6 @@ h5_size_t H5FedGetNumTrianglesInTetrahedralMeshCnode (
|
||||
|
||||
/****** TETRAHEDRON statistics routines **************************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
Returns the number of tetrahedral elements present in the mesh at
|
||||
level \c level in current step on this compute node.
|
||||
|
||||
\return number of tetrahedra
|
||||
\return \c -1 on error.
|
||||
|
||||
\note
|
||||
After counting the number for the local cnode we call MPI_Gather()
|
||||
to collect the number from the other cnodes and store them into an
|
||||
array. The inquired number will be provided from this array.
|
||||
*/
|
||||
h5_size_t H5FedGetNumTetrahedra (
|
||||
h5_file * fh, /*!< file handle */
|
||||
const h5_id_t level /*!< mesh level to query */
|
||||
) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
@@ -242,33 +160,6 @@ h5_size_t H5FedGetNumTetrahedraCnode (
|
||||
|
||||
/****** BOUNDARY statistics routines ****************************************/
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
Get the number of boundary triangles present in the mesh at
|
||||
level \c level in current step on this compute node.
|
||||
|
||||
\return number of tetrahedras
|
||||
\return \c -1 on error.
|
||||
|
||||
\note
|
||||
It is left to the API implementor how to make this information
|
||||
available. In general he can compute it from the definition
|
||||
of the tetrahedral mesh, using the adjacency relations, i.e.
|
||||
the fact that a boundary triangle has only one single adjacent
|
||||
tetrahedron.
|
||||
|
||||
\note
|
||||
After counting the number for the local cnode we call MPI_Gather()
|
||||
to collect the number from the other cnodes and store them into an
|
||||
array. The inquired number will be provided from this array.
|
||||
*/
|
||||
h5_size_t H5FedGetNumBoundaryTriangles (
|
||||
h5_file * fh, /*!< file handle */
|
||||
const h5_id_t level /*!< mesh level to query */
|
||||
) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5fed_c_api
|
||||
|
||||
+13
-19
@@ -14,27 +14,21 @@ extern "C" {
|
||||
|
||||
#include "H5PartTypes.h"
|
||||
|
||||
#define H5PART_SUCCESS H5_SUCCESS
|
||||
#define H5PART_ERR_NOMEM H5_ERR_NOMEM
|
||||
#define H5PART_ERR_INVAL H5_ERR_INVAL
|
||||
#define H5PART_ERR_BADFD H5_ERR_BADFD
|
||||
#define H5PART_ERR_LAYOUT H5_ERR_LAYOUT
|
||||
#define H5PART_ERR_NOENT H5_ERR_NOENT
|
||||
#define H5PART_ERR_INIT H5_ERR_INIT
|
||||
#define H5PART_ERR_NOENTRY H5_ERR_NOENTRY
|
||||
|
||||
#define H5PART_SUCCESS 0
|
||||
#define H5PART_ERR_NOMEM -12
|
||||
#define H5PART_ERR_INVAL -22
|
||||
#define H5PART_ERR_BADFD -77
|
||||
#define H5PART_ERR_MPI H5_ERR_MPI
|
||||
#define H5PART_ERR_HDF5 H5_ERR_HDF5
|
||||
|
||||
#define H5PART_ERR_INIT -200
|
||||
#define H5PART_ERR_NOENTRY -201
|
||||
|
||||
#define H5PART_ERR_MPI -201
|
||||
#define H5PART_ERR_HDF5 -202
|
||||
|
||||
|
||||
#define H5_O_RDONLY 0x01
|
||||
#define H5_O_WRONLY 0x02
|
||||
#define H5_O_APPEND 0x03
|
||||
#define H5_O_RDWR 0x04
|
||||
|
||||
#define H5PART_READ H5_O_RDONLY # legacy def, will be removed
|
||||
#define H5PART_WRITE H5_O_WRONLY # legacy def, will be removed
|
||||
#define H5PART_APPEND H5_O_APPEND # legacy def, will be removed
|
||||
#define H5PART_READ H5_O_RDONLY
|
||||
#define H5PART_WRITE H5_O_WRONLY
|
||||
#define H5PART_APPEND H5_O_APPEND
|
||||
|
||||
#define H5PART_INT64 ((h5part_int64_t)H5T_NATIVE_INT64)
|
||||
#define H5PART_FLOAT64 ((h5part_int64_t)H5T_NATIVE_DOUBLE)
|
||||
|
||||
+56
-56
@@ -6,85 +6,85 @@
|
||||
|
||||
#define CHECK_FILEHANDLE( f ) \
|
||||
if ( H5_check_filehandle ( f ) != H5PART_SUCCESS ) \
|
||||
return HANDLE_H5PART_BADFD_ERR;
|
||||
return HANDLE_H5_BADFD_ERR;
|
||||
|
||||
#define CHECK_WRITABLE_MODE( f ) \
|
||||
if ( f->mode==H5PART_READ ) \
|
||||
return (*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_INVAL, \
|
||||
H5_ERR_INVAL, \
|
||||
"Attempting to write to read-only file" );
|
||||
|
||||
#define CHECK_READONLY_MODE( f ) \
|
||||
if ( ! f->mode==H5PART_READ ) \
|
||||
return (*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_INVAL, \
|
||||
H5_ERR_INVAL, \
|
||||
"Operation is not allowed on writable files." );
|
||||
|
||||
#define CHECK_TIMEGROUP( f ) \
|
||||
if ( f->step_gid <= 0 ) \
|
||||
return (*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_INVAL, \
|
||||
H5_ERR_INVAL, \
|
||||
"Timegroup <= 0.");
|
||||
|
||||
/**************** H5Part *********************/
|
||||
|
||||
#define HANDLE_H5PART_BADFD_ERR \
|
||||
#define HANDLE_H5_BADFD_ERR \
|
||||
(*_err_handler)( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_BADFD, \
|
||||
H5_ERR_BADFD, \
|
||||
"Called with bad filehandle." );
|
||||
|
||||
#define HANDLE_H5PART_INIT_ERR \
|
||||
#define HANDLE_H5_INIT_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_INIT, \
|
||||
H5_ERR_INIT, \
|
||||
"Cannot initialize H5Part." );
|
||||
|
||||
#define HANDLE_H5PART_NOMEM_ERR \
|
||||
#define HANDLE_H5_NOMEM_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_NOMEM, \
|
||||
H5_ERR_NOMEM, \
|
||||
"Out of memory." );
|
||||
|
||||
#define HANDLE_H5PART_SETSTEP_ERR( rc, step ) \
|
||||
#define HANDLE_H5_SETSTEP_ERR( rc, step ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
rc, \
|
||||
"Cannont set time-step to %lld.", (long long)step );
|
||||
|
||||
#define HANDLE_H5PART_FILE_ACCESS_TYPE_ERR( flags ) \
|
||||
#define HANDLE_H5_FILE_ACCESS_TYPE_ERR( flags ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_INVAL, \
|
||||
H5_ERR_INVAL, \
|
||||
"Invalid file access type \"%d\".", flags);
|
||||
|
||||
#define HANDLE_H5PART_STEP_EXISTS_ERR( step ) \
|
||||
#define HANDLE_H5_STEP_EXISTS_ERR( step ) \
|
||||
(*_err_handler)( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_INVAL, \
|
||||
H5_ERR_INVAL, \
|
||||
"Step #%lld already exists, step cannot be set to an existing" \
|
||||
" step in write and append mode", (long long)step );
|
||||
|
||||
#define HANDLE_H5PART_SET_VIEW_ERR( rc, start, end ) \
|
||||
#define HANDLE_H5_SET_VIEW_ERR( rc, start, end ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
rc, \
|
||||
"Cannot set view to (%lld, %lld).", \
|
||||
(long long)start, (long long)end );
|
||||
|
||||
#define HANDLE_H5PART_GET_NUM_PARTICLES_ERR( rc ) \
|
||||
#define HANDLE_H5_GET_NUM_PARTICLES_ERR( rc ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
rc, \
|
||||
"Cannot get number of particles." );
|
||||
|
||||
#define HANDLE_H5PART_NOENTRY_ERR( group_name, type, idx ) \
|
||||
#define HANDLE_H5_NOENTRY_ERR( group_name, type, idx ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_NOENTRY, \
|
||||
H5_ERR_NOENTRY, \
|
||||
"No entry with index %lld and type %d in group %s!", \
|
||||
(long long)idx, type, group_name );
|
||||
|
||||
@@ -93,107 +93,107 @@
|
||||
#define HANDLE_H5A_CLOSE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot terminate access to attribute." );
|
||||
|
||||
#define HANDLE_H5A_CREATE_ERR( s ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot create attribute \"%s\".", s );
|
||||
|
||||
#define HANDLE_H5A_GET_NAME_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot get attribute name." );
|
||||
|
||||
#define HANDLE_H5A_GET_NUM_ATTRS_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot get number of attributes." );
|
||||
|
||||
#define HANDLE_H5A_GET_SPACE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot get a copy of dataspace for attribute." );
|
||||
|
||||
#define HANDLE_H5A_GET_TYPE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot get attribute datatype." );
|
||||
|
||||
#define HANDLE_H5A_OPEN_IDX_ERR( n ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot open attribute specified by index \"%lld\".", \
|
||||
(long long)n );
|
||||
|
||||
#define HANDLE_H5A_OPEN_NAME_ERR( s ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot open attribute specified by name \"%s\".", s );
|
||||
|
||||
#define HANDLE_H5A_READ_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot read attribute" );
|
||||
|
||||
#define HANDLE_H5A_WRITE_ERR( s ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot write attribute \"%s\".", s );
|
||||
|
||||
/* H5D: Dataset */
|
||||
#define HANDLE_H5D_CLOSE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Close of dataset failed." );
|
||||
|
||||
#define HANDLE_H5D_CREATE_ERR( s, n ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot create dataset for name \"%s\", step \"%lld\".", \
|
||||
s, (long long) n );
|
||||
|
||||
#define HANDLE_H5D_GET_SPACE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot get dataspace identifier.");
|
||||
|
||||
#define HANDLE_H5D_GET_TYPE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot determine dataset type.");
|
||||
|
||||
#define HANDLE_H5D_OPEN_ERR( s ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot open dataset \"%s\".", s );
|
||||
|
||||
#define HANDLE_H5D_READ_ERR( s, n ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Read from dataset \"%s\" failed, step \"%lld\".", \
|
||||
s, (long long) n );
|
||||
|
||||
#define HANDLE_H5D_WRITE_ERR( s, n ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Write to dataset \"%s\" failed, step \"%lld\".", \
|
||||
s, (long long)n );
|
||||
|
||||
@@ -201,13 +201,13 @@
|
||||
#define HANDLE_H5F_CLOSE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot terminate access to file." );
|
||||
|
||||
#define HANDLE_H5F_OPEN_ERR( filename, flags ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot open file \"%s\" with mode \"%d\"", filename, flags );
|
||||
|
||||
|
||||
@@ -216,25 +216,25 @@
|
||||
#define HANDLE_H5G_CLOSE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot terminate access to datagroup." );
|
||||
|
||||
#define HANDLE_H5G_CREATE_ERR( s ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot create datagroup \"%s\".", s );
|
||||
|
||||
#define HANDLE_H5G_GET_OBJINFO_ERR( s ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot get information about object \"%s\".", s );
|
||||
|
||||
#define HANDLE_H5G_OPEN_ERR( s ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot open group \"%s\".", s );
|
||||
|
||||
|
||||
@@ -242,26 +242,26 @@
|
||||
#define HANDLE_H5P_CLOSE_ERR( s ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot terminate access to property list \"%s\".", s );
|
||||
|
||||
#define HANDLE_H5P_CREATE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot create property list." );
|
||||
|
||||
#define HANDLE_H5P_SET_DXPL_MPIO_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"MPI: Cannot set data transfer mode." );
|
||||
|
||||
|
||||
#define HANDLE_H5P_SET_FAPL_MPIO_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot store IO communicator information to the " \
|
||||
"file access property list.");
|
||||
|
||||
@@ -269,63 +269,63 @@
|
||||
#define HANDLE_H5S_CREATE_SIMPLE_ERR( n ) \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot create dataspace with len \"%lld\".", (long long) n );
|
||||
|
||||
#define HANDLE_H5S_CLOSE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot terminate access to dataspace." );
|
||||
|
||||
#define HANDLE_H5S_GET_SELECT_NPOINTS_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot determine the number of elements in dataspace selection." );
|
||||
|
||||
#define HANDLE_H5S_GET_SIMPLE_EXTENT_NPOINTS_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot determine number of elements in dataspace." );
|
||||
|
||||
#define HANDLE_H5S_SELECT_HYPERSLAB_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot set select hyperslap region or add the specified region" );
|
||||
|
||||
/* H5T: type */
|
||||
#define HANDLE_H5T_CLOSE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_HDF5, \
|
||||
H5_ERR_HDF5, \
|
||||
"Cannot release datatype." );
|
||||
|
||||
/* MPI */
|
||||
#define HANDLE_MPI_ALLGATHER_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_MPI, \
|
||||
H5_ERR_MPI, \
|
||||
"Cannot gather data." );
|
||||
|
||||
#define HANDLE_MPI_COMM_SIZE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_MPI, \
|
||||
H5_ERR_MPI, \
|
||||
"Cannot get number of processes in my group." );
|
||||
|
||||
#define HANDLE_MPI_COMM_RANK_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_MPI, \
|
||||
H5_ERR_MPI, \
|
||||
"Cannot get rank of the calling process in my group." );
|
||||
|
||||
#define HANDLE_MPI_UNAVAILABLE_ERR \
|
||||
(*_err_handler) ( \
|
||||
H5_get_funcname(), \
|
||||
H5PART_ERR_MPI, \
|
||||
H5_ERR_MPI, \
|
||||
"MPI not available" );
|
||||
|
||||
#endif
|
||||
|
||||
+5
-3
@@ -61,9 +61,8 @@ libH5Part_a_SOURCES = \
|
||||
H5Fed.c \
|
||||
H5Fed_adjacency.c \
|
||||
H5Fed_dof.c \
|
||||
H5Fed_retrieve.c \
|
||||
H5Fed_statistics.c \
|
||||
H5Fed_store.c
|
||||
H5Fed_storeretrieve.c
|
||||
|
||||
SUBDIRS = h5 bindings
|
||||
|
||||
@@ -78,7 +77,10 @@ libH5Part.a: $(libH5Part_a_OBJECTS)
|
||||
H5Part.o: H5Part.c H5Part.h H5PartPrivate.h H5PartTypes.h
|
||||
H5Block.o: H5Block.c H5Part.h H5PartPrivate.h H5PartTypes.h H5Block.h H5BlockTypes.h
|
||||
|
||||
clean:
|
||||
clean-recursive:
|
||||
for d in ${SUBDIRS}; do ${MAKE} -C $$d clean; done
|
||||
|
||||
clean: clean-recursive
|
||||
rm -f *~ *.o *.a *.so
|
||||
|
||||
distclean: clean
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
#define __H5_H
|
||||
|
||||
#include "h5_types.h"
|
||||
#include "h5_private.h"
|
||||
|
||||
#include "attribs.h"
|
||||
#include "errorhandling.h"
|
||||
#include "openclose.h"
|
||||
#include "readwrite.h"
|
||||
#include "t_readwrite.h"
|
||||
#include "u_readwrite.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "H5Part.h"
|
||||
#include "H5Block.h"
|
||||
#include "H5PartPrivate.h"
|
||||
#include "H5BlockPrivate.h"
|
||||
#include "H5PartErrors.h"
|
||||
#include "H5BlockErrors.h"
|
||||
#include "H5.h"
|
||||
|
||||
+106
-58
@@ -8,6 +8,24 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define H5_SUCCESS 0
|
||||
#define H5_ERR_NOMEM -12
|
||||
#define H5_ERR_INVAL -22
|
||||
#define H5_ERR_BADFD -77
|
||||
|
||||
#define H5_ERR_LAYOUT -100
|
||||
#define H5_ERR_NOENT -101
|
||||
|
||||
#define H5_ERR_INIT -200
|
||||
#define H5_ERR_NOENTRY -201
|
||||
|
||||
#define H5_ERR_MPI -201
|
||||
#define H5_ERR_HDF5 -202
|
||||
|
||||
#define H5_O_RDONLY 0x01
|
||||
#define H5_O_WRONLY 0x02
|
||||
#define H5_O_APPEND 0x03
|
||||
#define H5_O_RDWR 0x04
|
||||
|
||||
#ifdef WIN32
|
||||
typedef __int64 int64_t;
|
||||
@@ -24,6 +42,8 @@ typedef double h5_float64_t;
|
||||
typedef h5_float64_t h5_float_t;
|
||||
typedef h5_float64_t h5part_float64_t;
|
||||
|
||||
typedef h5_err_t h5_int32_t;
|
||||
|
||||
struct h5_complex {
|
||||
h5_float64_t r,i;
|
||||
};
|
||||
@@ -38,6 +58,8 @@ struct h5_vertex { /* 32Byte */
|
||||
struct h5_edge { /* 16Bytes */
|
||||
h5_id_t id;
|
||||
h5_id_t parent_id;
|
||||
h5_id_t refined_on_evel; /* = 0 if not refined*/
|
||||
h5_id_t unused; /* for right alignment */
|
||||
h5_id_t vertex_ids[2];
|
||||
};
|
||||
|
||||
@@ -45,17 +67,19 @@ struct h5_triangle { /*24Bytes*/
|
||||
h5_id_t id;
|
||||
h5_id_t parent_id;
|
||||
h5_id_t vertex_ids[3];
|
||||
h5_id_t unused; /* for alignment */
|
||||
h5_id_t refined_on_level;
|
||||
};
|
||||
|
||||
struct h5_tetrahedron { /* 24Bytes */
|
||||
h5_id_t id;
|
||||
h5_id_t parent_id;
|
||||
h5_id_t refined_on_evel;
|
||||
h5_id_t unused; /* for right alignment */
|
||||
h5_id_t vertex_ids[4];
|
||||
};
|
||||
|
||||
typedef struct h5_vertex h5_vertex;
|
||||
typedef struct h5_edge h5_edg;
|
||||
typedef struct h5_edge h5_edge;
|
||||
typedef struct h5_triangle h5_triangle;
|
||||
typedef struct h5_tetrahedron h5_tetrahedron;
|
||||
|
||||
@@ -71,9 +95,85 @@ typedef h5_error_handler h5part_error_handler;
|
||||
typedef unsigned long MPI_Comm;
|
||||
#endif
|
||||
|
||||
struct h5u_fdata; /* unstructured data */
|
||||
struct h5b_fdata; /* block structured data */
|
||||
struct h5t_fdata; /* topology data */
|
||||
struct h5u_fdata {
|
||||
hsize_t nparticles; /* -> u.nparticles */
|
||||
|
||||
h5part_int64_t viewstart; /* -1 if no view is available: A "view" looks */
|
||||
h5part_int64_t viewend; /* at a subset of the data. */
|
||||
|
||||
/**
|
||||
the number of particles in each processor.
|
||||
With respect to the "VIEW", these numbers
|
||||
can be regarded as non-overlapping subsections
|
||||
of the particle array stored in the file.
|
||||
So they can be used to compute the offset of
|
||||
the view for each processor
|
||||
*/
|
||||
h5part_int64_t *pnparticles;
|
||||
|
||||
hid_t shape;
|
||||
hid_t diskshape;
|
||||
hid_t memshape;
|
||||
};
|
||||
|
||||
struct H5BlockPartition {
|
||||
h5part_int64_t i_start;
|
||||
h5part_int64_t i_end;
|
||||
h5part_int64_t j_start;
|
||||
h5part_int64_t j_end;
|
||||
h5part_int64_t k_start;
|
||||
h5part_int64_t k_end;
|
||||
};
|
||||
|
||||
struct h5b_fdata {
|
||||
h5part_int64_t step_idx;
|
||||
h5part_int64_t i_max;
|
||||
h5part_int64_t j_max;
|
||||
h5part_int64_t k_max;
|
||||
struct H5BlockPartition *user_layout;
|
||||
struct H5BlockPartition *write_layout;
|
||||
int have_layout;
|
||||
|
||||
hid_t shape;
|
||||
hid_t memshape;
|
||||
hid_t diskshape;
|
||||
hid_t blockgroup;
|
||||
hid_t field_group_id;
|
||||
};
|
||||
|
||||
struct h5t_fdata_level {
|
||||
};
|
||||
|
||||
struct h5t_fdata {
|
||||
h5_id_t new_level; /* idx of the first new level or -1 */
|
||||
h5_id_t cur_level;
|
||||
h5_size_t num_levels;
|
||||
|
||||
h5_size_t *num_vertices;
|
||||
h5_size_t *num_tets;
|
||||
h5_size_t *num_tets_on_level;
|
||||
|
||||
h5_id_t last_stored_vertex_id;
|
||||
h5_vertex * vertices;
|
||||
|
||||
h5_id_t last_stored_tet_id;
|
||||
h5_tetrahedron * tets;
|
||||
|
||||
/* HDF5 objects */
|
||||
|
||||
hid_t topo_gid; /* grp id of mesh in current level */
|
||||
hid_t coord_gid;
|
||||
hid_t vmesh_gid;
|
||||
|
||||
/* type ids' for compound types */
|
||||
hid_t float64_3tuple_tid;
|
||||
hid_t int32_2tuple_tid;
|
||||
hid_t int32_3tuple_tid;
|
||||
hid_t int32_4tuple_tid;
|
||||
hid_t vertex_tid;
|
||||
hid_t tet_tid;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
\struct h5_file
|
||||
@@ -109,6 +209,7 @@ struct h5_file {
|
||||
h5_int64_t step_idx; /* step index */
|
||||
hid_t step_gid; /* HDF5 grp id of current step */
|
||||
|
||||
int is_new_step;
|
||||
|
||||
/*
|
||||
BEGIN unstructured stuff,
|
||||
@@ -143,57 +244,4 @@ struct h5_file {
|
||||
|
||||
typedef struct h5_file h5_file;
|
||||
|
||||
struct h5u_fdata {
|
||||
hsize_t nparticles; /* -> u.nparticles */
|
||||
|
||||
h5part_int64_t viewstart; /* -1 if no view is available: A "view" looks */
|
||||
h5part_int64_t viewend; /* at a subset of the data. */
|
||||
|
||||
/**
|
||||
the number of particles in each processor.
|
||||
With respect to the "VIEW", these numbers
|
||||
can be regarded as non-overlapping subsections
|
||||
of the particle array stored in the file.
|
||||
So they can be used to compute the offset of
|
||||
the view for each processor
|
||||
*/
|
||||
h5part_int64_t *pnparticles;
|
||||
|
||||
hid_t shape;
|
||||
hid_t diskshape;
|
||||
hid_t memshape;
|
||||
}
|
||||
|
||||
struct h5b_fdata {
|
||||
h5part_int64_t step_idx;
|
||||
h5part_int64_t i_max;
|
||||
h5part_int64_t j_max;
|
||||
h5part_int64_t k_max;
|
||||
struct H5BlockPartition *user_layout;
|
||||
struct H5BlockPartition *write_layout;
|
||||
int have_layout;
|
||||
|
||||
hid_t shape;
|
||||
hid_t memshape;
|
||||
hid_t diskshape;
|
||||
hid_t blockgroup;
|
||||
hid_t field_group_id;
|
||||
};
|
||||
|
||||
struct h5t_fdata_level {
|
||||
int new_level;
|
||||
h5_id_t last_stored_vertex;
|
||||
h5_size_t num_vertices;
|
||||
h5_vertex * vertices;
|
||||
h5_id_t last_stored_tet;
|
||||
h5_size_t num_tets;
|
||||
h5_tetrahedron * tets;
|
||||
};
|
||||
|
||||
struct h5t_fdata {
|
||||
h5_id_t cur_level;
|
||||
h5_size_t num_levels;
|
||||
hid_t mesh_gid;
|
||||
struct h5t_fdata_level levels[];
|
||||
};
|
||||
#endif
|
||||
|
||||
+21
-46
@@ -12,7 +12,6 @@
|
||||
#include "H5Part.h"
|
||||
#include "H5Block.h"
|
||||
#include "H5PartPrivate.h"
|
||||
#include "H5BlockPrivate.h"
|
||||
#include "H5PartErrors.h"
|
||||
#include "H5BlockErrors.h"
|
||||
#include "H5.h"
|
||||
@@ -41,11 +40,11 @@ H5_check_filehandle (
|
||||
) {
|
||||
|
||||
if ( f == NULL )
|
||||
return HANDLE_H5PART_BADFD_ERR;
|
||||
return HANDLE_H5_BADFD_ERR;
|
||||
if ( f->file == 0 )
|
||||
return HANDLE_H5PART_BADFD_ERR;
|
||||
return HANDLE_H5_BADFD_ERR;
|
||||
if ( f->block == NULL )
|
||||
return HANDLE_H5PART_BADFD_ERR;
|
||||
return HANDLE_H5_BADFD_ERR;
|
||||
return H5PART_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -96,8 +95,7 @@ _h5u_open_file (
|
||||
f->pnparticles =
|
||||
(h5part_int64_t*) malloc (f->nprocs * sizeof (h5part_int64_t));
|
||||
if (f->pnparticles == NULL) {
|
||||
HANDLE_H5PART_NOMEM_ERR;
|
||||
goto error_cleanup;
|
||||
return HANDLE_H5_NOMEM_ERR;
|
||||
}
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
@@ -121,23 +119,23 @@ _h5b_open_file (
|
||||
herr = H5_check_filehandle ( f );
|
||||
if ( herr == H5_SUCCESS ) return H5_SUCCESS;
|
||||
|
||||
if ( (f == 0) || (f->file == 0) ) return HANDLE_H5PART_BADFD_ERR;
|
||||
if ( (f == 0) || (f->file == 0) ) return HANDLE_H5_BADFD_ERR;
|
||||
|
||||
f->block = (struct h5b_fdata*) malloc( sizeof (*f->block) );
|
||||
if ( f->block == NULL ) {
|
||||
return HANDLE_H5PART_NOMEM_ERR;
|
||||
return HANDLE_H5_NOMEM_ERR;
|
||||
}
|
||||
b = f->block;
|
||||
memset ( b, 0, sizeof (*b) );
|
||||
b->user_layout = (struct H5BlockPartition*) malloc (
|
||||
f->nprocs * sizeof (b->user_layout[0]) );
|
||||
if ( b->user_layout == NULL ) {
|
||||
return HANDLE_H5PART_NOMEM_ERR;
|
||||
return HANDLE_H5_NOMEM_ERR;
|
||||
}
|
||||
b->write_layout = (struct H5BlockPartition*) malloc (
|
||||
f->nprocs * sizeof (b->write_layout[0]) );
|
||||
if ( b->write_layout == NULL ) {
|
||||
return HANDLE_H5PART_NOMEM_ERR;
|
||||
return HANDLE_H5_NOMEM_ERR;
|
||||
}
|
||||
b->step_idx = -1;
|
||||
b->blockgroup = -1;
|
||||
@@ -161,7 +159,7 @@ H5_open_file (
|
||||
h5part_int64_t rc = H5PART_SUCCESS;
|
||||
|
||||
if ( _init() < 0 ) {
|
||||
HANDLE_H5PART_INIT_ERR;
|
||||
HANDLE_H5_INIT_ERR;
|
||||
return NULL;
|
||||
}
|
||||
_h5part_errno = H5PART_SUCCESS;
|
||||
@@ -169,14 +167,14 @@ H5_open_file (
|
||||
|
||||
f = (h5_file*) malloc( sizeof (h5_file) );
|
||||
if( f == NULL ) {
|
||||
HANDLE_H5PART_NOMEM_ERR;
|
||||
HANDLE_H5_NOMEM_ERR;
|
||||
goto error_cleanup;
|
||||
}
|
||||
memset (f, 0, sizeof (h5_file));
|
||||
|
||||
f->prefix_step_name = strdup ( H5PART_GROUPNAME_STEP );
|
||||
if( f->prefix_step_name == NULL ) {
|
||||
HANDLE_H5PART_NOMEM_ERR;
|
||||
HANDLE_H5_NOMEM_ERR;
|
||||
goto error_cleanup;
|
||||
}
|
||||
f->width_step_idx = 0;
|
||||
@@ -245,7 +243,7 @@ H5_open_file (
|
||||
f->access_prop);
|
||||
f->empty = 1;
|
||||
}
|
||||
else if ( flags == H5_O_APPEND || H5_O_RDWR ) {
|
||||
else if ( flags == H5_O_APPEND || H5_O_RDWR ) {
|
||||
int fd = open (filename, O_RDONLY, 0);
|
||||
if ( (fd == -1) && (errno == ENOENT) ) {
|
||||
f->file = H5Fcreate(filename, H5F_ACC_TRUNC,
|
||||
@@ -259,7 +257,7 @@ H5_open_file (
|
||||
}
|
||||
}
|
||||
else {
|
||||
HANDLE_H5PART_FILE_ACCESS_TYPE_ERR ( flags );
|
||||
HANDLE_H5_FILE_ACCESS_TYPE_ERR ( flags );
|
||||
goto error_cleanup;
|
||||
}
|
||||
|
||||
@@ -327,20 +325,21 @@ static h5part_int64_t
|
||||
_h5u_close_file (
|
||||
h5_file *f /*!< IN: file handle */
|
||||
) {
|
||||
herr_t herr;
|
||||
_h5part_errno = H5_SUCCESS;
|
||||
if( f->shape > 0 ) {
|
||||
r = H5Sclose( f->shape );
|
||||
if ( r < 0 ) HANDLE_H5S_CLOSE_ERR;
|
||||
herr = H5Sclose( f->shape );
|
||||
if ( herr < 0 ) HANDLE_H5S_CLOSE_ERR;
|
||||
f->shape = 0;
|
||||
}
|
||||
if( f->diskshape != H5S_ALL ) {
|
||||
r = H5Sclose( f->diskshape );
|
||||
if ( r < 0 ) HANDLE_H5S_CLOSE_ERR;
|
||||
herr = H5Sclose( f->diskshape );
|
||||
if ( herr < 0 ) HANDLE_H5S_CLOSE_ERR;
|
||||
f->diskshape = 0;
|
||||
}
|
||||
if( f->memshape != H5S_ALL ) {
|
||||
r = H5Sclose( f->memshape );
|
||||
if ( r < 0 ) HANDLE_H5S_CLOSE_ERR;
|
||||
herr = H5Sclose( f->memshape );
|
||||
if ( herr < 0 ) HANDLE_H5S_CLOSE_ERR;
|
||||
f->memshape = 0;
|
||||
}
|
||||
if( f->pnparticles ) {
|
||||
@@ -393,30 +392,6 @@ _h5b_close_file (
|
||||
return H5PART_SUCCESS;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_private
|
||||
|
||||
\internal
|
||||
|
||||
De-initialize topological internal structure. Open HDF5 objects are
|
||||
closed and allocated memory freed.
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
static h5part_int64_t
|
||||
_h5t_close_file (
|
||||
h5_file *fh /*!< IN: file handle */
|
||||
) {
|
||||
|
||||
h5_err_t herr = H5_SUCCESS;
|
||||
struct h5t_fdata *t = fh->t;
|
||||
|
||||
if ( t->levels ) {
|
||||
free ( levels );
|
||||
}
|
||||
return herr;
|
||||
}
|
||||
|
||||
h5part_int64_t
|
||||
H5_close_file (
|
||||
h5_file *f
|
||||
@@ -477,7 +452,7 @@ H5_define_stepname (
|
||||
) {
|
||||
f->prefix_step_name = strdup ( name );
|
||||
if( f->prefix_step_name == NULL ) {
|
||||
return HANDLE_H5PART_NOMEM_ERR;
|
||||
return HANDLE_H5_NOMEM_ERR;
|
||||
}
|
||||
f->width_step_idx = (int)width;
|
||||
|
||||
|
||||
+1
-10
@@ -5,8 +5,7 @@ h5_file*
|
||||
H5_open_file (
|
||||
const char *filename,
|
||||
unsigned flags,
|
||||
MPI_Comm comm,
|
||||
int f_parallel
|
||||
MPI_Comm comm
|
||||
);
|
||||
|
||||
h5part_int64_t
|
||||
@@ -14,14 +13,6 @@ H5_check_filehandle (
|
||||
const h5_file *f
|
||||
);
|
||||
|
||||
h5_file*
|
||||
H5_open_file (
|
||||
const char *filename,
|
||||
unsigned flags,
|
||||
MPI_Comm comm,
|
||||
int f_parallel
|
||||
);
|
||||
|
||||
h5part_int64_t
|
||||
H5_close_file (
|
||||
h5_file *f
|
||||
|
||||
+14
-13
@@ -11,7 +11,6 @@
|
||||
#include "H5Part.h"
|
||||
#include "H5Block.h"
|
||||
#include "H5PartPrivate.h"
|
||||
#include "H5BlockPrivate.h"
|
||||
#include "H5PartErrors.h"
|
||||
#include "H5BlockErrors.h"
|
||||
#include "H5.h"
|
||||
@@ -180,7 +179,7 @@ H5_get_object_name (
|
||||
&data );
|
||||
if ( herr < 0 ) return (h5part_int64_t)herr;
|
||||
|
||||
if ( herr == 0 ) HANDLE_H5PART_NOENTRY_ERR( group_name,
|
||||
if ( herr == 0 ) HANDLE_H5_NOENTRY_ERR( group_name,
|
||||
type, idx );
|
||||
|
||||
return H5PART_SUCCESS;
|
||||
@@ -210,7 +209,7 @@ _open_step (
|
||||
H5_print_info (
|
||||
"Proc[%d]: Open step #%lld for file %lld",
|
||||
f->myproc,
|
||||
(long long)step,
|
||||
(long long)f->step_idx,
|
||||
(long long)(size_t) f );
|
||||
f->is_new_step = 0;
|
||||
f->step_gid = H5Gopen ( f->file, f->step_name );
|
||||
@@ -222,14 +221,16 @@ _open_step (
|
||||
|
||||
static h5_err_t
|
||||
_init_step (
|
||||
h5_file * f
|
||||
) {
|
||||
h5_err_t h5err = _h5t_init_step ( f );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
_close_step (
|
||||
h5_err_t
|
||||
_h5_close_step (
|
||||
h5_file * f
|
||||
) {
|
||||
|
||||
@@ -265,7 +266,7 @@ _set_step (
|
||||
herr = _open_step ( f );
|
||||
if ( herr < 0 ) return herr;
|
||||
} else if ( (f->mode == H5_O_WRONLY) || (f->mode == H5_O_APPEND) ) {
|
||||
if ( herr > 0 ) return HANDLE_H5PART_STEP_EXISTS_ERR ( step );
|
||||
if ( herr > 0 ) return HANDLE_H5_STEP_EXISTS_ERR ( step_idx );
|
||||
herr = _create_step ( f );
|
||||
if ( herr < 0 ) return herr;
|
||||
} else if ( (f->mode == H5_O_RDWR) && (herr < 0) ) {
|
||||
@@ -278,20 +279,20 @@ _set_step (
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
h5p_int64_t
|
||||
h5_int64_t
|
||||
H5_set_step (
|
||||
h5_file *f, /*!< [in] Handle to open file */
|
||||
const h5_int64_t step_idx /*!< [in] Step to set. */
|
||||
) {
|
||||
|
||||
herr = _close_step ( f );
|
||||
if ( herr < 0 ) return herr;
|
||||
h5_err_t h5err = _h5_close_step ( f );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
|
||||
herr = _set_step ( f );
|
||||
if ( herr < 0 ) return herr;
|
||||
h5err = _set_step ( f, step_idx );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
|
||||
herr = _init_step ( f );
|
||||
if ( herr < 0 ) return herr;
|
||||
h5err = _init_step ( f );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
+53
-11
@@ -12,10 +12,10 @@
|
||||
#include "H5Part.h"
|
||||
#include "H5Block.h"
|
||||
#include "H5PartPrivate.h"
|
||||
#include "H5BlockPrivate.h"
|
||||
#include "H5PartErrors.h"
|
||||
#include "H5BlockErrors.h"
|
||||
#include "H5.h"
|
||||
#include "h5/h5_types.h"
|
||||
|
||||
extern h5part_error_handler _err_handler;
|
||||
extern h5part_int64_t _h5part_errno;
|
||||
@@ -26,7 +26,9 @@ static h5_err_t
|
||||
_create_array_types (
|
||||
h5_file * f
|
||||
) {
|
||||
struct h5t_fdata *t = &f->t;
|
||||
hsize_t dims[1] = { 3 };
|
||||
|
||||
t->float64_3tuple_tid = H5Tarray_create ( H5T_NATIVE_DOUBLE, 1, dims,NULL);
|
||||
dims[0] = 2;
|
||||
t->int32_2tuple_tid = H5Tarray_create ( H5T_NATIVE_INT32, 1, dims, NULL );
|
||||
@@ -42,6 +44,8 @@ static h5_err_t
|
||||
_create_vertex_type (
|
||||
h5_file * f
|
||||
) {
|
||||
struct h5t_fdata *t = &f->t;
|
||||
|
||||
t->vertex_tid = H5Tcreate ( H5T_COMPOUND, sizeof(struct h5_vertex) );
|
||||
H5Tinsert (
|
||||
t->vertex_tid,
|
||||
@@ -65,31 +69,35 @@ static h5_err_t
|
||||
_create_tet_type (
|
||||
h5_file * f
|
||||
) {
|
||||
struct h5t_fdata *t = &f->t;
|
||||
|
||||
t->tet_tid = H5Tcreate ( H5T_COMPOUND, sizeof(struct h5_tetrahedron) );
|
||||
H5Tinsert (
|
||||
t->tet_tid,
|
||||
"id",
|
||||
HOFFSET(struct h5_tet, id),
|
||||
HOFFSET(struct h5_tetrahedron, id),
|
||||
H5T_NATIVE_INT32 );
|
||||
H5Tinsert (
|
||||
t->tet_tid,
|
||||
"parent_id",
|
||||
HOFFSET(struct h5_tet, parent_id),
|
||||
HOFFSET(struct h5_tetrahedron, parent_id),
|
||||
H5T_NATIVE_INT32 );
|
||||
H5Tinsert (
|
||||
t->tet_tid,
|
||||
"vertex_ids",
|
||||
HOFFSET(struct h5_tet, vertex_ids),
|
||||
HOFFSET(struct h5_tetrahedron, vertex_ids),
|
||||
t->int32_4tuple_tid );
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_private
|
||||
|
||||
\internal
|
||||
|
||||
Initialize H5Block internal structure.
|
||||
Initialize topo internal structure. The structure has already be initialized
|
||||
with zero's.
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
@@ -98,15 +106,49 @@ _h5t_open_file (
|
||||
h5_file * f /*!< IN: file handle */
|
||||
) {
|
||||
h5_err_t h5err = H5_SUCCESS;;
|
||||
struct h5t_fdata * t = &fh->t;
|
||||
struct h5t_fdata * t = &f->t;
|
||||
|
||||
t->num_levels = -1;
|
||||
levels = NULL;
|
||||
|
||||
if (h5err = _create_array_types ( f )) < 0 ) return herr;
|
||||
if (h5err = _create_vertex_type ( f )) < 0 ) return herr;
|
||||
if (h5err = _create_tet_type ( f )) < 0 ) return herr;
|
||||
|
||||
if (( h5err = _create_array_types ( f )) < 0 ) return h5err;
|
||||
if (( h5err = _create_vertex_type ( f )) < 0 ) return h5err;
|
||||
if (( h5err = _create_tet_type ( f )) < 0 ) return h5err;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/*!
|
||||
\ingroup h5_private
|
||||
|
||||
\internal
|
||||
|
||||
De-initialize topological internal structure. Open HDF5 objects are
|
||||
closed and allocated memory freed.
|
||||
|
||||
\return H5_SUCCESS or error code
|
||||
*/
|
||||
static h5part_int64_t
|
||||
_h5t_close_file (
|
||||
h5_file *fh /*!< IN: file handle */
|
||||
) {
|
||||
|
||||
h5_err_t herr = H5_SUCCESS;
|
||||
struct h5t_fdata *t = &fh->t;
|
||||
|
||||
if ( t->num_vertices ) {
|
||||
free ( t->num_vertices );
|
||||
}
|
||||
if ( t->num_tets ) {
|
||||
free ( t->num_tets );
|
||||
}
|
||||
if ( t->num_tets_on_level ) {
|
||||
free ( t->num_tets_on_level );
|
||||
}
|
||||
if ( t->vertices ) {
|
||||
free ( t->vertices );
|
||||
}
|
||||
if ( t->tets ) {
|
||||
free ( t->tets );
|
||||
}
|
||||
return herr;
|
||||
}
|
||||
|
||||
+124
-44
@@ -11,7 +11,6 @@
|
||||
#include "H5Part.h"
|
||||
#include "H5Block.h"
|
||||
#include "H5PartPrivate.h"
|
||||
#include "H5BlockPrivate.h"
|
||||
#include "H5PartErrors.h"
|
||||
#include "H5BlockErrors.h"
|
||||
#include "H5.h"
|
||||
@@ -23,27 +22,105 @@ h5_err_t
|
||||
_h5t_init_step (
|
||||
h5_file * f
|
||||
) {
|
||||
memset ( f->t, 0, sizeof(f->t) );
|
||||
memset ( &f->t, 0, sizeof(f->t) );
|
||||
|
||||
f->t.mesh_gid = -1;
|
||||
f->t.topo_gid = -1;
|
||||
f->t.num_levels = f->is_new_step ? 0 : -1;
|
||||
f->t.cur_level = -1;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
static hid_t
|
||||
_open_group (
|
||||
h5_file * f,
|
||||
hid_t parent_gid,
|
||||
const char * const grpname
|
||||
) {
|
||||
hid_t gid;
|
||||
herr_t herr = H5Gget_objinfo(
|
||||
parent_gid, grpname, 1, NULL );
|
||||
if ( herr >= 0 ) {
|
||||
gid = H5Gopen ( parent_gid, grpname );
|
||||
} else {
|
||||
gid = H5Gcreate ( parent_gid, grpname, 0 );
|
||||
}
|
||||
if ( gid < 0 )
|
||||
return HANDLE_H5G_OPEN_ERR ( H5T_CONTAINER_GRPNAME );
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
_open_topo_group (
|
||||
h5_file * f
|
||||
) {
|
||||
herr_t herr = H5Gget_objinfo( f->step_gid, "Topo", 1, NULL );
|
||||
if ( herr => 0 ) {
|
||||
f->t.mesh_gid = H5Gopen ( f->step_gid, "Topo" );
|
||||
} else {
|
||||
f->t.mesh_gid = H5Gcreate ( f->step_gid, "Topo", 0 );
|
||||
return _open_group ( f, f->step_gid, H5T_CONTAINER_GRPNAME );
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
_open_coord_group (
|
||||
h5_file * f
|
||||
) {
|
||||
if ( f->t.topo_gid < 0 ) {
|
||||
h5_err_t h5err = _open_topo_group ( f );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
}
|
||||
if ( f->t.mesh_gid < 0 )
|
||||
return HANDLE_H5G_OPEN_ERR ( "Topo" );
|
||||
return _open_group ( f, f->t.topo_gid, H5T_COORD_GRPNAME );
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
_open_vmesh_group (
|
||||
h5_file * f
|
||||
) {
|
||||
if ( f->t.topo_gid < 0 ) {
|
||||
h5_err_t h5err = _open_topo_group ( f );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
}
|
||||
return _open_group ( f, f->t.topo_gid, H5T_VMESH_GRPNAME );
|
||||
}
|
||||
|
||||
static h5_err_t
|
||||
_write_obj (
|
||||
const hid_t gid,
|
||||
const hsize_t current_dims,
|
||||
const hsize_t max_dims,
|
||||
const hid_t tid,
|
||||
const void * const object,
|
||||
const char * const dsname
|
||||
) {
|
||||
hsize_t dims[1] = { current_dims };
|
||||
hsize_t maxdims[1] = { max_dims };
|
||||
|
||||
hid_t sid = H5Screate_simple (
|
||||
1,
|
||||
dims,
|
||||
maxdims
|
||||
);
|
||||
if ( sid < 0 ) return -1;
|
||||
|
||||
hid_t did = H5Dcreate (
|
||||
gid,
|
||||
dsname,
|
||||
tid,
|
||||
sid,
|
||||
H5P_DEFAULT);
|
||||
if ( did < 0 ) return -1;
|
||||
|
||||
herr_t herr = H5Dwrite (
|
||||
did,
|
||||
tid,
|
||||
H5S_ALL, H5S_ALL, H5P_DEFAULT,
|
||||
object );
|
||||
if ( herr < 0 ) return -1;
|
||||
|
||||
herr = H5Dclose ( did );
|
||||
if ( herr < 0 ) return -1;
|
||||
|
||||
herr = H5Sclose ( sid );
|
||||
if ( herr < 0 ) return -1;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -54,41 +131,23 @@ static h5_err_t
|
||||
_write_vertices (
|
||||
h5_file * f
|
||||
) {
|
||||
h5t_fdata t &f->t;
|
||||
herr_t herr;
|
||||
struct h5t_fdata *t = &f->t;
|
||||
h5_err_t h5err;
|
||||
|
||||
if ( t->coord3d_gid < 0 ) {
|
||||
h5err = _open_coord3d_group ( f );
|
||||
if ( t->coord_gid < 0 ) {
|
||||
h5err = _open_coord_group ( f );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
}
|
||||
|
||||
if ( t->num_levels == 0 ) return 0;
|
||||
if ( t->num_levels < 0 ) return -1;
|
||||
|
||||
hsize_t current_dims[1];
|
||||
current_dims[0] = t->levels[t->num_levels-1].num_vertices;
|
||||
|
||||
t->coord3d_sid = H5Screate_simple (
|
||||
1,
|
||||
current_dims,
|
||||
H5S_UNLIMITED
|
||||
hsize_t maxdim = H5S_UNLIMITED;
|
||||
h5err = _write_obj (
|
||||
t->coord_gid,
|
||||
t->vertex_tid,
|
||||
t->num_vertices[t->num_levels-1],
|
||||
maxdim,
|
||||
(void*)t->vertices,
|
||||
H5T_COORD3D_DSNAME
|
||||
);
|
||||
if ( t->coord3d_sid < 0 ) return -1;
|
||||
|
||||
t->coord3d_did = H5Dcreate (
|
||||
coord3d_gid,
|
||||
"COORD3D",
|
||||
t->vertex_tid,
|
||||
t->coord3d_sid,
|
||||
H5P_DEFAULT);
|
||||
if ( t->coord3d_did < 0 ) return -1;
|
||||
|
||||
herr = H5Dwrite (
|
||||
coord3d,
|
||||
t->vertex_tid,
|
||||
H5S_ALL, H5S_ALL, H5P_DEFAULT,
|
||||
t->vertices );
|
||||
if ( herr < 0 ) return -1;
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
@@ -97,9 +156,26 @@ static h5_err_t
|
||||
_write_tets (
|
||||
h5_file * f
|
||||
) {
|
||||
return -1;
|
||||
}
|
||||
struct h5t_fdata *t = &f->t;
|
||||
h5_err_t h5err;
|
||||
|
||||
if ( t->vmesh_gid < 0 ) {
|
||||
h5err = _open_vmesh_group ( f );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
}
|
||||
|
||||
hsize_t maxdim = H5S_UNLIMITED;
|
||||
herr_t herr = _write_obj (
|
||||
t->vmesh_gid,
|
||||
t->tet_tid,
|
||||
t->num_tets[t->num_levels-1],
|
||||
maxdim,
|
||||
(void*)t->tets,
|
||||
H5T_TETMESH_DSNAME
|
||||
);
|
||||
|
||||
return H5_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
determine new levels
|
||||
@@ -114,6 +190,10 @@ _write_data (
|
||||
) {
|
||||
struct h5t_fdata *t = &f->t;
|
||||
h5_err_t h5err;
|
||||
|
||||
if ( t->num_levels == 0 ) return 0;
|
||||
if ( t->num_levels < 0 ) return -1;
|
||||
|
||||
if ( t->topo_gid < 0 ) {
|
||||
h5err = _open_topo_group ( f );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
@@ -156,10 +236,10 @@ _h5t_close_step (
|
||||
h5_err_t h5err = _write_data ( f );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
|
||||
h5_err_t h5err = _close_hdf5_objs ( f );
|
||||
h5err = _close_hdf5_objs ( f );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
|
||||
h5_err_t h5err = _release_memory ( f );
|
||||
h5err = _release_memory ( f );
|
||||
if ( h5err < 0 ) return h5err;
|
||||
|
||||
return H5_SUCCESS;
|
||||
|
||||
@@ -403,7 +403,7 @@ H5U_set_view (
|
||||
end==-1 to mean end of file
|
||||
*/
|
||||
total = (hsize_t) H5U_get_num_elems ( f );
|
||||
if ( total < 0 ) return HANDLE_H5PART_GET_NUM_PARTICLES_ERR ( total );
|
||||
if ( total < 0 ) return HANDLE_H5_GET_NUM_PARTICLES_ERR ( total );
|
||||
|
||||
if ( start == -1 ) start = 0;
|
||||
if ( end == -1 ) end = total;
|
||||
@@ -471,7 +471,7 @@ H5U_get_view (
|
||||
else {
|
||||
viewend = H5U_get_num_elems ( f );
|
||||
if ( viewend < 0 )
|
||||
return HANDLE_H5PART_GET_NUM_PARTICLES_ERR ( viewend );
|
||||
return HANDLE_H5_GET_NUM_PARTICLES_ERR ( viewend );
|
||||
}
|
||||
|
||||
if ( start ) *start = viewstart;
|
||||
@@ -485,7 +485,7 @@ H5U_set_canonical_view (
|
||||
h5_file *f
|
||||
) {
|
||||
h5part_int64_t herr = H5U_reset_view ( f );
|
||||
if ( herr < 0 ) return HANDLE_H5PART_SET_VIEW_ERR( herr, -1, -1 );
|
||||
if ( herr < 0 ) return HANDLE_H5_SET_VIEW_ERR( herr, -1, -1 );
|
||||
|
||||
#ifdef PARALLEL_IO
|
||||
h5part_int64_t start = 0;
|
||||
@@ -494,7 +494,7 @@ H5U_set_canonical_view (
|
||||
int i = 0;
|
||||
|
||||
n = H5U_get_num_elems ( f );
|
||||
if ( n < 0 ) return HANDLE_H5PART_GET_NUM_PARTICLES_ERR ( n );
|
||||
if ( n < 0 ) return HANDLE_H5_GET_NUM_PARTICLES_ERR ( n );
|
||||
/*
|
||||
now lets query the attributes for this group to see if there
|
||||
is a 'pnparticles' group that contains the offsets for the
|
||||
@@ -518,7 +518,7 @@ H5U_set_canonical_view (
|
||||
}
|
||||
end = start + f->pnparticles[f->myproc] - 1;
|
||||
herr = H5U_set_view ( f, start, end );
|
||||
if ( herr < 0 ) return HANDLE_H5PART_SET_VIEW_ERR ( herr, start, end );
|
||||
if ( herr < 0 ) return HANDLE_H5_SET_VIEW_ERR ( herr, start, end );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ _write_data (
|
||||
h5part_int64_t j_dims = layout->j_end - layout->j_start + 1;
|
||||
h5part_int64_t k_dims = layout->k_end - layout->k_start + 1;
|
||||
|
||||
printf ( "Writing Step #%lld\n", (long long)f->timestep );
|
||||
printf ( "Writing Step #%lld\n", (long long)f->step_idx );
|
||||
|
||||
data = malloc ( i_dims * j_dims * k_dims * sizeof ( *data ) );
|
||||
for ( i = 0; i < i_dims; i++ ) {
|
||||
@@ -168,7 +168,7 @@ _read_data (
|
||||
h5part_int64_t j_dims = layout->j_end - layout->j_start + 1;
|
||||
h5part_int64_t k_dims = layout->k_end - layout->k_start + 1;
|
||||
|
||||
printf ( "Reading Step #%lld\n", (long long)f->timestep );
|
||||
printf ( "Reading Step #%lld\n", (long long)f->step_idx );
|
||||
|
||||
data = malloc ( i_dims * j_dims * k_dims * sizeof ( *data ) );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user