From 90b075b911d45f911015676d821290d988c8d777 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 16 Apr 2009 15:22:00 +0000 Subject: [PATCH] --- src/H5.c | 5 +--- src/H5.h | 5 +++- src/H5Block.c | 6 +++-- src/H5Fed.h | 5 ---- src/H5Fed_store.c | 52 ++++++++++++++++++++++++++++++------------ src/H5Fed_store.h | 42 +++++++++++++++++++++++----------- src/H5Part.c | 58 +---------------------------------------------- src/H5Part.h | 20 ++++------------ src/H5_inquiry.c | 56 ++++++++++++++++++++++++++++++--------------- src/Makefile.am | 7 ++++-- 10 files changed, 124 insertions(+), 132 deletions(-) diff --git a/src/H5.c b/src/H5.c index 03383b9..c2e822b 100644 --- a/src/H5.c +++ b/src/H5.c @@ -36,11 +36,11 @@ \defgroup h5_c_api_general */ - #include #include #include "h5_core/h5_core.h" #include "h5_core/h5_core_private.h" +#include "H5.h" /****** General routines *****************************************************/ @@ -52,9 +52,6 @@ \return File handle. \return NULL on error. - - \note - File is always opened in read/writer mode! */ h5_file_t * H5OpenFile ( diff --git a/src/H5.h b/src/H5.h index e33b220..123be85 100644 --- a/src/H5.h +++ b/src/H5.h @@ -16,15 +16,18 @@ #ifndef __H5_H #define __H5_H +#include "H5_inquiry.h" + h5_file_t * H5OpenFile ( const char * filename, + const h5_int32_t oflag, const MPI_Comm comm ); h5_err_t H5CloseFile ( - h5_file_t * fh + h5_file_t * f ); h5_err_t diff --git a/src/H5Block.c b/src/H5Block.c index b0900fa..af57be6 100644 --- a/src/H5Block.c +++ b/src/H5Block.c @@ -107,11 +107,12 @@ _normalize_partition ( \return H5_SUCCESS or error code */ #ifdef PARALLEL_IO +jfsdjk fjksdhf jkdsfjksdhfjkds kjf static h5_err_t _allgather ( - const h5_file *f /*!< IN: file handle */ + h5_file_t * const f /*!< IN: file handle */ ) { - struct h5b_partition *partition = &f->block->user_layout[f->myproc]; + struct h5b_partition *partition = &f->b->user_layout[f->myproc]; struct h5b_partition *layout = f->b->user_layout; MPI_Datatype partition_m; @@ -122,6 +123,7 @@ _allgather ( mpi_err = MPI_Type_commit ( &partition_m ); if ( mpi_err != MPI_SUCCESS ) return H5_ERR_MPI; TRY ( _h5_mpi_allgather ( + f, partition, 1, partition_m, diff --git a/src/H5Fed.h b/src/H5Fed.h index ce9a902..b47f122 100644 --- a/src/H5Fed.h +++ b/src/H5Fed.h @@ -55,11 +55,6 @@ H5FedGetLevel ( h5_file_t * f ); -h5_size_t -H5GetNumNodes ( - h5_file_t * f - ); - h5_size_t H5FedGetNumVertices ( h5_file_t * f diff --git a/src/H5Fed_store.c b/src/H5Fed_store.c index 537e385..c1397f5 100644 --- a/src/H5Fed_store.c +++ b/src/H5Fed_store.c @@ -57,24 +57,14 @@ H5FedAddLevel ( } h5_err_t -H5FedAddNumVertices ( - h5_file_t * f, +H5FedBeginStoreVertices ( + h5_file_t * const f, const h5_size_t num ) { SET_FNAME ( f, __func__ ); - return h5t_add_num_vertices ( f, num ); + return h5t_begin_store_vertices ( f, num ); } -h5_err_t -H5FedAddNumElements ( - h5_file_t * f, - const h5_size_t num - ) { - SET_FNAME ( f, __func__ ); - return h5t_add_num_elems ( f, num ); -} - - /*! \ingroup h5fed_c_api @@ -101,6 +91,22 @@ H5FedStoreVertex ( return h5t_store_vertex ( f, vertex_id, P ); } +h5_err_t +H5FedEndStoreVertices ( + h5_file_t * const f + ) { + return h5t_end_store_vertices ( f ); +} + +h5_err_t +H5FedBeginStoreElements ( + h5_file_t * f, + const h5_size_t num + ) { + SET_FNAME ( f, __func__ ); + return h5t_begin_store_elems ( f, num ); +} + /*! \ingroup h5fed_c_api @@ -131,12 +137,20 @@ H5FedStoreElement ( } h5_err_t -H5FedRefineNumElements ( +H5FedEndStoreElements ( + h5_file_t * const f + ) { + SET_FNAME ( f, __func__ ); + return h5t_end_store_elems ( f ); +} + +h5_err_t +H5FedBeginRefineElements ( h5_file_t * const f, const h5_size_t num ) { SET_FNAME ( f, __func__ ); - return h5t_refine_num_elems ( f, num ); + return h5t_begin_refine_elems ( f, num ); } h5_id_t @@ -147,3 +161,11 @@ H5FedRefineElement ( SET_FNAME ( f, __func__ ); return h5t_refine_elem ( f, local_eid ); } + +h5_err_t +H5FedEndRefineElements ( + h5_file_t * const f + ) { + SET_FNAME ( f, __func__ ); + return H5_SUCCESS; +} diff --git a/src/H5Fed_store.h b/src/H5Fed_store.h index 5a4f525..1db6248 100644 --- a/src/H5Fed_store.h +++ b/src/H5Fed_store.h @@ -27,37 +27,48 @@ H5FedAddMesh ( h5_id_t H5FedAddLevel ( - h5_file_t * f + h5_file_t * const f ); h5_err_t -H5FedAddNumVertices ( - h5_file_t * f, - const h5_size_t num - ); - -h5_err_t -H5FedAddNumElements ( - h5_file_t * f, +H5FedBeginStoreVertices ( + h5_file_t * const f, const h5_size_t num ); h5_id_t H5FedStoreVertex ( - h5_file_t * f, + h5_file_t * const f, const h5_id_t id, const h5_float64_t P[3] ); +h5_err_t +H5FedEndStoreVertices ( + h5_file_t * const f + ); + +h5_err_t +H5FedBeginStoreElements ( + h5_file_t * const f, + const h5_size_t num + ); + + h5_id_t H5FedStoreElement ( - h5_file_t * f, + h5_file_t * const f, const h5_id_t local_vids[] ); h5_err_t -H5FedRefineNumElements ( - h5_file_t * f, +H5FedEndStoreElements ( + h5_file_t * const f + ); + +h5_err_t +H5FedBeginRefineElements ( + h5_file_t * const f, const h5_size_t num ); @@ -67,4 +78,9 @@ H5FedRefineElement ( const h5_id_t local_eid ); +h5_err_t +H5FedEndRefineElements ( + h5_file_t * const f + ); + #endif diff --git a/src/H5Part.c b/src/H5Part.c index 1de24a7..d9160e8 100644 --- a/src/H5Part.c +++ b/src/H5Part.c @@ -613,59 +613,6 @@ H5PartSetStep ( /********************** query file structure *********************************/ - -/*! - \ingroup h5part_c_api_read - - Query whether a particular step already exists in the file - \c f. - - It works for both reading and writing of files - - \return true or false -*/ -h5_int64_t -H5PartHasStep ( - h5_file_t *f, /*!< [in] Handle to open file */ - h5_int64_t step /*!< [in] Step number to query */ - ) { - - SET_FNAME ( f, __func__ ); - - if ( h5_check_filehandle ( f ) != H5_SUCCESS ) - return h5_get_errno ( f ); - - return h5_has_step( f, step ); -} - -/*! - \ingroup h5part_c_api_read - - Get the number of time-steps that are currently stored in the file - \c f. - - It works for both reading and writing of files, but is probably - only typically used when you are reading. - - \return number of time-steps or error code -*/ -h5_int64_t -H5PartGetNumSteps ( - h5_file_t *f /*!< [in] Handle to open file */ - ) { - - SET_FNAME ( f, __func__ ); - - if ( h5_check_filehandle ( f ) != H5_SUCCESS ) - return h5_get_errno ( f ); - - return hdf5_get_num_objects_matching_pattern ( - f->file, - "/", - H5G_UNKNOWN, - f->prefix_step_name ); -} - /*! \ingroup h5part_c_api_read @@ -680,9 +627,7 @@ H5PartGetNumDatasets ( ) { SET_FNAME ( f, __func__ ); - - if ( h5_check_filehandle ( f ) != H5_SUCCESS ) - return h5_get_errno ( f ); + CHECK_FILEHANDLE ( f ); return hdf5_get_num_objects ( f->file, f->step_name, H5G_DATASET ); } @@ -960,7 +905,6 @@ H5PartReadDataInt64 ( ) { SET_FNAME ( f, __func__ ); - CHECK_FILEHANDLE( f ); return h5u_read_elems ( f, name, array, H5T_NATIVE_INT64 ); diff --git a/src/H5Part.h b/src/H5Part.h index be19f92..50f5232 100644 --- a/src/H5Part.h +++ b/src/H5Part.h @@ -19,16 +19,17 @@ #define __H5Part_H #include + +#ifdef __cplusplus +extern "C" { +#endif + #include "h5_core/h5_core.h" #include "H5.h" #ifdef PARALLEL_IO #include #endif -#ifdef __cplusplus -extern "C" { -#endif - // #define H5PART_SUCCESS H5_SUCCESS #define H5PART_ERR_NOMEM H5_ERR_NOMEM #define H5PART_ERR_INVAL H5_ERR_INVAL @@ -108,17 +109,6 @@ H5PartSetStep ( const h5_int64_t step ); -h5_int64_t -H5PartHasStep ( - h5_file_t *f, - const h5_int64_t step - ); - -h5_int64_t -H5PartGetNumSteps ( - h5_file_t *f - ); - h5_int64_t H5PartGetNumDatasets ( h5_file_t *f diff --git a/src/H5_inquiry.c b/src/H5_inquiry.c index 9fd102d..360213a 100644 --- a/src/H5_inquiry.c +++ b/src/H5_inquiry.c @@ -19,39 +19,55 @@ #include #include -#include "h5/h5.h" -#include "h5/h5_private.h" -#include "H5Fed.h" +#include "h5_core/h5_core.h" +#include "h5_core/h5_core_private.h" +#include "H5.h" /*! \ingroup h5_inquiry Get the number of compute nodes. + \param[in] f File handle. + \return Number of compute notes. \return \c -1 on error. */ h5_size_t H5GetNumNodes ( - h5_file_t * f /*!< file handle */ + h5_file_t * const f ) { - SET_FNAME ( __func__ ); - return (h5_size_t)fh->nprocs; + SET_FNAME ( f, __func__ ); + CHECK_FILEHANDLE ( f ); + return (h5_size_t)f->nprocs; } -/*` - \ingroup h5_inquiry +/*! + \ingroup h5part_c_api_read - Get the number of steps that are currently stored in the file. + Get the number of time-steps that are currently stored in the file + \c f. - \return number of steps or error code + It works for both reading and writing of files, but is probably + only typically used when you are reading. + + \param[in] f File handle. + + \return number of time-steps or error code */ -h5_id_t +h5_size_t H5GetNumSteps ( - h5_file_t * fh /*!< file handle */ + h5_file_t * const f ) { - SET_FNAME ( __func__ ); - return h5_get_num_steps( fh ); + + SET_FNAME ( f, __func__ ); + CHECK_FILEHANDLE ( f ); + + return hdf5_get_num_objects_matching_pattern ( + f->file, + "/", + H5G_UNKNOWN, + f->prefix_step_name ); } /*! @@ -59,17 +75,21 @@ H5GetNumSteps ( Query whether a particular step already exists in the file. + \param[in] f File handle. + \param[in] stepno Step number to query for existence + \return true or false */ h5_err_t H5HasStep ( - h5_file_t *f, /*!< [in] Handle to open file */ - h5part_int64_t step /*!< [in] Step number to query */ + h5_file_t *f, + h5_id_t stepno ) { - SET_FNAME ( __func__ ); + SET_FNAME ( f, __func__ ); + CHECK_FILEHANDLE ( f ); - return h5_has_step( f, step ); + return h5_has_step( f, stepno ); } diff --git a/src/Makefile.am b/src/Makefile.am index 1fd2b4d..3016957 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -43,11 +43,13 @@ EXTRA_LIBRARIES = libH5.a # Header files that I wish to install in $(prefix)/include include_HEADERS = \ - H5Part.h \ + H5.h \ H5Block.h \ H5Fed.h \ H5Fed_boundaries.h \ - H5Fed_map.h + H5Fed_map.h \ + H5Fed_store.h \ + H5Part.h # Listing of all possible headers that I may include EXTRA_HEADERS = @@ -55,6 +57,7 @@ EXTRA_HEADERS = # Listing of sources libH5_a_SOURCES = \ H5.c \ + H5_inquiry.c \ H5Block.c \ H5Fed.c \ H5Fed_adjacency.c \