From 2c267f173a259ba750f8162f126480202ce6ea55 Mon Sep 17 00:00:00 2001 From: Marc Howison Date: Sat, 10 Jul 2010 00:00:54 +0000 Subject: [PATCH] continued working on Fortran interface --- .gitattributes | 19 +- configure.ac | 15 +- src/C/H5Block.c | 124 ++- src/C/H5Block_readwrite.c | 626 ++++++++++++ src/C/H5_attribs.c | 5 +- src/C/Makefile.am | 14 +- src/C/generate-h5b-readwrite.py | 576 +++++++++++ src/Fortran/H5.f90 | 143 +++ src/Fortran/H5BlockF.c | 447 --------- src/Fortran/H5BlockReadWriteF.c | 555 ----------- src/Fortran/H5Block_F.c | 289 ++++++ ...ockReadWrite.f90 => H5Block_readwrite.f90} | 124 ++- src/Fortran/H5Block_readwrite_F.c | 664 +++++++++++++ src/Fortran/H5Part.f90 | 322 +----- src/Fortran/H5PartAttrib.f90 | 168 ---- src/Fortran/H5PartAttribF.c | 600 ------------ src/Fortran/H5PartF.c | 913 ------------------ src/Fortran/H5Part_F.c | 370 +++++++ src/Fortran/{H5F.c => H5_F.c} | 82 +- src/Fortran/H5_attribs.f90 | 249 +++++ src/Fortran/H5_attribs_F.c | 592 ++++++++++++ src/Fortran/Makefile.am | 46 +- src/Makefile.am | 2 +- src/h5core/Makefile.am | 10 +- src/h5core/h5_hdf5.c | 15 + src/h5core/h5_hdf5_private.h | 8 +- src/h5core/h5_openclose.c | 40 +- src/h5core/h5_syscall.c | 2 + src/h5core/h5b_attribs.c | 24 +- src/h5core/h5b_model.c | 57 +- src/h5core/h5b_model_private.h | 13 +- src/h5core/h5b_readwrite.c | 498 +++++----- src/include/H5.h | 3 + src/include/H5Block.h | 250 ++--- src/include/H5Block_readwrite.h | 201 ++++ src/include/H5Fed.h | 1 - src/include/H5hut.h | 2 - src/include/h5core/h5_core.h | 1 + src/include/h5core/h5_openclose.h | 12 + src/include/h5core/h5b_attribs.h | 9 + src/include/h5core/h5b_readwrite.h | 40 + 41 files changed, 4482 insertions(+), 3649 deletions(-) create mode 100644 src/C/H5Block_readwrite.c create mode 100755 src/C/generate-h5b-readwrite.py create mode 100644 src/Fortran/H5.f90 delete mode 100755 src/Fortran/H5BlockF.c delete mode 100644 src/Fortran/H5BlockReadWriteF.c create mode 100755 src/Fortran/H5Block_F.c rename src/Fortran/{H5BlockReadWrite.f90 => H5Block_readwrite.f90} (63%) create mode 100644 src/Fortran/H5Block_readwrite_F.c delete mode 100644 src/Fortran/H5PartAttrib.f90 delete mode 100644 src/Fortran/H5PartAttribF.c delete mode 100755 src/Fortran/H5PartF.c create mode 100755 src/Fortran/H5Part_F.c rename src/Fortran/{H5F.c => H5_F.c} (73%) create mode 100644 src/Fortran/H5_attribs.f90 create mode 100644 src/Fortran/H5_attribs_F.c create mode 100644 src/include/H5Block_readwrite.h create mode 100644 src/include/h5core/h5b_readwrite.h diff --git a/.gitattributes b/.gitattributes index d0fffa8..44e5224 100644 --- a/.gitattributes +++ b/.gitattributes @@ -367,6 +367,7 @@ src/C++/H5Fed.hh -text src/C++/Makefile.am -text src/C/H5.c -text src/C/H5Block.c -text +src/C/H5Block_readwrite.c -text src/C/H5Fed.c -text src/C/H5Fed_adjacency.c -text src/C/H5Fed_inquiry.c -text @@ -377,15 +378,17 @@ src/C/H5Part.c -text src/C/H5_attribs.c -text src/C/H5_inquiry.c -text src/C/Makefile.am -text +src/C/generate-h5b-readwrite.py -text +src/Fortran/H5.f90 -text src/Fortran/H5Block.f90 -text -src/Fortran/H5BlockF.c -text -src/Fortran/H5BlockReadWrite.f90 -text -src/Fortran/H5BlockReadWriteF.c -text -src/Fortran/H5F.c -text +src/Fortran/H5Block_F.c -text +src/Fortran/H5Block_readwrite.f90 -text +src/Fortran/H5Block_readwrite_F.c -text src/Fortran/H5Part.f90 -text -src/Fortran/H5PartAttrib.f90 -text -src/Fortran/H5PartAttribF.c -text -src/Fortran/H5PartF.c -text +src/Fortran/H5Part_F.c -text +src/Fortran/H5_F.c -text +src/Fortran/H5_attribs.f90 -text +src/Fortran/H5_attribs_F.c -text src/Fortran/Makefile.am -text src/Fortran/TestUnderscore.f -text src/Fortran/TestUnderscoreC.c -text @@ -461,6 +464,7 @@ src/h5core/h5u_readwrite.c -text src/h5core/h5u_types_private.h -text src/include/H5.h -text src/include/H5Block.h -text +src/include/H5Block_readwrite.h -text src/include/H5Fed.h -text src/include/H5Fed_adjacency.h -text src/include/H5Fed_inquiry.h -text @@ -483,6 +487,7 @@ src/include/h5core/h5_readwrite.h -text src/include/h5core/h5_types.h -text src/include/h5core/h5b_attribs.h -text src/include/h5core/h5b_model.h -text +src/include/h5core/h5b_readwrite.h -text src/include/h5core/h5t_adjacencies.h -text src/include/h5core/h5t_core.h -text src/include/h5core/h5t_inquiry.h -text diff --git a/configure.ac b/configure.ac index 3f50a94..00f136e 100644 --- a/configure.ac +++ b/configure.ac @@ -193,14 +193,14 @@ if test "X$USE_FORTRAN" = "Xyes"; then fi AC_MSG_CHECKING([symbol convention in object files]) - `cd src && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore` - `cd src && ${FC} ${FFLAGS} -c TestUnderscore.f` - `cd src && ${CC} ${CFLAGS} -c TestUnderscoreC.c` - `cd src && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o` + `cd src/Fortran && rm -f TestUnderscore.o TestUnderscoreC.o TestUnderscore` + `cd src/Fortran && ${FC} ${FFLAGS} -c TestUnderscore.f` + `cd src/Fortran && ${CC} ${CFLAGS} -c TestUnderscoreC.c` + `cd src/Fortran && ${FC} ${FFLAGS} -o TestUnderscore TestUnderscore.o TestUnderscoreC.o` - if test -f src/TestUnderscore ; then + if test -f src/Fortran/TestUnderscore ; then UNDERSCORE_H=Underscore.h - `cd src && ./TestUnderscore > Underscore.h` + `cd src/Fortran && ./TestUnderscore > Underscore.h` AC_MSG_RESULT([ok]) else AC_MSG_RESULT([nok]) @@ -497,6 +497,7 @@ AC_CONFIG_FILES([ src/Makefile src/C/Makefile src/h5core/Makefile + src/Fortran/Makefile test/Makefile test/H5Part/Makefile test/H5Block/Makefile @@ -515,7 +516,7 @@ AC_MSG_RESULT([ ]) AC_MSG_RESULT([Host OS: $host_os]) AC_MSG_RESULT([Host CPU: $host_cpu]) AC_MSG_RESULT([Host vendor: $host_vendor]) -AC_MSG_RESULT([Build libraries: $FORTRAN_LIB]) +AC_MSG_RESULT([Build libraries: libH5Core.a libH5hutC.a $FORTRAN_LIB]) AC_MSG_RESULT([Build test programs: $TTARGET]) AC_MSG_RESULT([Build tools: $BUILD_TOOLS]) AC_MSG_RESULT([CC = $CC]) diff --git a/src/C/H5Block.c b/src/C/H5Block.c index 87559e5..d4ff936 100644 --- a/src/C/H5Block.c +++ b/src/C/H5Block.c @@ -71,9 +71,7 @@ use the same field dimensions, set the layout only once before the first timestep. - \return \c H5_SUCCESS on success
- \c H5PART_ERR_MPI
- \c H5PART_ERR_HDF5 + \return \c H5_SUCCESS on success */ h5_err_t H5Block3dSetView ( @@ -91,6 +89,31 @@ H5Block3dSetView ( return h5b_3d_set_view(f, i_start, i_end, j_start, j_end, k_start, k_end); } +/*! + \ingroup h5block_model + + Return partition of processor \c proc as specified with + \ref H5Block3dSetView. + + \return \c H5_SUCCESS on success +*/ +h5_err_t +H5Block3dGetView ( + h5_file_t *const f, /*!< IN: File handle */ + const int proc, /*!< IN: Processor to get partition from */ + h5_size_t *i_start, /*!< OUT: start index of \c i */ + h5_size_t *i_end, /*!< OUT: end index of \c i */ + h5_size_t *j_start, /*!< OUT: start index of \c j */ + h5_size_t *j_end, /*!< OUT: end index of \c j */ + h5_size_t *k_start, /*!< OUT: start index of \c k */ + h5_size_t *k_end /*!< OUT: end index of \c k */ + ) { + + SET_FNAME( f, __func__ ); + + return h5b_3d_get_view(f, proc, i_start, i_end, j_start, j_end, k_start, k_end); +} + /*! \ingroup h5block_model @@ -131,41 +154,14 @@ H5Block3dGetChunk ( return h5b_3d_get_chunk(f, field_name, dims); } -/*! - \ingroup h5block_model - - Return partition of processor \c proc as specified with - \c H5Block3dSetView(). - - \return \c H5_SUCCESS on success.
- \c H5PART_ERR_INVAL if proc is invalid. -*/ -h5_err_t -H5Block3dGetView ( - h5_file_t *const f, /*!< IN: File handle */ - const int proc, /*!< IN: Processor to get partition from */ - h5_size_t *i_start, /*!< OUT: start index of \c i */ - h5_size_t *i_end, /*!< OUT: end index of \c i */ - h5_size_t *j_start, /*!< OUT: start index of \c j */ - h5_size_t *j_end, /*!< OUT: end index of \c j */ - h5_size_t *k_start, /*!< OUT: start index of \c k */ - h5_size_t *k_end /*!< OUT: end index of \c k */ - ) { - - SET_FNAME( f, __func__ ); - //CHECK_LAYOUT ( f ); - - return h5b_3d_get_view(f, proc, i_start, i_end, j_start, j_end, k_start, k_end); -} /*! \ingroup h5block_model Return reduced (ghost-zone free) partition of processor \c proc - as specified with \c H5Block3dSetView(). + as specified with \ref H5Block3dSetView. - \return \c H5_SUCCESS on success.
- \c H5PART_ERR_INVAL if proc is invalid. + \return \c H5_SUCCESS on success */ h5_err_t H5Block3dGetReducedView ( @@ -180,7 +176,6 @@ H5Block3dGetReducedView ( ) { SET_FNAME( f, __func__ ); - //CHECK_LAYOUT ( f ); return h5b_3d_get_reduced_view(f, proc, i_start, i_end, j_start, j_end, k_start, k_end); } @@ -220,7 +215,6 @@ H5BlockGetNumFields ( ) { SET_FNAME( f, __func__ ); - //CHECK_TIMEGROUP( f ); return h5b_get_num_fields(f); } @@ -235,7 +229,7 @@ H5BlockGetNumFields ( This function can be used to retrieve all fields bound to the current time-step by looping from \c 0 to the number of fields minus one. The number of fields bound to the current time-step - can be queried by calling the function \c H5BlockGetNumFields(). + can be queried by calling the function \ref H5BlockGetNumFields. \return \c H5_SUCCESS or error code */ @@ -268,9 +262,9 @@ h5_err_t H5BlockGetFieldInfoByName ( h5_file_t *const f, /*!< IN: file handle */ const char *name, /*!< IN: field name */ - h5_int64_t *grid_rank, /*!< OUT: grid rank */ - h5_int64_t *grid_dims, /*!< OUT: grid dimensions */ - h5_int64_t *field_rank, /*!< OUT: field rank */ + h5_size_t *grid_rank, /*!< OUT: grid rank */ + h5_size_t *grid_dims, /*!< OUT: grid dimensions */ + h5_size_t *field_rank, /*!< OUT: field rank */ h5_int64_t *type /*!< OUT: datatype */ ) { @@ -312,29 +306,27 @@ H5BlockWriteFieldAttribString ( /*! \ingroup h5block_attrib - Write float32 \c values as attribute \c attrib_name of field - \c field_name. + Read the string value from attribute \c attrib_name of field + \c field_name into a \c buffer. \return \c H5_SUCCESS or error code */ h5_err_t -H5BlockWriteFieldAttribFloat32 ( +H5BlockReadFieldAttribString ( h5_file_t *const f, /*!< IN: file handle */ const char *field_name, /*!< IN: field name */ const char *attrib_name, /*!< IN: attribute name */ - const char *values, /*!< IN: attribute value */ - const h5_size_t nvalues /*!< IN: number of values */ + char *buffer /*!< OUT: attribute value */ ) { SET_FNAME( f, __func__ ); - return h5_write_field_attrib ( + return h5_read_field_attrib ( f, field_name, attrib_name, - H5T_NATIVE_FLOAT, - values, - nvalues ); + H5_STRING_T, + (void*)buffer); } /*! @@ -355,3 +347,41 @@ H5BlockGetNumFieldAttribs ( return h5b_get_num_field_attribs(f, field_name); } +/*! + \ingroup h5block_attrib + + Gets the name, type and number of elements of the field attribute + specified by its index. + + This function can be used to retrieve all attributes bound to the + specified field by looping from \c 0 to the number of attribute + minus one. The number of attributes bound to the + field can be queried by calling \ref H5BlockGetNumFieldAttribs. + + \return \c H5_SUCCESS or error code +*/ +h5_int64_t +H5BlockGetFieldAttribInfo ( + h5_file_t *const f, /*!< [in] Handle to open file */ + const char *field_name, /* \\ingroup h5blockf_data +!! See \\ref H5Block#DIM#dWriteScalarField#TYPE_ABV# +!! \\return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset + #TYPE_F90#, INTENT(IN) :: data(*) !< the array of data +END FUNCTION +""" + +read_scalar_fi = """ +!> \\ingroup h5blockf_data +!! See \\ref H5Block#DIM#dReadScalarField#TYPE_ABV# +!! \\return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_#DIM#d_read_scalar_field_#TYPE_F90_ABV# ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset + #TYPE_F90#, INTENT(OUT) :: data(*) !< buffer to read the data into +END FUNCTION +""" + +write_scalar_fc = """ +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# F77NAME ( \\ + h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV#_, \\ + H5BL_#DIM#D_WRITE_SCALAR_FIELD_#TYPE_F90_ABVC# ) +#endif + +h5_err_t +h5bl_#DIM#d_write_scalar_field_#TYPE_F90_ABV# ( + h5_int64_t *f, + const char *field_name, + const h5_#TYPE_H5P#_t *data, + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block#DIM#dWriteScalarField#TYPE_ABV# ( + filehandle, field_name2, data ); + + free ( field_name2 ); + return herr; +} +""" + +read_scalar_fc = """ +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_read_scalar_field_#TYPE_F90_ABV# F77NAME ( \\ + h5bl_3d_read_scalar_field_#TYPE_F90_ABV#_, \\ + H5BL_#DIM#D_READ_SCALAR_FIELD_#TYPE_F90_ABVC# ) +#endif + +h5_err_t +h5bl_#DIM#d_read_scalar_field_#TYPE_F90_ABV# ( + h5_int64_t *f, + const char *field_name, + h5_#TYPE_H5P#_t *data, + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block#DIM#dWriteScalarField#TYPE_ABV# ( + filehandle, field_name2, data ); + + free ( field_name2 ); + return herr; +} +""" + +write_vector_h = """ +h5_err_t +H5Block#DIM#dWriteVector3dField#TYPE_ABV# ( + h5_file_t *f, + const char *name, + const h5_#TYPE_H5P#_t *x_data, + const h5_#TYPE_H5P#_t *y_data, + const h5_#TYPE_H5P#_t *z_data + ); +""" + +read_vector_h = """ +h5_err_t +H5Block#DIM#dReadVector3dField#TYPE_ABV# ( + h5_file_t *f, + const char *name, + h5_#TYPE_H5P#_t *x_data, + h5_#TYPE_H5P#_t *y_data, + h5_#TYPE_H5P#_t *z_data + ); +""" + +write_vector_c = """ +/*! + \\ingroup h5block_data +*/ +/*! + Write a 3-dimensional field \\c name with 3-dimensional vectors as values + from the buffers starting at \\c x_data, \\c y_data and \\c z_data to the + current time-step using the defined field layout. Values are 3-dimensional + vectors with #TYPE_FULL# values. + + You must use the Fortran indexing scheme to access items in \\c data. + + \\return \\c H5_SUCCESS or error code +*/ +h5_err_t +H5Block#DIM#dWriteVector3dField#TYPE_ABV# ( + h5_file_t *f, /*!< IN: file handle */ + const char *name, /*!< IN: name of dataset to write */ + const h5_#TYPE_H5P#_t *x_data, /*!< IN: X axis data */ + const h5_#TYPE_H5P#_t *y_data, /*!< IN: Y axis data */ + const h5_#TYPE_H5P#_t *z_data /*!< IN: Z axis data */ + ) { + + SET_FNAME( f, __func__ ); + + return h5b_write_vector3d_data(f, name, + (void*)x_data, (void*)y_data, (void*)z_data, #TYPE_HDF5#); +} +""" + +read_vector_c = """ +/*! + \\ingroup h5block_data +*/ +/*! + Read a 3-dimensional field \\c name with 3-dimensional vectors as values + from the buffers starting at \\c x_data, \\c y_data and \\c z_data to the + current time-step using the defined field layout. Values are 3-dimensional + vectors with #TYPE_FULL# values. + + You must use the Fortran indexing scheme to access items in \\c data. + + \\return \\c H5_SUCCESS or error code +*/ +h5_err_t +H5Block#DIM#dReadVector3dField#TYPE_ABV# ( + h5_file_t *f, /*!< IN: file handle */ + const char *name, /*!< IN: name of dataset to write */ + h5_#TYPE_H5P#_t *x_data, /*!< OUT: X axis data */ + h5_#TYPE_H5P#_t *y_data, /*!< OUT: Y axis data */ + h5_#TYPE_H5P#_t *z_data /*!< OUT: Z axis data */ + ) { + + SET_FNAME( f, __func__ ); + + return h5b_read_vector3d_data(f, name, + (void*)x_data, (void*)y_data, (void*)z_data, #TYPE_HDF5#); +} +""" + +write_vector_fi = """ +!> \\ingroup h5blockf_data +!! See \\ref H5Block#DIM#dWriteVector3dField#TYPE_ABV# +!! \\return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# ( filehandle, name, x, y, z ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset + #TYPE_F90#, INTENT(IN) :: x(*) !< the array of x data to write + #TYPE_F90#, INTENT(IN) :: y(*) !< the array of y data to write + #TYPE_F90#, INTENT(IN) :: z(*) !< the array of z data to write +END FUNCTION +""" + +read_vector_fi = """ +!> \\ingroup h5blockf_data +!! See \\ref H5Block#DIM#dReadVector3dField#TYPE_ABV# +!! \\return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# ( filehandle, name, x, y, z ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset + #TYPE_F90#, INTENT(OUT) :: x(*) !< buffer to read the x data into + #TYPE_F90#, INTENT(OUT) :: y(*) !< buffer to read the y data into + #TYPE_F90#, INTENT(OUT) :: z(*) !< buffer to read the z data into +END FUNCTION +""" + +write_vector_fc = """ +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# F77NAME ( \\ + h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV#_, \\ + H5BL_#DIM#D_WRITE_VECTOR3D_FIELD_#TYPE_F90_ABVC# ) +#endif + +h5_err_t +h5bl_#DIM#d_write_vector3d_field_#TYPE_F90_ABV# ( + h5_int64_t *f, /*!< file handle */ + const char *field_name, /*!< name of the data set */ + const h5_#TYPE_H5P#_t *xval, /*!< array of x component data */ + const h5_#TYPE_H5P#_t *yval, /*!< array of y component data */ + const h5_#TYPE_H5P#_t *zval, /*!< array of z component data */ + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block#DIM#dWriteVector3dField#TYPE_ABV# ( + filehandle, field_name2, xval, yval, zval ); + + free ( field_name2 ); + return herr; +} +""" + +read_vector_fc = """ +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# F77NAME ( \\ + h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV#_, \\ + H5BL_#DIM#D_READ_VECTOR3D_FIELD_#TYPE_F90_ABVC# ) +#endif + +h5_err_t +h5bl_#DIM#d_read_vector3d_field_#TYPE_F90_ABV# ( + h5_int64_t *f, /*!< file handle */ + const char *field_name, /*!< name of the data set */ + h5_#TYPE_H5P#_t *xval, /*!< array of x component data */ + h5_#TYPE_H5P#_t *yval, /*!< array of y component data */ + h5_#TYPE_H5P#_t *zval, /*!< array of z component data */ + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block#DIM#dReadVector3dField#TYPE_ABV# ( + filehandle, field_name2, xval, yval, zval ); + + free ( field_name2 ); + return herr; +} +""" + +write_attr_h = """ +h5_err_t +H5BlockWriteFieldAttrib#TYPE_ABV# ( + h5_file_t *f, + const char *field_name, + const char *attrib_name, + const h5_#TYPE_H5P#_t *values, + const h5_size_t nvalues + ); +""" + +write_attr_c = """ +/*! + \\ingroup h5block_attrib + + Write #TYPE_H5P# \\c values as attribute \\c attrib_name of field + \\c field_name. + + \\return \\c H5_SUCCESS or error code +*/ +h5_err_t +H5BlockWriteFieldAttrib#TYPE_ABV# ( + h5_file_t *f, /*!< IN: file handle */ + const char *field_name, /*!< IN: field name */ + const char *attrib_name, /*!< IN: attribute name */ + const h5_#TYPE_H5P#_t *values, /*!< IN: attribute values */ + const h5_size_t nvalues /*!< IN: number of elements */ + ) { + + SET_FNAME( f, __func__ ); + + return h5_write_field_attrib ( + f, + field_name, + attrib_name, + #TYPE_HDF5#, + values, + nvalues ); +} +""" + +write_attr_fi = """ +!> \\ingroup h5_attrib_f +!! See \\ref H5BlockWriteFieldAttrib#TYPE_ABV# +!! \\return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_writefieldattrib_#TYPE_F90_ABV# ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute + #TYPE_F90#, INTENT(IN) :: values(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nvalues !< the number of elements in the array +END FUNCTION +""" + +write_attr_fc = """ +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_writefieldattrib_#TYPE_F90_ABV# F77NAME ( \\ + h5bl_writefieldattrib_#TYPE_F90_ABV#_, \\ + H5BL_WRITEFIELDATTRIB_#TYPE_F90_ABVC# ) +#endif + +h5_err_t +h5bl_writefieldattrib_#TYPE_F90_ABV# ( + h5_int64_t *f, + const char *field_name, + const char *attrib_name, + const h5_#TYPE_H5P#_t *values, + const h5_size_t *nvalues, + const int l_field_name, + const int l_attrib_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); + + h5_err_t herr = H5BlockWriteFieldAttrib#TYPE_ABV# ( + filehandle, field_name2, attrib_name2, values, *nvalues ); + + free ( field_name2 ); + free ( attrib_name2 ); + return herr; +} +""" + +read_attr_h = """ +h5_err_t +H5BlockReadFieldAttrib#TYPE_ABV# ( + h5_file_t *f, + const char *field_name, + const char *attrib_name, + h5_#TYPE_H5P#_t *buffer + ); +""" + +read_attr_c = """ +/*! + \\ingroup h5block_attrib + + Read #TYPE_H5P# values from attribute \\c attrib_name of field + \\c field_name into a \\c buffer. + + \\return \\c H5_SUCCESS or error code +*/ +h5_err_t +H5BlockReadFieldAttrib#TYPE_ABV# ( + h5_file_t *f, /*!< IN: file handle */ + const char *field_name, /*!< IN: field name */ + const char *attrib_name, /*!< IN: attribute name */ + h5_#TYPE_H5P#_t *buffer /*!< OUT: attribute values */ + ) { + + SET_FNAME( f, __func__ ); + + return h5_read_field_attrib ( + f, + field_name, + attrib_name, + #TYPE_HDF5#, + (void*)buffer); +} +""" + +read_attr_fi = """ +!> \\ingroup h5_attrib_f +!! See \\ref H5BlockReadFieldAttrib#TYPE_ABV# +!! \\return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_readfieldattrib_#TYPE_F90_ABV# ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute + #TYPE_F90#, INTENT(IN) :: values(*) !< the buffer to read into +END FUNCTION +""" + +read_attr_fc = """ +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_readfieldattrib_#TYPE_F90_ABV# F77NAME ( \\ + h5bl_readfieldattrib_#TYPE_F90_ABV#_, \\ + H5BL_READFIELDATTRIB_#TYPE_F90_ABVC# ) +#endif + +h5_err_t +h5bl_readfieldattrib_#TYPE_F90_ABV# ( + h5_int64_t *f, + const char *field_name, + const char *attrib_name, + h5_#TYPE_H5P#_t *values, + const int l_field_name, + const int l_attrib_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); + + h5_err_t herr = H5BlockReadFieldAttrib#TYPE_ABV# ( + filehandle, field_name2, attrib_name2, values ); + + free ( field_name2 ); + free ( attrib_name2 ); + return herr; +} +""" + + +dims = ["3"] +types = [ + ["floating points (64-bit)", "Float64", "float64", "H5T_NATIVE_DOUBLE", "REAL*8", "r8", "R8"], + ["floating points (32-bit)", "Float32", "float32", "H5T_NATIVE_FLOAT", "REAL*4", "r4", "R4"], + ["integers (64-bit)", "Int64", "int64", "H5T_NATIVE_INT64", "INTEGER*8", "i8", "I8"], + ["integers (32-bit)", "Int32", "int32", "H5T_NATIVE_INT32", "INTEGER*4", "i4", "I4"] +] + +def create_call(template, type, dim): + fcn = template + fcn = fcn.replace('#DIM#',dim)\ + .replace('#TYPE_FULL#',type[0])\ + .replace('#TYPE_ABV#',type[1])\ + .replace('#TYPE_H5P#',type[2])\ + .replace('#TYPE_HDF5#',type[3])\ + .replace('#TYPE_F90#',type[4])\ + .replace('#TYPE_F90_ABV#',type[5])\ + .replace('#TYPE_F90_ABVC#',type[6]) + return fcn + +def write_calls(): + cfile = file('H5Block_readwrite.c','w') + cfile.write(c_head) + hfile = file('../include/H5Block_readwrite.h','w') + hfile.write(h_head) + fcfile = file('../Fortran/H5Block_readwrite_F.c','w') + fcfile.write(fc_head) + fifile = file('../Fortran/H5Block_readwrite.f90','w') + for dim in dims: + for type in types: + cfile.write(create_call(write_scalar_c,type,dim)); + cfile.write(create_call(read_scalar_c,type,dim)); + hfile.write(create_call(write_scalar_h,type,dim)); + hfile.write(create_call(read_scalar_h,type,dim)); + fcfile.write(create_call(write_scalar_fc,type,dim)); + fcfile.write(create_call(read_scalar_fc,type,dim)); + fifile.write(create_call(write_scalar_fi,type,dim)); + fifile.write(create_call(read_scalar_fi,type,dim)); + cfile.write(create_call(write_vector_c,type,dim)); + cfile.write(create_call(read_vector_c,type,dim)); + hfile.write(create_call(write_vector_h,type,dim)); + hfile.write(create_call(read_vector_h,type,dim)); + fcfile.write(create_call(write_vector_fc,type,dim)); + fcfile.write(create_call(read_vector_fc,type,dim)); + fifile.write(create_call(write_vector_fi,type,dim)); + fifile.write(create_call(read_vector_fi,type,dim)); + for type in types: + cfile.write(create_call(write_attr_c,type,"")); + hfile.write(create_call(write_attr_h,type,"")); + fifile.write(create_call(write_attr_fi,type,"")); + fcfile.write(create_call(write_attr_fc,type,"")); + cfile.write(create_call(read_attr_c,type,"")); + hfile.write(create_call(read_attr_h,type,"")); + fifile.write(create_call(read_attr_fi,type,"")); + fcfile.write(create_call(read_attr_fc,type,"")); + cfile.close() + hfile.write(h_tail) + hfile.close() + fcfile.close() + fifile.close() + +write_calls() + diff --git a/src/Fortran/H5.f90 b/src/Fortran/H5.f90 new file mode 100644 index 0000000..fb0d656 --- /dev/null +++ b/src/Fortran/H5.f90 @@ -0,0 +1,143 @@ +! Declaration of subroutines for Fortran Bindings + +!> \defgroup h5_f90_api H5hut F90 API + +!> \ingroup h5_f90_api +!! \defgroup h5_open_f File Handling +!< + +!> \ingroup h5_f90_api +!! \defgroup h5_model_f Setting up the Data Model +!< + +!> \ingroup h5_f90_api +!! \defgroup h5_data_f Reading and Writing Datasets +!< + +!> \ingroup h5_f90_api +!! \defgroup h5_attrib_f Reading and Writing Attributes +!< + + +!!!!!!!! File Opening and Closing !!!!!!!! + +!> \ingroup h5_open_f +!! Opens a file for reading. See \ref H5OpenFile +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_openr ( filename ) + CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading +END FUNCTION + +!> \ingroup h5_open_f +!! Opens a file for writing in truncate mode. See \ref H5OpenFile +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_openw ( filename ) + CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing +END FUNCTION + +!> \ingroup h5_open_f +!! Opens a file for writing in append mode. See \ref H5OpenFile +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_opena ( filename ) + CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending +END FUNCTION + +!> \ingroup h5_open_f +!! Opens a parallel file for reading. +!! See \ref H5OpenFile +!! +!! Flags are specified as a comma separated string that can include: +!! +!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver +!! - \c vfd_indendent - use MPI-IO in indepedent mode +!! +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_openr_par_align ( filename, mpi_communicator, align ) + CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading + INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program + CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags +END FUNCTION + +!> \ingroup h5_open_f +!! Opens a parallel file for writing. +!! See \ref H5OpenFile +!! +!! Flags are specified as a comma separated string that can include: +!! +!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver +!! - \c vfd_indendent - use MPI-IO in indepedent mode +!! - \c vfd_mpio_ind - use MPI-IO in indepedent mode +!! +!! See \ref H5PartOpenFileParallelAlign +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_openw_par_align ( filename, mpi_communicator, align, flags ) + CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing + INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program + CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags +END FUNCTION + +!> \ingroup h5_open_f +!! Opens a parallel file for writing in append mode. +!! See \ref H5OpenFile +!! +!! Flags are specified as a comma separated string that can include: +!! +!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver +!! - \c vfd_indendent - use MPI-IO in indepedent mode +!! +!! See \ref H5PartOpenFileParallelAlign +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_opena_par_align ( filename, mpi_communicator, align, flags ) + CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending + INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program + CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags +END FUNCTION + +!> \ingroup h5_open_f +!! Closes a file. See \ref H5CloseFile +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_close ( filehandle ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open +END FUNCTION + +!> \ingroup h5_open_f +!! Checks that a file is valid. See \ref H5CheckFile +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_check ( filehandle ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open +END FUNCTION + +!> \ingroup h5_open_f +!! See \ref H5SetVerbosityLevel +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_set_verbosity_level ( level ) + INTEGER*8, INTENT(IN) :: level !< the level from 0 (no output) to 5 (most detailed) +END FUNCTION + +!> \ingroup h5_model_f +!! See \ref H5SetStep +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_setstep (filehandle,step) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + INTEGER*8, INTENT(IN) :: step !< a timestep value >= 1 +END FUNCTION + +!> \ingroup h5_model_f +!! See \ref H5GetNumSteps +!! \return the number of steps or error code +!< +INTEGER*8 FUNCTION h5_getnsteps (filehandle) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open +END FUNCTION + + diff --git a/src/Fortran/H5BlockF.c b/src/Fortran/H5BlockF.c deleted file mode 100755 index f95e6ef..0000000 --- a/src/Fortran/H5BlockF.c +++ /dev/null @@ -1,447 +0,0 @@ -#include "H5hut.h" -#include "Underscore.h" - -#if defined(F77_SINGLE_UNDERSCORE) -#define F77NAME(a,b) a -#elif defined(F77_CRAY_UNDERSCORE) -#define F77NAME(a,b) b -#elif defined(F77_NO_UNDERSCORE) -#else -#error Error, no way to determine how to construct fortran bindings -#endif - -#if ! defined(F77_NO_UNDERSCORE) - -#define h5bl_define3dlayout F77NAME ( \ - h5bl_define3dlayout_, \ - H5BL_DEFINE3DLAYOUT ) -#define h5bl_define3dchunkdims F77NAME ( \ - h5bl_define3dchunkdims_, \ - H5BL_DEFINE3DCHUNKDIMS ) -#define h5bl_get_partition_of_proc F77NAME ( \ - h5bl_get_partition_of_proc_, \ - H5BL_GET_PARTITION_OF_PROC ) -#define h5bl_get_reduced_partition_of_proc F77NAME ( \ - h5bl_get_reduced_partition_of_proc_,\ - H5BL_GET_REDUCED_PARTITION_OF_PROC ) -#define h5bl_get_proc_of F77NAME ( \ - h5bl_get_proc_of_, \ - H5BL_GET_PROC_OF ) -#define h5bl_getnumfields F77NAME ( \ - h5bl_getnumfields_, \ - H5BL_GETNUMFIELDS ) -#define h5bl_getfieldinfo F77NAME ( \ - h5bl_getfieldinfo_, \ - H5BL_GETFIELDINFO ) -#define h5bl_writefieldattrib_string F77NAME ( \ - h5bl_writefieldattrib_string_, \ - H5BL_WRITEFIELDATTRIB_STRING ) -#define h5bl_getnfieldattribs F77NAME ( \ - h5bl_getnfieldattribs_, \ - H5BL_GETNFIELDATTRIBS ) -#define h5bl_getfieldattribinfo F77NAME ( \ - h5bl_getfieldattribinfo_, \ - h5bl_getfieldattribinfo ) -#define h5bl_readfieldattrib_i8 F77NAME ( \ - h5bl_readfieldattrib_i8_, \ - H5BL_READFIELDATTRIB_I8 ) -#define h5bl_readfieldattrib_r8 F77NAME ( \ - h5bl_readfieldattrib_r8_, \ - H5BL_READFIELDATTRIB_R8 ) -#define h5bl_readfieldattrib_string F77NAME ( \ - h5bl_readfieldattrib_string_, \ - H5BL_READFIELDATTRIB_STRING ) -#define h5bl_has_fielddata F77NAME ( \ - h5bl_has_fielddata_, \ - H5BL_HAS_FIELDDATA ) -#define h5bl_3d_set_field_spacing F77NAME ( \ - h5bl_3d_set_field_spacing_, \ - H5BL_3D_SET_FIELD_SPACING ) -#define h5bl_3d_get_field_spacing F77NAME ( \ - h5bl_3d_get_field_spacing_, \ - H5BL_3D_GET_FIELD_SPACING ) -#define h5bl_3d_set_field_origin F77NAME ( \ - h5bl_3d_set_field_origin_, \ - H5BL_3D_SET_FIELD_ORIGIN ) -#define h5bl_3d_get_field_origin F77NAME ( \ - h5bl_3d_get_field_origin_, \ - H5BL_3D_GET_FIELD_origin ) -#endif - -h5part_int64_t -h5bl_define3dlayout ( - h5part_int64_t *f, - const h5part_int64_t *i_start, /*!< start index of i */ - const h5part_int64_t *i_end, /*!< end index of i */ - const h5part_int64_t *j_start, /*!< start index of j */ - const h5part_int64_t *j_end, /*!< end index of j */ - const h5part_int64_t *k_start, /*!< start index of k */ - const h5part_int64_t *k_end /*!< end index of k */ - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - return H5BlockDefine3DFieldLayout ( - filehandle, - *i_start-1, *i_end-1, - *j_start-1, *j_end-1, - *k_start-1, *k_end-1 ); -} - -h5part_int64_t -h5bl_define3dchunkdims ( - h5part_int64_t *f, - const h5part_int64_t *i, - const h5part_int64_t *j, - const h5part_int64_t *k - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - return H5BlockDefine3DChunkDims ( filehandle, *i, *j, *k ); -} - -h5part_int64_t -h5bl_get_partition_of_proc ( - h5part_int64_t *f, /*!< file handle */ - const h5part_int64_t *proc, - h5part_int64_t *i_start, /*!< start index of i */ - h5part_int64_t *i_end, /*!< end index of i */ - h5part_int64_t *j_start, /*!< start index of j */ - h5part_int64_t *j_end, /*!< end index of j */ - h5part_int64_t *k_start, /*!< start index of k */ - h5part_int64_t *k_end /*!< end index of k */ - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - h5part_int64_t herr = H5Block3dGetPartitionOfProc ( - filehandle, - *proc, - i_start, i_end, j_start, j_end, k_start, k_end ); - if ( herr < 0 ) return herr; - - (*i_start)++; - (*i_end)++; - (*j_start)++; - (*j_end)++; - (*k_start)++; - (*k_end)++; - - return H5PART_SUCCESS; -} - -h5part_int64_t -h5bl_get_reduced_partition_of_proc ( - h5part_int64_t *f, - const h5part_int64_t *proc, - 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 - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - h5part_int64_t herr = H5Block3dGetReducedPartitionOfProc ( - filehandle, - *proc, - i_start, i_end, j_start, j_end, k_start, k_end ); - if ( herr < 0 ) return herr; - - (*i_start)++; - (*i_end)++; - (*j_start)++; - (*j_end)++; - (*k_start)++; - (*k_end)++; - - return H5PART_SUCCESS; -} - -h5part_int64_t -h5bl_get_proc_of ( - h5part_int64_t *f, - const h5part_int64_t *i, - const h5part_int64_t *j, - const h5part_int64_t *k - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - return H5Block3dGetProcOf ( filehandle, (*i)-1, (*j)-1, (*k)-1 ); -} - -h5part_int64_t -h5bl_getnumfields ( - h5part_int64_t *f /*!< file handle */ - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - return H5BlockGetNumFields ( filehandle ); -} - -h5part_int64_t -h5bl_getfieldinfo ( - h5part_int64_t *f, - const h5part_int64_t *idx, - char *field_name, - h5part_int64_t *grid_rank, - h5part_int64_t *grid_dims, - h5part_int64_t *field_dims, - h5part_int64_t *type, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - h5part_int64_t herr = H5BlockGetFieldInfo ( - filehandle, *idx, field_name, l_field_name, - grid_rank, grid_dims, field_dims, type ); - _H5Part_strc2for ( field_name, l_field_name ); - return herr; -} - -h5part_int64_t -h5bl_writefieldattrib_string ( - h5part_int64_t *f, - const char *field_name, - const char *attrib_name, - const char *attrib_value, - const int l_field_name, - const int l_attrib_name, - const int l_attrib_value - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 =_H5Part_strdupfor2c ( field_name, l_field_name ); - char *attrib_name2=_H5Part_strdupfor2c ( attrib_name, l_attrib_name ); - char *attrib_value2=_H5Part_strdupfor2c( attrib_value,l_attrib_value ); - - h5part_int64_t herr = H5BlockWriteFieldAttribString ( - filehandle, field_name2, attrib_name2, attrib_value2 ); - - free ( field_name2 ); - free ( attrib_name2 ); - free ( attrib_value2 ); - return herr; -} - - -h5part_int64_t -h5bl_getnfieldattribs ( - h5part_int64_t *f, - const char *field_name, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5BlockGetNumFieldAttribs ( - filehandle, field_name2 ); - - free ( field_name2 ); - return herr; -} - -h5part_int64_t -h5bl_getfieldattribinfo ( - h5part_int64_t *f, - const char *field_name, - const h5part_int64_t *attrib_idx, - char *attrib_name, - h5part_int64_t *attrib_nelem, - const int l_field_name, - const int l_attrib_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - h5part_int64_t attrib_type; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5BlockGetFieldAttribInfo ( - filehandle, field_name2, *attrib_idx, - attrib_name, l_attrib_name, - &attrib_type, - attrib_nelem ); - - _H5Part_strc2for ( attrib_name, l_attrib_name ); - - free ( field_name2 ); - return herr; -} - - -h5part_int64_t -h5bl_readfieldattrib_i8 ( - h5part_int64_t *f, - const char *field_name, - const char *attrib_name, - h5part_int64_t *attrib_value, - const int l_field_name, - const int l_attrib_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 =_H5Part_strdupfor2c ( field_name, l_field_name ); - char *attrib_name2=_H5Part_strdupfor2c ( attrib_name, l_attrib_name ); - - h5part_int64_t herr = H5BlockReadFieldAttrib ( - filehandle, field_name2, attrib_name2, attrib_value ); - - free ( field_name2 ); - free ( attrib_name2 ); - return herr; -} - -h5part_int64_t -h5bl_readfieldattrib_r8 ( - h5part_int64_t *f, - const char *field_name, - const char *attrib_name, - h5part_float64_t *attrib_value, - const int l_field_name, - const int l_attrib_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 =_H5Part_strdupfor2c ( field_name, l_field_name ); - char *attrib_name2=_H5Part_strdupfor2c ( attrib_name, l_attrib_name ); - - h5part_int64_t herr = H5BlockReadFieldAttrib ( - filehandle, field_name2, attrib_name2, attrib_value ); - - free ( field_name2 ); - free ( attrib_name2 ); - return herr; -} - -h5part_int64_t -h5bl_readfieldattrib_string ( - h5part_int64_t *f, - const char *field_name, - const char *attrib_name, - char *attrib_value, - const int l_field_name, - const int l_attrib_name, - const int l_attrib_value - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 =_H5Part_strdupfor2c ( field_name, l_field_name ); - char *attrib_name2=_H5Part_strdupfor2c ( attrib_name, l_attrib_name ); - - h5part_int64_t herr = H5BlockReadFieldAttrib ( - filehandle, field_name2, attrib_name2, attrib_value ); - - _H5Part_strc2for ( attrib_value, l_attrib_value ); - - free ( field_name2 ); - free ( attrib_name2 ); - return herr; -} - -h5part_int64_t -h5bl_has_fielddata ( - h5part_int64_t *f - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - return H5BlockHasFieldData ( filehandle ); -} - -h5part_int64_t -h5b_3d_get_field_spacing ( - h5part_int64_t *f, - const char *field_name, - h5part_float64_t *x, - h5part_float64_t *y, - h5part_float64_t *z, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dGetFieldSpacing ( - filehandle, field_name2, x, y, z ); - - free ( field_name2 ); - return herr; -} - -h5part_int64_t -h5b_3d_set_field_spacing ( - h5part_int64_t *f, - const char *field_name, - const h5part_float64_t *x, - const h5part_float64_t *y, - const h5part_float64_t *z, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dSetFieldSpacing ( - filehandle, field_name2, *x, *y, *z ); - - free ( field_name2 ); - return herr; -} - -h5part_int64_t -h5b_3d_get_field_origin ( - h5part_int64_t *f, - const char *field_name, - h5part_float64_t *x, - h5part_float64_t *y, - h5part_float64_t *z, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dGetFieldOrigin ( - filehandle, field_name2, x, y, z ); - - free ( field_name2 ); - return herr; -} - -h5part_int64_t -h5b_3d_set_field_origin ( - h5part_int64_t *f, - const char *field_name, - const h5part_float64_t *x, - const h5part_float64_t *y, - const h5part_float64_t *z, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dSetFieldOrigin ( - filehandle, field_name2, *x, *y, *z ); - - free ( field_name2 ); - return herr; -} diff --git a/src/Fortran/H5BlockReadWriteF.c b/src/Fortran/H5BlockReadWriteF.c deleted file mode 100644 index a3899ba..0000000 --- a/src/Fortran/H5BlockReadWriteF.c +++ /dev/null @@ -1,555 +0,0 @@ - -#include "H5Part.h" -#include "H5PartPrivate.h" -#include "H5Block.h" -#include "H5BlockReadWrite.h" -#include "Underscore.h" - -#if defined(F77_SINGLE_UNDERSCORE) -#define F77NAME(a,b) a -#elif defined(F77_CRAY_UNDERSCORE) -#define F77NAME(a,b) b -#elif defined(F77_NO_UNDERSCORE) -#else -#error Error, no way to determine how to construct fortran bindings -#endif - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_write_scalar_field_r8 F77NAME ( \ - h5bl_3d_write_scalar_field_r8_, \ - H5BL_3D_WRITE_SCALAR_FIELD_R8 ) -#endif - -h5part_int64_t -h5bl_3d_write_scalar_field_r8 ( - h5part_int64_t *f, - const char *field_name, - const h5part_float64_t *data, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dWriteScalarFieldFloat64 ( - filehandle, field_name2, data ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_read_scalar_field_r8 F77NAME ( \ - h5bl_3d_read_scalar_field_r8_, \ - H5BL_3D_READ_SCALAR_FIELD_R8 ) -#endif - -h5part_int64_t -h5bl_3d_read_scalar_field_r8 ( - h5part_int64_t *f, - const char *field_name, - h5part_float64_t *data, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dWriteScalarFieldFloat64 ( - filehandle, field_name2, data ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_write_3dvector_field_r8 F77NAME ( \ - h5bl_3d_write_3dvector_field_r8_, \ - H5BL_3D_WRITE_3DVECTOR_FIELD_R8 ) -#endif - -h5part_int64_t -h5bl_3d_write_3dvector_field_r8 ( - h5part_int64_t *f, /*!< file handle */ - const char *field_name, /*!< name of the data set */ - const h5part_float64_t *xval, /*!< array of x component data */ - const h5part_float64_t *yval, /*!< array of y component data */ - const h5part_float64_t *zval, /*!< array of z component data */ - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dWrite3dVectorFieldFloat64 ( - filehandle, field_name2, xval, yval, zval ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_read_3dvector_field_r8 F77NAME ( \ - h5bl_3d_read_3dvector_field_r8_, \ - H5BL_3D_READ_3DVECTOR_FIELD_R8 ) -#endif - -h5part_int64_t -h5bl_3d_read_3dvector_field_r8 ( - h5part_int64_t *f, /*!< file handle */ - const char *field_name, /*!< name of the data set */ - h5part_float64_t *xval, /*!< array of x component data */ - h5part_float64_t *yval, /*!< array of y component data */ - h5part_float64_t *zval, /*!< array of z component data */ - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dRead3dVectorFieldFloat64 ( - filehandle, field_name2, xval, yval, zval ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_write_scalar_field_r4 F77NAME ( \ - h5bl_3d_write_scalar_field_r4_, \ - H5BL_3D_WRITE_SCALAR_FIELD_R4 ) -#endif - -h5part_int64_t -h5bl_3d_write_scalar_field_r4 ( - h5part_int64_t *f, - const char *field_name, - const h5part_float32_t *data, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dWriteScalarFieldFloat32 ( - filehandle, field_name2, data ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_read_scalar_field_r4 F77NAME ( \ - h5bl_3d_read_scalar_field_r4_, \ - H5BL_3D_READ_SCALAR_FIELD_R4 ) -#endif - -h5part_int64_t -h5bl_3d_read_scalar_field_r4 ( - h5part_int64_t *f, - const char *field_name, - h5part_float32_t *data, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dWriteScalarFieldFloat32 ( - filehandle, field_name2, data ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_write_3dvector_field_r4 F77NAME ( \ - h5bl_3d_write_3dvector_field_r4_, \ - H5BL_3D_WRITE_3DVECTOR_FIELD_R4 ) -#endif - -h5part_int64_t -h5bl_3d_write_3dvector_field_r4 ( - h5part_int64_t *f, /*!< file handle */ - const char *field_name, /*!< name of the data set */ - const h5part_float32_t *xval, /*!< array of x component data */ - const h5part_float32_t *yval, /*!< array of y component data */ - const h5part_float32_t *zval, /*!< array of z component data */ - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dWrite3dVectorFieldFloat32 ( - filehandle, field_name2, xval, yval, zval ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_read_3dvector_field_r4 F77NAME ( \ - h5bl_3d_read_3dvector_field_r4_, \ - H5BL_3D_READ_3DVECTOR_FIELD_R4 ) -#endif - -h5part_int64_t -h5bl_3d_read_3dvector_field_r4 ( - h5part_int64_t *f, /*!< file handle */ - const char *field_name, /*!< name of the data set */ - h5part_float32_t *xval, /*!< array of x component data */ - h5part_float32_t *yval, /*!< array of y component data */ - h5part_float32_t *zval, /*!< array of z component data */ - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dRead3dVectorFieldFloat32 ( - filehandle, field_name2, xval, yval, zval ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_write_scalar_field_i8 F77NAME ( \ - h5bl_3d_write_scalar_field_i8_, \ - H5BL_3D_WRITE_SCALAR_FIELD_I8 ) -#endif - -h5part_int64_t -h5bl_3d_write_scalar_field_i8 ( - h5part_int64_t *f, - const char *field_name, - const h5part_int64_t *data, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dWriteScalarFieldInt64 ( - filehandle, field_name2, data ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_read_scalar_field_i8 F77NAME ( \ - h5bl_3d_read_scalar_field_i8_, \ - H5BL_3D_READ_SCALAR_FIELD_I8 ) -#endif - -h5part_int64_t -h5bl_3d_read_scalar_field_i8 ( - h5part_int64_t *f, - const char *field_name, - h5part_int64_t *data, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dWriteScalarFieldInt64 ( - filehandle, field_name2, data ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_write_3dvector_field_i8 F77NAME ( \ - h5bl_3d_write_3dvector_field_i8_, \ - H5BL_3D_WRITE_3DVECTOR_FIELD_I8 ) -#endif - -h5part_int64_t -h5bl_3d_write_3dvector_field_i8 ( - h5part_int64_t *f, /*!< file handle */ - const char *field_name, /*!< name of the data set */ - const h5part_int64_t *xval, /*!< array of x component data */ - const h5part_int64_t *yval, /*!< array of y component data */ - const h5part_int64_t *zval, /*!< array of z component data */ - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dWrite3dVectorFieldInt64 ( - filehandle, field_name2, xval, yval, zval ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_read_3dvector_field_i8 F77NAME ( \ - h5bl_3d_read_3dvector_field_i8_, \ - H5BL_3D_READ_3DVECTOR_FIELD_I8 ) -#endif - -h5part_int64_t -h5bl_3d_read_3dvector_field_i8 ( - h5part_int64_t *f, /*!< file handle */ - const char *field_name, /*!< name of the data set */ - h5part_int64_t *xval, /*!< array of x component data */ - h5part_int64_t *yval, /*!< array of y component data */ - h5part_int64_t *zval, /*!< array of z component data */ - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dRead3dVectorFieldInt64 ( - filehandle, field_name2, xval, yval, zval ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_write_scalar_field_i4 F77NAME ( \ - h5bl_3d_write_scalar_field_i4_, \ - H5BL_3D_WRITE_SCALAR_FIELD_I4 ) -#endif - -h5part_int64_t -h5bl_3d_write_scalar_field_i4 ( - h5part_int64_t *f, - const char *field_name, - const h5part_int32_t *data, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dWriteScalarFieldInt32 ( - filehandle, field_name2, data ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_read_scalar_field_i4 F77NAME ( \ - h5bl_3d_read_scalar_field_i4_, \ - H5BL_3D_READ_SCALAR_FIELD_I4 ) -#endif - -h5part_int64_t -h5bl_3d_read_scalar_field_i4 ( - h5part_int64_t *f, - const char *field_name, - h5part_int32_t *data, - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dWriteScalarFieldInt32 ( - filehandle, field_name2, data ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_write_3dvector_field_i4 F77NAME ( \ - h5bl_3d_write_3dvector_field_i4_, \ - H5BL_3D_WRITE_3DVECTOR_FIELD_I4 ) -#endif - -h5part_int64_t -h5bl_3d_write_3dvector_field_i4 ( - h5part_int64_t *f, /*!< file handle */ - const char *field_name, /*!< name of the data set */ - const h5part_int32_t *xval, /*!< array of x component data */ - const h5part_int32_t *yval, /*!< array of y component data */ - const h5part_int32_t *zval, /*!< array of z component data */ - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dWrite3dVectorFieldInt32 ( - filehandle, field_name2, xval, yval, zval ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_3d_read_3dvector_field_i4 F77NAME ( \ - h5bl_3d_read_3dvector_field_i4_, \ - H5BL_3D_READ_3DVECTOR_FIELD_I4 ) -#endif - -h5part_int64_t -h5bl_3d_read_3dvector_field_i4 ( - h5part_int64_t *f, /*!< file handle */ - const char *field_name, /*!< name of the data set */ - h5part_int32_t *xval, /*!< array of x component data */ - h5part_int32_t *yval, /*!< array of y component data */ - h5part_int32_t *zval, /*!< array of z component data */ - const int l_field_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - - h5part_int64_t herr = H5Block3dRead3dVectorFieldInt32 ( - filehandle, field_name2, xval, yval, zval ); - - free ( field_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_writefieldattrib_r8 F77NAME ( \ - h5bl_writefieldattrib_r8_, \ - H5BL_WRITEFIELDATTRIB_R8 ) -#endif - -h5part_int64_t -h5bl_writefieldattrib_r8 ( - h5part_int64_t *f, - const char *field_name, - const char *attrib_name, - const h5part_float64_t *attrib_value, - const h5part_int64_t *attrib_nelem, - const int l_field_name, - const int l_attrib_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - char *attrib_name2 =_H5Part_strdupfor2c ( attrib_name, l_attrib_name ); - - h5part_int64_t herr = H5BlockWriteFieldAttribFloat64 ( - filehandle, field_name2, attrib_name2, - attrib_value, *attrib_nelem ); - - free ( field_name2 ); - free ( attrib_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_writefieldattrib_r4 F77NAME ( \ - h5bl_writefieldattrib_r4_, \ - H5BL_WRITEFIELDATTRIB_R4 ) -#endif - -h5part_int64_t -h5bl_writefieldattrib_r4 ( - h5part_int64_t *f, - const char *field_name, - const char *attrib_name, - const h5part_float32_t *attrib_value, - const h5part_int64_t *attrib_nelem, - const int l_field_name, - const int l_attrib_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - char *attrib_name2 =_H5Part_strdupfor2c ( attrib_name, l_attrib_name ); - - h5part_int64_t herr = H5BlockWriteFieldAttribFloat32 ( - filehandle, field_name2, attrib_name2, - attrib_value, *attrib_nelem ); - - free ( field_name2 ); - free ( attrib_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_writefieldattrib_i8 F77NAME ( \ - h5bl_writefieldattrib_i8_, \ - H5BL_WRITEFIELDATTRIB_I8 ) -#endif - -h5part_int64_t -h5bl_writefieldattrib_i8 ( - h5part_int64_t *f, - const char *field_name, - const char *attrib_name, - const h5part_int64_t *attrib_value, - const h5part_int64_t *attrib_nelem, - const int l_field_name, - const int l_attrib_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - char *attrib_name2 =_H5Part_strdupfor2c ( attrib_name, l_attrib_name ); - - h5part_int64_t herr = H5BlockWriteFieldAttribInt64 ( - filehandle, field_name2, attrib_name2, - attrib_value, *attrib_nelem ); - - free ( field_name2 ); - free ( attrib_name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5bl_writefieldattrib_i4 F77NAME ( \ - h5bl_writefieldattrib_i4_, \ - H5BL_WRITEFIELDATTRIB_I4 ) -#endif - -h5part_int64_t -h5bl_writefieldattrib_i4 ( - h5part_int64_t *f, - const char *field_name, - const char *attrib_name, - const h5part_int32_t *attrib_value, - const h5part_int64_t *attrib_nelem, - const int l_field_name, - const int l_attrib_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *field_name2 = _H5Part_strdupfor2c ( field_name, l_field_name ); - char *attrib_name2 =_H5Part_strdupfor2c ( attrib_name, l_attrib_name ); - - h5part_int64_t herr = H5BlockWriteFieldAttribInt32 ( - filehandle, field_name2, attrib_name2, - attrib_value, *attrib_nelem ); - - free ( field_name2 ); - free ( attrib_name2 ); - return herr; -} diff --git a/src/Fortran/H5Block_F.c b/src/Fortran/H5Block_F.c new file mode 100755 index 0000000..d93b3d5 --- /dev/null +++ b/src/Fortran/H5Block_F.c @@ -0,0 +1,289 @@ +#include + +#include "H5hut.h" +#include "Underscore.h" + +#if defined(F77_SINGLE_UNDERSCORE) +#define F77NAME(a,b) a +#elif defined(F77_CRAY_UNDERSCORE) +#define F77NAME(a,b) b +#elif defined(F77_NO_UNDERSCORE) +#else +#error Error, no way to determine how to construct fortran bindings +#endif + +#if ! defined(F77_NO_UNDERSCORE) + +#define h5bl_3d_setview F77NAME ( \ + h5bl_3d_setview_, \ + H5BL_3D_SETVIEW ) +#define h5bl_3d_getview F77NAME ( \ + h5bl_3d_getview_, \ + H5BL_3D_GETVIEW ) +#define h5bl_3d_setchunk F77NAME ( \ + h5bl_3d_setchunk_, \ + H5BL_3D_SETCHUNK ) +#define h5bl_3d_getreducedview F77NAME ( \ + h5bl_3d_getreducedview_,\ + H5BL_3D_GETREDUCEDVIEW ) +#define h5bl_3d_getproc F77NAME ( \ + h5bl_getproc_, \ + H5BL_GETPROC ) +#define h5bl_getnumfields F77NAME ( \ + h5bl_getnumfields_, \ + H5BL_GETNUMFIELDS ) +#define h5bl_getfieldinfo F77NAME ( \ + h5bl_getfieldinfo_, \ + H5BL_GETFIELDINFO ) +#define h5bl_writefieldattrib_string F77NAME ( \ + h5bl_writefieldattrib_string_, \ + H5BL_WRITEFIELDATTRIB_STRING ) +#define h5bl_getnfieldattribs F77NAME ( \ + h5bl_getnfieldattribs_, \ + H5BL_GETNFIELDATTRIBS ) +#define h5bl_getfieldattribinfo F77NAME ( \ + h5bl_getfieldattribinfo_, \ + h5bl_getfieldattribinfo ) +#define h5bl_readfieldattrib_string F77NAME ( \ + h5bl_readfieldattrib_string_, \ + H5BL_READFIELDATTRIB_STRING ) +#endif + +h5_err_t +h5bl_3d_setview ( + h5_int64_t *f, + const h5_int64_t *i_start, /*!< start index of i */ + const h5_int64_t *i_end, /*!< end index of i */ + const h5_int64_t *j_start, /*!< start index of j */ + const h5_int64_t *j_end, /*!< end index of j */ + const h5_int64_t *k_start, /*!< start index of k */ + const h5_int64_t *k_end /*!< end index of k */ + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5Block3dSetView ( + filehandle, + *i_start-1, *i_end-1, + *j_start-1, *j_end-1, + *k_start-1, *k_end-1 ); +} + +h5_err_t +h5bl_3d_setchunk ( + h5_int64_t *f, + const h5_int64_t *i, + const h5_int64_t *j, + const h5_int64_t *k + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5Block3dSetChunk ( filehandle, *i, *j, *k ); +} + +h5_err_t +h5bl_3d_getview ( + h5_int64_t *f, /*!< file handle */ + const h5_int64_t *proc, + h5_int64_t *i_start, /*!< start index of i */ + h5_int64_t *i_end, /*!< end index of i */ + h5_int64_t *j_start, /*!< start index of j */ + h5_int64_t *j_end, /*!< end index of j */ + h5_int64_t *k_start, /*!< start index of k */ + h5_int64_t *k_end /*!< end index of k */ + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + h5_err_t herr = H5Block3dGetView ( + filehandle, + *proc, + i_start, i_end, j_start, j_end, k_start, k_end ); + if ( herr < 0 ) return herr; + + (*i_start)++; + (*i_end)++; + (*j_start)++; + (*j_end)++; + (*k_start)++; + (*k_end)++; + + return H5_SUCCESS; +} + +h5_err_t +h5bl_3d_getreducedview ( + h5_int64_t *f, + const h5_int64_t *proc, + h5_int64_t *i_start, + h5_int64_t *i_end, + h5_int64_t *j_start, + h5_int64_t *j_end, + h5_int64_t *k_start, + h5_int64_t *k_end + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + h5_err_t herr = H5Block3dGetReducedView ( + filehandle, + *proc, + i_start, i_end, j_start, j_end, k_start, k_end ); + if ( herr < 0 ) return herr; + + (*i_start)++; + (*i_end)++; + (*j_start)++; + (*j_end)++; + (*k_start)++; + (*k_end)++; + + return H5_SUCCESS; +} + +h5_err_t +h5bl_3d_getproc ( + h5_int64_t *f, + const h5_int64_t *i, + const h5_int64_t *j, + const h5_int64_t *k + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5Block3dGetProc ( filehandle, (*i)-1, (*j)-1, (*k)-1 ); +} + +h5_err_t +h5bl_getnumfields ( + h5_int64_t *f /*!< file handle */ + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5BlockGetNumFields ( filehandle ); +} + +h5_err_t +h5bl_getfieldinfo ( + h5_int64_t *f, + const h5_int64_t *idx, + char *field_name, + h5_size_t *grid_rank, + h5_size_t *grid_dims, + h5_size_t *field_dims, + h5_int64_t *type, + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + h5_err_t herr = H5BlockGetFieldInfo ( + filehandle, *idx, field_name, l_field_name, + grid_rank, grid_dims, field_dims, type ); + h5_strc2for ( field_name, l_field_name ); + return herr; +} + +h5_err_t +h5bl_writefieldattrib_string ( + h5_int64_t *f, + const char *field_name, + const char *attrib_name, + const char *attrib_value, + const int l_field_name, + const int l_attrib_name, + const int l_attrib_value + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); + char *attrib_value2 = h5_strdupfor2c ( attrib_value, l_attrib_value ); + + h5_err_t herr = H5BlockWriteFieldAttribString ( + filehandle, field_name2, attrib_name2, attrib_value2 ); + + free ( field_name2 ); + free ( attrib_name2 ); + free ( attrib_value2 ); + return herr; +} + + +h5_err_t +h5bl_getnfieldattribs ( + h5_int64_t *f, + const char *field_name, + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5BlockGetNumFieldAttribs ( + filehandle, field_name2 ); + + free ( field_name2 ); + return herr; +} + +h5_err_t +h5bl_getfieldattribinfo ( + h5_int64_t *f, + const char *field_name, + const h5_int64_t *attrib_idx, + char *attrib_name, + h5_size_t *attrib_nelem, + const int l_field_name, + const int l_attrib_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + h5_int64_t attrib_type; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5BlockGetFieldAttribInfo ( + filehandle, field_name2, *attrib_idx, + attrib_name, l_attrib_name, + &attrib_type, + attrib_nelem ); + + h5_strc2for ( attrib_name, l_attrib_name ); + + free ( field_name2 ); + return herr; +} + + +h5_err_t +h5bl_readfieldattrib_string ( + h5_int64_t *f, + const char *field_name, + const char *attrib_name, + char *attrib_value, + const int l_field_name, + const int l_attrib_name, + const int l_attrib_value + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); + + h5_err_t herr = H5BlockReadFieldAttrib ( + filehandle, field_name2, attrib_name2, attrib_value ); + + h5_strc2for ( attrib_value, l_attrib_value ); + + free ( field_name2 ); + free ( attrib_name2 ); + return herr; +} + diff --git a/src/Fortran/H5BlockReadWrite.f90 b/src/Fortran/H5Block_readwrite.f90 similarity index 63% rename from src/Fortran/H5BlockReadWrite.f90 rename to src/Fortran/H5Block_readwrite.f90 index f3be29b..5aa8ea5 100644 --- a/src/Fortran/H5BlockReadWrite.f90 +++ b/src/Fortran/H5Block_readwrite.f90 @@ -20,10 +20,10 @@ INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r8 ( filehandle, name, data ) END FUNCTION !> \ingroup h5blockf_data -!! See \ref H5Block3dWrite3dVectorFieldFloat64 +!! See \ref H5Block3dWriteVector3dFieldFloat64 !! \return 0 on success or error code !< -INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_r8 ( filehandle, name, x, y, z ) +INTEGER*8 FUNCTION h5bl_3d_write_vector3d_field_r8 ( filehandle, name, x, y, z ) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset REAL*8, INTENT(IN) :: x(*) !< the array of x data to write @@ -32,10 +32,10 @@ INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_r8 ( filehandle, name, x, y, z ) END FUNCTION !> \ingroup h5blockf_data -!! See \ref H5Block3dRead3dVectorFieldFloat64 +!! See \ref H5Block3dReadVector3dFieldFloat64 !! \return 0 on success or error code !< -INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_r8 ( filehandle, name, x, y, z ) +INTEGER*8 FUNCTION h5bl_3d_read_vector3d_field_r8 ( filehandle, name, x, y, z ) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset REAL*8, INTENT(OUT) :: x(*) !< buffer to read the x data into @@ -64,10 +64,10 @@ INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r4 ( filehandle, name, data ) END FUNCTION !> \ingroup h5blockf_data -!! See \ref H5Block3dWrite3dVectorFieldFloat32 +!! See \ref H5Block3dWriteVector3dFieldFloat32 !! \return 0 on success or error code !< -INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_r4 ( filehandle, name, x, y, z ) +INTEGER*8 FUNCTION h5bl_3d_write_vector3d_field_r4 ( filehandle, name, x, y, z ) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset REAL*4, INTENT(IN) :: x(*) !< the array of x data to write @@ -76,10 +76,10 @@ INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_r4 ( filehandle, name, x, y, z ) END FUNCTION !> \ingroup h5blockf_data -!! See \ref H5Block3dRead3dVectorFieldFloat32 +!! See \ref H5Block3dReadVector3dFieldFloat32 !! \return 0 on success or error code !< -INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_r4 ( filehandle, name, x, y, z ) +INTEGER*8 FUNCTION h5bl_3d_read_vector3d_field_r4 ( filehandle, name, x, y, z ) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset REAL*4, INTENT(OUT) :: x(*) !< buffer to read the x data into @@ -108,10 +108,10 @@ INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i8 ( filehandle, name, data ) END FUNCTION !> \ingroup h5blockf_data -!! See \ref H5Block3dWrite3dVectorFieldInt64 +!! See \ref H5Block3dWriteVector3dFieldInt64 !! \return 0 on success or error code !< -INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_i8 ( filehandle, name, x, y, z ) +INTEGER*8 FUNCTION h5bl_3d_write_vector3d_field_i8 ( filehandle, name, x, y, z ) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset INTEGER*8, INTENT(IN) :: x(*) !< the array of x data to write @@ -120,10 +120,10 @@ INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_i8 ( filehandle, name, x, y, z ) END FUNCTION !> \ingroup h5blockf_data -!! See \ref H5Block3dRead3dVectorFieldInt64 +!! See \ref H5Block3dReadVector3dFieldInt64 !! \return 0 on success or error code !< -INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_i8 ( filehandle, name, x, y, z ) +INTEGER*8 FUNCTION h5bl_3d_read_vector3d_field_i8 ( filehandle, name, x, y, z ) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset INTEGER*8, INTENT(OUT) :: x(*) !< buffer to read the x data into @@ -152,10 +152,10 @@ INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i4 ( filehandle, name, data ) END FUNCTION !> \ingroup h5blockf_data -!! See \ref H5Block3dWrite3dVectorFieldInt32 +!! See \ref H5Block3dWriteVector3dFieldInt32 !! \return 0 on success or error code !< -INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_i4 ( filehandle, name, x, y, z ) +INTEGER*8 FUNCTION h5bl_3d_write_vector3d_field_i4 ( filehandle, name, x, y, z ) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset INTEGER*4, INTENT(IN) :: x(*) !< the array of x data to write @@ -164,10 +164,10 @@ INTEGER*8 FUNCTION h5bl_3d_write_3dvector_field_i4 ( filehandle, name, x, y, z ) END FUNCTION !> \ingroup h5blockf_data -!! See \ref H5Block3dRead3dVectorFieldInt32 +!! See \ref H5Block3dReadVector3dFieldInt32 !! \return 0 on success or error code !< -INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_i4 ( filehandle, name, x, y, z ) +INTEGER*8 FUNCTION h5bl_3d_read_vector3d_field_i4 ( filehandle, name, x, y, z ) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset INTEGER*4, INTENT(OUT) :: x(*) !< buffer to read the x data into @@ -175,50 +175,94 @@ INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field_i4 ( filehandle, name, x, y, z ) INTEGER*4, INTENT(OUT) :: z(*) !< buffer to read the z data into END FUNCTION -!> \ingroup h5blockf_attrib +!> \ingroup h5_attrib_f !! See \ref H5BlockWriteFieldAttribFloat64 !! \return 0 on success or error code !< INTEGER*8 FUNCTION h5bl_writefieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field - CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute - REAL*8, INTENT(IN) :: attrib_value(*) !< the array of data to write into the attribute - INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute + REAL*8, INTENT(IN) :: values(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nvalues !< the number of elements in the array END FUNCTION -!> \ingroup h5blockf_attrib +!> \ingroup h5_attrib_f +!! See \ref H5BlockReadFieldAttribFloat64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_readfieldattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute + REAL*8, INTENT(IN) :: values(*) !< the buffer to read into +END FUNCTION + +!> \ingroup h5_attrib_f !! See \ref H5BlockWriteFieldAttribFloat32 !! \return 0 on success or error code !< INTEGER*8 FUNCTION h5bl_writefieldattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field - CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute - REAL*4, INTENT(IN) :: attrib_value(*) !< the array of data to write into the attribute - INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute + REAL*4, INTENT(IN) :: values(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nvalues !< the number of elements in the array END FUNCTION -!> \ingroup h5blockf_attrib +!> \ingroup h5_attrib_f +!! See \ref H5BlockReadFieldAttribFloat32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_readfieldattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute + REAL*4, INTENT(IN) :: values(*) !< the buffer to read into +END FUNCTION + +!> \ingroup h5_attrib_f !! See \ref H5BlockWriteFieldAttribInt64 !! \return 0 on success or error code !< INTEGER*8 FUNCTION h5bl_writefieldattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field - CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute - INTEGER*8, INTENT(IN) :: attrib_value(*) !< the array of data to write into the attribute - INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute + INTEGER*8, INTENT(IN) :: values(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nvalues !< the number of elements in the array END FUNCTION -!> \ingroup h5blockf_attrib +!> \ingroup h5_attrib_f +!! See \ref H5BlockReadFieldAttribInt64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_readfieldattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute + INTEGER*8, INTENT(IN) :: values(*) !< the buffer to read into +END FUNCTION + +!> \ingroup h5_attrib_f !! See \ref H5BlockWriteFieldAttribInt32 !! \return 0 on success or error code !< INTEGER*8 FUNCTION h5bl_writefieldattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field - CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute - INTEGER*4, INTENT(IN) :: attrib_value(*) !< the array of data to write into the attribute - INTEGER*8, INTENT(IN) :: attrib_nelem !< the number of elements in the array + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute + INTEGER*4, INTENT(IN) :: values(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nvalues !< the number of elements in the array +END FUNCTION + +!> \ingroup h5_attrib_f +!! See \ref H5BlockReadFieldAttribInt32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_readfieldattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: field_name !< the name of the field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< the name of the attribute + INTEGER*4, INTENT(IN) :: values(*) !< the buffer to read into END FUNCTION diff --git a/src/Fortran/H5Block_readwrite_F.c b/src/Fortran/H5Block_readwrite_F.c new file mode 100644 index 0000000..4fa1765 --- /dev/null +++ b/src/Fortran/H5Block_readwrite_F.c @@ -0,0 +1,664 @@ + +#include "H5hut.h" +#include "Underscore.h" + +#if defined(F77_SINGLE_UNDERSCORE) +#define F77NAME(a,b) a +#elif defined(F77_CRAY_UNDERSCORE) +#define F77NAME(a,b) b +#elif defined(F77_NO_UNDERSCORE) +#else +#error Error, no way to determine how to construct fortran bindings +#endif + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_write_scalar_field_r8 F77NAME ( \ + h5bl_3d_write_scalar_field_r8_, \ + H5BL_3D_WRITE_SCALAR_FIELD_R8 ) +#endif + +h5_err_t +h5bl_3d_write_scalar_field_r8 ( + h5_int64_t *f, + const char *field_name, + const h5_float64_t *data, + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dWriteScalarFieldFloat64 ( + filehandle, field_name2, data ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_read_scalar_field_r8 F77NAME ( \ + h5bl_3d_read_scalar_field_r8_, \ + H5BL_3D_READ_SCALAR_FIELD_R8 ) +#endif + +h5_err_t +h5bl_3d_read_scalar_field_r8 ( + h5_int64_t *f, + const char *field_name, + h5_float64_t *data, + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dWriteScalarFieldFloat64 ( + filehandle, field_name2, data ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_write_vector3d_field_r8 F77NAME ( \ + h5bl_3d_write_vector3d_field_r8_, \ + H5BL_3D_WRITE_VECTOR3D_FIELD_R8 ) +#endif + +h5_err_t +h5bl_3d_write_vector3d_field_r8 ( + h5_int64_t *f, /*!< file handle */ + const char *field_name, /*!< name of the data set */ + const h5_float64_t *xval, /*!< array of x component data */ + const h5_float64_t *yval, /*!< array of y component data */ + const h5_float64_t *zval, /*!< array of z component data */ + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dWriteVector3dFieldFloat64 ( + filehandle, field_name2, xval, yval, zval ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_read_vector3d_field_r8 F77NAME ( \ + h5bl_3d_read_vector3d_field_r8_, \ + H5BL_3D_READ_VECTOR3D_FIELD_R8 ) +#endif + +h5_err_t +h5bl_3d_read_vector3d_field_r8 ( + h5_int64_t *f, /*!< file handle */ + const char *field_name, /*!< name of the data set */ + h5_float64_t *xval, /*!< array of x component data */ + h5_float64_t *yval, /*!< array of y component data */ + h5_float64_t *zval, /*!< array of z component data */ + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dReadVector3dFieldFloat64 ( + filehandle, field_name2, xval, yval, zval ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_write_scalar_field_r4 F77NAME ( \ + h5bl_3d_write_scalar_field_r4_, \ + H5BL_3D_WRITE_SCALAR_FIELD_R4 ) +#endif + +h5_err_t +h5bl_3d_write_scalar_field_r4 ( + h5_int64_t *f, + const char *field_name, + const h5_float32_t *data, + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dWriteScalarFieldFloat32 ( + filehandle, field_name2, data ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_read_scalar_field_r4 F77NAME ( \ + h5bl_3d_read_scalar_field_r4_, \ + H5BL_3D_READ_SCALAR_FIELD_R4 ) +#endif + +h5_err_t +h5bl_3d_read_scalar_field_r4 ( + h5_int64_t *f, + const char *field_name, + h5_float32_t *data, + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dWriteScalarFieldFloat32 ( + filehandle, field_name2, data ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_write_vector3d_field_r4 F77NAME ( \ + h5bl_3d_write_vector3d_field_r4_, \ + H5BL_3D_WRITE_VECTOR3D_FIELD_R4 ) +#endif + +h5_err_t +h5bl_3d_write_vector3d_field_r4 ( + h5_int64_t *f, /*!< file handle */ + const char *field_name, /*!< name of the data set */ + const h5_float32_t *xval, /*!< array of x component data */ + const h5_float32_t *yval, /*!< array of y component data */ + const h5_float32_t *zval, /*!< array of z component data */ + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dWriteVector3dFieldFloat32 ( + filehandle, field_name2, xval, yval, zval ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_read_vector3d_field_r4 F77NAME ( \ + h5bl_3d_read_vector3d_field_r4_, \ + H5BL_3D_READ_VECTOR3D_FIELD_R4 ) +#endif + +h5_err_t +h5bl_3d_read_vector3d_field_r4 ( + h5_int64_t *f, /*!< file handle */ + const char *field_name, /*!< name of the data set */ + h5_float32_t *xval, /*!< array of x component data */ + h5_float32_t *yval, /*!< array of y component data */ + h5_float32_t *zval, /*!< array of z component data */ + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dReadVector3dFieldFloat32 ( + filehandle, field_name2, xval, yval, zval ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_write_scalar_field_i8 F77NAME ( \ + h5bl_3d_write_scalar_field_i8_, \ + H5BL_3D_WRITE_SCALAR_FIELD_I8 ) +#endif + +h5_err_t +h5bl_3d_write_scalar_field_i8 ( + h5_int64_t *f, + const char *field_name, + const h5_int64_t *data, + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dWriteScalarFieldInt64 ( + filehandle, field_name2, data ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_read_scalar_field_i8 F77NAME ( \ + h5bl_3d_read_scalar_field_i8_, \ + H5BL_3D_READ_SCALAR_FIELD_I8 ) +#endif + +h5_err_t +h5bl_3d_read_scalar_field_i8 ( + h5_int64_t *f, + const char *field_name, + h5_int64_t *data, + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dWriteScalarFieldInt64 ( + filehandle, field_name2, data ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_write_vector3d_field_i8 F77NAME ( \ + h5bl_3d_write_vector3d_field_i8_, \ + H5BL_3D_WRITE_VECTOR3D_FIELD_I8 ) +#endif + +h5_err_t +h5bl_3d_write_vector3d_field_i8 ( + h5_int64_t *f, /*!< file handle */ + const char *field_name, /*!< name of the data set */ + const h5_int64_t *xval, /*!< array of x component data */ + const h5_int64_t *yval, /*!< array of y component data */ + const h5_int64_t *zval, /*!< array of z component data */ + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dWriteVector3dFieldInt64 ( + filehandle, field_name2, xval, yval, zval ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_read_vector3d_field_i8 F77NAME ( \ + h5bl_3d_read_vector3d_field_i8_, \ + H5BL_3D_READ_VECTOR3D_FIELD_I8 ) +#endif + +h5_err_t +h5bl_3d_read_vector3d_field_i8 ( + h5_int64_t *f, /*!< file handle */ + const char *field_name, /*!< name of the data set */ + h5_int64_t *xval, /*!< array of x component data */ + h5_int64_t *yval, /*!< array of y component data */ + h5_int64_t *zval, /*!< array of z component data */ + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dReadVector3dFieldInt64 ( + filehandle, field_name2, xval, yval, zval ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_write_scalar_field_i4 F77NAME ( \ + h5bl_3d_write_scalar_field_i4_, \ + H5BL_3D_WRITE_SCALAR_FIELD_I4 ) +#endif + +h5_err_t +h5bl_3d_write_scalar_field_i4 ( + h5_int64_t *f, + const char *field_name, + const h5_int32_t *data, + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dWriteScalarFieldInt32 ( + filehandle, field_name2, data ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_read_scalar_field_i4 F77NAME ( \ + h5bl_3d_read_scalar_field_i4_, \ + H5BL_3D_READ_SCALAR_FIELD_I4 ) +#endif + +h5_err_t +h5bl_3d_read_scalar_field_i4 ( + h5_int64_t *f, + const char *field_name, + h5_int32_t *data, + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dWriteScalarFieldInt32 ( + filehandle, field_name2, data ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_write_vector3d_field_i4 F77NAME ( \ + h5bl_3d_write_vector3d_field_i4_, \ + H5BL_3D_WRITE_VECTOR3D_FIELD_I4 ) +#endif + +h5_err_t +h5bl_3d_write_vector3d_field_i4 ( + h5_int64_t *f, /*!< file handle */ + const char *field_name, /*!< name of the data set */ + const h5_int32_t *xval, /*!< array of x component data */ + const h5_int32_t *yval, /*!< array of y component data */ + const h5_int32_t *zval, /*!< array of z component data */ + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dWriteVector3dFieldInt32 ( + filehandle, field_name2, xval, yval, zval ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_3d_read_vector3d_field_i4 F77NAME ( \ + h5bl_3d_read_vector3d_field_i4_, \ + H5BL_3D_READ_VECTOR3D_FIELD_I4 ) +#endif + +h5_err_t +h5bl_3d_read_vector3d_field_i4 ( + h5_int64_t *f, /*!< file handle */ + const char *field_name, /*!< name of the data set */ + h5_int32_t *xval, /*!< array of x component data */ + h5_int32_t *yval, /*!< array of y component data */ + h5_int32_t *zval, /*!< array of z component data */ + const int l_field_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + + h5_err_t herr = H5Block3dReadVector3dFieldInt32 ( + filehandle, field_name2, xval, yval, zval ); + + free ( field_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_writefieldattrib_r8 F77NAME ( \ + h5bl_writefieldattrib_r8_, \ + H5BL_WRITEFIELDATTRIB_R8 ) +#endif + +h5_err_t +h5bl_writefieldattrib_r8 ( + h5_int64_t *f, + const char *field_name, + const char *attrib_name, + const h5_float64_t *values, + const h5_size_t *nvalues, + const int l_field_name, + const int l_attrib_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); + + h5_err_t herr = H5BlockWriteFieldAttribFloat64 ( + filehandle, field_name2, attrib_name2, values, *nvalues ); + + free ( field_name2 ); + free ( attrib_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_readfieldattrib_r8 F77NAME ( \ + h5bl_readfieldattrib_r8_, \ + H5BL_READFIELDATTRIB_R8 ) +#endif + +h5_err_t +h5bl_readfieldattrib_r8 ( + h5_int64_t *f, + const char *field_name, + const char *attrib_name, + h5_float64_t *values, + const int l_field_name, + const int l_attrib_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); + + h5_err_t herr = H5BlockReadFieldAttribFloat64 ( + filehandle, field_name2, attrib_name2, values ); + + free ( field_name2 ); + free ( attrib_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_writefieldattrib_r4 F77NAME ( \ + h5bl_writefieldattrib_r4_, \ + H5BL_WRITEFIELDATTRIB_R4 ) +#endif + +h5_err_t +h5bl_writefieldattrib_r4 ( + h5_int64_t *f, + const char *field_name, + const char *attrib_name, + const h5_float32_t *values, + const h5_size_t *nvalues, + const int l_field_name, + const int l_attrib_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); + + h5_err_t herr = H5BlockWriteFieldAttribFloat32 ( + filehandle, field_name2, attrib_name2, values, *nvalues ); + + free ( field_name2 ); + free ( attrib_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_readfieldattrib_r4 F77NAME ( \ + h5bl_readfieldattrib_r4_, \ + H5BL_READFIELDATTRIB_R4 ) +#endif + +h5_err_t +h5bl_readfieldattrib_r4 ( + h5_int64_t *f, + const char *field_name, + const char *attrib_name, + h5_float32_t *values, + const int l_field_name, + const int l_attrib_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); + + h5_err_t herr = H5BlockReadFieldAttribFloat32 ( + filehandle, field_name2, attrib_name2, values ); + + free ( field_name2 ); + free ( attrib_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_writefieldattrib_i8 F77NAME ( \ + h5bl_writefieldattrib_i8_, \ + H5BL_WRITEFIELDATTRIB_I8 ) +#endif + +h5_err_t +h5bl_writefieldattrib_i8 ( + h5_int64_t *f, + const char *field_name, + const char *attrib_name, + const h5_int64_t *values, + const h5_size_t *nvalues, + const int l_field_name, + const int l_attrib_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); + + h5_err_t herr = H5BlockWriteFieldAttribInt64 ( + filehandle, field_name2, attrib_name2, values, *nvalues ); + + free ( field_name2 ); + free ( attrib_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_readfieldattrib_i8 F77NAME ( \ + h5bl_readfieldattrib_i8_, \ + H5BL_READFIELDATTRIB_I8 ) +#endif + +h5_err_t +h5bl_readfieldattrib_i8 ( + h5_int64_t *f, + const char *field_name, + const char *attrib_name, + h5_int64_t *values, + const int l_field_name, + const int l_attrib_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); + + h5_err_t herr = H5BlockReadFieldAttribInt64 ( + filehandle, field_name2, attrib_name2, values ); + + free ( field_name2 ); + free ( attrib_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_writefieldattrib_i4 F77NAME ( \ + h5bl_writefieldattrib_i4_, \ + H5BL_WRITEFIELDATTRIB_I4 ) +#endif + +h5_err_t +h5bl_writefieldattrib_i4 ( + h5_int64_t *f, + const char *field_name, + const char *attrib_name, + const h5_int32_t *values, + const h5_size_t *nvalues, + const int l_field_name, + const int l_attrib_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); + + h5_err_t herr = H5BlockWriteFieldAttribInt32 ( + filehandle, field_name2, attrib_name2, values, *nvalues ); + + free ( field_name2 ); + free ( attrib_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5bl_readfieldattrib_i4 F77NAME ( \ + h5bl_readfieldattrib_i4_, \ + H5BL_READFIELDATTRIB_I4 ) +#endif + +h5_err_t +h5bl_readfieldattrib_i4 ( + h5_int64_t *f, + const char *field_name, + const char *attrib_name, + h5_int32_t *values, + const int l_field_name, + const int l_attrib_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); + + h5_err_t herr = H5BlockReadFieldAttribInt32 ( + filehandle, field_name2, attrib_name2, values ); + + free ( field_name2 ); + free ( attrib_name2 ); + return herr; +} diff --git a/src/Fortran/H5Part.f90 b/src/Fortran/H5Part.f90 index 0ccd0b6..fd4d308 100644 --- a/src/Fortran/H5Part.f90 +++ b/src/Fortran/H5Part.f90 @@ -1,189 +1,6 @@ -! Declaration of subroutines for Fortran Bindings - -!> \defgroup h5part_f90_api H5Part F90 API - -!> \ingroup h5part_f90_api -!! \defgroup h5partf_open File Opening and Closing -!< - -!> \ingroup h5part_f90_api -!! \defgroup h5partf_model Setting up the Data Model -!< - -!> \ingroup h5part_f90_api -!! \defgroup h5partf_data Reading and Writing Datasets -!< - -!> \ingroup h5part_f90_api -!! \defgroup h5partf_attrib Reading and Writing Attributes -!< - - -!!!!!!!! File Opening and Closing !!!!!!!! - -!> \ingroup h5partf_open -!! Opens a file for reading. See \ref H5PartOpenFile -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_openr ( filename ) - CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading -END FUNCTION - -!> \ingroup h5partf_open -!! Opens a file for writing in truncate mode. See \ref H5PartOpenFile -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_openw ( filename ) - CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing -END FUNCTION - -!> \ingroup h5partf_open -!! Opens a file for writing in append mode. See \ref H5PartOpenFile -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_opena ( filename ) - CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending -END FUNCTION - -!> \ingroup h5partf_open -!! Opens a parallel file for reading. -!! See \ref H5PartOpenFileParallel -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_openr_par ( filename, mpi_communicator ) - CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading - INTEGER, INTENT(IN) :: mpi_communicator !< the MPI communicator used by the program -END FUNCTION - -!> \ingroup h5partf_open -!! Opens a parallel file for writing in truncate mode. -!! See \ref H5PartOpenFileParallel -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_openw_par ( filename, mpi_communicator ) - CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing - INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program -END FUNCTION - -!> \ingroup h5partf_open -!! Opens a parallel file for writing in append mode. -!! See \ref H5PartOpenFileParallel -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_opena_par ( filename, mpi_communicator ) - CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending - INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program -END FUNCTION - -!> \ingroup h5partf_open -!! Opens a file for reading and specifies an HDF5 alignment. -!! See \ref H5PartOpenFileAlign -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_openr_align ( filename, align ) - CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading - INTEGER*8, INTENT(IN) :: align !< alignment value in bytes -END FUNCTION - -!> \ingroup h5partf_open -!! Opens a file for writing in truncate mode and specifies an HDF5 alignment. -!! See \ref H5PartOpenFileAlign -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_openw_align ( filename, align ) - CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing - INTEGER*8, INTENT(IN) :: align !< alignment value in bytes -END FUNCTION - -!> \ingroup h5partf_open -!! Opens a file for writing in append mode and specifies an HDF5 alignment. -!! See \ref H5PartOpenFileAlign -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_opena_align ( filename, align ) - CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending - INTEGER*8, INTENT(IN) :: align !< alignment value in bytes -END FUNCTION - -!> \ingroup h5partf_open -!! Opens a parallel file for reading and specifies an HDF5 alignment. -!! See \ref H5PartOpenFileParallelAlign -!! -!! Flags are specified as a comma separated string that can include: -!! -!! - \c fs_lustre - enable optimizations for the Lustre file system -!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver -!! - \c vfd_mpio_ind - use MPI-IO in indepedent mode -!! -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_openr_par_align ( filename, mpi_communicator, align ) - CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for reading - INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program - INTEGER*8, INTENT(IN) :: align !< alignment value in bytes - CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags -END FUNCTION - -!> \ingroup h5partf_open -!! Opens a parallel file for writing in truncate mode and specifies -!! an HDF5 alignment. -!! -!! Flags are specified as a comma separated string that can include: -!! -!! - \c fs_lustre - enable optimizations for the Lustre file system -!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver -!! - \c vfd_mpio_ind - use MPI-IO in indepedent mode -!! -!! See \ref H5PartOpenFileParallelAlign -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_openw_par_align ( filename, mpi_communicator, align, flags ) - CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for writing - INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program - INTEGER*8, INTENT(IN) :: align !< alignment value in bytes - CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags -END FUNCTION - -!> \ingroup h5partf_open -!! Opens a parallel file for writing in append mode and specifies -!! an HDF5 alignment. -!! -!! Flags are specified as a comma separated string that can include: -!! -!! - \c fs_lustre - enable optimizations for the Lustre file system -!! - \c vfd_mpiposix - use the HDF5 MPI-POSIX virtual file driver -!! - \c vfd_mpio_ind - use MPI-IO in indepedent mode -!! -!! See \ref H5PartOpenFileParallelAlign -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_opena_par_align ( filename, mpi_communicator, align, flags ) - CHARACTER(LEN=*), INTENT(IN) :: filename !< the filename to open for appending - INTEGER, INTENT(IN) :: mpi_communicator !< the MPI_Communicator used by the program - INTEGER*8, INTENT(IN) :: align !< alignment value in bytes - CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags -END FUNCTION - -!> \ingroup h5partf_open -!! Closes a file. See \ref H5PartCloseFile -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_close ( filehandle ) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open -END FUNCTION - -!> \ingroup h5partf_open -!! See \ref H5PartSetVerbosityLevel -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_set_verbosity_level ( level ) - INTEGER*8, INTENT(IN) :: level !< the level from 0 (no output) to 5 (most detailed) -END FUNCTION - - !!!!!!!! Setting up the Data Model !!!!!!!! -!> \ingroup h5partf_model +!> \ingroup h5_model_f !! See \ref H5PartSetNumParticles !! \return 0 on success or error code !< @@ -192,7 +9,7 @@ INTEGER*8 FUNCTION h5pt_setnpoints ( filehandle, npoints ) INTEGER*8, INTENT(IN) :: npoints !< the number of particles on *this* processor END FUNCTION -!> \ingroup h5partf_model +!> \ingroup h5_model_f !! See \ref H5PartSetNumParticlesStrided !! \return 0 on success or error code !< @@ -202,24 +19,7 @@ INTEGER*8 FUNCTION h5pt_setnpoints_strided ( filehandle, npoints, stride ) INTEGER*8, INTENT(IN) :: stride !< the stride value (e.g. the number of fields in the particle data array) END FUNCTION -!> \ingroup h5partf_model -!! See \ref H5PartSetStep -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_setstep (filehandle,step) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open - INTEGER*8, INTENT(IN) :: step !< a timestep value >= 1 -END FUNCTION - -!> \ingroup h5partf_model -!! See \ref H5PartGetNumSteps -!! \return the number of steps or error code -!< -INTEGER*8 FUNCTION h5pt_getnsteps (filehandle) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open -END FUNCTION - -!> \ingroup h5partf_model +!> \ingroup h5_model_f !! See \ref H5PartGetNumDatasets !! \return the number of datasets or error code !< @@ -227,7 +27,7 @@ INTEGER*8 FUNCTION h5pt_getndatasets (filehandle) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5partf_model +!> \ingroup h5_model_f !! See \ref H5PartGetNumParticles !! \return the number of particles or error code !< @@ -235,7 +35,7 @@ INTEGER*8 FUNCTION h5pt_getnpoints (filehandle) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5partf_model +!> \ingroup h5_model_f !! See \ref H5PartGetDatasetName !! \return 0 on success or error code !< @@ -245,7 +45,7 @@ INTEGER*8 FUNCTION h5pt_getdatasetname (filehandle,index,name) CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the dataset name into END FUNCTION -!> \ingroup h5partf_model +!> \ingroup h5_model_f !! See \ref H5PartSetView !! \return 0 on success or error code !< @@ -255,7 +55,7 @@ INTEGER*8 FUNCTION h5pt_setview (filehandle,start,end) INTEGER*8, INTENT(IN) :: end !< offset of the last particle in the view (inclusive) END FUNCTION -!> \ingroup h5partf_model +!> \ingroup h5_model_f !! See \ref H5PartSetViewIndices !! \return 0 on success or error code !< @@ -265,7 +65,7 @@ INTEGER*8 FUNCTION h5pt_setview_indices (filehandle,indices,nelem) INTEGER*8, INTENT(IN) :: nelem !< number of particles in the list END FUNCTION -!> \ingroup h5partf_model +!> \ingroup h5_model_f !! See \ref H5PartSetViewEmpty !! \return 0 on success or error code !< @@ -273,7 +73,7 @@ INTEGER*8 FUNCTION h5pt_setview_empty (filehandle) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5partf_model +!> \ingroup h5_model_f !! See \ref H5PartResetView !! \return 0 on success or error code !< @@ -281,7 +81,7 @@ INTEGER*8 FUNCTION h5pt_resetview (filehandle) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5partf_model +!> \ingroup h5_model_f !! See \ref H5PartResetView !! \return 1 if true, 0 if false, or error code !< @@ -289,7 +89,7 @@ INTEGER*8 FUNCTION h5pt_hasview (filehandle) INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open END FUNCTION -!> \ingroup h5partf_model +!> \ingroup h5_model_f !! See \ref H5PartGetView !! \return 0 on success or error code !< @@ -302,7 +102,7 @@ END FUNCTION !!!!!!!! Reading and Writing Datasets !!!!!!!! -!> \ingroup h5partf_data +!> \ingroup h5_data_f !! See \ref H5PartWriteDataFloat64 !! \return 0 on success or error code !< @@ -312,7 +112,7 @@ INTEGER*8 FUNCTION h5pt_writedata_r8 ( filehandle, name, data ) REAL*8, INTENT(IN) :: data(*) !< the array of float64 data to write END FUNCTION -!> \ingroup h5partf_data +!> \ingroup h5_data_f !! See \ref H5PartWriteDataFloat32 !! \return 0 on success or error code !< @@ -322,7 +122,7 @@ INTEGER*8 FUNCTION h5pt_writedata_r4 ( filehandle, name, data ) REAL, INTENT(IN) :: data(*) !< the array of float32 data to write END FUNCTION -!> \ingroup h5partf_data +!> \ingroup h5_data_f !! See \ref H5PartWriteDataInt64 !! \return 0 on success or error code !< @@ -332,7 +132,7 @@ INTEGER*8 FUNCTION h5pt_writedata_i8 ( filehandle, name, data ) INTEGER*8, INTENT(IN) :: data(*) !< the array of int64 data to write END FUNCTION -!> \ingroup h5partf_data +!> \ingroup h5_data_f !! See \ref H5PartWriteDataInt32 !! \return 0 on success or error code !< @@ -343,7 +143,7 @@ INTEGER*8 FUNCTION h5pt_writedata_i4 ( filehandle, name, data ) END FUNCTION -!> \ingroup h5partf_data +!> \ingroup h5_data_f !! See \ref H5PartReadDataFloat64 !! \return 0 on success or error code !< @@ -353,7 +153,7 @@ INTEGER*8 FUNCTION h5pt_readdata_r8 (filehandle,name,data) REAL*8, INTENT(OUT) :: data(*) !< array to read float64 data into END FUNCTION -!> \ingroup h5partf_data +!> \ingroup h5_data_f !! See \ref H5PartReadDataFloat32 !! \return 0 on success or error code !< @@ -363,7 +163,7 @@ INTEGER*8 FUNCTION h5pt_readdata_r4 (filehandle,name,data) REAL, INTENT(OUT) :: data(*) !< array to read float32 data into END FUNCTION -!> \ingroup h5partf_data +!> \ingroup h5_data_f !! See \ref H5PartReadDataInt64 !! \return 0 on success or error code !< @@ -373,7 +173,7 @@ INTEGER*8 FUNCTION h5pt_readdata_i8 (filehandle,name,data) INTEGER*8, INTENT(OUT) :: data(*) !< array to read int64 data into END FUNCTION -!> \ingroup h5partf_data +!> \ingroup h5_data_f !! See \ref H5PartReadDataInt32 !! \return 0 on success or error code !< @@ -383,87 +183,3 @@ INTEGER*8 FUNCTION h5pt_readdata_i4 (filehandle,name,data) INTEGER, INTENT(OUT) :: data(*) !< array to read int32 data into END FUNCTION - -!!!!!!!! Reading and Writing Attributes !!!!!!!! - -!> \ingroup h5partf_attrib -!! See \ref H5PartWriteFileAttribString -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_writefileattrib_string (filehandle,attrib_name,attrib_value) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - CHARACTER(LEN=*), INTENT(IN) :: value !< the string value to store -END FUNCTION - -!> \ingroup h5partf_attrib -!! See \ref H5PartWriteStepAttribString -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_writestepattrib_string (filehandle,attrib_name,attrib_value) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - CHARACTER(LEN=*), INTENT(IN) :: value !< the string value to store -END FUNCTION - -!> \ingroup h5partf_attrib -!! Reads the attribute \c name in the file root ("/") -!! into the string buffer \c value. -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_readfileattrib_string (filehandle,attrib_name,attrib_value) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - CHARACTER(LEN=*), INTENT(OUT) :: value !< buffer to read the string value into -END FUNCTION - -!> \ingroup h5partf_attrib -!! Reads the attribute \c name in the current step -!! into the string buffer \c value. -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_readstepattrib_string (filehandle,attrib_name,attrib_value) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - CHARACTER(LEN=*), INTENT(OUT) :: value !< buffer to read the string value into -END FUNCTION - -!> \ingroup h5partf_attrib -!! See \ref H5PartGetNumStepAttribs -!! \return number of attributes or error code -!< -INTEGER*8 FUNCTION h5pt_getnstepattribs (filehandle) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open -END FUNCTION - -!> \ingroup h5partf_attrib -!! See \ref H5PartGetNumFileAttribs -!! \return number of attributes or error code -!< -INTEGER*8 FUNCTION h5pt_getnfileattribs (filehandle) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open -END FUNCTION - -!> \ingroup h5partf_attrib -!! See \ref H5PartGetStepAttribInfo -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_getstepattribinfo (filehandle,idx,attrib_name,attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open - INTEGER*8, INTENT(IN) :: index !< index of the attribute to query (starting from 0) - CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the attribute name into - INTEGER*8, INTENT(OUT) :: nelem !< number of elements in the attribute's array -END FUNCTION - -!> \ingroup h5partf_attrib -!! See \ref H5PartGetFileAttribInfo -!! \return 0 on success or error code -!< -INTEGER*8 FUNCTION h5pt_getfileattribinfo (filehandle,idx,attrib_name,attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open - INTEGER*8, INTENT(IN) :: index !< index of the attribute to query (starting from 0) - CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the attribute name into - INTEGER*8, INTENT(OUT) :: nelem !< number of elements in the attribute's array -END FUNCTION - - diff --git a/src/Fortran/H5PartAttrib.f90 b/src/Fortran/H5PartAttrib.f90 deleted file mode 100644 index 23fb8b6..0000000 --- a/src/Fortran/H5PartAttrib.f90 +++ /dev/null @@ -1,168 +0,0 @@ - -!< \ingroup h5partf_attrib -!! See \ref H5PartWritefileAttribFloat64 -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_writefileattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - REAL*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute - INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array -END FUNCTION - -!< \ingroup h5partf_attrib -!! Read the attribute \c name into the buffer \c data. -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_readfileattrib_r8 ( filehandle, name, data ) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - REAL*8, INTENT(OUT) :: data(*) !< buffer to read value into -END FUNCTION - -!< \ingroup h5partf_attrib -!! See \ref H5PartWritefileAttribFloat32 -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_writefileattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - REAL*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute - INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array -END FUNCTION - -!< \ingroup h5partf_attrib -!! Read the attribute \c name into the buffer \c data. -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_readfileattrib_r4 ( filehandle, name, data ) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - REAL*4, INTENT(OUT) :: data(*) !< buffer to read value into -END FUNCTION - -!< \ingroup h5partf_attrib -!! See \ref H5PartWritefileAttribInt64 -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_writefileattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - INTEGER*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute - INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array -END FUNCTION - -!< \ingroup h5partf_attrib -!! Read the attribute \c name into the buffer \c data. -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_readfileattrib_i8 ( filehandle, name, data ) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read value into -END FUNCTION - -!< \ingroup h5partf_attrib -!! See \ref H5PartWritefileAttribInt32 -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_writefileattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - INTEGER*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute - INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array -END FUNCTION - -!< \ingroup h5partf_attrib -!! Read the attribute \c name into the buffer \c data. -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_readfileattrib_i4 ( filehandle, name, data ) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read value into -END FUNCTION - -!< \ingroup h5partf_attrib -!! See \ref H5PartWritestepAttribFloat64 -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_writestepattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - REAL*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute - INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array -END FUNCTION - -!< \ingroup h5partf_attrib -!! Read the attribute \c name into the buffer \c data. -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_readstepattrib_r8 ( filehandle, name, data ) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - REAL*8, INTENT(OUT) :: data(*) !< buffer to read value into -END FUNCTION - -!< \ingroup h5partf_attrib -!! See \ref H5PartWritestepAttribFloat32 -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_writestepattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - REAL*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute - INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array -END FUNCTION - -!< \ingroup h5partf_attrib -!! Read the attribute \c name into the buffer \c data. -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_readstepattrib_r4 ( filehandle, name, data ) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - REAL*4, INTENT(OUT) :: data(*) !< buffer to read value into -END FUNCTION - -!< \ingroup h5partf_attrib -!! See \ref H5PartWritestepAttribInt64 -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_writestepattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - INTEGER*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute - INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array -END FUNCTION - -!< \ingroup h5partf_attrib -!! Read the attribute \c name into the buffer \c data. -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_readstepattrib_i8 ( filehandle, name, data ) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read value into -END FUNCTION - -!< \ingroup h5partf_attrib -!! See \ref H5PartWritestepAttribInt32 -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_writestepattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - INTEGER*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute - INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array -END FUNCTION - -!< \ingroup h5partf_attrib -!! Read the attribute \c name into the buffer \c data. -!! \return 0 on success or error code -!> -INTEGER*8 FUNCTION h5pt_readstepattrib_i4 ( filehandle, name, data ) - INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open - CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute - INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read value into -END FUNCTION diff --git a/src/Fortran/H5PartAttribF.c b/src/Fortran/H5PartAttribF.c deleted file mode 100644 index 23e9ac8..0000000 --- a/src/Fortran/H5PartAttribF.c +++ /dev/null @@ -1,600 +0,0 @@ -#include "H5hut.h" -#include "Underscore.h" - -#if defined(F77_SINGLE_UNDERSCORE) -#define F77NAME(a,b) a -#elif defined(F77_CRAY_UNDERSCORE) -#define F77NAME(a,b) b -#elif defined(F77_NO_UNDERSCORE) -#else -#error Error, no way to determine how to construct fortran bindings -#endif - -/* Writing attributes */ -#define h5_writefileattrib_string F77NAME ( \ - h5pt_writefileattrib_string_, \ - H5PT_writefileattrib_string ) -#define h5_writestepattrib_string F77NAME ( \ - h5pt_writestepattrib_string_, \ - H5PT_WRITESTEPATTRIB_STRING ) - -h5_int64_t -h5pt_writefileattrib_string ( - const h5_int64_t *f, - const char *attrib_name, - const char *attrib_value, - const int l_attrib_name, - const int l_attrib_value - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char *attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name); - char *attrib_value2= _H5Part_strdupfor2c (attrib_value,l_attrib_value); - - h5_int64_t herr = H5PartWriteFileAttribString ( - filehandle, attrib_name2, attrib_value2 ); - - free ( attrib_name2 ); - free ( attrib_value2 ); - return herr; -} - -h5_int64_t -h5pt_writestepattrib_string ( - const h5_int64_t *f, - const char *attrib_name, - const char *attrib_value, - const int l_attrib_name, - const int l_attrib_value - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char *attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name); - char *attrib_value2= _H5Part_strdupfor2c (attrib_value,l_attrib_value); - - h5_int64_t herr = H5PartWriteStepAttribString ( - filehandle, attrib_name2, attrib_value2 ); - - free ( attrib_name2 ); - free ( attrib_value2 ); - return herr; -} - - - -/* Reading attributes */ -#define h5pt_getnstepattribs F77NAME ( \ - h5pt_getnstepattribs_, \ - H5PT_GETNSTEPATTRIBS ) -#define h5pt_getnfileattribs F77NAME ( \ - h5pt_getnfileattribs_, \ - H5PT_GETNFILEATTRIBS ) -#define h5pt_getstepattribinfo F77NAME ( \ - h5pt_getstepattribinfo_, \ - H5PT_GETSTEPATTRIBINFO ) -#define h5pt_getfileattribinfo F77NAME ( \ - h5pt_getfileattribinfo_, \ - H5PT_GETFILEATTRIBINFO ) -#define h5pt_readstepattrib_string F77NAME ( \ - h5pt_readstepattrib_string_, \ - H5PT_READSTEPATTRIB_STRING ) -#define h5pt_readfileattrib_string F77NAME ( \ - h5pt_readfileattrib_string_, \ - H5PT_READFILEATTRIB_STRING ) - - - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writefileattrib_r8 F77NAME ( \ - h5pt_writefileattrib_r8_, \ - H5PT_WRITEFILEATTRIB_R8 ) -#endif - -h5_int64_t -h5pt_readstepattrib_string ( - const h5_int64_t *f, - const char *attrib_name, - char *attrib_value, - const int l_attrib_name, - const int l_attrib_value - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char * attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name); - - h5_int64_t herr = H5PartReadStepAttrib ( - filehandle, attrib_name2, attrib_value ); - - _H5Part_strc2for ( attrib_value, l_attrib_value ); - - free ( attrib_name2 ); - return herr; -} - -h5_int64_t -h5pt_readfileattrib_string ( - const h5_int64_t *f, - const char *attrib_name, - char *attrib_value, - const int l_attrib_name, - const int l_attrib_value - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char * attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name); - - h5_int64_t herr = H5PartReadFileAttrib ( - filehandle, attrib_name2, attrib_value ); - - _H5Part_strc2for ( attrib_value, l_attrib_value ); - - free ( attrib_name2 ); - return herr; -} - -h5part_int64_t -h5pt_writefileattrib_r8 ( - h5part_int64_t *f, - const char *name, - const h5part_float64_t *data, - const h5part_float64_t *nelem, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartWriteFileAttrib ( - filehandle, name2, H5PART_FLOAT64, data, *nelem); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writefileattrib_r8 F77NAME ( \ - h5pt_writefileattrib_r8_, \ - H5PT_WRITEFILEATTRIB_R8 ) -#endif - -h5part_int64_t -h5pt_readfileattrib_r8 ( - h5part_int64_t *f, - const char *name, - const h5part_float64_t *data, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartReadFileAttrib ( - filehandle, name2, (void*)data); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writefileattrib_r4 F77NAME ( \ - h5pt_writefileattrib_r4_, \ - H5PT_WRITEFILEATTRIB_R4 ) -#endif - -h5part_int64_t -h5pt_writefileattrib_r4 ( - h5part_int64_t *f, - const char *name, - const h5part_float32_t *data, - const h5part_float32_t *nelem, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartWriteFileAttrib ( - filehandle, name2, H5PART_FLOAT32, data, *nelem); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writefileattrib_r4 F77NAME ( \ - h5pt_writefileattrib_r4_, \ - H5PT_WRITEFILEATTRIB_R4 ) -#endif - -h5part_int64_t -h5pt_readfileattrib_r4 ( - h5part_int64_t *f, - const char *name, - const h5part_float32_t *data, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartReadFileAttrib ( - filehandle, name2, (void*)data); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writefileattrib_i8 F77NAME ( \ - h5pt_writefileattrib_i8_, \ - H5PT_WRITEFILEATTRIB_I8 ) -#endif - -h5part_int64_t -h5pt_writefileattrib_i8 ( - h5part_int64_t *f, - const char *name, - const h5part_int64_t *data, - const h5part_int64_t *nelem, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartWriteFileAttrib ( - filehandle, name2, H5PART_INT64, data, *nelem); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writefileattrib_i8 F77NAME ( \ - h5pt_writefileattrib_i8_, \ - H5PT_WRITEFILEATTRIB_I8 ) -#endif - -h5part_int64_t -h5pt_readfileattrib_i8 ( - h5part_int64_t *f, - const char *name, - const h5part_int64_t *data, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartReadFileAttrib ( - filehandle, name2, (void*)data); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writefileattrib_i4 F77NAME ( \ - h5pt_writefileattrib_i4_, \ - H5PT_WRITEFILEATTRIB_I4 ) -#endif - -h5part_int64_t -h5pt_writefileattrib_i4 ( - h5part_int64_t *f, - const char *name, - const h5part_int32_t *data, - const h5part_int32_t *nelem, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartWriteFileAttrib ( - filehandle, name2, H5PART_INT32, data, *nelem); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writefileattrib_i4 F77NAME ( \ - h5pt_writefileattrib_i4_, \ - H5PT_WRITEFILEATTRIB_I4 ) -#endif - -h5part_int64_t -h5pt_readfileattrib_i4 ( - h5part_int64_t *f, - const char *name, - const h5part_int32_t *data, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartReadFileAttrib ( - filehandle, name2, (void*)data); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writestepattrib_r8 F77NAME ( \ - h5pt_writestepattrib_r8_, \ - H5PT_WRITESTEPATTRIB_R8 ) -#endif - -h5part_int64_t -h5pt_writestepattrib_r8 ( - h5part_int64_t *f, - const char *name, - const h5part_float64_t *data, - const h5part_float64_t *nelem, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartWriteStepAttrib ( - filehandle, name2, H5PART_FLOAT64, data, *nelem); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writestepattrib_r8 F77NAME ( \ - h5pt_writestepattrib_r8_, \ - H5PT_WRITESTEPATTRIB_R8 ) -#endif - -h5part_int64_t -h5pt_readstepattrib_r8 ( - h5part_int64_t *f, - const char *name, - const h5part_float64_t *data, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartReadStepAttrib ( - filehandle, name2, (void*)data); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writestepattrib_r4 F77NAME ( \ - h5pt_writestepattrib_r4_, \ - H5PT_WRITESTEPATTRIB_R4 ) -#endif - -h5part_int64_t -h5pt_writestepattrib_r4 ( - h5part_int64_t *f, - const char *name, - const h5part_float32_t *data, - const h5part_float32_t *nelem, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartWriteStepAttrib ( - filehandle, name2, H5PART_FLOAT32, data, *nelem); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writestepattrib_r4 F77NAME ( \ - h5pt_writestepattrib_r4_, \ - H5PT_WRITESTEPATTRIB_R4 ) -#endif - -h5part_int64_t -h5pt_readstepattrib_r4 ( - h5part_int64_t *f, - const char *name, - const h5part_float32_t *data, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartReadStepAttrib ( - filehandle, name2, (void*)data); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writestepattrib_i8 F77NAME ( \ - h5pt_writestepattrib_i8_, \ - H5PT_WRITESTEPATTRIB_I8 ) -#endif - -h5part_int64_t -h5pt_writestepattrib_i8 ( - h5part_int64_t *f, - const char *name, - const h5part_int64_t *data, - const h5part_int64_t *nelem, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartWriteStepAttrib ( - filehandle, name2, H5PART_INT64, data, *nelem); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writestepattrib_i8 F77NAME ( \ - h5pt_writestepattrib_i8_, \ - H5PT_WRITESTEPATTRIB_I8 ) -#endif - -h5part_int64_t -h5pt_readstepattrib_i8 ( - h5part_int64_t *f, - const char *name, - const h5part_int64_t *data, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartReadStepAttrib ( - filehandle, name2, (void*)data); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writestepattrib_i4 F77NAME ( \ - h5pt_writestepattrib_i4_, \ - H5PT_WRITESTEPATTRIB_I4 ) -#endif - -h5part_int64_t -h5pt_writestepattrib_i4 ( - h5part_int64_t *f, - const char *name, - const h5part_int32_t *data, - const h5part_int32_t *nelem, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartWriteStepAttrib ( - filehandle, name2, H5PART_INT32, data, *nelem); - - free ( name2 ); - return herr; -} - -#if ! defined(F77_NO_UNDERSCORE) -#define h5pt_writestepattrib_i4 F77NAME ( \ - h5pt_writestepattrib_i4_, \ - H5PT_WRITESTEPATTRIB_I4 ) -#endif - -h5part_int64_t -h5pt_readstepattrib_i4 ( - h5part_int64_t *f, - const char *name, - const h5part_int32_t *data, - const int l_name - ) { - - H5PartFile *filehandle = (H5PartFile*)(size_t)*f; - - char *name2 =_H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartReadStepAttrib ( - filehandle, name2, (void*)data); - - free ( name2 ); - return herr; -} - -/*** QUERY ***/ - -h5_int64_t -h5pt_getnstepattribs ( - const h5_int64_t *f - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartGetNumStepAttribs ( filehandle ); -} - -h5_int64_t -h5pt_getnfileattribs ( - const h5_int64_t *f - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartGetNumFileAttribs ( filehandle ); -} - -h5_int64_t -h5pt_getstepattribinfo ( - const h5_int64_t *f, - const h5_int64_t *idx, - char *name, - h5_int64_t *nelem, - const int l_name - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - h5_int64_t type; - - h5_int64_t herr = H5PartGetStepAttribInfo ( - filehandle, *idx, name, l_name, &type, nelem); - - _H5Part_strc2for( name, l_name ); - return herr; -} - -h5_int64_t -h5pt_getfileattribinfo ( - const h5_int64_t *f, - const h5_int64_t *idx, - char *name, - h5_int64_t *nelem, - const int l_name ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - h5_int64_t type; - - h5_int64_t herr = H5PartGetFileAttribInfo ( - filehandle, *idx, name, l_name, &type, nelem); - - _H5Part_strc2for( name, l_name ); - return herr; -} - - diff --git a/src/Fortran/H5PartF.c b/src/Fortran/H5PartF.c deleted file mode 100755 index 9dfb108..0000000 --- a/src/Fortran/H5PartF.c +++ /dev/null @@ -1,913 +0,0 @@ -#include -#include - -#include "H5hut.h" -#include "Underscore.h" - -#if defined(F77_SINGLE_UNDERSCORE) -#define F77NAME(a,b) a -#elif defined(F77_CRAY_UNDERSCORE) -#define F77NAME(a,b) b -#elif defined(F77_NO_UNDERSCORE) -#else -#error Error, no way to determine how to construct fortran bindings -#endif - -#if ! defined(F77_NO_UNDERSCORE) - -/* open/close interface */ -#define h5pt_openr F77NAME ( \ - h5pt_openr_, \ - H5PT_OPENR ) -#define h5pt_openw F77NAME ( \ - h5pt_openw_, \ - H5PT_OPENW ) -#define h5pt_opena F77NAME ( \ - h5pt_opena_, \ - H5PT_OPENA ) -#define h5pt_openr_par F77NAME ( \ - h5pt_openr_par_, \ - H5PT_OPENR_PAR ) -#define h5pt_openw_par F77NAME ( \ - h5pt_openw_par_, \ - H5PT_OPENW_PAR ) -#define h5pt_opena_par F77NAME ( \ - h5pt_opena_par_, \ - H5PT_OPENA_PAR ) -#define h5pt_openr_align F77NAME ( \ - h5pt_openr_align_, \ - H5PT_OPENR_ALIGN ) -#define h5pt_openw_align F77NAME ( \ - h5pt_openw_align_, \ - H5PT_OPENW_ALIGN ) -#define h5pt_opena_align F77NAME ( \ - h5pt_opena_align_, \ - H5PT_OPENA_ALIGN ) -#define h5pt_openr_par_align F77NAME ( \ - h5pt_openr_par_align_, \ - H5PT_OPENR_PAR_ALIGN ) -#define h5pt_openw_par_align F77NAME ( \ - h5pt_openw_par_align_, \ - H5PT_OPENW_PAR_ALIGN ) -#define h5pt_opena_par_align F77NAME ( \ - h5pt_opena_par_align_, \ - H5PT_OPENA_PAR_ALIGN ) - -#define h5pt_close F77NAME ( \ - h5pt_close_, \ - H5PT_CLOSE) - -/* writing interface */ -#define h5pt_setnpoints F77NAME ( \ - h5pt_setnpoints_, \ - H5PT_SETNPOINTS ) -#define h5pt_setnpoints_strided F77NAME ( \ - h5pt_setnpoints_strided_, \ - H5PT_SETNPOINTS_STRIDED ) -#define h5pt_setstep F77NAME ( \ - h5pt_setstep_, \ - H5PT_SETSTEP ) -#define h5pt_writedata_r8 F77NAME ( \ - h5pt_writedata_r8_, \ - H5PT_WRITEDATA_R8 ) -#define h5pt_writedata_r4 F77NAME ( \ - h5pt_writedata_r4_, \ - H5PT_WRITEDATA_R4 ) -#define h5pt_writedata_i8 F77NAME ( \ - h5pt_writedata_i8_, \ - H5PT_WRITEDATA_I8 ) -#define h5pt_writedata_i4 F77NAME ( \ - h5pt_writedata_i4_, \ - H5PT_WRITEDATA_I4 ) - -/* Reading interface (define dataset, step, particles, attributes) */ -#define h5pt_getnsteps F77NAME ( \ - h5pt_getnsteps_, \ - H5PT_GETNSTEPS ) -#define h5pt_getndatasets F77NAME ( \ - h5pt_getndatasets_, \ - H5PT_GETNDATASETS ) -#define h5pt_getnpoints F77NAME ( \ - h5pt_getnpoints_, \ - H5PT_GETNPOINTS ) -#define h5pt_getdatasetname F77NAME ( \ - h5pt_getdatasetname_, \ - H5PT_GETDATASETNAME ) - -/* Views and parallelism */ -#define h5pt_setview F77NAME ( \ - h5pt_setview_, \ - H5PT_SETVIEW ) -#define h5pt_setview_indices F77NAME ( \ - h5pt_setview_indices_, \ - H5PT_SETVIEW_INDICES ) -#define h5pt_setview_empty F77NAME ( \ - h5pt_setview_empty_, \ - H5PT_SETVIEW_EMPTY ) -#define h5pt_resetview F77NAME ( \ - h5pt_resetview_, \ - H5PT_RESETVIEW ) -#define h5pt_hasview F77NAME ( \ - h5pt_hasview_, \ - H5PT_HASVIEW ) -#define h5pt_getview F77NAME ( \ - h5pt_getview_, \ - H5PT_GETVIEW ) - -/* Reading data */ -#define h5pt_readdata_r8 F77NAME ( \ - h5pt_readdata_r8_, \ - H5PT_READDATA_R8 ) -#define h5pt_readdata_r4 F77NAME ( \ - h5pt_readdata_r4_, \ - H5PT_READDATA_R4 ) -#define h5pt_readdata_i8 F77NAME ( \ - h5pt_readdata_i8_, \ - H5PT_READDATA_I8 ) -#define h5pt_readdata_i4 F77NAME ( \ - h5pt_readdata_i4_, \ - H5PT_READDATA_I4 ) - -/* Writing attributes */ -#define h5pt_writefileattrib_string F77NAME ( \ - h5pt_writefileattrib_string_, \ - H5PT_writefileattrib_string ) -#define h5pt_writestepattrib_string F77NAME ( \ - h5pt_writestepattrib_string_, \ - H5PT_WRITESTEPATTRIB_STRING ) - -/* Reading attributes */ -#define h5pt_getnstepattribs F77NAME ( \ - h5pt_getnstepattribs_, \ - H5PT_GETNSTEPATTRIBS ) -#define h5pt_getnfileattribs F77NAME ( \ - h5pt_getnfileattribs_, \ - H5PT_GETNFILEATTRIBS ) -#define h5pt_getstepattribinfo F77NAME ( \ - h5pt_getstepattribinfo_, \ - H5PT_GETSTEPATTRIBINFO ) -#define h5pt_getfileattribinfo F77NAME ( \ - h5pt_getfileattribinfo_, \ - H5PT_GETFILEATTRIBINFO ) -#define h5pt_readstepattrib_string F77NAME ( \ - h5pt_readstepattrib_string_, \ - H5PT_READSTEPATTRIB_STRING ) -#define h5pt_readfileattrib_string F77NAME ( \ - h5pt_readfileattrib_string_, \ - H5PT_READFILEATTRIB_STRING ) - -/* error handling */ -#define h5pt_set_verbosity_level F77NAME ( \ - h5pt_set_verbosity_level_, \ - H5PT_SET_VERBOSITY_LEVEL ) - -#endif - -static char * -_H5Part_strdupfor2c ( - const char *s, - const ssize_t len - ) { - - char *dup = (char*)malloc ( len + 1 ); - strncpy ( dup, s, len ); - char *p = dup + len; - do { - *p-- = '\0'; - } while ( *p == ' ' ); - return dup; -} - -static char * -_H5Part_strc2for ( - char * const str, - const ssize_t l_str - ) { - - size_t len = strlen ( str ); - memset ( str+len, ' ', l_str-len ); - - return str; -} - -static char -_H5Part_flagsfor2c ( - char * flags - ) { - - char fbits = 0x00; - - flags = strtok ( flags, "," ); - while ( flags != NULL ) { - if ( strcmp ( flags, "vfd_mpiposix" ) == 0 ) - fbits |= H5_VFD_MPIPOSIX; - else if ( strcmp ( flags, "vfd_independent" ) == 0 ) - fbits |= H5_VFD_INDEPENDENT; - flags = strtok ( NULL, "," ); - } - - return fbits; -} - -/* open/close interface */ -h5_err_t -h5pt_openr ( - const char *file_name, - const int l_file_name - ) { - - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - - h5_file_t* f = H5OpenFile ( file_name2, H5PART_READ ); - - free ( file_name2 ); - return (h5part_int64_t)(size_t)f; -} - -h5_err_t -h5pt_openw ( - const char *file_name, - const int l_file_name - ) { - - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - - h5_file_t* f = H5OpenFile ( file_name2, H5PART_WRITE ); - - free ( file_name2 ); - return (h5part_int64_t)(size_t)f; -} - -h5part_int64_t -h5pt_opena ( - const char *file_name, - const int l_file_name - ) { - - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - - h5_file_t* f = H5OpenFile ( file_name2, H5PART_APPEND ); - - free ( file_name2 ); - return (h5part_int64_t)(size_t)f; -} - -h5part_int64_t -h5pt_openr_align ( - const char *file_name, - const h5part_int64_t *align, - const int l_file_name - ) { - - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - - h5_file_t* f = H5OpenFileAlign ( file_name2, H5PART_READ, *align ); - - free ( file_name2 ); - return (h5part_int64_t)(size_t)f; -} - -h5part_int64_t -h5pt_openw_align ( - const char *file_name, - const h5part_int64_t *align, - const int l_file_name - ) { - - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - - h5_file_t* f = H5OpenFileAlign ( file_name2, H5PART_WRITE, *align ); - - free ( file_name2 ); - return (h5part_int64_t)(size_t)f; -} - -h5part_int64_t -h5pt_opena_align ( - const char *file_name, - const h5part_int64_t *align, - const int l_file_name - ) { - - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - - h5_file_t* f = H5OpenFileAlign ( file_name2, H5PART_APPEND, *align ); - - free ( file_name2 ); - return (h5part_int64_t)(size_t)f; -} - -#ifdef PARALLEL_IO -h5part_int64_t -h5pt_openr_par ( - const char *file_name, - MPI_Fint *fcomm, - const int l_file_name - ) { - - MPI_Comm ccomm = MPI_Comm_f2c (*fcomm); - - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - - h5_file_t* f = H5OpenFileParallel ( - file_name2, H5PART_READ, ccomm ); - - free ( file_name2 ); - return (h5part_int64_t)(size_t)f; -} - -h5part_int64_t -h5pt_openw_par ( - const char *file_name, - MPI_Fint *fcomm, - const int l_file_name - ) { - - MPI_Comm ccomm = MPI_Comm_f2c (*fcomm); - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - - h5_file_t* f = H5OpenFileParallel ( - file_name2, H5PART_WRITE, ccomm ); - - free ( file_name2 ); - return (h5part_int64_t)(size_t)f; -} - -h5part_int64_t -h5pt_opena_par ( - const char *file_name, - MPI_Fint *fcomm, - const int l_file_name - ) { - - MPI_Comm ccomm = MPI_Comm_f2c (*fcomm); - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - - h5_file_t* f = H5OpenFileParallel ( - file_name2, H5PART_APPEND, ccomm ); - - free ( file_name2 ); - return (h5part_int64_t)(size_t)f; -} - -h5part_int64_t -h5pt_openr_par_align ( - const char *file_name, - MPI_Fint *fcomm, - const h5part_int64_t *align, - const char *flags, - const int l_file_name, - const int l_flags - ) { - - MPI_Comm ccomm = MPI_Comm_f2c (*fcomm); - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - char *flags2 = _H5Part_strdupfor2c ( flags, l_flags ); - - char fbits = H5PART_READ | _H5Part_flagsfor2c ( flags2 ); - - h5_file_t* f = H5OpenFileParallelAlign ( - file_name2, fbits, ccomm, *align ); - - free ( file_name2 ); - free ( flags2 ); - return (h5part_int64_t)(size_t)f; -} - -h5part_int64_t -h5pt_openw_par_align ( - const char *file_name, - MPI_Fint *fcomm, - const h5part_int64_t *align, - const char *flags, - const int l_file_name, - const int l_flags - ) { - - MPI_Comm ccomm = MPI_Comm_f2c (*fcomm); - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - char *flags2 = _H5Part_strdupfor2c ( flags, l_flags ); - - char fbits = H5PART_WRITE | _H5Part_flagsfor2c ( flags2 ); - - h5_file_t* f = H5OpenFileParallelAlign ( - file_name2, fbits, ccomm, *align ); - - free ( file_name2 ); - free ( flags2 ); - return (h5part_int64_t)(size_t)f; -} - -h5part_int64_t -h5pt_opena_par_align ( - const char *file_name, - MPI_Fint *fcomm, - const h5part_int64_t *align, - const char *flags, - const int l_file_name, - const int l_flags - ) { - - MPI_Comm ccomm = MPI_Comm_f2c (*fcomm); - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - char *flags2 = _H5Part_strdupfor2c ( flags, l_flags ); - - char fbits = H5PART_APPEND | _H5Part_flagsfor2c ( flags2 ); - - h5_file_t* f = H5OpenFileParallelAlign ( - file_name2, fbits, ccomm, *align ); - - free ( file_name2 ); - free ( flags2 ); - return (h5part_int64_t)(size_t)f; -} -#endif - -h5part_int64_t -h5pt_close ( - const h5part_int64_t *f - ) { - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartCloseFile ( filehandle ); -} - -/*==============Writing and Setting Dataset info========*/ - -h5part_int64_t -h5pt_readstep ( - const h5part_int64_t *f, - const h5part_int64_t *step, - h5part_float64_t *x, - h5part_float64_t *y, - h5part_float64_t *z, - h5part_float64_t *px, - h5part_float64_t *py, - h5part_float64_t *pz, - h5part_int64_t *id - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartReadParticleStep ( - filehandle,(*step)-1,x,y,z,px,py,pz,id); -} - - -h5part_int64_t -h5pt_setnpoints ( - const h5part_int64_t *f, - h5part_int64_t *np - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartSetNumParticles ( filehandle, *np ); -} - -h5part_int64_t -h5pt_setnpoints_strided ( - const h5part_int64_t *f, - h5part_int64_t *np, - h5part_int64_t *stride - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartSetNumParticlesStrided ( filehandle, *np, *stride ); -} - -h5part_int64_t -h5pt_setstep ( - const h5part_int64_t *f, - h5part_int64_t *step ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartSetStep ( filehandle, (*step)-1 ); -} - -h5part_int64_t -h5pt_writedata_r8 ( - const h5part_int64_t *f, - const char *name, - const h5part_float64_t *data, - const int l_name ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char *name2 = _H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartWriteDataFloat64 ( - filehandle, name2, data ); - - free ( name2 ); - - return herr; -} - -h5part_int64_t -h5pt_writedata_r4 ( - const h5part_int64_t *f, - const char *name, - const h5part_float32_t *data, - const int l_name ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char *name2 = _H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartWriteDataFloat32 ( - filehandle, name2, data ); - - free ( name2 ); - - return herr; -} - -h5part_int64_t -h5pt_writedata_i8 ( - const h5part_int64_t *f, - const char *name, - const h5part_int64_t *data, - const int l_name ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char *name2 = _H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartWriteDataInt64 ( - filehandle, name2, data ); - - free ( name2 ); - - return herr; -} - -h5part_int64_t -h5pt_writedata_i4 ( - const h5part_int64_t *f, - const char *name, - const h5part_int32_t *data, - const int l_name ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char *name2 = _H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartWriteDataInt32 ( - filehandle, name2, data ); - - free ( name2 ); - - return herr; -} - -/*==============Reading Data Characteristics============*/ - -h5part_int64_t -h5pt_getnsteps ( - const h5part_int64_t *f - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartGetNumSteps ( filehandle ); -} - -h5part_int64_t -h5pt_getndatasets ( - const h5part_int64_t *f - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartGetNumDatasets ( filehandle ); -} - -h5part_int64_t -h5pt_getnpoints ( - const h5part_int64_t *f - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartGetNumParticles ( filehandle ); -} - -h5part_int64_t -h5pt_getdatasetname ( - const h5part_int64_t *f, - const h5part_int64_t *index, - char *name, - const int l_name - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - h5part_int64_t herr = H5PartGetDatasetName ( - filehandle, *index, name, l_name ); - - _H5Part_strc2for ( name, l_name ); - return herr; -} - -/*=============Setting and getting views================*/ - -h5part_int64_t -h5pt_setview ( - const h5part_int64_t *f, - const h5part_int64_t *start, - const h5part_int64_t *end - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartSetView ( filehandle, *start, *end ); -} - -h5part_int64_t -h5pt_setview_indices ( - const h5part_int64_t *f, - const h5part_int64_t *indices, - const h5part_int64_t *nelem - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartSetViewIndices ( filehandle, indices, *nelem ); -} - -h5part_int64_t -h5pt_setview_empty ( - const h5part_int64_t *f - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartSetViewEmpty ( filehandle ); -} - -h5part_int64_t -h5pt_resetview ( - const h5part_int64_t *f - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartResetView ( filehandle ); -} - -h5part_int64_t -h5pt_hasview ( - const h5part_int64_t *f - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartHasView ( filehandle ); -} - -h5part_int64_t -h5pt_getview ( - const h5part_int64_t *f, - h5part_int64_t *start, - h5part_int64_t *end - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartGetView ( filehandle, start, end); -} -/*==================Reading data ============*/ -h5part_int64_t -h5pt_readdata_r8 ( - const h5part_int64_t *f, - const char *name, - h5part_float64_t *array, - const int l_name - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char *name2 = _H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartReadDataFloat64 ( - filehandle, name2, array ); - - free ( name2 ); - return herr; -} - -h5part_int64_t -h5pt_readdata_r4 ( - const h5part_int64_t *f, - const char *name, - h5part_float32_t *array, - const int l_name - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char *name2 = _H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartReadDataFloat32 ( - filehandle, name2, array ); - - free ( name2 ); - return herr; -} - -h5part_int64_t -h5pt_readdata_i8 ( - const h5part_int64_t *f, - const char *name, - h5part_int64_t *array, - const int l_name - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char *name2 = _H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartReadDataInt64 ( - filehandle, name2, array ); - - free ( name2 ); - return herr; -} - -h5part_int64_t -h5pt_readdata_i4 ( - const h5part_int64_t *f, - const char *name, - h5part_int32_t *array, - const int l_name - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char *name2 = _H5Part_strdupfor2c ( name, l_name ); - - h5part_int64_t herr = H5PartReadDataInt32 ( - filehandle, name2, array ); - - free ( name2 ); - return herr; -} - -/*=================== Attributes ================*/ - -h5part_int64_t -h5pt_writefileattrib_string ( - const h5part_int64_t *f, - const char *attrib_name, - const char *attrib_value, - const int l_attrib_name, - const int l_attrib_value - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char *attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name); - char *attrib_value2= _H5Part_strdupfor2c (attrib_value,l_attrib_value); - - h5part_int64_t herr = H5PartWriteFileAttribString ( - filehandle, attrib_name2, attrib_value2 ); - - free ( attrib_name2 ); - free ( attrib_value2 ); - return herr; -} - -h5part_int64_t -h5pt_writestepattrib_string ( - const h5part_int64_t *f, - const char *attrib_name, - const char *attrib_value, - const int l_attrib_name, - const int l_attrib_value - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char *attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name); - char *attrib_value2= _H5Part_strdupfor2c (attrib_value,l_attrib_value); - - h5part_int64_t herr = H5PartWriteStepAttribString ( - filehandle, attrib_name2, attrib_value2 ); - - free ( attrib_name2 ); - free ( attrib_value2 ); - return herr; -} - -/* Reading attributes ************************* */ - -h5part_int64_t -h5pt_getnstepattribs ( - const h5part_int64_t *f - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartGetNumStepAttribs ( filehandle ); -} - -h5part_int64_t -h5pt_getnfileattribs ( - const h5part_int64_t *f - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - return H5PartGetNumFileAttribs ( filehandle ); -} - -h5part_int64_t -h5pt_getstepattribinfo ( - const h5part_int64_t *f, - const h5part_int64_t *idx, - char *name, - h5part_int64_t *nelem, - const int l_name - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - h5part_int64_t type; - - h5part_int64_t herr = H5PartGetStepAttribInfo ( - filehandle, *idx, name, l_name, &type, nelem); - - _H5Part_strc2for( name, l_name ); - return herr; -} - -h5part_int64_t -h5pt_getfileattribinfo ( - const h5part_int64_t *f, - const h5part_int64_t *idx, - char *name, - h5part_int64_t *nelem, - const int l_name ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - h5part_int64_t type; - - h5part_int64_t herr = H5PartGetFileAttribInfo ( - filehandle, *idx, name, l_name, &type, nelem); - - _H5Part_strc2for( name, l_name ); - return herr; -} - -h5part_int64_t -h5pt_readstepattrib_string ( - const h5part_int64_t *f, - const char *attrib_name, - char *attrib_value, - const int l_attrib_name, - const int l_attrib_value - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char * attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name); - - h5part_int64_t herr = H5PartReadStepAttrib ( - filehandle, attrib_name2, attrib_value ); - - _H5Part_strc2for ( attrib_value, l_attrib_value ); - - free ( attrib_name2 ); - return herr; -} - -h5part_int64_t -h5pt_readfileattrib_string ( - const h5part_int64_t *f, - const char *attrib_name, - char *attrib_value, - const int l_attrib_name, - const int l_attrib_value - ) { - - h5_file_t *filehandle = (h5_file_t*)(size_t)*f; - - char * attrib_name2 = _H5Part_strdupfor2c (attrib_name,l_attrib_name); - - h5part_int64_t herr = H5PartReadFileAttrib ( - filehandle, attrib_name2, attrib_value ); - - _H5Part_strc2for ( attrib_value, l_attrib_value ); - - free ( attrib_name2 ); - return herr; -} - -h5part_int64_t -h5pt_set_verbosity_level ( - const h5part_int64_t *level - ) { - return H5PartSetVerbosityLevel ( *level ); -} diff --git a/src/Fortran/H5Part_F.c b/src/Fortran/H5Part_F.c new file mode 100755 index 0000000..2243a25 --- /dev/null +++ b/src/Fortran/H5Part_F.c @@ -0,0 +1,370 @@ +#include "H5hut.h" +#include "Underscore.h" + +#if defined(F77_SINGLE_UNDERSCORE) +#define F77NAME(a,b) a +#elif defined(F77_CRAY_UNDERSCORE) +#define F77NAME(a,b) b +#elif defined(F77_NO_UNDERSCORE) +#else +#error Error, no way to determine how to construct fortran bindings +#endif + +#if ! defined(F77_NO_UNDERSCORE) + +#define h5pt_setnpoints F77NAME ( \ + h5pt_setnpoints_, \ + H5PT_SETNPOINTS ) +#define h5pt_setnpoints_strided F77NAME ( \ + h5pt_setnpoints_strided_, \ + H5PT_SETNPOINTS_STRIDED ) +#define h5pt_getnsteps F77NAME ( \ + h5pt_getnsteps_, \ + H5PT_GETNSTEPS ) +#define h5pt_getndatasets F77NAME ( \ + h5pt_getndatasets_, \ + H5PT_GETNDATASETS ) +#define h5pt_getnpoints F77NAME ( \ + h5pt_getnpoints_, \ + H5PT_GETNPOINTS ) +#define h5pt_getdatasetname F77NAME ( \ + h5pt_getdatasetname_, \ + H5PT_GETDATASETNAME ) +#define h5pt_setview F77NAME ( \ + h5pt_setview_, \ + H5PT_SETVIEW ) +#define h5pt_setview_indices F77NAME ( \ + h5pt_setview_indices_, \ + H5PT_SETVIEW_INDICES ) +#define h5pt_resetview F77NAME ( \ + h5pt_resetview_, \ + H5PT_RESETVIEW ) +#define h5pt_hasview F77NAME ( \ + h5pt_hasview_, \ + H5PT_HASVIEW ) +#define h5pt_getview F77NAME ( \ + h5pt_getview_, \ + H5PT_GETVIEW ) +#define h5pt_writedata_r8 F77NAME ( \ + h5pt_writedata_r8_, \ + H5PT_WRITEDATA_R8 ) +#define h5pt_writedata_r4 F77NAME ( \ + h5pt_writedata_r4_, \ + H5PT_WRITEDATA_R4 ) +#define h5pt_writedata_i8 F77NAME ( \ + h5pt_writedata_i8_, \ + H5PT_WRITEDATA_I8 ) +#define h5pt_writedata_i4 F77NAME ( \ + h5pt_writedata_i4_, \ + H5PT_WRITEDATA_I4 ) +#define h5pt_readdata_r8 F77NAME ( \ + h5pt_readdata_r8_, \ + H5PT_READDATA_R8 ) +#define h5pt_readdata_r4 F77NAME ( \ + h5pt_readdata_r4_, \ + H5PT_READDATA_R4 ) +#define h5pt_readdata_i8 F77NAME ( \ + h5pt_readdata_i8_, \ + H5PT_READDATA_I8 ) +#define h5pt_readdata_i4 F77NAME ( \ + h5pt_readdata_i4_, \ + H5PT_READDATA_I4 ) + +#endif + +h5_err_t +h5pt_setnpoints ( + const h5_int64_t *f, + h5_int64_t *np + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5PartSetNumParticles ( filehandle, *np ); +} + +h5_err_t +h5pt_setnpoints_strided ( + const h5_int64_t *f, + h5_int64_t *np, + h5_int64_t *stride + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5PartSetNumParticlesStrided ( filehandle, *np, *stride ); +} + +/*==============Reading Data Characteristics============*/ + +h5_err_t +h5pt_getnsteps ( + const h5_int64_t *f + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5PartGetNumSteps ( filehandle ); +} + +h5_err_t +h5pt_getndatasets ( + const h5_int64_t *f + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5PartGetNumDatasets ( filehandle ); +} + +h5_err_t +h5pt_getnpoints ( + const h5_int64_t *f + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5PartGetNumParticles ( filehandle ); +} + +h5_err_t +h5pt_getdatasetname ( + const h5_int64_t *f, + const h5_int64_t *index, + char *name, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + h5_int64_t herr = H5PartGetDatasetName ( + filehandle, *index, name, l_name ); + + _h5_strc2for ( name, l_name ); + return herr; +} + +/*=============Setting and getting views================*/ + +h5_err_t +h5pt_setview ( + const h5_int64_t *f, + const h5_int64_t *start, + const h5_int64_t *end + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5PartSetView ( filehandle, *start, *end ); +} + +h5_err_t +h5pt_setview_indices ( + const h5_int64_t *f, + const h5_int64_t *indices, + const h5_int64_t *nelem + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5PartSetViewIndices ( filehandle, indices, *nelem ); +} + +h5_err_t +h5pt_setview_empty ( + const h5_int64_t *f + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5PartSetViewEmpty ( filehandle ); +} + +h5_err_t +h5pt_resetview ( + const h5_int64_t *f + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5PartResetView ( filehandle ); +} + +h5_err_t +h5pt_hasview ( + const h5_int64_t *f + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5PartHasView ( filehandle ); +} + +h5_err_t +h5pt_getview ( + const h5_int64_t *f, + h5_int64_t *start, + h5_int64_t *end + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5PartGetView ( filehandle, start, end); +} + + +/*==================Writing data ============*/ +h5_err_t +h5pt_writedata_r8 ( + const h5_int64_t *f, + const char *name, + const h5_float64_t *data, + const int l_name ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_int64_t herr = H5PartWriteDataFloat64 ( + filehandle, name2, data ); + + free ( name2 ); + + return herr; +} + +h5_err_t +h5pt_writedata_r4 ( + const h5_int64_t *f, + const char *name, + const h5_float32_t *data, + const int l_name ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_int64_t herr = H5PartWriteDataFloat32 ( + filehandle, name2, data ); + + free ( name2 ); + + return herr; +} + +h5_err_t +h5pt_writedata_i8 ( + const h5_int64_t *f, + const char *name, + const h5_int64_t *data, + const int l_name ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_int64_t herr = H5PartWriteDataInt64 ( + filehandle, name2, data ); + + free ( name2 ); + + return herr; +} + +h5_err_t +h5pt_writedata_i4 ( + const h5_int64_t *f, + const char *name, + const h5_int32_t *data, + const int l_name ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_int64_t herr = H5PartWriteDataInt32 ( + filehandle, name2, data ); + + free ( name2 ); + + return herr; +} + + +/*==================Reading data ============*/ +h5_err_t +h5pt_readdata_r8 ( + const h5_int64_t *f, + const char *name, + h5_float64_t *array, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_int64_t herr = H5PartReadDataFloat64 ( + filehandle, name2, array ); + + free ( name2 ); + return herr; +} + +h5_err_t +h5pt_readdata_r4 ( + const h5_int64_t *f, + const char *name, + h5_float32_t *array, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_int64_t herr = H5PartReadDataFloat32 ( + filehandle, name2, array ); + + free ( name2 ); + return herr; +} + +h5_err_t +h5pt_readdata_i8 ( + const h5_int64_t *f, + const char *name, + h5_int64_t *array, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_int64_t herr = H5PartReadDataInt64 ( + filehandle, name2, array ); + + free ( name2 ); + return herr; +} + +h5_err_t +h5pt_readdata_i4 ( + const h5_int64_t *f, + const char *name, + h5_int32_t *array, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_int64_t herr = H5PartReadDataInt32 ( + filehandle, name2, array ); + + free ( name2 ); + return herr; +} + diff --git a/src/Fortran/H5F.c b/src/Fortran/H5_F.c similarity index 73% rename from src/Fortran/H5F.c rename to src/Fortran/H5_F.c index 9ebd489..0b47aae 100644 --- a/src/Fortran/H5F.c +++ b/src/Fortran/H5_F.c @@ -1,5 +1,5 @@ +#include #include -#include #include "H5hut.h" #include "Underscore.h" @@ -51,35 +51,8 @@ #endif -static char * -_H5Part_strdupfor2c ( - const char *s, - const ssize_t len - ) { - - char *dup = (char*)malloc ( len + 1 ); - strncpy ( dup, s, len ); - char *p = dup + len; - do { - *p-- = '\0'; - } while ( *p == ' ' ); - return dup; -} - -static char * -_H5Part_strc2for ( - char * const str, - const ssize_t l_str - ) { - - size_t len = strlen ( str ); - memset ( str+len, ' ', l_str-len ); - - return str; -} - static h5_int32_t -_H5Part_flagsfor2c ( +_flagsfor2c ( char * flags ) { @@ -98,13 +71,13 @@ _H5Part_flagsfor2c ( } /* open/close interface */ -h5_int64_t +h5_err_t h5_openr ( const char *file_name, const int l_file_name ) { - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); + char *file_name2 = h5_strdupfor2c ( file_name, l_file_name ); h5_file_t* f = H5OpenFile ( file_name2, H5_O_RDONLY, 0 ); @@ -112,13 +85,13 @@ h5_openr ( return (h5_int64_t)(size_t)f; } -h5_int64_t +h5_err_t h5_openw ( const char *file_name, const int l_file_name ) { - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); + char *file_name2 = h5_strdupfor2c ( file_name, l_file_name ); h5_file_t* f = H5OpenFile ( file_name2, H5_O_WRONLY, 0 ); @@ -126,13 +99,13 @@ h5_openw ( return (h5_int64_t)(size_t)f; } -h5_int64_t +h5_err_t h5pt_opena ( const char *file_name, const int l_file_name ) { - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); + char *file_name2 = h5_strdupfor2c ( file_name, l_file_name ); h5_file_t* f = H5OpenFile ( file_name2, H5_O_APPEND, 0 ); @@ -141,7 +114,7 @@ h5pt_opena ( } #ifdef PARALLEL_IO -h5_int64_t +h5_err_t h5_openr_par ( const char *file_name, MPI_Fint *fcomm, @@ -151,10 +124,10 @@ h5_openr_par ( ) { MPI_Comm ccomm = MPI_Comm_f2c (*fcomm); - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - char *flags2 = _H5Part_strdupfor2c ( flags, l_flags ); + char *file_name2 = h5_strdupfor2c ( file_name, l_file_name ); + char *flags2 = h5_strdupfor2c ( flags, l_flags ); - h5_int32_t fbits = H5_O_RDONLY | _H5Part_flagsfor2c ( flags2 ); + h5_int32_t fbits = H5_O_RDONLY | _flagsfor2c ( flags2 ); h5_file_t* f = H5OpenFile ( file_name2, ccomm, fbits ); @@ -163,7 +136,7 @@ h5_openr_par ( return (h5_int64_t)(size_t)f; } -h5_int64_t +h5_err_t h5_openw_par ( const char *file_name, MPI_Fint *fcomm, @@ -173,10 +146,10 @@ h5_openw_par ( ) { MPI_Comm ccomm = MPI_Comm_f2c (*fcomm); - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - char *flags2 = _H5Part_strdupfor2c ( flags, l_flags ); + char *file_name2 = h5_strdupfor2c ( file_name, l_file_name ); + char *flags2 = h5_strdupfor2c ( flags, l_flags ); - h5_int32_t fbits = H5_O_WRONLY | _H5Part_flagsfor2c ( flags2 ); + h5_int32_t fbits = H5_O_WRONLY | _flagsfor2c ( flags2 ); h5_file_t* f = H5OpenFile ( file_name2, fbits, ccomm ); @@ -185,7 +158,7 @@ h5_openw_par ( return (h5_int64_t)(size_t)f; } -h5_int64_t +h5_err_t h5pt_opena_par_align ( const char *file_name, MPI_Fint *fcomm, @@ -196,10 +169,10 @@ h5pt_opena_par_align ( ) { MPI_Comm ccomm = MPI_Comm_f2c (*fcomm); - char *file_name2 = _H5Part_strdupfor2c ( file_name, l_file_name ); - char *flags2 = _H5Part_strdupfor2c ( flags, l_flags ); + char *file_name2 = h5_strdupfor2c ( file_name, l_file_name ); + char *flags2 = h5_strdupfor2c ( flags, l_flags ); - h5_int32_t fbits = H5_O_APPEND | _H5Part_flagsfor2c ( flags2 ); + h5_int32_t fbits = H5_O_APPEND | _flagsfor2c ( flags2 ); h5_file_t* f = H5OpenFile( file_name2, fbits, ccomm ); @@ -218,7 +191,16 @@ h5_close ( return H5CloseFile ( filehandle ); } -h5_int64_t +h5_err_t +h5_check ( + const h5_int64_t *f + ) { + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5CheckFile ( filehandle ); +} + +h5_err_t h5_setstep ( const h5_int64_t *f, h5_int64_t *step ) { @@ -228,7 +210,7 @@ h5_setstep ( return H5SetStep ( filehandle, (*step)-1 ); } -h5_int64_t +h5_err_t h5_getnsteps ( const h5_int64_t *f ) { @@ -238,7 +220,7 @@ h5_getnsteps ( return H5GetNumSteps ( filehandle ); } -h5_int64_t +h5_err_t h5_set_verbosity_level ( const h5_int64_t *level ) { diff --git a/src/Fortran/H5_attribs.f90 b/src/Fortran/H5_attribs.f90 new file mode 100644 index 0000000..759ab6f --- /dev/null +++ b/src/Fortran/H5_attribs.f90 @@ -0,0 +1,249 @@ +!!!!!!!! Reading and Writing Attributes !!!!!!!! + +!> \ingroup h5_attrib_f +!! See \ref H5WriteFileAttribString +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_writefileattrib_string (filehandle,attrib_name,attrib_value) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + CHARACTER(LEN=*), INTENT(IN) :: value !< the string value to store +END FUNCTION + +!> \ingroup h5_attrib_f +!! See \ref H5WriteStepAttribString +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_writestepattrib_string (filehandle,attrib_name,attrib_value) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + CHARACTER(LEN=*), INTENT(IN) :: value !< the string value to store +END FUNCTION + +!> \ingroup h5_attrib_f +!! See \ref H5ReadFileAttribString +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_readfileattrib_string (filehandle,attrib_name,attrib_value) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + CHARACTER(LEN=*), INTENT(OUT) :: value !< buffer to read the string value into +END FUNCTION + +!> \ingroup h5_attrib_f +!! See \ref H5ReadStepAttribString +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_readstepattrib_string (filehandle,attrib_name,attrib_value) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + CHARACTER(LEN=*), INTENT(OUT) :: value !< buffer to read the string value into +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5WriteFileAttribFloat64 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_writefileattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + REAL*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5ReadFileAttribFloat64 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_readfileattrib_r8 ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + REAL*8, INTENT(OUT) :: data(*) !< buffer to read value into +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5WriteFileAttribFloat32 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_writefileattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + REAL*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5ReadFileAttribFloat32 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_readfileattrib_r4 ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + REAL*4, INTENT(OUT) :: data(*) !< buffer to read value into +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5WriteFileAttribInt64 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_writefileattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + INTEGER*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5ReadFileAttribInt64 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_readfileattrib_i8 ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read value into +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5WriteFileAttribInt32 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_writefileattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + INTEGER*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5ReadFileAttribInt32 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_readfileattrib_i4 ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read value into +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5WriteStepAttribFloat64 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_writestepattrib_r8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + REAL*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5ReadStepAttribFloat64 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_readstepattrib_r8 ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + REAL*8, INTENT(OUT) :: data(*) !< buffer to read value into +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5WriteStepAttribFloat32 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_writestepattrib_r4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + REAL*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5ReadStepAttribFloat32 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_readstepattrib_r4 ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + REAL*4, INTENT(OUT) :: data(*) !< buffer to read value into +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5WriteStepAttribInt64 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_writestepattrib_i8 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + INTEGER*8, INTENT(IN) :: data(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5ReadStepAttribInt64 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_readstepattrib_i8 ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + INTEGER*8, INTENT(OUT) :: data(*) !< buffer to read value into +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5WriteStepAttribInt32 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_writestepattrib_i4 ( filehandle, field_name, attrib_name, attrib_value, attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + INTEGER*4, INTENT(IN) :: data(*) !< the array of data to write into the attribute + INTEGER*8, INTENT(IN) :: nelem !< the number of elements in the array +END FUNCTION + +!< \ingroup h5_attrib_f +!! See \ref H5ReadStepAttribInt32 +!! \return 0 on success or error code +!> +INTEGER*8 FUNCTION h5_readstepattrib_i4 ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned at file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the attribute + INTEGER*4, INTENT(OUT) :: data(*) !< buffer to read value into +END FUNCTION + +!> \ingroup h5_attrib_f +!! See \ref H5GetNumStepAttribs +!! \return number of attributes or error code +!< +INTEGER*8 FUNCTION h5_getnstepattribs (filehandle) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open +END FUNCTION + +!> \ingroup h5_attrib_f +!! See \ref H5GetNumFileAttribs +!! \return number of attributes or error code +!< +INTEGER*8 FUNCTION h5_getnfileattribs (filehandle) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open +END FUNCTION + +!> \ingroup h5_attrib_f +!! See \ref H5GetStepAttribInfo +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_getstepattribinfo (filehandle,idx,attrib_name,attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + INTEGER*8, INTENT(IN) :: index !< index of the attribute to query (starting from 0) + CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the attribute name into + INTEGER*8, INTENT(OUT) :: nelem !< number of elements in the attribute's array +END FUNCTION + +!> \ingroup h5_attrib_f +!! See \ref H5GetFileAttribInfo +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_getfileattribinfo (filehandle,idx,attrib_name,attrib_nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + INTEGER*8, INTENT(IN) :: index !< index of the attribute to query (starting from 0) + CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the attribute name into + INTEGER*8, INTENT(OUT) :: nelem !< number of elements in the attribute's array +END FUNCTION + + diff --git a/src/Fortran/H5_attribs_F.c b/src/Fortran/H5_attribs_F.c new file mode 100644 index 0000000..53dbad6 --- /dev/null +++ b/src/Fortran/H5_attribs_F.c @@ -0,0 +1,592 @@ +#include + +#include "H5hut.h" +#include "Underscore.h" + +#if defined(F77_SINGLE_UNDERSCORE) +#define F77NAME(a,b) a +#elif defined(F77_CRAY_UNDERSCORE) +#define F77NAME(a,b) b +#elif defined(F77_NO_UNDERSCORE) +#else +#error Error, no way to determine how to construct fortran bindings +#endif + +#if ! defined(F77_NO_UNDERSCORE) + +#define h5_writefileattrib_string F77NAME ( \ + h5_writefileattrib_string_, \ + H5_writefileattrib_string ) +#define h5_writestepattrib_string F77NAME ( \ + h5_writestepattrib_string_, \ + H5_WRITESTEPATTRIB_STRING ) +#define h5_readstepattrib_string F77NAME ( \ + h5_readstepattrib_string_, \ + h5_READSTEPATTRIB_STRING ) +#define h5_readfileattrib_string F77NAME ( \ + h5_readfileattrib_string_, \ + h5_READFILEATTRIB_STRING ) + +#endif + +h5_err_t +h5_writefileattrib_string ( + const h5_int64_t *f, + const char *attrib_name, + const char *attrib_value, + const int l_attrib_name, + const int l_attrib_value + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *attrib_name2 = h5_strdupfor2c (attrib_name,l_attrib_name); + char *attrib_value2= h5_strdupfor2c (attrib_value,l_attrib_value); + + h5_err_t herr = H5WriteFileAttribString ( + filehandle, attrib_name2, attrib_value2 ); + + free ( attrib_name2 ); + free ( attrib_value2 ); + return herr; +} + +h5_err_t +h5_writestepattrib_string ( + const h5_int64_t *f, + const char *attrib_name, + const char *attrib_value, + const int l_attrib_name, + const int l_attrib_value + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *attrib_name2 = h5_strdupfor2c (attrib_name,l_attrib_name); + char *attrib_value2= h5_strdupfor2c (attrib_value,l_attrib_value); + + h5_err_t herr = H5WriteStepAttribString ( + filehandle, attrib_name2, attrib_value2 ); + + free ( attrib_name2 ); + free ( attrib_value2 ); + return herr; +} + + +h5_err_t +h5_readstepattrib_string ( + const h5_int64_t *f, + const char *attrib_name, + char *attrib_value, + const int l_attrib_name, + const int l_attrib_value + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char * attrib_name2 = h5_strdupfor2c (attrib_name,l_attrib_name); + + h5_err_t herr = H5ReadStepAttribString ( + filehandle, attrib_name2, attrib_value ); + + h5_strc2for ( attrib_value, l_attrib_value ); + + free ( attrib_name2 ); + return herr; +} + +h5_err_t +h5_readfileattrib_string ( + const h5_int64_t *f, + const char *attrib_name, + char *attrib_value, + const int l_attrib_name, + const int l_attrib_value + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char * attrib_name2 = h5_strdupfor2c (attrib_name,l_attrib_name); + + h5_err_t herr = H5ReadFileAttribString ( + filehandle, attrib_name2, attrib_value ); + + h5_strc2for ( attrib_value, l_attrib_value ); + + free ( attrib_name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writefileattrib_r8 F77NAME ( \ + h5_writefileattrib_r8_, \ + h5_WRITEFILEATTRIB_R8 ) +#endif + +h5_err_t +h5_writefileattrib_r8 ( + h5_int64_t *f, + const char *name, + const h5_float64_t *data, + const h5_float64_t *nelem, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5WriteFileAttribFloat64( + filehandle, name2, data, *nelem); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writefileattrib_r8 F77NAME ( \ + h5_writefileattrib_r8_, \ + h5_WRITEFILEATTRIB_R8 ) +#endif + +h5_err_t +h5_readfileattrib_r8 ( + h5_int64_t *f, + const char *name, + h5_float64_t *data, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5ReadFileAttribFloat64(filehandle, name2, data); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writefileattrib_r4 F77NAME ( \ + h5_writefileattrib_r4_, \ + h5_WRITEFILEATTRIB_R4 ) +#endif + +h5_err_t +h5_writefileattrib_r4 ( + h5_int64_t *f, + const char *name, + const h5_float32_t *data, + const h5_float32_t *nelem, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5WriteFileAttribFloat32( + filehandle, name2, data, *nelem); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writefileattrib_r4 F77NAME ( \ + h5_writefileattrib_r4_, \ + h5_WRITEFILEATTRIB_R4 ) +#endif + +h5_err_t +h5_readfileattrib_r4 ( + h5_int64_t *f, + const char *name, + h5_float32_t *data, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5ReadFileAttribFloat32(filehandle, name2, data); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writefileattrib_i8 F77NAME ( \ + h5_writefileattrib_i8_, \ + h5_WRITEFILEATTRIB_I8 ) +#endif + +h5_err_t +h5_writefileattrib_i8 ( + h5_int64_t *f, + const char *name, + const h5_int64_t *data, + const h5_int64_t *nelem, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5WriteFileAttribInt64(filehandle, name2, data, *nelem); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writefileattrib_i8 F77NAME ( \ + h5_writefileattrib_i8_, \ + h5_WRITEFILEATTRIB_I8 ) +#endif + +h5_err_t +h5_readfileattrib_i8 ( + h5_int64_t *f, + const char *name, + h5_int64_t *data, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5ReadFileAttribInt64(filehandle, name2, data); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writefileattrib_i4 F77NAME ( \ + h5_writefileattrib_i4_, \ + h5_WRITEFILEATTRIB_I4 ) +#endif + +h5_err_t +h5_writefileattrib_i4 ( + h5_int64_t *f, + const char *name, + const h5_int32_t *data, + const h5_int32_t *nelem, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5WriteFileAttribInt32(filehandle, name2, data, *nelem); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writefileattrib_i4 F77NAME ( \ + h5_writefileattrib_i4_, \ + h5_WRITEFILEATTRIB_I4 ) +#endif + +h5_err_t +h5_readfileattrib_i4 ( + h5_int64_t *f, + const char *name, + h5_int32_t *data, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5ReadFileAttribInt32(filehandle, name2, data); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writestepattrib_r8 F77NAME ( \ + h5_writestepattrib_r8_, \ + h5_WRITESTEPATTRIB_R8 ) +#endif + +h5_err_t +h5_writestepattrib_r8 ( + h5_int64_t *f, + const char *name, + const h5_float64_t *data, + const h5_float64_t *nelem, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5WriteStepAttribFloat64( + filehandle, name2, data, *nelem); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writestepattrib_r8 F77NAME ( \ + h5_writestepattrib_r8_, \ + h5_WRITESTEPATTRIB_R8 ) +#endif + +h5_err_t +h5_readstepattrib_r8 ( + h5_int64_t *f, + const char *name, + h5_float64_t *data, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5ReadStepAttribFloat64(filehandle, name2, data); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writestepattrib_r4 F77NAME ( \ + h5_writestepattrib_r4_, \ + h5_WRITESTEPATTRIB_R4 ) +#endif + +h5_err_t +h5_writestepattrib_r4 ( + h5_int64_t *f, + const char *name, + const h5_float32_t *data, + const h5_float32_t *nelem, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5WriteStepAttribFloat32( + filehandle, name2, data, *nelem); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writestepattrib_r4 F77NAME ( \ + h5_writestepattrib_r4_, \ + h5_WRITESTEPATTRIB_R4 ) +#endif + +h5_err_t +h5_readstepattrib_r4 ( + h5_int64_t *f, + const char *name, + h5_float32_t *data, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5ReadStepAttribFloat32(filehandle, name2, data); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writestepattrib_i8 F77NAME ( \ + h5_writestepattrib_i8_, \ + h5_WRITESTEPATTRIB_I8 ) +#endif + +h5_err_t +h5_writestepattrib_i8 ( + h5_int64_t *f, + const char *name, + const h5_int64_t *data, + const h5_int64_t *nelem, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5WriteStepAttribInt64(filehandle, name2, data, *nelem); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writestepattrib_i8 F77NAME ( \ + h5_writestepattrib_i8_, \ + h5_WRITESTEPATTRIB_I8 ) +#endif + +h5_err_t +h5_readstepattrib_i8 ( + h5_int64_t *f, + const char *name, + h5_int64_t *data, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5ReadStepAttribInt64(filehandle, name2, data); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writestepattrib_i4 F77NAME ( \ + h5_writestepattrib_i4_, \ + h5_WRITESTEPATTRIB_I4 ) +#endif + +h5_err_t +h5_writestepattrib_i4 ( + h5_int64_t *f, + const char *name, + const h5_int32_t *data, + const h5_int32_t *nelem, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5WriteStepAttribInt32(filehandle, name2, data, *nelem); + + free ( name2 ); + return herr; +} + +#if ! defined(F77_NO_UNDERSCORE) +#define h5_writestepattrib_i4 F77NAME ( \ + h5_writestepattrib_i4_, \ + h5_WRITESTEPATTRIB_I4 ) +#endif + +h5_err_t +h5_readstepattrib_i4 ( + h5_int64_t *f, + const char *name, + h5_int32_t *data, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + char *name2 = h5_strdupfor2c ( name, l_name ); + + h5_err_t herr = H5ReadStepAttribInt32(filehandle, name2, data); + + free ( name2 ); + return herr; +} + +/*** QUERY ***/ + +#if ! defined(F77_NO_UNDERSCORE) + +#define h5_getnstepattribs F77NAME ( \ + h5_getnstepattribs_, \ + h5_GETNSTEPATTRIBS ) +#define h5_getnfileattribs F77NAME ( \ + h5_getnfileattribs_, \ + h5_GETNFILEATTRIBS ) +#define h5_getstepattribinfo F77NAME ( \ + h5_getstepattribinfo_, \ + h5_GETSTEPATTRIBINFO ) +#define h5_getfileattribinfo F77NAME ( \ + h5_getfileattribinfo_, \ + h5_GETFILEATTRIBINFO ) + +#endif + +h5_err_t +h5_getnstepattribs ( + const h5_int64_t *f + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5GetNumStepAttribs ( filehandle ); +} + +h5_err_t +h5_getnfileattribs ( + const h5_int64_t *f + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + + return H5GetNumFileAttribs ( filehandle ); +} + +h5_err_t +h5_getstepattribinfo ( + const h5_int64_t *f, + const h5_int64_t *idx, + char *name, + h5_int64_t *nelem, + const int l_name + ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_int64_t type; + + h5_err_t herr = H5GetStepAttribInfo ( + filehandle, *idx, name, l_name, &type, nelem); + + h5_strc2for( name, l_name ); + return herr; +} + +h5_err_t +h5_getfileattribinfo ( + const h5_int64_t *f, + const h5_int64_t *idx, + char *name, + h5_int64_t *nelem, + const int l_name ) { + + h5_file_t *filehandle = (h5_file_t*)(size_t)*f; + h5_int64_t type; + + h5_err_t herr = H5GetFileAttribInfo ( + filehandle, *idx, name, l_name, &type, nelem); + + h5_strc2for( name, l_name ); + return herr; +} + diff --git a/src/Fortran/Makefile.am b/src/Fortran/Makefile.am index f434351..3fe3aed 100644 --- a/src/Fortran/Makefile.am +++ b/src/Fortran/Makefile.am @@ -7,24 +7,22 @@ LIBS = $(HDFLIB) @MPILIB@ INCLUDES = -I../include -I@HDF5ROOT@/include @MPIINC@ -INCLUDES = -I@HDF5ROOT@/include @MPIINC@ +F90_FILES = H5.f90 \ + H5_attribs.f90 \ + H5Part.f90 \ + H5Block.f90 \ + H5Block_readwrite.f90 -EXTRA_HEADERS = H5PartPrivate.h \ - H5BlockPrivate.h \ - H5MultiBlockPrivate.h \ - H5PartAttrib.h +EXTRA_HEADERS = ../include/H5hut.h # Extra files that I wish to include in the dist tar ball. EXTRA_DIST = TestUnderscoreC.c \ TestUnderscore.f \ - H5Part.f90 \ - H5PartAttrib.f90 \ - H5Block.f90 \ - H5BlockReadWrite.f90 \ - $(EXTRA_HEADERS) + $(F90_FILES) # Files that I don't want to include in the dist tar ball -nodist_include_HEADERS = ../include/H5PartF.h @UNDERSCORE_H@ +#nodist_include_HEADERS = ../include/H5hutF.h @UNDERSCORE_H@ +nodist_include_HEADERS = ../include/H5hutF.h # What to build... Will be determined by configure script. lib_LIBRARIES = @FORTRAN_LIB@ @@ -32,27 +30,15 @@ lib_LIBRARIES = @FORTRAN_LIB@ # Listing of all possible targets that I may build. EXTRA_LIBRARIES = libH5hutF.a -# Header files that I wish to install in $(prefix)/include -include_HEADERS = \ - ../include/H5hut.h \ - ../include/H5.h \ - ../include/H5_inquiry.h \ - ../include/H5_attribs.h \ - ../include/H5Block.h \ - ../include/H5Fed.h \ - ../include/H5Fed_store.h \ - ../include/H5Fed_tags.h \ - ../include/H5Part.h +libH5hutF_a_SOURCES = H5_F.c \ + H5_attribs_F.c \ + H5Part_F.c \ + H5Block_F.c \ + H5Block_readwrite_F.c -libH5hutF_a_SOURCES = $(libH5Part_a_SOURCES) \ - H5PartF.c \ - H5PartAttribF.c \ - H5BlockF.c \ - H5BlockReadWriteF.c +all: ../include/H5hutF.h ../lib/libH5hutF.a -all: ../include/H5PartF.h ./lib/libH5hutF.a - -../include/H5PartF.h: H5Part.f90 H5PartAttrib.f90 H5Block.f90 H5BlockReadWrite.f90 +../include/H5hutF.h: $(F90_FILES) awk '/INTEGER\*8 FUNCTION/{print "\t" $$1 " " $$3}' $^ >$@ ../lib/libH5hutF.a: libH5hutF.a diff --git a/src/Makefile.am b/src/Makefile.am index 226f3aa..3dde480 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,3 @@ # test level Makefile.am -SUBDIRS = h5core C +SUBDIRS = h5core C Fortran diff --git a/src/h5core/Makefile.am b/src/h5core/Makefile.am index 0f568ed..2468144 100644 --- a/src/h5core/Makefile.am +++ b/src/h5core/Makefile.am @@ -17,8 +17,9 @@ EXTRA_HEADERS = \ ../include/h5core/h5_readwrite.h \ ../include/h5core/h5_types.h \ ../include/h5core/h5u_readwrite.h \ - ../include/h5core/h5u_model.h \ - ../include/h5core/h5b_model.h \ + ../include/h5core/h5b_readwrite.h \ + ../include/h5core/h5u_model.h \ + ../include/h5core/h5b_model.h \ ../include/h5core/h5b_attribs.h \ ../include/h5core/h5t_adjacencies.h \ ../include/h5core/h5t_inquiry.h \ @@ -39,7 +40,7 @@ EXTRA_HEADERS = \ h5_syscall_private.h \ h5u_errorhandling_private.h \ h5b_errorhandling_private.h \ - h5b_model_private.h \ + h5b_model_private.h \ h5t_adjacencies_tetm_private.h \ h5t_adjacencies_trim_private.h \ h5t_consts_private.h \ @@ -86,8 +87,9 @@ libH5Core_a_SOURCES = \ h5_readwrite.c \ h5_syscall.c \ h5u_readwrite.c \ + h5b_readwrite.c \ h5u_model.c \ - h5b_model.c \ + h5b_model.c \ h5b_attribs.c \ h5t_adjacencies.c \ h5t_adjacencies_tetm.c \ diff --git a/src/h5core/h5_hdf5.c b/src/h5core/h5_hdf5.c index b208e20..834e170 100644 --- a/src/h5core/h5_hdf5.c +++ b/src/h5core/h5_hdf5.c @@ -1166,6 +1166,21 @@ h5priv_close_hdf5_attribute ( } /****** L i n k **************************************************************/ +h5_err_t +h5priv_hdf5_link_exists ( + h5_file_t* const f, + const hid_t loc_id, + const char* name + ) { + htri_t exists = H5Lexists ( loc_id, name, H5P_DEFAULT ); + if (exists < 0 ) + return h5_error (f, + H5_ERR_HDF5, + "Cannot query link %s/%s.", + h5_get_objname (loc_id), name); + return exists; +} + h5_err_t h5priv_delete_hdf5_link ( h5_file_t* const f, diff --git a/src/h5core/h5_hdf5_private.h b/src/h5core/h5_hdf5_private.h index 2996080..4e81e1d 100644 --- a/src/h5core/h5_hdf5_private.h +++ b/src/h5core/h5_hdf5_private.h @@ -68,7 +68,6 @@ h5priv_close_hdf5_dataset ( const hid_t dataset_id ); - h5_err_t h5priv_write_hdf5_dataset ( h5_file_t* const f, @@ -420,6 +419,13 @@ h5priv_get_base_type_name ( ); /*** link ***/ +h5_err_t +h5priv_hdf5_link_exists ( + h5_file_t* const f, + const hid_t loc_id, + const char* name + ); + h5_err_t h5priv_delete_hdf5_link ( h5_file_t* const f, diff --git a/src/h5core/h5_openclose.c b/src/h5core/h5_openclose.c index cc0d298..30d9142 100644 --- a/src/h5core/h5_openclose.c +++ b/src/h5core/h5_openclose.c @@ -44,7 +44,7 @@ h5priv_error_handler ( hid_t estack_id, void* __f ) { - if (h5_get_debug_level () >= 5) { + if (h5_get_debuglevel() >= 5) { H5Eprint (estack_id, stderr); } return 0; @@ -105,7 +105,7 @@ h5bpriv_open_file ( TRY( b->write_layout = h5priv_alloc (f, NULL, size) ); size_t n = sizeof (struct h5b_partition) / sizeof (h5_int64_t); - TRY( h5priv_mpi_type_contiguous(f, + TRY( h5priv_mpi_type_contiguous(f, n, MPI_LONG_LONG, &b->partition_mpi_t) ); b->shape = -1; @@ -347,7 +347,7 @@ h5bpriv_close_file ( TRY( h5priv_close_hdf5_dataspace (f, b->diskshape) ); TRY( h5priv_close_hdf5_dataspace (f, b->memshape) ); TRY( h5priv_close_hdf5_property (f, b->dcreate_prop) ); - TRY( h5priv_mpi_type_free (f, b->partition_mpi_t) ); + TRY( h5priv_mpi_type_free (f, &b->partition_mpi_t) ); free (f->b); f->b = NULL; @@ -426,7 +426,7 @@ h5_get_stepname_fmt ( h5_file_t* const f, /*!< Handle to file */ char* name, /*!< OUT: Prefix */ int l_name, /*!< length of buffer name */ - int* width /*!< OUT: Width of the number */ + int* width /*!< OUT: Width of the number */ ) { return h5_error_not_implemented (f, __FILE__, __func__, __LINE__); } @@ -504,7 +504,7 @@ h5_has_step ( h5_id_t stepno /*!< step number to check */ ) { char name[128]; - sprintf (name, "%s#%0*ld", + sprintf (name, "%s#%0*ld", f->prefix_step_name, f->width_step_idx, (long)stepno); return (H5Gget_info_by_name (f->file, name, NULL, H5P_DEFAULT) >= 0); } @@ -518,7 +518,7 @@ h5_has_step ( */ h5_err_t h5_start_traverse_steps ( - h5_file_t* const f /*!< file handle */ + h5_file_t* const f /*!< file handle */ ) { return h5_error_not_implemented (f, __FILE__, __func__, __LINE__); } @@ -536,3 +536,31 @@ h5_traverse_steps ( ) { return h5_error_not_implemented (f, __FILE__, __func__, __LINE__); } + +char * +h5_strdupfor2c ( + const char *s, + const ssize_t len + ) { + + char *dup = (char*)malloc ( len + 1 ); + strncpy ( dup, s, len ); + char *p = dup + len; + do { + *p-- = '\0'; + } while ( *p == ' ' ); + return dup; +} + +char * +h5_strc2for ( + char * const str, + const ssize_t l_str + ) { + + size_t len = strlen ( str ); + memset ( str+len, ' ', l_str-len ); + + return str; +} + diff --git a/src/h5core/h5_syscall.c b/src/h5core/h5_syscall.c index 564d1d0..09a5be9 100644 --- a/src/h5core/h5_syscall.c +++ b/src/h5core/h5_syscall.c @@ -71,3 +71,5 @@ h5priv_tfind ( } return ptr; } + + diff --git a/src/h5core/h5b_attribs.c b/src/h5core/h5b_attribs.c index 8edd765..dfab677 100644 --- a/src/h5core/h5b_attribs.c +++ b/src/h5core/h5b_attribs.c @@ -21,7 +21,28 @@ h5_write_field_attrib ( attrib_value, attrib_nelem) ); - return h5bpriv_close_field_group(f); + return H5_SUCCESS; +} + +h5_err_t +h5_read_field_attrib ( + h5_file_t *const f, /*!< IN: file handle */ + const char *field_name, /*!< IN: field name */ + const char *attrib_name, /*!< IN: attribute name */ + const h5_int64_t attrib_type, /*!< IN: attribute type */ + void *buffer /*!< OUT: attribute value */ + ) { + + TRY( h5bpriv_open_field_group(f, field_name) ); + + TRY( h5_read_attrib ( + f, + H5_ATTRIB_FIELD, + attrib_name, + attrib_type, + buffer) ); + + return H5_SUCCESS; } h5_ssize_t @@ -34,7 +55,6 @@ h5b_get_num_field_attribs ( TRY( h5bpriv_open_field_group(f, field_name) ); TRY( n = h5priv_get_num_hdf5_attribute(f, f->b->field_gid ) ); - TRY( h5bpriv_close_field_group(f) ); return n; } diff --git a/src/h5core/h5b_model.c b/src/h5core/h5b_model.c index 7310434..90e290d 100644 --- a/src/h5core/h5b_model.c +++ b/src/h5core/h5b_model.c @@ -458,14 +458,8 @@ _dissolve_ghostzones ( return H5_SUCCESS; } -/*! - \ingroup h5block_private - - \internal - -*/ -static h5_err_t -_release_hyperslab ( +h5_err_t +h5bpriv_release_hyperslab ( h5_file_t *const f /*!< IN: file handle */ ) { if ( f->b->shape > 0 ) { @@ -483,8 +477,8 @@ _release_hyperslab ( return H5_SUCCESS; } -static h5_err_t -_open_block_group ( +h5_err_t +h5bpriv_open_block_group ( h5_file_t *const f /*!< IN: file handle */ ) { @@ -497,12 +491,29 @@ _open_block_group ( if ( b->block_gid < 0 ) { TRY( b->block_gid = h5priv_open_hdf5_group(f, - f->step_gid, H5_BLOCKNAME) ); + f->step_gid, H5_BLOCKNAME) ); } return H5_SUCCESS; } +h5_err_t +h5bpriv_have_field_group ( + h5_file_t *const f, /*!< IN: file handle */ + const char *name + ) { + + char name2[H5_DATANAME_LEN]; + h5_normalize_dataset_name(f, name, name2); + + TRY( h5bpriv_open_block_group ( f ) ); + + h5_err_t exists; + TRY( exists = h5priv_hdf5_have_link(f, f->b->block_gid, name2) ); + + return exists; +} + h5_err_t h5bpriv_open_field_group ( h5_file_t *const f, /*!< IN: file handle */ @@ -511,22 +522,14 @@ h5bpriv_open_field_group ( char name2[H5_DATANAME_LEN]; h5_normalize_dataset_name(f, name, name2); - - TRY( _open_block_group ( f ) ); - TRY( f->b->field_gid = h5priv_open_hdf5_group(f, f->b->block_gid, name2) ); - - return H5_SUCCESS; -} - -h5_err_t -h5bpriv_close_field_group ( - h5_file_t *const f /*!< IN: file handle */ - ) { - + if ( f->b->field_gid >= 0 ) { TRY( h5priv_close_hdf5_group(f, f->b->field_gid) ); } + TRY( h5bpriv_open_block_group ( f ) ); + TRY( f->b->field_gid = h5priv_open_hdf5_group(f, f->b->block_gid, name2) ); + return H5_SUCCESS; } @@ -618,8 +621,6 @@ h5b_3d_get_chunk ( (long long)dims[1], (long long)dims[2] ); - TRY( h5bpriv_close_field_group( f ) ); - return H5_SUCCESS; } @@ -703,7 +704,7 @@ h5b_get_num_fields ( h5_file_t *const f /*!< IN: File handle */ ) { - TRY( _open_block_group(f) ); + TRY( h5bpriv_open_block_group(f) ); return h5priv_get_num_objs_in_hdf5_group( f, f->b->block_gid ); } @@ -752,7 +753,7 @@ h5b_get_field_info_by_name ( TRY( h5priv_close_hdf5_dataspace(f, dataspace_id) ); TRY( h5priv_close_hdf5_dataset(f, dataset_id) ); - return h5bpriv_close_field_group(f); + return H5_SUCCESS; } h5_err_t @@ -767,7 +768,7 @@ h5b_get_field_info ( h5_int64_t *type /*!< OUT: datatype */ ) { - TRY( _open_block_group(f) ); + TRY( h5bpriv_open_block_group(f) ); TRY( h5priv_get_hdf5_objname_by_idx( f, f->b->block_gid, diff --git a/src/h5core/h5b_model_private.h b/src/h5core/h5b_model_private.h index 0f8258a..e5f8c74 100644 --- a/src/h5core/h5b_model_private.h +++ b/src/h5core/h5b_model_private.h @@ -1,6 +1,12 @@ #ifndef __H5B_MODEL_PRIVATE_H #define __H5B_MODEL_PRIVATE_H +h5_err_t +h5bpriv_have_field_group ( + h5_file_t *const f, /*!< IN: file handle */ + const char *name + ); + h5_err_t h5bpriv_open_field_group ( h5_file_t *const f, /*!< IN: file handle */ @@ -8,7 +14,12 @@ h5bpriv_open_field_group ( ); h5_err_t -h5bpriv_close_field_group ( +h5bpriv_open_block_group ( + h5_file_t *const f /*!< IN: file handle */ + ); + +h5_err_t +h5bpriv_release_hyperslab ( h5_file_t *const f /*!< IN: file handle */ ); diff --git a/src/h5core/h5b_readwrite.c b/src/h5core/h5b_readwrite.c index 6e2ca1f..987bb23 100644 --- a/src/h5core/h5b_readwrite.c +++ b/src/h5core/h5b_readwrite.c @@ -1,225 +1,51 @@ +#include "h5core/h5_core.h" +#include "h5_core_private.h" + static h5_err_t _create_block_group ( - const h5_file_t *const f /*!< IN: file handle */ + h5_file_t *const f /*!< IN: file handle */ ) { - herr_t herr; - struct h5b_fdata *b = f->b; + h5_err_t exists; + TRY( exists = h5priv_hdf5_link_exists(f, f->step_gid, H5_BLOCKNAME) ); - if ( b->blockgroup > 0 ) { - herr = H5Gclose ( b->blockgroup ); - if ( herr < 0 ) return HANDLE_H5G_CLOSE_ERR; - f->b->blockgroup = -1; + if (exists > 0) { + TRY( h5bpriv_open_block_group(f) ); + } else { + TRY( f->b->block_gid = h5priv_create_hdf5_group(f, + f->step_gid, H5_BLOCKNAME) ); } - herr = H5Gcreate ( - f->timegroup, - H5BLOCK_GROUPNAME_BLOCK, -#ifndef H5_USE_16_API - H5P_DEFAULT, - H5P_DEFAULT, - H5P_DEFAULT -#else - 0 -#endif - ); - if ( herr < 0 ) return HANDLE_H5G_CREATE_ERR ( H5BLOCK_GROUPNAME_BLOCK ); - - f->b->blockgroup = herr; return H5_SUCCESS; } -/*! - \ingroup h5block_private - - \internal - - \return \c H5_SUCCESS or error code -*/ -h5_int64_t -_H5Block_create_field_group ( - h5_file_t *const f, /*!< IN: file handle */ +static h5_err_t +_create_field_group ( + h5_file_t *const f, /*!< IN: file handle */ const char *name /*!< IN: name of field group to create */ ) { - h5_int64_t h5err; struct h5b_fdata *b = f->b; + TRY( _create_block_group(f) ); - if ( ! _H5Part_have_group ( f->timegroup, H5BLOCK_GROUPNAME_BLOCK ) ) { - h5err = _create_block_group ( f ); + char name2[H5_DATANAME_LEN]; + h5_normalize_dataset_name(f, name, name2); + + h5_err_t exists; + TRY( exists = h5priv_hdf5_link_exists(f, b->block_gid, name2) ); + + if (exists > 0) { + TRY( h5bpriv_open_field_group(f, name2) ); } else { - h5err = _open_block_group ( f ); + TRY( b->field_gid = h5priv_create_hdf5_group(f, + b->block_gid, name2) ); } - if ( h5err < 0 ) return h5err; - - h5err = _select_hyperslab_for_writing ( f ); - if ( h5err < 0 ) return h5err; - - if ( _H5Part_have_group ( b->blockgroup, name ) ) - return HANDLE_H5PART_GROUP_EXISTS_ERR ( name ); - - herr_t herr = H5Gcreate ( - b->blockgroup, - name, -#ifndef H5_USE_16_API - H5P_DEFAULT, - H5P_DEFAULT, - H5P_DEFAULT -#else - 0 -#endif - ); - if ( herr < 0 ) return HANDLE_H5G_CREATE_ERR ( name ); - b->field_group_id = herr; return H5_SUCCESS; } - -h5_int64_t -_H5Block_select_hyperslab_for_reading ( - h5_file_t *const f, /*!< IN: file handle */ - hid_t dataset - ) { - - struct h5b_fdata *b = f->b; - struct h5b_partition *p = &b->user_layout[f->myproc]; - int rank; - hsize_t field_dims[3]; - hsize_t start[3] = { - p->k_start, - p->j_start, - p->i_start }; - hsize_t stride[3] = { 1, 1, 1 }; - hsize_t part_dims[3] = { - p->k_end - p->k_start + 1, - p->j_end - p->j_start + 1, - p->i_end - p->i_start + 1 }; - - h5_int64_t herr = _release_hyperslab ( f ); - if ( herr < 0 ) return HANDLE_H5S_CLOSE_ERR; - - b->diskshape = H5Dget_space ( dataset ); - if ( b->diskshape < 0 ) return HANDLE_H5D_GET_SPACE_ERR; - - 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 ); - - 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; - - _H5Part_print_debug ( - "PROC[%d]: field_dims: (%lld,%lld,%lld)", - f->myproc, - (long long)field_dims[2], - (long long)field_dims[1], - (long long)field_dims[0] ); - - b->diskshape = H5Screate_simple ( rank, field_dims,field_dims ); - if ( b->diskshape < 0 ) - return HANDLE_H5S_CREATE_SIMPLE_3D_ERR ( field_dims ); - - f->b->memshape = H5Screate_simple ( rank, part_dims, part_dims ); - if ( b->memshape < 0 ) - return HANDLE_H5S_CREATE_SIMPLE_3D_ERR ( part_dims ); - - herr = H5Sselect_hyperslab ( - b->diskshape, - H5S_SELECT_SET, - start, - stride, - part_dims, - NULL ); - if ( herr < 0 ) return HANDLE_H5S_SELECT_HYPERSLAB_ERR; - - _H5Part_print_debug ( - "PROC[%d]: Select hyperslab: \n" - "\tstart: (%lld,%lld,%lld)\n" - "\tstride: (%lld,%lld,%lld)\n" - "\tdims: (%lld,%lld,%lld)", - f->myproc, - (long long)start[2], - (long long)start[1], - (long long)start[0], - (long long)stride[2], - (long long)stride[1], - (long long)stride[0], - (long long)part_dims[2], - (long long)part_dims[1], - (long long)part_dims[0] ); - - return H5_SUCCESS; -} - -/*! - \ingroup h5block_private - - \internal - - \return \c H5_SUCCESS or error code -*/ -h5_int64_t -_H5Block_read_data ( - h5_file_t *const f, /*!< IN: file handle */ - const char *name, /*!< IN: name of dataset to read */ - void *data, /*!< OUT: ptr to read buffer */ - hid_t type /*!< IN: data type */ - ) { - - h5_int64_t herr; - struct h5b_fdata *b = f->b; - - hid_t dataset_id = H5Dopen ( b->field_group_id, name -#ifndef H5_USE_16_API - , H5P_DEFAULT -#endif - ); - if ( dataset_id < 0 ) return HANDLE_H5D_OPEN_ERR ( name ); - - herr = _H5Block_select_hyperslab_for_reading ( f, dataset_id ); - if ( herr < 0 ) return herr; - -#ifdef PARALLEL_IO - herr = _H5Part_start_throttle ( f ); - if ( herr < 0 ) return herr; -#endif - - herr = H5Dread ( - dataset_id, - type, - f->b->memshape, - f->b->diskshape, - f->xfer_prop, - data ); - if ( herr < 0 ) return HANDLE_H5D_READ_ERR ( name, f->timestep ); - -#ifdef PARALLEL_IO - herr = _H5Part_end_throttle ( f ); - if ( herr < 0 ) return herr; -#endif - - herr = H5Dclose ( dataset_id ); - if ( herr < 0 ) return HANDLE_H5D_CLOSE_ERR; - - return H5_SUCCESS; -} - -/********************** functions for writing ********************************/ - -/*! - \ingroup h5block_private - - \internal - - \return \c H5_SUCCESS or error code -*/ -static h5_int64_t +static h5_err_t _select_hyperslab_for_writing ( h5_file_t *const f /*!< IN: file handle */ ) { @@ -229,7 +55,6 @@ _select_hyperslab_for_writing ( */ if ( f->b->shape >= 0 ) return H5_SUCCESS; - herr_t herr; struct h5b_fdata *b = f->b; struct h5b_partition *p = &b->write_layout[f->myproc]; struct h5b_partition *q = &b->user_layout[f->myproc]; @@ -255,15 +80,11 @@ _select_hyperslab_for_writing ( }; - b->shape = H5Screate_simple ( rank, field_dims, field_dims ); - if ( b->shape < 0 ) - return HANDLE_H5S_CREATE_SIMPLE_3D_ERR ( field_dims ); - - b->diskshape = H5Screate_simple ( rank, field_dims,field_dims ); - if ( b->diskshape < 0 ) - return HANDLE_H5S_CREATE_SIMPLE_3D_ERR ( field_dims ); - - _H5Part_print_debug ( + TRY( b->shape = h5priv_create_hdf5_dataspace(f, + rank, field_dims, NULL) ); + TRY( b->diskshape = h5priv_create_hdf5_dataspace(f, + rank, field_dims, NULL) ); + h5_debug (f, "PROC[%d]: Select hyperslab on diskshape: \n" "\tstart: (%lld,%lld,%lld)\n" "\tstride: (%lld,%lld,%lld)\n" @@ -279,28 +100,26 @@ _select_hyperslab_for_writing ( (long long)part_dims[1], (long long)part_dims[0] ); - herr = H5Sselect_hyperslab ( + TRY( h5priv_select_hyperslab_of_hdf5_dataspace(f, b->diskshape, H5S_SELECT_SET, start, stride, part_dims, - NULL ); - if ( herr < 0 ) return HANDLE_H5S_SELECT_HYPERSLAB_ERR; + NULL) ); field_dims[0] = q->k_end - q->k_start + 1; field_dims[1] = q->j_end - q->j_start + 1; field_dims[2] = q->i_end - q->i_start + 1; - f->b->memshape = H5Screate_simple ( rank, field_dims, field_dims ); - if ( b->memshape < 0 ) - return HANDLE_H5S_CREATE_SIMPLE_3D_ERR ( part_dims ); + TRY( b->memshape = h5priv_create_hdf5_dataspace(f, + rank, field_dims, NULL) ); start[0] = p->k_start - q->k_start; start[1] = p->j_start - q->j_start; start[2] = p->i_start - q->i_start; - _H5Part_print_debug ( + h5_debug (f, "PROC[%d]: Select hyperslab on memshape: \n" "\tstart: (%lld,%lld,%lld)\n" "\tstride: (%lld,%lld,%lld)\n" @@ -316,79 +135,226 @@ _select_hyperslab_for_writing ( (long long)part_dims[1], (long long)part_dims[0] ); - herr = H5Sselect_hyperslab ( + TRY( h5priv_select_hyperslab_of_hdf5_dataspace(f, b->memshape, H5S_SELECT_SET, start, stride, part_dims, - NULL ); - if ( herr < 0 ) return HANDLE_H5S_SELECT_HYPERSLAB_ERR; + NULL) ); return H5_SUCCESS; } -/*! - \ingroup h5block_private - - \internal - - \return \c H5_SUCCESS or error code -*/ -h5_int64_t -_H5Block_write_data ( - h5_file_t *const f, /*!< IN: file handle */ - const char *name, /*!< IN: name of dataset to write */ +static h5_err_t +_write_data ( + h5_file_t *const f, /*!< IN: file handle */ + const char *field_name, /*!< IN: name of field */ + const char *data_name, /*!< IN: name of dataset */ const void *data, /*!< IN: data to write */ const hid_t type /*!< IN: data type */ ) { - herr_t herr; hid_t dataset; struct h5b_fdata *b = f->b; -#ifndef H5_USE_16_API - htri_t exists = H5Lexists ( b->field_group_id, name, H5P_DEFAULT ); - if ( exists > 0 ) return HANDLE_H5D_EXISTS_ERR ( name, f->timestep ); -#endif + h5_err_t exists; + TRY( exists = h5priv_hdf5_link_exists (f, b->field_gid, data_name) ); + if ( exists > 0 ) { + TRY( dataset = h5priv_open_hdf5_dataset(f, + b->field_gid, data_name) ); + hid_t type_file; + TRY( type_file = h5priv_get_hdf5_dataset_type(f, dataset) ); + if ( type != type_file ) { + return h5_error(f, + H5_ERR_HDF5, + "Field '%s' already has type '%s' " + "but was written as '%s'.", + field_name, + h5priv_get_base_type_name(f, type_file), + h5priv_get_base_type_name(f, type) ); + } + } else { + TRY( dataset = h5priv_create_hdf5_dataset(f, + b->field_gid, + data_name, + type, + b->shape, + b->dcreate_prop) ); + } - dataset = H5Dcreate ( - b->field_group_id, - name, - type, - b->shape, -#ifndef H5_USE_16_API - H5P_DEFAULT, - b->create_prop, - H5P_DEFAULT -#else - b->create_prop -#endif - ); - if ( dataset < 0 ) return HANDLE_H5D_CREATE_ERR ( name, f->timestep ); - -#ifdef PARALLEL_IO - herr = _H5Part_start_throttle ( f ); - if ( herr < 0 ) return herr; -#endif - - herr = H5Dwrite ( + TRY( h5priv_write_hdf5_dataset(f, dataset, type, b->memshape, b->diskshape, f->xfer_prop, - data ); - if ( herr < 0 ) return HANDLE_H5D_WRITE_ERR ( name, f->timestep ); + data) ); -#ifdef PARALLEL_IO - herr = _H5Part_end_throttle ( f ); - if ( herr < 0 ) return herr; -#endif - - herr = H5Dclose ( dataset ); - if ( herr < 0 ) return HANDLE_H5D_CLOSE_ERR; + TRY( h5priv_close_hdf5_dataset(f, dataset) ); return H5_SUCCESS; } +h5_err_t +h5b_write_scalar_data ( + h5_file_t *const f, /*!< IN: file handle */ + const char *field_name, /*!< IN: name of field */ + const void *data, /*!< IN: data to write */ + const hid_t type /*!< IN: data type */ + ) { + TRY( _create_field_group(f, field_name) ); + TRY( _select_hyperslab_for_writing(f) ); + TRY( _write_data(f, field_name, H5_BLOCKNAME_X, data, type) ); + return H5_SUCCESS; +} + +h5_err_t +h5b_write_vector3d_data ( + h5_file_t *const f, /*!< IN: file handle */ + const char *field_name, /*!< IN: name of field */ + const void *xdata, /*!< IN: x data to write */ + const void *ydata, /*!< IN: y data to write */ + const void *zdata, /*!< IN: z data to write */ + const hid_t type /*!< IN: data type */ + ) { + TRY( _create_field_group(f, field_name) ); + TRY( _select_hyperslab_for_writing(f) ); + TRY( _write_data(f, field_name, H5_BLOCKNAME_X, xdata, type) ); + TRY( _write_data(f, field_name, H5_BLOCKNAME_Y, ydata, type) ); + TRY( _write_data(f, field_name, H5_BLOCKNAME_Z, zdata, type) ); + return H5_SUCCESS; +} + +static h5_err_t +_select_hyperslab_for_reading ( + h5_file_t *const f, /*!< IN: file handle */ + const hid_t dataset + ) { + + struct h5b_fdata *b = f->b; + struct h5b_partition *p = &b->user_layout[f->myproc]; + int rank; + hsize_t field_dims[3]; + hsize_t start[3] = { + p->k_start, + p->j_start, + p->i_start }; + hsize_t stride[3] = { 1, 1, 1 }; + hsize_t part_dims[3] = { + p->k_end - p->k_start + 1, + p->j_end - p->j_start + 1, + p->i_end - p->i_start + 1 }; + + TRY( h5bpriv_release_hyperslab(f) ); + + TRY( b->diskshape = h5priv_get_hdf5_dataset_space(f, dataset) ); + + TRY( rank = h5priv_get_dims_of_hdf5_dataspace(f, + b->diskshape, field_dims, NULL) ); + if ( rank != 3 ) + return h5_error(f, + H5_ERR_INVAL, + "H5Block dataset has bad rank '%d' instead of rank 3! " + "Is the file corrupt?", + rank); + + 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 h5_error(f, + H5_ERR_LAYOUT, + "H5Block dataset has invalid layout. " + "Is the file corrupt?"); + + h5_debug (f, + "PROC[%d]: field_dims: (%lld,%lld,%lld)", + f->myproc, + (long long)field_dims[2], + (long long)field_dims[1], + (long long)field_dims[0] ); + + TRY( b->memshape = h5priv_create_hdf5_dataspace(f, + rank, part_dims, NULL) ); + + TRY( h5priv_select_hyperslab_of_hdf5_dataspace(f, + b->diskshape, + H5S_SELECT_SET, + start, + stride, + part_dims, + NULL) ); + + h5_debug (f, + "PROC[%d]: Select hyperslab: \n" + "\tstart: (%lld,%lld,%lld)\n" + "\tstride: (%lld,%lld,%lld)\n" + "\tdims: (%lld,%lld,%lld)", + f->myproc, + (long long)start[2], + (long long)start[1], + (long long)start[0], + (long long)stride[2], + (long long)stride[1], + (long long)stride[0], + (long long)part_dims[2], + (long long)part_dims[1], + (long long)part_dims[0] ); + + return H5_SUCCESS; +} + +static h5_err_t +_read_data ( + h5_file_t *const f, /*!< IN: file handle */ + const char *field_name, /*!< IN: name of field */ + const char *data_name, /*!< IN: name of dataset */ + void *data, /*!< OUT: ptr to read buffer */ + const hid_t type /*!< IN: data type */ + ) { + + hid_t dataset; + struct h5b_fdata *b = f->b; + + TRY( dataset = h5priv_open_hdf5_dataset(f, b->field_gid, data_name) ); + TRY( _select_hyperslab_for_reading(f, dataset) ); + TRY( h5priv_read_hdf5_dataset(f, + dataset, + type, + f->b->memshape, + f->b->diskshape, + f->xfer_prop, + data) ); + TRY( h5priv_close_hdf5_dataset(f, dataset) ); + + return H5_SUCCESS; +} + +h5_err_t +h5b_read_scalar_data ( + h5_file_t *const f, /*!< IN: file handle */ + const char *field_name, /*!< IN: name of field */ + void *data, /*!< OUT: read bufer */ + const hid_t type /*!< IN: data type */ + ) { + TRY( h5bpriv_open_field_group(f, field_name) ); + TRY( _read_data(f, field_name, H5_BLOCKNAME_X, data, type) ); + return H5_SUCCESS; +} + +h5_err_t +h5b_read_vector3d_data ( + h5_file_t *const f, /*!< IN: file handle */ + const char *field_name, /*!< IN: name of field */ + void *xdata, /*!< IN: x data to write */ + void *ydata, /*!< IN: y data to write */ + void *zdata, /*!< IN: z data to write */ + const hid_t type /*!< IN: data type */ + ) { + TRY( h5bpriv_open_field_group(f, field_name) ); + TRY( _read_data(f, field_name, H5_BLOCKNAME_X, xdata, type) ); + TRY( _read_data(f, field_name, H5_BLOCKNAME_Y, ydata, type) ); + TRY( _read_data(f, field_name, H5_BLOCKNAME_Z, zdata, type) ); + return H5_SUCCESS; +} + diff --git a/src/include/H5.h b/src/include/H5.h index 9f61848..187b6f6 100644 --- a/src/include/H5.h +++ b/src/include/H5.h @@ -16,6 +16,9 @@ #ifndef __H5_H #define __H5_H +#include "H5_inquiry.h" +#include "H5_attribs.h" + h5_file_t * H5OpenFile ( const char * filename, diff --git a/src/include/H5Block.h b/src/include/H5Block.h index 57129b4..89fef71 100644 --- a/src/include/H5Block.h +++ b/src/include/H5Block.h @@ -1,202 +1,128 @@ #ifndef __H5BLOCK_H #define __H5BLOCK_H -#ifdef __cplusplus -extern "C" { -#endif - -/*! - Interface for block structured field data - -*/ +#include "H5.h" +#include "H5Block_readwrite.h" h5_err_t -H5BlockDefine3DFieldLayout ( - h5_file_t *f, - const h5_size_t i_start, - const h5_size_t i_end, - const h5_size_t j_start, - const h5_size_t j_end, - const h5_size_t k_start, - const h5_size_t k_end +H5Block3dSetView ( + h5_file_t *const f, /*!< IN: File handle */ + const h5_int64_t i_start, /*!< IN: start index of \c i */ + const h5_int64_t i_end, /*!< IN: end index of \c i */ + const h5_int64_t j_start, /*!< IN: start index of \c j */ + const h5_int64_t j_end, /*!< IN: end index of \c j */ + const h5_int64_t k_start, /*!< IN: start index of \c k */ + const h5_int64_t k_end /*!< IN: end index of \c k */ ); h5_err_t -H5Block3dGetPartitionOfProc ( - h5_file_t *f, - const h5_int64_t proc, - h5_size_t *i_start, - h5_size_t *i_end, - h5_size_t *j_start, - h5_size_t *j_end, - h5_size_t *k_start, - h5_size_t *k_end +H5Block3dGetView ( + h5_file_t *const f, /*!< IN: File handle */ + const int proc, /*!< IN: Processor to get partition from */ + h5_size_t *i_start, /*!< OUT: start index of \c i */ + h5_size_t *i_end, /*!< OUT: end index of \c i */ + h5_size_t *j_start, /*!< OUT: start index of \c j */ + h5_size_t *j_end, /*!< OUT: end index of \c j */ + h5_size_t *k_start, /*!< OUT: start index of \c k */ + h5_size_t *k_end /*!< OUT: end index of \c k */ ); h5_err_t -H5Block3dGetReducedPartitionOfProc ( - h5_file_t *f, - h5_id_t proc, - h5_size_t *i_start, - h5_size_t *i_end, - h5_size_t *j_start, - h5_size_t *j_end, - h5_size_t *k_start, - h5_size_t *k_end +H5Block3dSetChunk ( + h5_file_t *const f, /*!< IN: File handle */ + const h5_int64_t i, /*!< IN: size of \c i */ + const h5_int64_t j, /*!< IN: size of \c j */ + const h5_int64_t k /*!< IN: size of \c k */ ); -h5_id_t -H5Block3dGetProcOf ( - h5_file_t *f, - h5_size_t i, - h5_size_t j, - h5_size_t k +h5_err_t +H5Block3dGetChunk ( + h5_file_t *const f, /*!< IN: File handle */ + const char *field_name, /*!< IN: name of dataset */ + h5_size_t *dims /*!< OUT: array containing the chunk dimensions */ ); -h5_int64_t -H5Block3dWriteScalarFieldFloat64 ( - h5_file_t *f, - const char *name, - const h5_float64_t *data +h5_err_t +H5Block3dGetReducedView ( + h5_file_t *const f, /*!< IN: File handle */ + const int proc, /*!< IN: Processor to get partition from */ + h5_size_t *i_start, /*!< OUT: start index of \c i */ + h5_size_t *i_end, /*!< OUT: end index of \c i */ + h5_size_t *j_start, /*!< OUT: start index of \c j */ + h5_size_t *j_end, /*!< OUT: end index of \c j */ + h5_size_t *k_start, /*!< OUT: start index of \c j */ + h5_size_t *k_end /*!< OUT: end index of \c j */ ); -h5_int64_t -H5Block3dReadScalarFieldFloat64 ( - h5_file_t *f, - const char *name, - h5_float64_t *data +int +H5Block3dGetProc ( + h5_file_t *const f, /*!< IN: File handle */ + const h5_int64_t i, /*!< IN: \c i coordinate */ + const h5_int64_t j, /*!< IN: \c j coordinate */ + const h5_int64_t k /*!< IN: \c k coordinate */ ); -h5_int64_t +h5_size_t H5BlockGetNumFields ( - h5_file_t *f + h5_file_t *const f /*!< IN: file handle */ ); -h5_int64_t +h5_err_t H5BlockGetFieldInfo ( - h5_file_t *f, - const h5_int64_t idx, - char *name, - const h5_int64_t len_name, - h5_int64_t *grid_rank, - h5_int64_t *grid_dims, - h5_int64_t *field_dims + h5_file_t *const f, /*!< IN: file handle */ + const h5_size_t idx, /*!< IN: index of field */ + char *name, /*!< OUT: field name */ + const h5_size_t len_name, /*!< IN: buffer size */ + h5_size_t *grid_rank, /*!< OUT: grid rank */ + h5_size_t *grid_dims, /*!< OUT: grid dimensions */ + h5_size_t *field_rank, /*!< OUT: field rank */ + h5_int64_t *type /*!< OUT: datatype */ ); -h5_int64_t +h5_err_t H5BlockGetFieldInfoByName ( - h5_file_t *f, - const char *field_name, - h5_int64_t *grid_rank, - h5_int64_t *grid_dims, - h5_int64_t *field_dims + h5_file_t *const f, /*!< IN: file handle */ + const char *name, /*!< IN: field name */ + h5_size_t *grid_rank, /*!< OUT: grid rank */ + h5_size_t *grid_dims, /*!< OUT: grid dimensions */ + h5_size_t *field_rank, /*!< OUT: field rank */ + h5_int64_t *type /*!< OUT: datatype */ ); -h5_int64_t -H5Block3dGetFieldOrigin ( - h5_file_t *f, - const char *field_name, - h5_float64_t *x_origin, - h5_float64_t *y_origin, - h5_float64_t *z_origin - ); - -h5_int64_t -H5Block3dSetFieldOrigin ( - h5_file_t *f, - const char *field_name, - const h5_float64_t x_origin, - const h5_float64_t y_origin, - const h5_float64_t z_origin - ); - -h5_int64_t -H5Block3dGetFieldSpacing ( - h5_file_t *f, - const char *field_name, - h5_float64_t *x_spacing, - h5_float64_t *y_spacing, - h5_float64_t *z_spacing - ); - -h5_int64_t -H5Block3dSetFieldSpacing ( - h5_file_t *f, - const char *field_name, - const h5_float64_t x_spacing, - const h5_float64_t y_spacing, - const h5_float64_t z_spacing - ); - -h5_int64_t -H5Block3dWrite3dVectorFieldFloat64 ( - h5_file_t *f, - const char *name, - const h5_float64_t *xval, - const h5_float64_t *yval, - const h5_float64_t *zval - ); - -h5_int64_t -H5Block3dRead3dVectorFieldFloat64 ( - h5_file_t *f, - const char *name, - h5_float64_t *xval, - h5_float64_t *yval, - h5_float64_t *zval - ); - -h5_int64_t -H5BlockWriteFieldAttrib ( - h5_file_t *f, - const char *field_name, - const char *attrib_name, - const h5_int64_t attrib_type, - const void *attrib_value, - const h5_int64_t attrib_nelem - ); - -h5_int64_t +h5_err_t H5BlockWriteFieldAttribString ( - h5_file_t *f, - const char *field_name, - const char *attrib_name, - const char *attrib_value + h5_file_t *const f, /*!< IN: file handle */ + const char *field_name, /*!< IN: field name */ + const char *attrib_name, /*!< IN: attribute name */ + const char *value /*!< IN: attribute value */ ); -h5_int64_t +h5_err_t +H5BlockReadFieldAttribString ( + h5_file_t *const f, /*!< IN: file handle */ + const char *field_name, /*!< IN: field name */ + const char *attrib_name, /*!< IN: attribute name */ + char *buffer /*!< OUT: attribute value */ + ); + +h5_ssize_t H5BlockGetNumFieldAttribs ( - h5_file_t *f, - const char *field_name + h5_file_t *const f, /*