diff --git a/src/Fortran/H5.c b/src/Fortran/H5.c index 575cf92..3a240e4 100644 --- a/src/Fortran/H5.c +++ b/src/Fortran/H5.c @@ -233,7 +233,7 @@ h5_finalize ( void ) { H5_API_ENTER (h5_int64_t, "%s", ""); - H5_API_RETURN (h5_close_hdf5()); + H5_API_RETURN (h5_close_h5hut ()); } diff --git a/src/h5core/h5_file.c b/src/h5core/h5_file.c index 5e54590..2160111 100644 --- a/src/h5core/h5_file.c +++ b/src/h5core/h5_file.c @@ -613,12 +613,13 @@ h5_close_file ( } h5_err_t -h5_close_hdf5 ( +h5_close_h5hut ( void ) { H5_CORE_API_ENTER (h5_err_t, "%s", ""); - TRY (ret_value = hdf5_close ()); - H5_RETURN (ret_value); + TRY (h5priv_finalize ()); + TRY (hdf5_close ()); + H5_RETURN (H5_SUCCESS); } h5_err_t diff --git a/src/h5core/private/h5_init.c b/src/h5core/private/h5_init.c index b83f055..a7d8386 100644 --- a/src/h5core/private/h5_init.c +++ b/src/h5core/private/h5_init.c @@ -69,6 +69,19 @@ create_array_types ( H5_RETURN (H5_SUCCESS); } +static inline h5_err_t +close_array_types ( + void + ) { + H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); + TRY (hdf5_close_type (h5_dta_types.h5_coord3d_t)); + TRY (hdf5_close_type (h5_dta_types.h5_3glb_idx_t)); + TRY (hdf5_close_type (h5_dta_types.h5_4glb_idx_t)); + TRY (hdf5_close_type (h5_dta_types.h5_4chk_idx_t)); + TRY (hdf5_close_type (h5_dta_types.h5_coord6d_t)); + H5_RETURN (H5_SUCCESS); +} + static inline h5_err_t create_vertex_type ( void @@ -95,6 +108,16 @@ create_vertex_type ( H5_RETURN (H5_SUCCESS); } +static inline h5_err_t +close_vertex_type ( + void + ) { + H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); + TRY (hdf5_close_type (h5_dta_types.h5_vertex_t)); + H5_RETURN (H5_SUCCESS); +} + + static inline h5_err_t create_triangle_type ( void @@ -158,7 +181,16 @@ create_triangle_type ( } static inline h5_err_t -create_tag_types ( +close_triangle_type ( + void + ) { + H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); + TRY (hdf5_close_type (h5_dta_types.h5_triangle_t)); + H5_RETURN (H5_SUCCESS); +} + +static inline h5_err_t +create_tag_type ( void ) { H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); @@ -183,6 +215,15 @@ create_tag_types ( H5_RETURN (H5_SUCCESS); } +static inline h5_err_t +close_tag_type ( + void + ) { + H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); + TRY (hdf5_close_type (h5_dta_types.h5t_glb_tag_idx_t)); + H5_RETURN (H5_SUCCESS); +} + static inline h5_err_t create_tet_type ( void @@ -245,6 +286,15 @@ create_tet_type ( H5_RETURN (H5_SUCCESS); } +static inline h5_err_t +close_tet_type ( + void + ) { + H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); + TRY (hdf5_close_type (h5_dta_types.h5_tet_t)); + H5_RETURN (H5_SUCCESS); +} + #if defined(WITH_PARALLEL_H5GRID) static inline h5_err_t @@ -301,6 +351,16 @@ create_chunk_type ( H5_RETURN (H5_SUCCESS); } +static inline h5_err_t +close_chunk_type ( + void + ) { + H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); + TRY (hdf5_close_type (h5_dta_types.h5_chunk_t)); + H5_RETURN (H5_SUCCESS); +} + + static inline h5_err_t create_octree_type ( void @@ -350,6 +410,15 @@ create_octree_type ( H5_RETURN (H5_SUCCESS); } +static inline h5_err_t +close_octree_type ( + void + ) { + H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); + TRY (hdf5_close_type (h5_dta_types.h5_octree_t)); + H5_RETURN (H5_SUCCESS); +} + static inline h5_err_t create_userdata_type ( void @@ -369,6 +438,15 @@ create_userdata_type ( H5_RETURN (H5_SUCCESS); } +static inline h5_err_t +close_userdata_type ( + void + ) { + H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); + TRY (hdf5_close_type (h5_dta_types.h5_userdata_t)); + H5_RETURN (H5_SUCCESS); +} + static inline h5_err_t create_mpi_type_glb_tet ( void @@ -669,7 +747,7 @@ h5priv_initialize ( memset (&h5_call_stack, 0, sizeof (h5_call_stack)); // must be set here, otherwise next statement will fail! h5_initialized = 1; - H5_CORE_API_ENTER (h5_err_t, "%s", "void"); + H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); ret_value = H5_SUCCESS; #ifdef H5_HAVE_PARALLEL int mpi_is_initialized; @@ -690,7 +768,7 @@ h5priv_initialize ( TRY (create_vertex_type ()); TRY (create_triangle_type ()); TRY (create_tet_type ()); - TRY (create_tag_types ()); + TRY (create_tag_type ()); #if defined(WITH_PARALLEL_H5GRID) TRY (create_chunk_type ()); @@ -705,3 +783,21 @@ h5priv_initialize ( #endif H5_RETURN ((ret_value != H5_SUCCESS) ? _h5_exit (42) : H5_SUCCESS); } + +h5_err_t +h5priv_finalize ( + void + ) { + H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void"); + TRY (close_array_types ()); + TRY (close_vertex_type ()); + TRY (close_triangle_type ()); + TRY (close_tag_type ()); + TRY (close_tet_type ()); +#if defined(WITH_PARALLEL_H5GRID) + TRY (close_chunk_type ()); + TRY (close_octree_type ()); + TRY (close_userdata_type ()); +#endif + H5_RETURN (H5_SUCCESS); +} diff --git a/src/h5core/private/h5_init.h b/src/h5core/private/h5_init.h index 118bc66..2403431 100644 --- a/src/h5core/private/h5_init.h +++ b/src/h5core/private/h5_init.h @@ -22,6 +22,9 @@ extern "C" { h5_err_t h5priv_initialize (void); +h5_err_t +h5priv_finalize (void); + extern int h5_initialized; extern h5_dta_types_t h5_dta_types; extern int h5_myproc; diff --git a/src/include/H5_file.h b/src/include/H5_file.h index 0d2c571..4cc9cba 100644 --- a/src/include/H5_file.h +++ b/src/include/H5_file.h @@ -399,7 +399,7 @@ H5Finalize ( void ) { H5_API_ENTER (h5_err_t, "%s", ""); - H5_API_RETURN (h5_close_hdf5 ()); + H5_API_RETURN (h5_close_h5hut ()); } #ifdef __cplusplus diff --git a/src/include/h5core/h5_file.h b/src/include/h5core/h5_file.h index 0b8a527..ebc81d6 100644 --- a/src/include/h5core/h5_file.h +++ b/src/include/h5core/h5_file.h @@ -66,7 +66,7 @@ h5_close_file ( const h5_file_t); h5_err_t -h5_close_hdf5 ( +h5_close_h5hut ( void); h5_err_t