diff --git a/.gitattributes b/.gitattributes index 2799d3f..a7d2b17 100644 --- a/.gitattributes +++ b/.gitattributes @@ -394,16 +394,31 @@ examples/H5Part/H5testFpar.f90 -text examples/H5Part/Makefile.am -text /license.txt -text src/C/Makefile.am -text +src/Fortran/H5.c -text src/Fortran/H5.f90 -text +src/Fortran/H5Block.c -text src/Fortran/H5Block.f90 -text +src/Fortran/H5BlockF.f90 -text src/Fortran/H5Block_F.c -text +src/Fortran/H5Block_attribs.c -text +src/Fortran/H5Block_attribsF.f90 -text +src/Fortran/H5Block_io.c -text +src/Fortran/H5Block_ioF.f90 -text src/Fortran/H5Block_readwrite.f90 -text src/Fortran/H5Block_readwrite_F.c -text +src/Fortran/H5F.f90 -text +src/Fortran/H5Part.c -text src/Fortran/H5Part.f90 -text +src/Fortran/H5PartF.f90 -text src/Fortran/H5Part_F.c -text +src/Fortran/H5Part_io.c -text +src/Fortran/H5Part_ioF.f90 -text src/Fortran/H5_F.c -text +src/Fortran/H5_attribs.c -text src/Fortran/H5_attribs.f90 -text +src/Fortran/H5_attribsF.f90 -text src/Fortran/H5_attribs_F.c -text +src/Fortran/H5_constF.f90 -text src/Fortran/Makefile.am -text src/Fortran/TestUnderscore.f -text src/Fortran/TestUnderscoreC.c -text diff --git a/src/Fortran/H5.c b/src/Fortran/H5.c new file mode 100644 index 0000000..737a3b0 --- /dev/null +++ b/src/Fortran/H5.c @@ -0,0 +1,395 @@ +/* + Copyright (c) 2006-2013, The Regents of the University of California, + through Lawrence Berkeley National Laboratory (subject to receipt of any + required approvals from the U.S. Dept. of Energy) and the Paul Scherrer + Institut (Switzerland). All rights reserved. + + License: see file COPYING in top level of source distribution. +*/ + +#include "h5_private.h" +//#include "h5core/h5_model.h" + +/* file handling interface */ +static inline h5_int64_t +open_file ( + const char *name, + const int l_name, + h5_int32_t flags, + MPI_Comm ccomm, + h5_size_t align + ) { + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_file_t* f = h5_open_file ( name2, flags, ccomm, align ); + free ( name2 ); + return (h5_int64_t)f; +} + +#define h5_openr F77_NAME( \ + h5_openr, \ + h5_openr_, \ + H5_OPENR) +h5_int64_t +h5_openr ( + const char *file_name, + const int l_file_name + ) { + H5_API_ENTER (h5_int64_t, "file_name='%s'", + file_name); + H5_API_RETURN (open_file (file_name, l_file_name, H5_O_RDONLY, 0, 0)); +} + +#define h5_openw F77_NAME( \ + h5_openw, \ + h5_openw_, \ + H5_OPENW) +h5_int64_t +h5_openw ( + const char *file_name, + const int l_file_name + ) { + H5_API_ENTER (h5_int64_t, "file_name='%s'", + file_name); + H5_API_RETURN (open_file (file_name, l_file_name, H5_O_WRONLY, 0, 0)); +} + +#define h5_opena F77_NAME( \ + h5_opena, \ + h5_opena_, \ + H5_OPENA) +h5_int64_t +h5_opena ( + const char *file_name, + const int l_file_name + ) { + H5_API_ENTER (h5_int64_t, "file_name='%s'", + file_name); + H5_API_RETURN (open_file (file_name, l_file_name, H5_O_APPEND, 0, 0)); +} + +#define h5_openr_align F77_NAME( \ + h5_openr_align, \ + h5_openr_align_, \ + H5_OPENR_ALIGN) +h5_int64_t +h5_openr_align ( + const char *file_name, + const h5_int64_t *align, + const int l_file_name + ) { + H5_API_ENTER (h5_int64_t, "file_name='%s', align=%llu", + file_name, (long long unsigned)align); + H5_API_RETURN (open_file (file_name, l_file_name, H5_O_RDONLY, 0, *align)); +} + +#define h5_openw_align F77_NAME( \ + h5_openw_align, \ + h5_openw_align_, \ + H5_OPENW_ALIGN) +h5_int64_t +h5_openw_align ( + const char *file_name, + const h5_int64_t *align, + const int l_file_name + ) { + H5_API_ENTER (h5_int64_t, "file_name='%s', align=%llu", + file_name, (long long unsigned)align); + H5_API_RETURN (open_file (file_name, l_file_name, H5_O_WRONLY, 0, *align)); +} + +#define h5_opena_align F77_NAME( \ + h5_opena_align, \ + h5_opena_align_, \ + H5_OPENA_ALIGN) +h5_int64_t +h5_opena_align ( + const char *file_name, + const h5_int64_t *align, + const int l_file_name + ) { + H5_API_ENTER (h5_int64_t, "file_name='%s', align=%llu", + file_name, (long long unsigned)align); + H5_API_RETURN (open_file (file_name, l_file_name, H5_O_APPEND, 0, *align)); +} + +#ifdef PARALLEL_IO +h5_int32_t +flagsfor2c ( + const char* flags, + const int l_flags + ) { + if (flags == NULL) + return 0; + + h5_int32_t fbits = 0; + char* flags2 = h5_strdupfor2c (flags, l_flags); + + flags2 = strtok (flags2, ","); + while (flags != NULL) { + if (strcmp (flags2, "vfd_mpiposix") == 0) + fbits |= H5_VFD_MPIPOSIX; + else if (strcmp (flags2, "vfd_core") == 0) + fbits |= H5_VFD_CORE; + else if (strcmp (flags2, "vfd_mpio_ind") == 0) + fbits |= H5_VFD_MPIIO_IND; + else if (strcmp (flags2, "fs_lustre") == 0) + fbits |= H5_FS_LUSTRE; + else { + // :FIXME: ignore unknown strings!? + } + flags2 = strtok (NULL, ","); + } + free (flags2); + return fbits; +} + +static inline h5_int64_t +open_file_par ( + const char* file_name, + const int l_file_name, + MPI_Fint* fcomm, + const h5_int32_t mode, + const char* flags, + const int l_flags, + h5_int64_t align + ) { + return open_file ( + file_name, l_file_name, + mode | flagsfor2c (flags, l_flags), + MPI_Comm_f2c (*fcomm), + align); +} + +#define h5_openr_par F77_NAME( \ + h5_openr_par, \ + h5_openr_par_, \ + H5_OPENR_PAR) +h5_int64_t +h5_openr_par ( + const char *file_name, + MPI_Fint *fcomm, + const int l_file_name + ) { + H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d", + l_file_name, file_name, *fcomm); + H5_API_RETURN ( + open_file_par ( + file_name, l_file_name, + fcomm, + H5_O_RDONLY, + NULL, 0, + 0)); +} + +#define h5_openw_par F77_NAME( \ + h5_openw_par, \ + h5_openw_par_, \ + H5_OPENW_PAR) +h5_int64_t +h5_openw_par ( + const char* file_name, + MPI_Fint* fcomm, + const int l_file_name + ) { + H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d", + l_file_name, file_name, *fcomm); + H5_API_RETURN ( + open_file_par ( + file_name, l_file_name, + fcomm, + H5_O_WRONLY, + NULL, 0, + 0)); +} + +#define h5_opena_par F77_NAME( \ + h5_opena_par, \ + h5_opena_par_, \ + H5_OPENA_PAR) +h5_int64_t +h5_opena_par ( + const char* file_name, + MPI_Fint* fcomm, + const int l_file_name + ) { + H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d", + l_file_name, file_name, *fcomm); + H5_API_RETURN ( + open_file_par ( + file_name, l_file_name, + fcomm, + H5_O_APPEND, + NULL, 0, + 0)); +} + +#define h5_openr_par_align F77_NAME( \ + h5_openr_par_align, \ + h5_openr_par_align_, \ + H5_OPENR_PAR_ALIGN) +h5_int64_t +h5_openr_par_align ( + const char *file_name, + MPI_Fint *fcomm, + const h5_int64_t *align, + const char *flags, + const int l_file_name, + const int l_flags + ) { + H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d, flags=%s, align=%lld", + l_file_name, file_name, *fcomm, flags, (long long)align); + H5_API_RETURN ( + open_file_par ( + file_name, l_file_name, + fcomm, + H5_O_RDONLY, + flags, l_flags, + *align)); +} + +#define h5_openw_par_align F77_NAME( \ + h5_openw_par_align, \ + h5_openw_par_align_, \ + H5_OPENW_PAR_ALIGN) +h5_int64_t +h5_openw_par_align ( + const char *file_name, + MPI_Fint *fcomm, + const h5_int64_t *align, + const char *flags, + const int l_file_name, + const int l_flags + ) { + H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d, flags=%s, align=%lld", + l_file_name, file_name, *fcomm, flags, (long long)align); + H5_API_RETURN ( + open_file_par ( + file_name, l_file_name, + fcomm, + H5_O_WRONLY, + flags, l_flags, + *align)); +} + +#define h5_opena_par_align F77_NAME( \ + h5_opena_par_align, \ + h5_opena_par_align_, \ + H5_OPENA_PAR_ALIGN) +h5_int64_t +h5_opena_par_align ( + const char *file_name, + MPI_Fint *fcomm, + const h5_int64_t *align, + const char *flags, + const int l_file_name, + const int l_flags + ) { + H5_API_ENTER (h5_int64_t, "file_name='%*s', fcomm=%d, flags=%s, align=%lld", + l_file_name, file_name, *fcomm, flags, (long long)align); + H5_API_RETURN ( + open_file_par ( + file_name, l_file_name, + fcomm, + H5_O_APPEND, + flags, l_flags, + *align)); +} +#endif + +#define h5_close F77_NAME( \ + h5_close, \ + h5_close_, \ + H5_CLOSE) +h5_int64_t +h5_close ( + const h5_int64_t *f + ) { + h5_file_t* fh = h5_filehandlefor2c(f); + H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh); + H5_API_RETURN (h5_close_file (fh)); +} + +#define h5_finalize F77_NAME( \ + h5_finalize, \ + h5_finalize_, \ + H5_FINALIZE) +h5_int64_t +h5_finalize ( + void + ) { + H5_API_ENTER (h5_int64_t, "%s", ""); + H5_API_RETURN (h5_close_hdf5()); +} + +#define h5_check F77_NAME( \ + h5_check, \ + h5_check_, \ + H5_CHECK) +h5_int64_t +h5_check ( + const h5_int64_t *f + ) { + + h5_file_t* fh = h5_filehandlefor2c(f); + H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh); + H5_API_RETURN (h5_check_filehandle (fh)); +} + +/* H5hut data model */ +#define h5_setstep F77_NAME(  \ + h5_setstep, \ + h5_setstep_, \ + H5_SETSTEP) +h5_int64_t +h5_setstep ( + const h5_int64_t *f, + h5_int64_t *step ) { + + h5_file_t* fh = h5_filehandlefor2c(f); + H5_API_ENTER (h5_int64_t, "f=%p, step=%lld", (h5_file_p)fh, (long long)*step); + H5_API_RETURN (h5_set_step (fh, (*step)-1)); +} + +#define h5_getstep F77_NAME( \ + h5_getstep, \ + h5_getstep_, \ + H5_GETSTEP) +h5_int64_t +h5_getstep ( + const h5_int64_t *f + ) { + + h5_file_t* fh = h5_filehandlefor2c(f); + H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh); + H5_API_RETURN (h5_get_step (fh) + 1); +} + +#define h5_getnsteps F77_NAME( \ + h5_getnsteps, \ + h5_getnsteps_, \ + H5_GETNSTEPS) +h5_int64_t +h5_getnsteps ( + const h5_int64_t *f + ) { + + h5_file_t* fh = h5_filehandlefor2c(f); + H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh); + H5_API_RETURN (h5_get_num_steps (fh)); +} + + +/* debug output */ +#define h5_set_verbosity_level F77_NAME( \ + h5_set_verbosity_level, \ + h5_set_verbosity_level_, \ + H5_SET_VERBOSITY_LEVEL) +h5_int64_t +h5_set_verbosity_level ( + const h5_int64_t *level + ) { + + H5_API_ENTER (h5_int64_t, "level=%lld", (long long)*level); + H5_API_RETURN(h5_set_debuglevel (*level)); +} + diff --git a/src/Fortran/H5Block.c b/src/Fortran/H5Block.c new file mode 100755 index 0000000..cf88c19 --- /dev/null +++ b/src/Fortran/H5Block.c @@ -0,0 +1,199 @@ +/* + Copyright (c) 2006-2012, The Regents of the University of California, + through Lawrence Berkeley National Laboratory (subject to receipt of any + required approvals from the U.S. Dept. of Energy) and the Paul Scherrer + Institut (Switzerland). All rights reserved. + + License: see file COPYING in top level of source distribution. +*/ + +#include "h5_private.h" +#include "h5core/h5b_model.h" + +#define h5bl_3d_setview F77_NAME ( \ + h5bl_3d_setview, \ + h5bl_3d_setview_, \ + H5BL_3D_SETVIEW ) +h5_int64_t +h5bl_3d_setview ( + const h5_int64_t* const fh, + const h5_int64_t* const i_start, /*!< start index of i */ + const h5_int64_t* const i_end, /*!< end index of i */ + const h5_int64_t* const j_start, /*!< start index of j */ + const h5_int64_t* const j_end, /*!< end index of j */ + const h5_int64_t* const k_start, /*!< start index of k */ + const h5_int64_t* const k_end /*!< end index of k */ + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, " + "i_start=%lld, i_end=%lld, " + "j_start=%lld, j_end=%lld, " + "k_start=%lld, k_end=%lld", + (h5_file_p)f, + *i_start, (long long)i_end, + (long long)j_start, (long long)j_end, + (long long)k_start, (long long)k_end); + H5_API_RETURN(h5b_3d_set_view ( + f, + *i_start-1, *i_end-1, + *j_start-1, *j_end-1, + *k_start-1, *k_end-1 )); +} + +#define h5bl_3d_getview F77_NAME ( \ + h5bl_3d_getview, \ + h5bl_3d_getview_, \ + H5BL_3D_GETVIEW ) +h5_int64_t +h5bl_3d_getview ( + const h5_int64_t* const fh, + h5_int64_t* const i_start, + h5_int64_t* const i_end, + h5_int64_t* const j_start, + h5_int64_t* const j_end, + h5_int64_t* const k_start, + h5_int64_t* const k_end + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, " + "i_start=%p, i_end=%p, " + "j_start=%p, j_end=%p, " + "k_start=%p, k_end=%p", + (h5_file_p)f, + i_start, i_end, + j_start, j_end, + k_start, k_end); + TRY (h5b_3d_get_view ( + f, + (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 )); + *i_start += 1; + *i_end += 1; + *j_start += 1; + *j_end += 1; + *k_start += 1; + *k_end += 1; + H5_API_RETURN (H5_SUCCESS); +} + + + +#define h5bl_3d_getreducedview F77_NAME ( \ + h5bl_3d_getreducedview, \ + h5bl_3d_getreducedview_, \ + H5BL_3D_GETREDUCEDVIEW ) +h5_int64_t +h5bl_3d_getreducedview ( + const h5_int64_t* const fh, + h5_int64_t* const i_start, + h5_int64_t* const i_end, + h5_int64_t* const j_start, + h5_int64_t* const j_end, + h5_int64_t* const k_start, + h5_int64_t* const k_end + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, " + "i_start=%p, i_end=%p, " + "j_start=%p, j_end=%p, " + "k_start=%p, k_end=%p", + (h5_file_p)f, + i_start, i_end, + j_start, j_end, + k_start, k_end); + TRY (h5b_3d_get_reduced_view ( + f, + (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)); + *i_start += 1; + *i_end += 1; + *j_start += 1; + *j_end += 1; + *k_start += 1; + *k_end += 1; + H5_API_RETURN (H5_SUCCESS); +} + +#define h5bl_3d_hasview F77_NAME ( \ + h5bl_hasview, \ + h5bl_hasview_, \ + H5BL_HASVIEW ) +h5_int64_t +h5bl_3d_hasview ( + const h5_int64_t* const fh + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p", + (h5_file_p)f); + H5_API_RETURN (h5b_3d_has_view ( f )); +} + +#define h5bl_3d_setchunk F77_NAME ( \ + h5bl_3d_setchunk, \ + h5bl_3d_setchunk_, \ + H5BL_3D_SETCHUNK ) +h5_int64_t +h5bl_3d_setchunk ( + const h5_int64_t* const fh, + const h5_int64_t* const i, + const h5_int64_t* const j, + const h5_int64_t* const k + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, i=%lld, j=%lld, k=%lld", + (h5_file_p)f, (long long)i, (long long)j, (long long)k); + H5_API_RETURN(h5b_3d_set_chunk ( f, *i, *j, *k )); +} + +#define h5bl_getnumfields F77_NAME ( \ + h5bl_getnumfields, \ + h5bl_getnumfields_, \ + H5BL_GETNUMFIELDS ) +h5_int64_t +h5bl_getnumfields ( + const h5_int64_t* const fh + ) { + + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p", + (h5_file_p)f); + H5_API_RETURN (h5b_get_num_fields (f)); +} + +#define h5bl_getfieldinfo F77_NAME ( \ + h5bl_getfieldinfo, \ + h5bl_getfieldinfo_, \ + H5BL_GETFIELDINFO ) +h5_int64_t +h5bl_getfieldinfo ( + const h5_int64_t* const fh, + const h5_int64_t *idx, + char* const name, + h5_size_t* const field_rank, + h5_size_t* const field_dims, + h5_size_t* const elem_rank, + h5_int64_t* const type, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, idx=%lld, " + "name=%*s," + "field_rank=%p, field_dims=%p, elem_rank=%p, type=%p", + (h5_file_p)f, (long long)*idx, l_name, name, + field_rank, field_dims, elem_rank, type); + h5_int64_t herr = h5b_get_field_info ( + f, *idx - 1, name, (h5_size_t)l_name, + field_rank, field_dims, elem_rank, type ); + h5_strc2for ( name, l_name ); + H5_API_RETURN(herr); +} + diff --git a/src/Fortran/H5BlockF.f90 b/src/Fortran/H5BlockF.f90 new file mode 100644 index 0000000..f145d31 --- /dev/null +++ b/src/Fortran/H5BlockF.f90 @@ -0,0 +1,97 @@ +! _ _ _ _ +! __| | __ _| |_ __ _ _ __ ___ ___ __| | ___| | +! / _` |/ _` | __/ _` | | '_ ` _ \ / _ \ / _` |/ _ \ | +! | (_| | (_| | || (_| | | | | | | | (_) | (_| | __/ | +! \__,_|\__,_|\__\__,_| |_| |_| |_|\___/ \__,_|\___|_| + + +!> +!! \ingroup h5block_model_f +!! See \ref H5Block3dSetView +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_setview ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end ) + INTEGER*8, INTENT(IN) :: filehandle + INTEGER*8, INTENT(IN) :: i_start + INTEGER*8, INTENT(IN) :: i_end + INTEGER*8, INTENT(IN) :: j_start + INTEGER*8, INTENT(IN) :: j_end + INTEGER*8, INTENT(IN) :: k_start + INTEGER*8, INTENT(IN) :: k_end +END FUNCTION + +!> +!! \ingroup h5block_model_f +!! See \ref H5Block3dGetView +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_getview ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end ) + INTEGER*8, INTENT(IN) :: filehandle + INTEGER*8, INTENT(OUT) :: i_start + INTEGER*8, INTENT(OUT) :: i_end + INTEGER*8, INTENT(OUT) :: j_start + INTEGER*8, INTENT(OUT) :: j_end + INTEGER*8, INTENT(OUT) :: k_start + INTEGER*8, INTENT(OUT) :: k_end +END FUNCTION + +!> +!! \ingroup h5block_model_f +!! See \ref H5Block3dGetReducedView +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_getreducedview ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end ) + INTEGER*8, INTENT(IN) :: filehandle + INTEGER*8, INTENT(OUT) :: i_start + INTEGER*8, INTENT(OUT) :: i_end + INTEGER*8, INTENT(OUT) :: j_start + INTEGER*8, INTENT(OUT) :: j_end + INTEGER*8, INTENT(OUT) :: k_start + INTEGER*8, INTENT(OUT) :: k_end +END FUNCTION + +!> +!! \ingroup h5block_model_f +!! See \ref H5Block3dHasView +!! \return rank of processor error code +!< +INTEGER*8 FUNCTION h5bl_3d_hasview ( filehandle ) + INTEGER*8, INTENT(IN) :: filehandle +END FUNCTION + +!> +!! \ingroup h5block_model_f +!! See \ref H5Block3dSetChunk +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_setchunk ( filehandle, i, j, k ) + INTEGER*8, INTENT(IN) :: filehandle + INTEGER*8, INTENT(IN) :: i + INTEGER*8, INTENT(IN) :: j + INTEGER*8, INTENT(IN) :: k +END FUNCTION + +!> +!! \ingroup h5block_model_f +!! See \ref H5BlockGetNumFields +!! \return number of fields or error code +!< +INTEGER*8 FUNCTION h5bl_getnumfields ( filehandle ) + INTEGER*8, INTENT(IN) :: filehandle +END FUNCTION + +!> +!! \ingroup h5block_model_f +!! See \ref H5BlockGetFieldInfo +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_getfieldinfo ( filehandle, idx, field_name, grid_rank, grid_dims, field_dims ) + INTEGER*8, INTENT(IN) :: filehandle + INTEGER*8, INTENT(IN) :: idx + CHARACTER(LEN=*), INTENT(OUT) :: field_name + INTEGER*8, INTENT(OUT) :: grid_rank + INTEGER*8, INTENT(OUT) :: grid_dims(*) + INTEGER*8, INTENT(OUT) :: field_dims + INTEGER*8, INTENT(OUT) :: type +END FUNCTION + diff --git a/src/Fortran/H5Block_F.c b/src/Fortran/H5Block_F.c index f44c628..1939d0f 100755 --- a/src/Fortran/H5Block_F.c +++ b/src/Fortran/H5Block_F.c @@ -13,107 +13,107 @@ #error Error, no way to determine how to construct fortran bindings #endif -#if ! defined(F77_NO_UNDERSCORE) +#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_hasview F77NAME ( \ - h5bl_hasview_, \ - H5BL_HASVIEW ) -#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 ) +#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_hasview F77NAME ( \ + h5bl_hasview_, \ + H5BL_HASVIEW ) +#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 *const 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_int64_t *const 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 *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, " - "i_start=%lld, i_end=%lld, " - "j_start=%lld, j_end=%lld, " - "k_start=%lld, k_end=%lld", - fh, - (long long)i_start, (long long)i_end, - (long long)j_start, (long long)j_end, - (long long)k_start, (long long)k_end); + "f=%p, " + "i_start=%lld, i_end=%lld, " + "j_start=%lld, j_end=%lld, " + "k_start=%lld, k_end=%lld", + fh, + (long long)i_start, (long long)i_end, + (long long)j_start, (long long)j_end, + (long long)k_start, (long long)k_end); H5_API_RETURN(h5b_3d_set_view ( - fh, - *i_start-1, *i_end-1, - *j_start-1, *j_end-1, - *k_start-1, *k_end-1 )); + fh, + *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 *const f, - const h5_int64_t *i, - const h5_int64_t *j, - const h5_int64_t *k - ) { + h5_int64_t *const f, + const h5_int64_t *i, + const h5_int64_t *j, + const h5_int64_t *k + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, i=%lld, j=%lld, k=%lld", - fh, (long long)i, (long long)j, (long long)k); + "f=%p, i=%lld, j=%lld, k=%lld", + fh, (long long)i, (long long)j, (long long)k); H5_API_RETURN(h5b_3d_set_chunk ( fh, *i, *j, *k )); } h5_err_t h5bl_3d_getview ( - h5_int64_t *const f, - h5_int64_t *const i_start, - h5_int64_t *const i_end, - h5_int64_t *const j_start, - h5_int64_t *const j_end, - h5_int64_t *const k_start, - h5_int64_t *const k_end - ) { + h5_int64_t *const f, + h5_int64_t *const i_start, + h5_int64_t *const i_end, + h5_int64_t *const j_start, + h5_int64_t *const j_end, + h5_int64_t *const k_start, + h5_int64_t *const k_end + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, " - "i_start=%p, i_end=%p, " - "j_start=%p, j_end=%p, " - "k_start=%p, k_end=%p", - fh, - i_start, i_end, - j_start, j_end, - k_start, k_end); + "f=%p, " + "i_start=%p, i_end=%p, " + "j_start=%p, j_end=%p, " + "k_start=%p, k_end=%p", + fh, + i_start, i_end, + j_start, j_end, + k_start, k_end); H5_API_RETURN (h5b_3d_get_view ( fh, (h5_size_t*)i_start, (h5_size_t*)i_end, @@ -123,25 +123,25 @@ h5bl_3d_getview ( h5_err_t h5bl_3d_getreducedview ( - h5_int64_t *const f, - h5_int64_t *const i_start, - h5_int64_t *const i_end, - h5_int64_t *const j_start, - h5_int64_t *const j_end, - h5_int64_t *const k_start, - h5_int64_t *const k_end - ) { + h5_int64_t *const f, + h5_int64_t *const i_start, + h5_int64_t *const i_end, + h5_int64_t *const j_start, + h5_int64_t *const j_end, + h5_int64_t *const k_start, + h5_int64_t *const k_end + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, " - "i_start=%p, i_end=%p, " - "j_start=%p, j_end=%p, " - "k_start=%p, k_end=%p", - fh, - i_start, i_end, - j_start, j_end, - k_start, k_end); + "f=%p, " + "i_start=%p, i_end=%p, " + "j_start=%p, j_end=%p, " + "k_start=%p, k_end=%p", + fh, + i_start, i_end, + j_start, j_end, + k_start, k_end); H5_API_RETURN(h5b_3d_get_reduced_view ( fh, (h5_size_t*)i_start, (h5_size_t*)i_end, @@ -151,8 +151,8 @@ h5bl_3d_getreducedview ( h5_int64_t h5bl_3d_hasview ( - h5_int64_t *const f - ) { + h5_int64_t *const f + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_int64_t, "f=%p", fh); @@ -161,8 +161,8 @@ h5bl_3d_hasview ( h5_err_t h5bl_getnumfields ( - h5_int64_t *const f - ) { + h5_int64_t *const f + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_int64_t, "f=%p", fh); @@ -171,60 +171,60 @@ h5bl_getnumfields ( h5_err_t h5bl_getfieldinfo ( - h5_int64_t *const f, - const h5_int64_t *idx, - char *name, - h5_size_t *field_rank, - h5_size_t *field_dims, - h5_size_t *elem_rank, - h5_int64_t *type, - const int l_name - ) { + h5_int64_t *const f, + const h5_int64_t *idx, + char *name, + h5_size_t *field_rank, + h5_size_t *field_dims, + h5_size_t *elem_rank, + h5_int64_t *type, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, idx=%lld, " - "name=%p," - "field_rank=%p, field_dims=%p, elem_rank=%p, type=%p, l_name=%d", - fh, (long long)*idx, name, - field_rank, field_dims, elem_rank, type, l_name); + "f=%p, idx=%lld, " + "name=%p," + "field_rank=%p, field_dims=%p, elem_rank=%p, type=%p, l_name=%d", + fh, (long long)*idx, name, + field_rank, field_dims, elem_rank, type, l_name); h5_err_t herr = h5b_get_field_info ( - fh, *idx, name, (h5_size_t)l_name, - field_rank, field_dims, elem_rank, type ); + fh, *idx, name, (h5_size_t)l_name, + field_rank, field_dims, elem_rank, type ); h5_strc2for ( name, l_name ); H5_API_RETURN(herr); } h5_err_t h5bl_writefieldattrib_string ( - h5_int64_t *const f, - const char *field_name, - const char *attrib_name, - const char *buffer, - const int l_field_name, - const int l_attrib_name, - const int l_buffer - ) { + h5_int64_t *const f, + const char *field_name, + const char *attrib_name, + const char *buffer, + const int l_field_name, + const int l_attrib_name, + const int l_buffer + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); char *buffer2 = h5_strdupfor2c ( buffer, l_buffer ); H5_API_ENTER (h5_err_t, - "f=%p, " - "field_name='%s', " - "attrib_name='%s', " - "buffer='%s', " - "l_field_name=%d, " - "l_attrib_name=%d, " - "l_buffer=%d", - fh, - field_name2, - attrib_name2, - buffer2, l_field_name, l_attrib_name, l_buffer); + "f=%p, " + "field_name='%s', " + "attrib_name='%s', " + "buffer='%s', " + "l_field_name=%d, " + "l_attrib_name=%d, " + "l_buffer=%d", + fh, + field_name2, + attrib_name2, + buffer2, l_field_name, l_attrib_name, l_buffer); h5_err_t herr = h5_write_field_attrib ( - fh, field_name2, attrib_name2, - H5_STRING_T, buffer2, strlen(buffer2)+1 ); + fh, field_name2, attrib_name2, + H5_STRING_T, buffer2, strlen(buffer2)+1 ); free ( field_name2 ); free ( attrib_name2 ); @@ -235,15 +235,15 @@ h5bl_writefieldattrib_string ( h5_err_t h5bl_getnfieldattribs ( - h5_int64_t *const f, - const char *name, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', l_name=%d", fh, name2, l_name); + "f=%p, name='%s', l_name=%d", fh, name2, l_name); h5_err_t herr = h5b_get_num_field_attribs ( fh, name2 ); free ( name2 ); H5_API_RETURN(herr); @@ -251,33 +251,33 @@ h5bl_getnfieldattribs ( h5_err_t h5bl_getfieldattribinfo ( - h5_int64_t *const 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_int64_t *const 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 *fh = h5_filehandlefor2c(f); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); H5_API_ENTER (h5_err_t, - "f=%p field_name='%s', " - "attrib_idx=%lld, " - "attrib_name=%p, " - "attrib_nelem=%p, l_field_name=%d, l_attrib_name=%d", - fh, - field_name2, - (long long)*attrib_idx, - attrib_name, attrib_nelem, l_field_name, l_attrib_name); + "f=%p field_name='%s', " + "attrib_idx=%lld, " + "attrib_name=%p, " + "attrib_nelem=%p, l_field_name=%d, l_attrib_name=%d", + fh, + field_name2, + (long long)*attrib_idx, + attrib_name, attrib_nelem, l_field_name, l_attrib_name); h5_int64_t attrib_type; h5_err_t herr = h5b_get_field_attrib_info ( - fh, field_name2, *attrib_idx, - attrib_name, l_attrib_name, - &attrib_type, - attrib_nelem ); + fh, field_name2, *attrib_idx, + attrib_name, l_attrib_name, + &attrib_type, + attrib_nelem ); h5_strc2for ( attrib_name, l_attrib_name ); @@ -288,31 +288,31 @@ h5bl_getfieldattribinfo ( h5_err_t h5bl_readfieldattrib_string ( - h5_int64_t *const f, - const char *field_name, - const char *attrib_name, - char *buffer, - const int l_field_name, - const int l_attrib_name, - const int l_buffer - ) { + h5_int64_t *const f, + const char *field_name, + const char *attrib_name, + char *buffer, + const int l_field_name, + const int l_attrib_name, + const int l_buffer + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); H5_API_ENTER (h5_err_t, - "f=%p, " - "field_name='%s', " - "attrib_name='%s', " - "buffer=%p, l_field_name=%d, l_attrib_name=%d, l_buffer=%d", - fh, - field_name, - attrib_name, - buffer, l_field_name, l_attrib_name, l_buffer); + "f=%p, " + "field_name='%s', " + "attrib_name='%s', " + "buffer=%p, l_field_name=%d, l_attrib_name=%d, l_buffer=%d", + fh, + field_name, + attrib_name, + buffer, l_field_name, l_attrib_name, l_buffer); h5_err_t herr = h5_read_field_attrib ( - fh, field_name2, attrib_name2, - H5_STRING_T, buffer ); + fh, field_name2, attrib_name2, + H5_STRING_T, buffer ); h5_strc2for ( buffer, l_buffer ); diff --git a/src/Fortran/H5Block_attribs.c b/src/Fortran/H5Block_attribs.c new file mode 100644 index 0000000..a371c7c --- /dev/null +++ b/src/Fortran/H5Block_attribs.c @@ -0,0 +1,455 @@ +/* + Copyright (c) 2006-2012, The Regents of the University of California, + through Lawrence Berkeley National Laboratory (subject to receipt of any + required approvals from the U.S. Dept. of Energy) and the Paul Scherrer + Institut (Switzerland). All rights reserved. + + License: see file COPYING in top level of source distribution. +*/ + +#include "h5_private.h" +#include "h5core/h5b_attribs.h" + +#define H5_R8_T H5_FLOAT64_T +#define H5_R4_T H5_FLOAT32_T +#define H5_I8_T H5_INT64_T +#define H5_I4_T H5_INT32_T + +/* + __ _ _ _ ___ _ __ _ _ + / _` | | | |/ _ \ '__| | | | + | (_| | |_| | __/ | | |_| | + \__, |\__,_|\___|_| \__, | + |_| |___/ +*/ + +#define h5bl_getnfieldattribs F77_NAME ( \ + h5bl_getnfieldattribs, \ + h5bl_getnfieldattribs_, \ + H5BL_GETNFIELDATTRIBS) +h5_int64_t +h5bl_getnfieldattribs ( + const h5_int64_t* const fh, + const char* const name, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%*s'", + (h5_file_p)f, l_name, name); + char* name2 = h5_strdupfor2c ( name, l_name ); + h5_int64_t herr = h5b_get_num_field_attribs (f, name2); + free (name2); + H5_API_RETURN (herr); +} + +#define h5bl_getfieldattribinfo F77_NAME ( \ + h5bl_getfieldattribinfo, \ + h5bl_getfieldattribinfo_, \ + h5bl_getfieldattribinfo) +h5_int64_t +h5bl_getfieldattribinfo ( + const h5_int64_t* const fh, + const char* const field_name, + const h5_int64_t* const attrib_idx, + char* const attrib_name, + h5_int64_t* const attrib_nelem, + const int l_field_name, + const int l_attrib_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, field_name='%*s', attrib_idx=%lld, " + "attrib_name=%p, attrib_nelem=%p", + (h5_file_p)f, + l_field_name, field_name, + (long long)*attrib_idx, + attrib_name, attrib_nelem); + + char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); + h5_int64_t attrib_type; + h5_int64_t herr = h5b_get_field_attrib_info ( + f, + field_name2, *attrib_idx - 1, + attrib_name, l_attrib_name, + &attrib_type, + (h5_size_t*)attrib_nelem ); + + h5_strc2for ( attrib_name, l_attrib_name ); + + free (field_name2); + H5_API_RETURN (herr); +} + +/* + _ __ + (_) / /__ + | | / / _ \ + | |/ / (_) | + |_/_/ \___/ +*/ +static inline h5_int64_t +write_field_attrib ( + h5_file_t* const fh, + const char* field_name, + const int l_field_name, + const char* attrib_name, + const int l_attrib_name, + const h5_int64_t attrib_type, + const void* attrib_value, + const hsize_t attrib_nelems + ) { + char *field_name2 = h5_strdupfor2c (field_name, l_field_name); + char *attrib_name2 = h5_strdupfor2c (attrib_name, l_attrib_name); + h5_int64_t h5err = h5_write_field_attrib ( + fh, field_name2, + attrib_name2, attrib_type, + attrib_value, attrib_nelems); + free (field_name2); + free (attrib_name2); + return h5err; +} + +static inline h5_int64_t +read_field_attrib ( + h5_file_t* const fh, + const char* field_name, + const int l_field_name, + const char* attrib_name, + const int l_attrib_name, + const hid_t attrib_type, + void* attrib_value + ) { + char *field_name2 = h5_strdupfor2c (field_name, l_field_name); + char *attrib_name2 = h5_strdupfor2c (attrib_name, l_attrib_name); + h5_int64_t h5err = h5_read_field_attrib ( + fh, field_name2, + attrib_name2, attrib_type, attrib_value); + free (field_name2); + free (attrib_name2); + return h5err; +} + +/* + _ _ + ___| |_ _ __(_)_ __ __ _ + / __| __| '__| | '_ \ / _` | + \__ \ |_| | | | | | | (_| | + |___/\__|_| |_|_| |_|\__, | + |___/ +*/ +#define h5bl_writefieldattrib_string F77_NAME ( \ + h5bl_writefieldattrib_string, \ + h5bl_writefieldattrib_string_, \ + H5BL_WRITEFIELDATTRIB_STRING) +h5_int64_t +h5bl_writefieldattrib_string ( + const h5_int64_t* const fh, + const char* const field_name, + const char* const attrib_name, + const char* const attrib_value, + const int l_field_name, + const int l_attrib_name, + const int l_attrib_value + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, field_name='%.*s', " + "attrib_name='%.*s' attrib_value='%.*s'", + (h5_file_p)f, + l_field_name, field_name, + l_attrib_name, attrib_name, + l_attrib_value, attrib_value); + char* attrib_value2 = h5_strdupfor2c (attrib_value, l_attrib_value); + h5_int64_t h5err = write_field_attrib ( + f, + field_name, l_field_name, + attrib_name, l_attrib_name, + H5_STRING_T, + attrib_value2, strlen(attrib_value2)+1 ); + free (attrib_value2); + H5_API_RETURN (h5err); +} + +#define h5bl_readfieldattrib_string F77_NAME ( \ + h5bl_readfieldattrib_string, \ + h5bl_readfieldattrib_string_, \ + H5BL_READFIELDATTRIB_STRING) +h5_err_t +h5bl_readfieldattrib_string ( + const h5_int64_t* const fh, + const char* const field_name, + const char* const attrib_name, + char* const attrib_value, + const int l_field_name, + const int l_attrib_name, + const int l_attrib_value + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "f=%p, field_name='%.*s', attrib_name='%.*s' attrib_value='%p'", + (h5_file_p)f, + l_field_name, field_name, + l_attrib_name, attrib_name, + attrib_value); + h5_int64_t h5err = read_field_attrib ( + f, + field_name, l_field_name, + attrib_name, l_attrib_name, + H5_STRING_T, attrib_value); + + h5_strc2for (attrib_value, l_attrib_value); + H5_API_RETURN (h5err); +} + +/* + _ + _ __ ___ __ _| | + | '__/ _ \/ _` | | + | | | __/ (_| | | + |_| \___|\__,_|_| +*/ +#define h5bl_writefieldattrib_r8 F77_NAME ( \ + h5bl_writefieldattrib_r8, \ + h5bl_writefieldattrib_r8_, \ + H5BL_WRITEFIELDATTRIB_R8) +h5_int64_t +h5bl_writefieldattrib_r8 ( + const h5_int64_t* const fh, + const char* const field_name, + const char* const attrib_name, + const h5_float64_t* const attrib_value, + const h5_int64_t* const attrib_nelems, + const int l_field_name, + const int l_attrib_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, field_name='%.*s', attrib_name='%.*s', " + "attrib_value=%p, attrib_nelems=%lld", + (h5_file_p)f, + l_field_name, field_name, + l_attrib_name, attrib_name, + attrib_value, *attrib_nelems); + H5_API_RETURN (write_field_attrib ( + f, + field_name, l_field_name, + attrib_name, l_attrib_name, + H5_R8_T, + attrib_value, *attrib_nelems)); +} + +#define h5bl_readfieldattrib_r8 F77_NAME ( \ + h5bl_readfieldattrib_r8, \ + h5bl_readfieldattrib_r8_, \ + H5BL_READFIELDATTRIB_R8) +h5_err_t +h5bl_readfieldattrib_r8 ( + const h5_int64_t* const fh, + const char* const field_name, + const char* const attrib_name, + h5_float64_t* const attrib_value, + const int l_field_name, + const int l_attrib_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, field_name='%.*s', attrib_name='%.*s', " + "attrib_value=%p", + (h5_file_p)f, + l_field_name, field_name, + l_attrib_name, attrib_name, + attrib_value); + H5_API_RETURN (read_field_attrib ( + f, + field_name, l_field_name, + attrib_name, l_attrib_name, + H5_R8_T, + attrib_value)); +} + +#define h5bl_writefieldattrib_r4 F77_NAME ( \ + h5bl_writefieldattrib_r4, \ + h5bl_writefieldattrib_r4_, \ + H5BL_WRITEFIELDATTRIB_R4) +h5_int64_t +h5bl_writefieldattrib_r4 ( + const h5_int64_t* const fh, + const char* const field_name, + const char* const attrib_name, + const h5_float32_t* const attrib_value, + const h5_int64_t* const attrib_nelems, + const int l_field_name, + const int l_attrib_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, field_name='%.*s', attrib_name='%.*s', " + "attrib_value=%p, attrib_nelems=%lld", + (h5_file_p)f, + l_field_name, field_name, + l_attrib_name, attrib_name, + attrib_value, *attrib_nelems); + H5_API_RETURN (write_field_attrib ( + f, + field_name, l_field_name, + attrib_name, l_attrib_name, + H5_R4_T, + attrib_value, *attrib_nelems)); +} + +#define h5bl_readfieldattrib_r4 F77_NAME ( \ + h5bl_readfieldattrib_r4, \ + h5bl_readfieldattrib_r4_, \ + H5BL_READFIELDATTRIB_R4) +h5_err_t +h5bl_readfieldattrib_r4 ( + const h5_int64_t* const fh, + const char* const field_name, + const char* const attrib_name, + h5_float32_t* const attrib_value, + const int l_field_name, + const int l_attrib_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, field_name='%.*s', attrib_name='%.*s', " + "attrib_value=%p", + (h5_file_p)f, + l_field_name, field_name, + l_attrib_name, attrib_name, + attrib_value); + H5_API_RETURN (read_field_attrib ( + f, + field_name, l_field_name, + attrib_name, l_attrib_name, + H5_R4_T, + attrib_value)); +} + +/* + _ _ + (_)_ __ | |_ ___ __ _ ___ _ __ + | | '_ \| __/ _ \/ _` |/ _ \ '__| + | | | | | || __/ (_| | __/ | + |_|_| |_|\__\___|\__, |\___|_| + |___/ +*/ +#define h5bl_writefieldattrib_i8 F77_NAME ( \ + h5bl_writefieldattrib_i8, \ + h5bl_writefieldattrib_i8_, \ + H5BL_WRITEFIELDATTRIB_I8) +h5_int64_t +h5bl_writefieldattrib_i8 ( + const h5_int64_t* const fh, + const char* const field_name, + const char* const attrib_name, + const h5_int64_t* const attrib_value, + const h5_int64_t* const attrib_nelems, + const int l_field_name, + const int l_attrib_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, field_name='%.*s', attrib_name='%.*s', " + "attrib_value=%p, attrib_nelems=%lld", + (h5_file_p)f, + l_field_name, field_name, + l_attrib_name, attrib_name, + attrib_value, *attrib_nelems); + H5_API_RETURN (write_field_attrib ( + f, + field_name, l_field_name, + attrib_name, l_attrib_name, + H5_I8_T, + attrib_value, *attrib_nelems)); +} + +#define h5bl_readfieldattrib_i8 F77_NAME ( \ + h5bl_readfieldattrib_i8, \ + h5bl_readfieldattrib_i8_, \ + H5BL_READFIELDATTRIB_I8) +h5_err_t +h5bl_readfieldattrib_i8 ( + const h5_int64_t* const fh, + const char* const field_name, + const char* const attrib_name, + h5_int64_t* const attrib_value, + const int l_field_name, + const int l_attrib_name, + const int l_attrib_value + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, field_name='%.*s', attrib_name='%.*s', " + "attrib_value=%p", + (h5_file_p)f, + l_field_name, field_name, + l_attrib_name, attrib_name, + attrib_value); + H5_API_RETURN (read_field_attrib ( + f, + field_name, l_field_name, + attrib_name, l_attrib_name, + H5_I8_T, + attrib_value)); +} + +#define h5bl_writefieldattrib_i4 F77_NAME ( \ + h5bl_writefieldattrib_i4, \ + h5bl_writefieldattrib_i4_, \ + H5BL_WRITEFIELDATTRIB_I4 ) +h5_int64_t +h5bl_writefieldattrib_i4 ( + const h5_int64_t* const fh, + const char* const field_name, + const char* const attrib_name, + const h5_int32_t* const attrib_value, + const h5_int64_t* const attrib_nelems, + const int l_field_name, + const int l_attrib_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, field_name='%.*s', attrib_name='%.*s', " + "attrib_value=%p, attrib_nelems=%lld", + (h5_file_p)f, + l_field_name, field_name, + l_attrib_name, attrib_name, + attrib_value, *attrib_nelems); + H5_API_RETURN (write_field_attrib ( + f, + field_name, l_field_name, + attrib_name, l_attrib_name, + H5_I4_T, + attrib_value, *attrib_nelems)); +} + +#define h5bl_readfieldattrib_i4 F77_NAME ( \ + h5bl_readfieldattrib_i4, \ + h5bl_readfieldattrib_i4_, \ + H5BL_READFIELDATTRIB_I4) +h5_err_t +h5bl_readfieldattrib_i4 ( + const h5_int64_t* const fh, + const char* const field_name, + const char* const attrib_name, + h5_int32_t* const attrib_value, + const int l_field_name, + const int l_attrib_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, field_name='%.*s', attrib_name='%.*s', " + "attrib_value=%p", + (h5_file_p)f, + l_field_name, field_name, + l_attrib_name, attrib_name, + attrib_value); + H5_API_RETURN (read_field_attrib ( + f, + field_name, l_field_name, + attrib_name, l_attrib_name, + H5_I4_T, + attrib_value)); +} diff --git a/src/Fortran/H5Block_attribsF.f90 b/src/Fortran/H5Block_attribsF.f90 new file mode 100644 index 0000000..020aa6e --- /dev/null +++ b/src/Fortran/H5Block_attribsF.f90 @@ -0,0 +1,249 @@ + +! __ _ _ _ _ _ _ _ _ +! / _(_) ___| | __| | __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ +! | |_| |/ _ \ |/ _` | / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| +! | _| | __/ | (_| | | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ +! |_| |_|\___|_|\__,_| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ + +! +! __ _ _ _ ___ _ __ _ _ +! / _` | | | |/ _ \ '__| | | | +! | (_| | |_| | __/ | | |_| | +! \__, |\__,_|\___|_| \__, | +! |_| |___/ + +!> +!! \ingroup h5block_attrib_f +!! See \ref H5BlockGetNumFieldAttribs +!! \return number of attributes or error code +!< +INTEGER*8 FUNCTION h5bl_getnfieldattribs (filehandle, field_name) + INTEGER*8, INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field +END FUNCTION + +!> +!! \ingroup h5block_attrib_f +!! See \ref H5BlockGetFieldAttribInfo +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_getfieldattribinfo (filehandle, field_name, idx, attrib_name, attrib_nelems) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field + INTEGER*8,INTENT(IN) :: idx !< index of attribute being queried + CHARACTER(LEN=*), INTENT(OUT):: attrib_name !< name of attribute + INTEGER*8,INTENT(OUT):: attrib_nelems !< number of elements in the attrib array +END FUNCTION + +! _ __ _ _ +! (_) / /__ ___| |_ _ __(_)_ __ __ _ +! | | / / _ \ / __| __| '__| | '_ \ / _` | +! | |/ / (_) | \__ \ |_| | | | | | | (_| | +! |_/_/ \___/ |___/\__|_| |_|_| |_|\__, | +! |___/ + +!> +!! \ingroup h5block_attrib_f +!! See \ref H5BlockWriteFieldAttribString +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_writefieldattrib_string (filehandle, field_name, attrib_name, attrib_value, attrib_nelems) + INTEGER*8, INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute + CHARACTER(LEN=*), INTENT(IN) :: attrib_value!< attribute data to be written + INTEGER*8, INTENT(IN) :: attrib_nelems !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5block_attrib_f +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_readfieldattrib_string (filehandle, field_name, attrib_name, attrib_value) + INTEGER*8, INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute + CHARACTER(LEN=*), INTENT(IN) :: attrib_value!< attribute data will be read into this array +END FUNCTION + +! _ __ _ +! (_) / /__ _ __ ___ __ _| | +! | | / / _ \ | '__/ _ \/ _` | | +! | |/ / (_) | | | | __/ (_| | | +! |_/_/ \___/ |_| \___|\__,_|_| + +!> +!! \ingroup h5block_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_nelems) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write + REAL*8, INTENT(OUT):: attrib_value(*) !< attribute data to be written + INTEGER*8, INTENT(IN) :: attrib_nelems !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5block_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 ) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + REAL*8, INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array +END FUNCTION + +!> +!! \ingroup h5block_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_nelems) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write + REAL*4, INTENT(OUT):: attrib_value(*) !< attribute datato be written + INTEGER*8, INTENT(IN) :: attrib_nelems !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5block_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) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + REAL*4, INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array +END FUNCTION + +! _ __ _ _ +! (_) / /__ (_)_ __ | |_ ___ __ _ ___ _ __ +! | | / / _ \ | | '_ \| __/ _ \/ _` |/ _ \ '__| +! | |/ / (_) | | | | | | || __/ (_| | __/ | +! |_/_/ \___/ |_|_| |_|\__\___|\__, |\___|_| +! |___/ + +!> +!! \ingroup h5block_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_nelems) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write + INTEGER*8,INTENT(OUT):: attrib_value(*) !< attribute data to be written + INTEGER*8, INTENT(IN) :: attrib_nelems !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5block_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) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + INTEGER*8,INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array +END FUNCTION + +!> +!! \ingroup h5block_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_nelems) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write + INTEGER*4,INTENT(OUT):: attrib_value(*) !< attribute data to be written + INTEGER*8, INTENT(IN) :: attrib_nelems !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5block_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) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: field_name !< name of field + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + INTEGER*4,INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array +END FUNCTION + +! __ _ _ _ _ +! / _(_) ___| | __| | ___ _ __ __ _ ___(_)_ __ __ _ +! | |_| |/ _ \ |/ _` | / __| '_ \ / _` |/ __| | '_ \ / _` | +! | _| | __/ | (_| | \__ \ |_) | (_| | (__| | | | | (_| | +! |_| |_|\___|_|\__,_| |___/ .__/ \__,_|\___|_|_| |_|\__, | +! |_| |___/ + +!> +!! \ingroup h5block_attrib_f +!! See \ref H5Block3dGetFieldSpacing +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_get_field_spacing (filehandle, name, x, y, z) + INTEGER*8, INTENT(IN) :: filehandle + CHARACTER(LEN=*), INTENT(IN) :: name + REAL*8, INTENT(OUT) :: x + REAL*8, INTENT(OUT) :: y + REAL*8, INTENT(OUT) :: z +END FUNCTION + +!> +!! \ingroup h5block_attrib_f +!! See \ref H5Block3dSetFieldSpacing +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_set_field_spacing (filehandle, name, x, y, z) + INTEGER*8, INTENT(IN) :: filehandle + CHARACTER(LEN=*), INTENT(IN) :: name + REAL*8, INTENT(IN) :: x + REAL*8, INTENT(IN) :: y + REAL*8, INTENT(IN) :: z +END FUNCTION + +! __ _ _ _ _ _ +! / _(_) ___| | __| | ___ _ __(_) __ _(_)_ __ +! | |_| |/ _ \ |/ _` | / _ \| '__| |/ _` | | '_ \ +! | _| | __/ | (_| | | (_) | | | | (_| | | | | | +! |_| |_|\___|_|\__,_| \___/|_| |_|\__, |_|_| |_| +! |___/ + +!> +!! \ingroup h5block_attrib_f +!! See \ref H5Block3dGetFieldOrigin +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_get_field_origin (filehandle, name, x, y, z) + INTEGER*8, INTENT(IN) :: filehandle + CHARACTER(LEN=*), INTENT(IN) :: name + REAL*8, INTENT(OUT) :: x + REAL*8, INTENT(OUT) :: y + REAL*8, INTENT(OUT) :: z +END FUNCTION + +!> +!! \ingroup h5block_attrib_f +!! See \ref H5Block3dSetFieldOrigin +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_set_field_origin (filehandle, name, x, y, z) + INTEGER*8, INTENT(IN) :: filehandle + CHARACTER(LEN=*), INTENT(IN) :: name + REAL*8, INTENT(IN) :: x + REAL*8, INTENT(IN) :: y + REAL*8, INTENT(IN) :: z +END FUNCTION + +!> @} diff --git a/src/Fortran/H5Block_io.c b/src/Fortran/H5Block_io.c new file mode 100644 index 0000000..2c8ee98 --- /dev/null +++ b/src/Fortran/H5Block_io.c @@ -0,0 +1,387 @@ +/* + Copyright (c) 2006-2012, The Regents of the University of California, + through Lawrence Berkeley National Laboratory (subject to receipt of any + required approvals from the U.S. Dept. of Energy) and the Paul Scherrer + Institut (Switzerland). All rights reserved. + + License: see file COPYING in top level of source distribution. +*/ + +#include "h5_private.h" +//#include "h5core/h5b_io.h" + +#define h5bl_3d_write_scalar_field_r8 F77_NAME ( \ + h5bl_3d_write_scalar_field_r8, \ + h5bl_3d_write_scalar_field_r8_, \ + H5BL_3D_WRITE_SCALAR_FIELD_R8 ) +h5_err_t +h5bl_3d_write_scalar_field_r8 ( + const h5_int64_t* const fh, + const char* const name, + const h5_float64_t* const buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%*s', buffer=%p", + (h5_file_p)f, l_name, name, buffer); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_write_scalar_data ( + f, name2, (void*)buffer, H5T_NATIVE_DOUBLE ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5bl_3d_read_scalar_field_r8 F77_NAME ( \ + h5bl_3d_read_scalar_field_r8, \ + h5bl_3d_read_scalar_field_r8_, \ + H5BL_3D_READ_SCALAR_FIELD_R8 ) +h5_err_t +h5bl_3d_read_scalar_field_r8 ( + const h5_int64_t* const fh, + const char* const name, + h5_float64_t* const buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', buffer=%p, l_name=%d", + (h5_file_p)f, name, buffer, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_read_scalar_data ( + f, name2, buffer, H5T_NATIVE_DOUBLE ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5bl_3d_write_vector3d_field_r8 F77_NAME ( \ + h5bl_3d_write_vector3d_field_r8, \ + h5bl_3d_write_vector3d_field_r8_, \ + H5BL_3D_WRITE_VECTOR3D_FIELD_R8 ) +h5_err_t +h5bl_3d_write_vector3d_field_r8 ( + const h5_int64_t* const fh, + const char* const name, + const h5_float64_t* const x_buf, + const h5_float64_t* const y_buf, + const h5_float64_t* const z_buf, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + (h5_file_p)f, name, x_buf, y_buf, z_buf, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_write_vector3d_data ( + f, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5bl_3d_read_vector3d_field_r8 F77_NAME ( \ + h5bl_3d_read_vector3d_field_r8, \ + h5bl_3d_read_vector3d_field_r8_, \ + H5BL_3D_READ_VECTOR3D_FIELD_R8 ) +h5_err_t +h5bl_3d_read_vector3d_field_r8 ( + const h5_int64_t* const fh, + const char* const name, + h5_float64_t* const x_buf, + h5_float64_t* const y_buf, + h5_float64_t* const z_buf, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + (h5_file_p)f, name, x_buf, y_buf, z_buf, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_read_vector3d_data ( + f, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5bl_3d_write_scalar_field_r4 F77_NAME ( \ + h5bl_3d_write_scalar_field_r4, \ + h5bl_3d_write_scalar_field_r4_, \ + H5BL_3D_WRITE_SCALAR_FIELD_R4 ) +h5_err_t +h5bl_3d_write_scalar_field_r4 ( + const h5_int64_t*const fh, + const char* const name, + const h5_float32_t* const buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', buffer=%p, l_name=%d", + (h5_file_p)f, name, buffer, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_write_scalar_data ( + f, name2, (void*)buffer, H5T_NATIVE_FLOAT ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5bl_3d_read_scalar_field_r4 F77_NAME ( \ + h5bl_3d_read_scalar_field_r4, \ + h5bl_3d_read_scalar_field_r4_, \ + H5BL_3D_READ_SCALAR_FIELD_R4 ) +h5_err_t +h5bl_3d_read_scalar_field_r4 ( + const h5_int64_t* const fh, + const char* const name, + h5_float32_t* const buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', buffer=%p, l_name=%d", + (h5_file_p)f, name, buffer, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_read_scalar_data ( + f, name2, buffer, H5T_NATIVE_FLOAT ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5bl_3d_write_vector3d_field_r4 F77_NAME ( \ + h5bl_3d_write_vector3d_field_r4, \ + h5bl_3d_write_vector3d_field_r4_, \ + H5BL_3D_WRITE_VECTOR3D_FIELD_R4 ) +h5_err_t +h5bl_3d_write_vector3d_field_r4 ( + const h5_int64_t* const fh, + const char* const name, + const h5_float32_t* const x_buf, + const h5_float32_t* const y_buf, + const h5_float32_t* const z_buf, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + (h5_file_p)f, name, x_buf, y_buf, z_buf, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_write_vector3d_data ( + f, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_FLOAT ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5bl_3d_read_vector3d_field_r4 F77_NAME ( \ + h5bl_3d_read_vector3d_field_r4, \ + h5bl_3d_read_vector3d_field_r4_, \ + H5BL_3D_READ_VECTOR3D_FIELD_R4 ) +h5_err_t +h5bl_3d_read_vector3d_field_r4 ( + const h5_int64_t* const fh, + const char* const name, + h5_float32_t* const x_buf, + h5_float32_t* const y_buf, + h5_float32_t* const z_buf, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + (h5_file_p)f, name, x_buf, y_buf, z_buf, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_read_vector3d_data ( + f, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_FLOAT ); + free ( name2 ); + H5_API_RETURN (herr); +} + +#define h5bl_3d_write_scalar_field_i8 F77_NAME ( \ + h5bl_3d_write_scalar_field_i8, \ + h5bl_3d_write_scalar_field_i8_, \ + H5BL_3D_WRITE_SCALAR_FIELD_I8 ) +h5_err_t +h5bl_3d_write_scalar_field_i8 ( + const h5_int64_t* const fh, + const char* const name, + const h5_int64_t* const buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', buffer=%p, l_name=%d", + (h5_file_p)f, name, buffer, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_write_scalar_data ( + f, name2, (void*)buffer, H5T_NATIVE_INT64 ); + free ( name2 ); + H5_API_RETURN (herr); +} + +#define h5bl_3d_read_scalar_field_i8 F77_NAME ( \ + h5bl_3d_read_scalar_field_i8, \ + h5bl_3d_read_scalar_field_i8_, \ + H5BL_3D_READ_SCALAR_FIELD_I8 ) +h5_err_t +h5bl_3d_read_scalar_field_i8 ( + const h5_int64_t* const fh, + const char* const name, + h5_int64_t* const buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', buffer=%p, l_name=%d", + (h5_file_p)f, name, buffer, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_read_scalar_data ( + f, name2, buffer, H5T_NATIVE_INT64 ); + free (name2); + H5_API_RETURN (herr); +} + +#define h5bl_3d_write_vector3d_field_i8 F77_NAME ( \ + h5bl_3d_write_vector3d_field_i8, \ + h5bl_3d_write_vector3d_field_i8_, \ + H5BL_3D_WRITE_VECTOR3D_FIELD_I8 ) +h5_err_t +h5bl_3d_write_vector3d_field_i8 ( + const h5_int64_t* const fh, + const char* const name, + const h5_int64_t* const x_buf, + const h5_int64_t* const y_buf, + const h5_int64_t* const z_buf, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + (h5_file_p)f, name, x_buf, y_buf, z_buf, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_write_vector3d_data ( + f, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT64 ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5bl_3d_read_vector3d_field_i8 F77_NAME ( \ + h5bl_3d_read_vector3d_field_i8, \ + h5bl_3d_read_vector3d_field_i8_, \ + H5BL_3D_READ_VECTOR3D_FIELD_I8 ) +h5_err_t +h5bl_3d_read_vector3d_field_i8 ( + const h5_int64_t *const fh, + const char* const name, + h5_int64_t* const x_buf, + h5_int64_t* const y_buf, + h5_int64_t* const z_buf, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + (h5_file_p)f, name, x_buf, y_buf, z_buf, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_read_vector3d_data ( + f, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT64 ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5bl_3d_write_scalar_field_i4 F77_NAME ( \ + h5bl_3d_write_scalar_field_i4, \ + h5bl_3d_write_scalar_field_i4_, \ + H5BL_3D_WRITE_SCALAR_FIELD_I4 ) +h5_err_t +h5bl_3d_write_scalar_field_i4 ( + const h5_int64_t* const fh, + const char* const name, + const h5_int32_t* const buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', buffer=%p, l_name=%d", + (h5_file_p)f, name, buffer, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_write_scalar_data ( + f, name2, (void*)buffer, H5T_NATIVE_INT32 ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5bl_3d_read_scalar_field_i4 F77_NAME ( \ + h5bl_3d_read_scalar_field_i4, \ + h5bl_3d_read_scalar_field_i4_, \ + H5BL_3D_READ_SCALAR_FIELD_I4 ) +h5_err_t +h5bl_3d_read_scalar_field_i4 ( + const h5_int64_t* const fh, + const char* const name, + h5_int32_t* const buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', buffer=%p, l_name=%d", + (h5_file_p)f, name, buffer, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_read_scalar_data ( + f, name2, buffer, H5T_NATIVE_INT32 ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5bl_3d_write_vector3d_field_i4 F77_NAME ( \ + h5bl_3d_write_vector3d_field_i4, \ + h5bl_3d_write_vector3d_field_i4_, \ + H5BL_3D_WRITE_VECTOR3D_FIELD_I4 ) +h5_err_t +h5bl_3d_write_vector3d_field_i4 ( + const h5_int64_t* const fh, + const char* const name, + const h5_int32_t* const x_buf, + const h5_int32_t* const y_buf, + const h5_int32_t* const z_buf, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + (h5_file_p)f, name, x_buf, y_buf, z_buf, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_write_vector3d_data ( + f, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT32 ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5bl_3d_read_vector3d_field_i4 F77_NAME ( \ + h5bl_3d_read_vector3d_field_i4, \ + h5bl_3d_read_vector3d_field_i4_, \ + H5BL_3D_READ_VECTOR3D_FIELD_I4 ) +h5_err_t +h5bl_3d_read_vector3d_field_i4 ( + const h5_int64_t* const fh, + const char* const name, + h5_int32_t* const x_buf, + h5_int32_t* const y_buf, + h5_int32_t* const z_buf, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_err_t, + "fh=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + (h5_file_p)f, name, x_buf, y_buf, z_buf, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_err_t herr = h5b_read_vector3d_data ( + f, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT32 ); + free ( name2 ); + H5_API_RETURN(herr); +} diff --git a/src/Fortran/H5Block_ioF.f90 b/src/Fortran/H5Block_ioF.f90 new file mode 100644 index 0000000..12662d6 --- /dev/null +++ b/src/Fortran/H5Block_ioF.f90 @@ -0,0 +1,181 @@ +!> \ingroup h5hut_f90_api +!! \addtogroup h5block_data_f +!! @{ + +!> +!! See \ref H5Block3dWriteScalarFieldFloat64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_r8 ( filehandle, name, buffer ) + 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) :: buffer(*) !< the array of data +END FUNCTION + +!> +!! See \ref H5Block3dReadScalarFieldFloat64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r8 ( filehandle, name, buffer ) + 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) :: buffer(*) !< buffer to read the data into +END FUNCTION + +!> +!! See \ref H5Block3dWriteVector3dFieldFloat64 +!! \return 0 on success or error code +!< +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 + REAL*8, INTENT(IN) :: y(*) !< the array of y data to write + REAL*8, INTENT(IN) :: z(*) !< the array of z data to write +END FUNCTION + +!> +!! See \ref H5Block3dReadVector3dFieldFloat64 +!! \return 0 on success or error code +!< +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 + REAL*8, INTENT(OUT) :: y(*) !< buffer to read the y data into + REAL*8, INTENT(OUT) :: z(*) !< buffer to read the z data into +END FUNCTION + +!> +!! See \ref H5Block3dWriteScalarFieldFloat32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_r4 ( filehandle, name, buffer ) + 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) :: buffer(*) !< the array of data +END FUNCTION + +!> +!! See \ref H5Block3dReadScalarFieldFloat32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_r4 ( filehandle, name, buffer ) + 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) :: buffer(*) !< buffer to read the data into +END FUNCTION + +!> +!! See \ref H5Block3dWriteVector3dFieldFloat32 +!! \return 0 on success or error code +!< +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 + REAL*4, INTENT(IN) :: y(*) !< the array of y data to write + REAL*4, INTENT(IN) :: z(*) !< the array of z data to write +END FUNCTION + +!> +!! See \ref H5Block3dReadVector3dFieldFloat32 +!! \return 0 on success or error code +!< +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 + REAL*4, INTENT(OUT) :: y(*) !< buffer to read the y data into + REAL*4, INTENT(OUT) :: z(*) !< buffer to read the z data into +END FUNCTION + +!> +!! See \ref H5Block3dWriteScalarFieldInt64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_i8 ( filehandle, name, buffer ) + 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) :: buffer(*) !< the array of data +END FUNCTION + +!> +!! See \ref H5Block3dReadScalarFieldInt64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i8 ( filehandle, name, buffer ) + 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) :: buffer(*) !< buffer to read the data into +END FUNCTION + +!> +!! See \ref H5Block3dWriteVector3dFieldInt64 +!! \return 0 on success or error code +!< +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 + INTEGER*8, INTENT(IN) :: y(*) !< the array of y data to write + INTEGER*8, INTENT(IN) :: z(*) !< the array of z data to write +END FUNCTION + +!> +!! See \ref H5Block3dReadVector3dFieldInt64 +!! \return 0 on success or error code +!< +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 + INTEGER*8, INTENT(OUT) :: y(*) !< buffer to read the y data into + INTEGER*8, INTENT(OUT) :: z(*) !< buffer to read the z data into +END FUNCTION + +!> +!! See \ref H5Block3dWriteScalarFieldInt32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_write_scalar_field_i4 ( filehandle, name, buffer ) + 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) :: buffer(*) !< the array of data +END FUNCTION + +!> +!! See \ref H5Block3dReadScalarFieldInt32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5bl_3d_read_scalar_field_i4 ( filehandle, name, buffer ) + 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) :: buffer(*) !< buffer to read the data into +END FUNCTION + +!> +!! See \ref H5Block3dWriteVector3dFieldInt32 +!! \return 0 on success or error code +!< +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 + INTEGER*4, INTENT(IN) :: y(*) !< the array of y data to write + INTEGER*4, INTENT(IN) :: z(*) !< the array of z data to write +END FUNCTION + +!> +!! See \ref H5Block3dReadVector3dFieldInt32 +!! \return 0 on success or error code +!< +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 + INTEGER*4, INTENT(OUT) :: y(*) !< buffer to read the y data into + INTEGER*4, INTENT(OUT) :: z(*) !< buffer to read the z data into +END FUNCTION + +!> @} diff --git a/src/Fortran/H5Block_readwrite_F.c b/src/Fortran/H5Block_readwrite_F.c index a6d93c4..33ac9a9 100644 --- a/src/Fortran/H5Block_readwrite_F.c +++ b/src/Fortran/H5Block_readwrite_F.c @@ -13,664 +13,664 @@ #error Error, no way to determine how to construct fortran bindings #endif -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - const h5_float64_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_float64_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name, buffer, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_write_scalar_data ( - fh, name2, (void*)buffer, H5T_NATIVE_DOUBLE ); + fh, name2, (void*)buffer, H5T_NATIVE_DOUBLE ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - h5_float64_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name, buffer, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_read_scalar_data ( - fh, name2, buffer, H5T_NATIVE_DOUBLE ); + fh, name2, buffer, H5T_NATIVE_DOUBLE ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - const h5_float64_t *x_buf, - const h5_float64_t *y_buf, - const h5_float64_t *z_buf, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_float64_t *x_buf, + const h5_float64_t *y_buf, + const h5_float64_t *z_buf, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", - fh, name, x_buf, y_buf, z_buf, l_name); + "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + fh, name, x_buf, y_buf, z_buf, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_write_vector3d_data ( - fh, name2, - (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE ); + fh, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - h5_float64_t *x_buf, - h5_float64_t *y_buf, - h5_float64_t *z_buf, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_float64_t *x_buf, + h5_float64_t *y_buf, + h5_float64_t *z_buf, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", - fh, name, x_buf, y_buf, z_buf, l_name); + "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + fh, name, x_buf, y_buf, z_buf, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_read_vector3d_data ( - fh, name2, - (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE ); + fh, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_DOUBLE ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - const h5_float32_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_float32_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name, buffer, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_write_scalar_data ( - fh, name2, (void*)buffer, H5T_NATIVE_FLOAT ); + fh, name2, (void*)buffer, H5T_NATIVE_FLOAT ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - h5_float32_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_float32_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name, buffer, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_read_scalar_data ( - fh, name2, buffer, H5T_NATIVE_FLOAT ); + fh, name2, buffer, H5T_NATIVE_FLOAT ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - const h5_float32_t *x_buf, - const h5_float32_t *y_buf, - const h5_float32_t *z_buf, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_float32_t *x_buf, + const h5_float32_t *y_buf, + const h5_float32_t *z_buf, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", - fh, name, x_buf, y_buf, z_buf, l_name); + "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + fh, name, x_buf, y_buf, z_buf, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_write_vector3d_data ( - fh, name2, - (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_FLOAT ); + fh, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_FLOAT ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - h5_float32_t *x_buf, - h5_float32_t *y_buf, - h5_float32_t *z_buf, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_float32_t *x_buf, + h5_float32_t *y_buf, + h5_float32_t *z_buf, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", - fh, name, x_buf, y_buf, z_buf, l_name); + "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + fh, name, x_buf, y_buf, z_buf, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_read_vector3d_data ( - fh, name2, - (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_FLOAT ); + fh, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_FLOAT ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - const h5_int64_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_int64_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name, buffer, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_write_scalar_data ( - fh, name2, (void*)buffer, H5T_NATIVE_INT64 ); + fh, name2, (void*)buffer, H5T_NATIVE_INT64 ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - h5_int64_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_int64_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name, buffer, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_read_scalar_data ( - fh, name2, buffer, H5T_NATIVE_INT64 ); + fh, name2, buffer, H5T_NATIVE_INT64 ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - const h5_int64_t *x_buf, - const h5_int64_t *y_buf, - const h5_int64_t *z_buf, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_int64_t *x_buf, + const h5_int64_t *y_buf, + const h5_int64_t *z_buf, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", - fh, name, x_buf, y_buf, z_buf, l_name); + "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + fh, name, x_buf, y_buf, z_buf, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_write_vector3d_data ( - fh, name2, - (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT64 ); + fh, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT64 ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - h5_int64_t *x_buf, - h5_int64_t *y_buf, - h5_int64_t *z_buf, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_int64_t *x_buf, + h5_int64_t *y_buf, + h5_int64_t *z_buf, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", - fh, name, x_buf, y_buf, z_buf, l_name); + "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + fh, name, x_buf, y_buf, z_buf, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_read_vector3d_data ( - fh, name2, - (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT64 ); + fh, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT64 ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - const h5_int32_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_int32_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name, buffer, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_write_scalar_data ( - fh, name2, (void*)buffer, H5T_NATIVE_INT32 ); + fh, name2, (void*)buffer, H5T_NATIVE_INT32 ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - h5_int32_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_int32_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name, buffer, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_read_scalar_data ( - fh, name2, buffer, H5T_NATIVE_INT32 ); + fh, name2, buffer, H5T_NATIVE_INT32 ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - const h5_int32_t *x_buf, - const h5_int32_t *y_buf, - const h5_int32_t *z_buf, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_int32_t *x_buf, + const h5_int32_t *y_buf, + const h5_int32_t *z_buf, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", - fh, name, x_buf, y_buf, z_buf, l_name); + "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + fh, name, x_buf, y_buf, z_buf, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_write_vector3d_data ( - fh, name2, - (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT32 ); + fh, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT32 ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#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 ) + 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 *const f, - const char *name, - h5_int32_t *x_buf, - h5_int32_t *y_buf, - h5_int32_t *z_buf, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_int32_t *x_buf, + h5_int32_t *y_buf, + h5_int32_t *z_buf, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", - fh, name, x_buf, y_buf, z_buf, l_name); + "f=%p, name='%s', x_buf=%p, y_buf=%p, z_buf=%p, l_name=%d", + fh, name, x_buf, y_buf, z_buf, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5b_read_vector3d_data ( - fh, name2, - (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT32 ); + fh, name2, + (void*)x_buf, (void*)y_buf, (void*)z_buf, H5T_NATIVE_INT32 ); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5bl_writefieldattrib_r8 F77NAME ( \ - h5bl_writefieldattrib_r8_, \ - H5BL_WRITEFIELDATTRIB_R8 ) + h5bl_writefieldattrib_r8_, \ + H5BL_WRITEFIELDATTRIB_R8 ) #endif h5_err_t h5bl_writefieldattrib_r8 ( - h5_int64_t *const f, - const char *field_name, - const char *attrib_name, - const h5_float64_t *buffer, - const h5_size_t *nelems, - const int l_field_name, - const int l_attrib_name - ) { + h5_int64_t *const f, + const char *field_name, + const char *attrib_name, + const h5_float64_t *buffer, + const h5_size_t *nelems, + const int l_field_name, + const int l_attrib_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, field_name='%s', attrib_name='%s', " - "buffer=%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d", - fh, field_name, attrib_name, buffer, (long long)*nelems, - l_field_name, l_attrib_name); + "f=%p, field_name='%s', attrib_name='%s', " + "buffer=%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d", + fh, field_name, attrib_name, buffer, (long long)*nelems, + l_field_name, l_attrib_name); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); h5_err_t herr = h5_write_field_attrib ( - fh, field_name2, attrib_name2, - H5T_NATIVE_DOUBLE, buffer, *nelems ); + fh, field_name2, attrib_name2, + H5T_NATIVE_DOUBLE, buffer, *nelems ); free ( field_name2 ); free ( attrib_name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5bl_readfieldattrib_r8 F77NAME ( \ - h5bl_readfieldattrib_r8_, \ - H5BL_READFIELDATTRIB_R8 ) + h5bl_readfieldattrib_r8_, \ + H5BL_READFIELDATTRIB_R8 ) #endif h5_err_t h5bl_readfieldattrib_r8 ( - h5_int64_t *const f, - const char *field_name, - const char *attrib_name, - h5_float64_t *buffer, - const int l_field_name, - const int l_attrib_name - ) { + h5_int64_t *const f, + const char *field_name, + const char *attrib_name, + h5_float64_t *buffer, + const int l_field_name, + const int l_attrib_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, field_name='%s', attrib_name='%s', " - "values=%p, l_field_name=%d, l_attrib_name=%d", - fh, field_name, attrib_name, buffer, - l_field_name, l_attrib_name); + "f=%p, field_name='%s', attrib_name='%s', " + "values=%p, l_field_name=%d, l_attrib_name=%d", + fh, field_name, attrib_name, buffer, + l_field_name, l_attrib_name); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); h5_err_t herr = h5_read_field_attrib ( - fh, field_name2, attrib_name2, H5T_NATIVE_DOUBLE, buffer ); + fh, field_name2, attrib_name2, H5T_NATIVE_DOUBLE, buffer ); free ( field_name2 ); free ( attrib_name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5bl_writefieldattrib_r4 F77NAME ( \ - h5bl_writefieldattrib_r4_, \ - H5BL_WRITEFIELDATTRIB_R4 ) + h5bl_writefieldattrib_r4_, \ + H5BL_WRITEFIELDATTRIB_R4 ) #endif h5_err_t h5bl_writefieldattrib_r4 ( - h5_int64_t *const f, - const char *field_name, - const char *attrib_name, - const h5_float32_t *buffer, - const h5_size_t *nelems, - const int l_field_name, - const int l_attrib_name - ) { + h5_int64_t *const f, + const char *field_name, + const char *attrib_name, + const h5_float32_t *buffer, + const h5_size_t *nelems, + const int l_field_name, + const int l_attrib_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, field_name='%s', attrib_name='%s', " - "buffer=%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d", - fh, field_name, attrib_name, buffer, (long long)*nelems, - l_field_name, l_attrib_name); + "f=%p, field_name='%s', attrib_name='%s', " + "buffer=%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d", + fh, field_name, attrib_name, buffer, (long long)*nelems, + l_field_name, l_attrib_name); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); h5_err_t herr = h5_write_field_attrib ( - fh, field_name2, attrib_name2, - H5T_NATIVE_FLOAT, buffer, *nelems ); + fh, field_name2, attrib_name2, + H5T_NATIVE_FLOAT, buffer, *nelems ); free ( field_name2 ); free ( attrib_name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5bl_readfieldattrib_r4 F77NAME ( \ - h5bl_readfieldattrib_r4_, \ - H5BL_READFIELDATTRIB_R4 ) + h5bl_readfieldattrib_r4_, \ + H5BL_READFIELDATTRIB_R4 ) #endif h5_err_t h5bl_readfieldattrib_r4 ( - h5_int64_t *const f, - const char *field_name, - const char *attrib_name, - h5_float32_t *buffer, - const int l_field_name, - const int l_attrib_name - ) { + h5_int64_t *const f, + const char *field_name, + const char *attrib_name, + h5_float32_t *buffer, + const int l_field_name, + const int l_attrib_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, field_name='%s', attrib_name='%s', " - "values=%p, l_field_name=%d, l_attrib_name=%d", - fh, field_name, attrib_name, buffer, - l_field_name, l_attrib_name); + "f=%p, field_name='%s', attrib_name='%s', " + "values=%p, l_field_name=%d, l_attrib_name=%d", + fh, field_name, attrib_name, buffer, + l_field_name, l_attrib_name); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); h5_err_t herr = h5_read_field_attrib ( - fh, field_name2, attrib_name2, H5T_NATIVE_FLOAT, buffer ); + fh, field_name2, attrib_name2, H5T_NATIVE_FLOAT, buffer ); free ( field_name2 ); free ( attrib_name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5bl_writefieldattrib_i8 F77NAME ( \ - h5bl_writefieldattrib_i8_, \ - H5BL_WRITEFIELDATTRIB_I8 ) + h5bl_writefieldattrib_i8_, \ + H5BL_WRITEFIELDATTRIB_I8 ) #endif h5_err_t h5bl_writefieldattrib_i8 ( - h5_int64_t *const f, - const char *field_name, - const char *attrib_name, - const h5_int64_t *buffer, - const h5_size_t *nelems, - const int l_field_name, - const int l_attrib_name - ) { + h5_int64_t *const f, + const char *field_name, + const char *attrib_name, + const h5_int64_t *buffer, + const h5_size_t *nelems, + const int l_field_name, + const int l_attrib_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, field_name='%s', attrib_name='%s', " - "buffer=%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d", - fh, field_name, attrib_name, buffer, (long long)*nelems, - l_field_name, l_attrib_name); + "f=%p, field_name='%s', attrib_name='%s', " + "buffer=%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d", + fh, field_name, attrib_name, buffer, (long long)*nelems, + l_field_name, l_attrib_name); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); h5_err_t herr = h5_write_field_attrib ( - fh, field_name2, attrib_name2, - H5T_NATIVE_INT64, buffer, *nelems ); + fh, field_name2, attrib_name2, + H5T_NATIVE_INT64, buffer, *nelems ); free ( field_name2 ); free ( attrib_name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5bl_readfieldattrib_i8 F77NAME ( \ - h5bl_readfieldattrib_i8_, \ - H5BL_READFIELDATTRIB_I8 ) + h5bl_readfieldattrib_i8_, \ + H5BL_READFIELDATTRIB_I8 ) #endif h5_err_t h5bl_readfieldattrib_i8 ( - h5_int64_t *const f, - const char *field_name, - const char *attrib_name, - h5_int64_t *buffer, - const int l_field_name, - const int l_attrib_name - ) { + h5_int64_t *const f, + const char *field_name, + const char *attrib_name, + h5_int64_t *buffer, + const int l_field_name, + const int l_attrib_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, field_name='%s', attrib_name='%s', " - "values=%p, l_field_name=%d, l_attrib_name=%d", - fh, field_name, attrib_name, buffer, - l_field_name, l_attrib_name); + "f=%p, field_name='%s', attrib_name='%s', " + "values=%p, l_field_name=%d, l_attrib_name=%d", + fh, field_name, attrib_name, buffer, + l_field_name, l_attrib_name); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); h5_err_t herr = h5_read_field_attrib ( - fh, field_name2, attrib_name2, H5T_NATIVE_INT64, buffer ); + fh, field_name2, attrib_name2, H5T_NATIVE_INT64, buffer ); free ( field_name2 ); free ( attrib_name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5bl_writefieldattrib_i4 F77NAME ( \ - h5bl_writefieldattrib_i4_, \ - H5BL_WRITEFIELDATTRIB_I4 ) + h5bl_writefieldattrib_i4_, \ + H5BL_WRITEFIELDATTRIB_I4 ) #endif h5_err_t h5bl_writefieldattrib_i4 ( - h5_int64_t *const f, - const char *field_name, - const char *attrib_name, - const h5_int32_t *buffer, - const h5_size_t *nelems, - const int l_field_name, - const int l_attrib_name - ) { + h5_int64_t *const f, + const char *field_name, + const char *attrib_name, + const h5_int32_t *buffer, + const h5_size_t *nelems, + const int l_field_name, + const int l_attrib_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, field_name='%s', attrib_name='%s', " - "buffer=%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d", - fh, field_name, attrib_name, buffer, (long long)*nelems, - l_field_name, l_attrib_name); + "f=%p, field_name='%s', attrib_name='%s', " + "buffer=%p, nelems=%lld, l_field_name=%d, l_attrib_name=%d", + fh, field_name, attrib_name, buffer, (long long)*nelems, + l_field_name, l_attrib_name); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); h5_err_t herr = h5_write_field_attrib ( - fh, field_name2, attrib_name2, - H5T_NATIVE_INT32, buffer, *nelems ); + fh, field_name2, attrib_name2, + H5T_NATIVE_INT32, buffer, *nelems ); free ( field_name2 ); free ( attrib_name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5bl_readfieldattrib_i4 F77NAME ( \ - h5bl_readfieldattrib_i4_, \ - H5BL_READFIELDATTRIB_I4 ) + h5bl_readfieldattrib_i4_, \ + H5BL_READFIELDATTRIB_I4 ) #endif h5_err_t h5bl_readfieldattrib_i4 ( - h5_int64_t *const f, - const char *field_name, - const char *attrib_name, - h5_int32_t *buffer, - const int l_field_name, - const int l_attrib_name - ) { + h5_int64_t *const f, + const char *field_name, + const char *attrib_name, + h5_int32_t *buffer, + const int l_field_name, + const int l_attrib_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, - "f=%p, field_name='%s', attrib_name='%s', " - "values=%p, l_field_name=%d, l_attrib_name=%d", - fh, field_name, attrib_name, buffer, - l_field_name, l_attrib_name); + "f=%p, field_name='%s', attrib_name='%s', " + "values=%p, l_field_name=%d, l_attrib_name=%d", + fh, field_name, attrib_name, buffer, + l_field_name, l_attrib_name); char *field_name2 = h5_strdupfor2c ( field_name, l_field_name ); char *attrib_name2 = h5_strdupfor2c ( attrib_name, l_attrib_name ); h5_err_t herr = h5_read_field_attrib ( - fh, field_name2, attrib_name2, H5T_NATIVE_INT32, buffer ); + fh, field_name2, attrib_name2, H5T_NATIVE_INT32, buffer ); free ( field_name2 ); free ( attrib_name2 ); H5_API_RETURN(herr); diff --git a/src/Fortran/H5F.f90 b/src/Fortran/H5F.f90 new file mode 100644 index 0000000..7c234f2 --- /dev/null +++ b/src/Fortran/H5F.f90 @@ -0,0 +1,215 @@ +! Declaration of subroutines for Fortran Bindings + +!!!!!!!! File Opening and Closing !!!!!!!! + + +!> +!! \ingroup h5hut_file_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 h5hut_file_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 h5hut_file_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 h5hut_file_f +!! Opens a parallel file for reading. See \ref H5OpenFile +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_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 h5hut_file_f +!! Opens a parallel file for writing in truncate mode. See \ref H5OpenFile +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_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 h5hut_file_f +!! Opens a parallel file for writing in append mode. See \ref H5OpenFile +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_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 h5hut_file_f +!! Opens a file for reading and specifies an HDF5 alignment. +!! See \ref H5OpenFileAlign +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_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 h5hut_file_f +!! Opens a file for writing in truncate mode and specifies an HDF5 alignment. +!! See \ref H5OpenFileAlign +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_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 h5hut_file_f +!! Opens a file for writing in append mode and specifies an HDF5 alignment. +!! See \ref H5OpenFileAlign +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_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 h5hut_file_f +!! Opens a parallel file for reading and specifies an HDF5 alignment. +!! See \ref H5OpenFileAlign +!! +!! 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 H5OpenFileAlign +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_openr_par_align ( filename, mpi_communicator, align, flags ) + 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 h5hut_file_f +!! 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 H5OpenFileAlign +!! \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 + INTEGER*8, INTENT(IN) :: align !< alignment value in bytes + CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags +END FUNCTION + +!> +!! \ingroup h5hut_file_f +!! 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 H5OpenFileAlign +!! \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 + INTEGER*8, INTENT(IN) :: align !< alignment value in bytes + CHARACTER(LEN=*), INTENT(IN) :: flags !< additional flags +END FUNCTION + +!> +!! \ingroup h5hut_file_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 h5hut_file_f +!! Close HDF5 library. See \ref H5Finalize +!! \return \c H5_SUCCESS or \c H5_FAILURE +INTEGER*8 FUNCTION h5_finalize () +END FUNCTION + +!> +!! \ingroup h5hut_file_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 h5hut_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 h5hut_model_f +!! See \ref H5GetStep +!! \return the the current step or \c H5_FAILURE +INTEGER*8 FUNCTION h5_getstep (filehandle) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open +END FUNCTION + +!> +!! \ingroup h5hut_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 + +!> +!! \ingroup h5hut_error_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 + diff --git a/src/Fortran/H5Part.c b/src/Fortran/H5Part.c new file mode 100755 index 0000000..7f74301 --- /dev/null +++ b/src/Fortran/H5Part.c @@ -0,0 +1,219 @@ +/* + Copyright (c) 2006-2012, The Regents of the University of California, + through Lawrence Berkeley National Laboratory (subject to receipt of any + required approvals from the U.S. Dept. of Energy) and the Paul Scherrer + Institut (Switzerland). All rights reserved. + + License: see file COPYING in top level of source distribution. +*/ + +#include "h5_private.h" +#include "h5core/h5u_model.h" + +/*==============Reading Data Characteristics============*/ + +#define h5pt_getndatasets F77_NAME ( \ + h5pt_getndatasets, \ + h5pt_getndatasets_, \ + H5PT_GETNDATASETS ) +h5_int64_t +h5pt_getndatasets ( + const h5_int64_t* const fh + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, "fh=%p", (h5_file_p)f); + H5_API_RETURN(h5u_get_num_datasets (f)); +} + +#define h5pt_getnpoints F77_NAME ( \ + h5pt_getnpoints, \ + h5pt_getnpoints_, \ + H5PT_GETNPOINTS ) +h5_int64_t +h5pt_getnpoints ( + const h5_int64_t* const fh + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, "fh=%p", (h5_file_p)f); + H5_API_RETURN (h5u_get_num_particles (f)); +} + +#define h5pt_getdatasetname F77_NAME ( \ + h5pt_getdatasetname, \ + h5pt_getdatasetname_, \ + H5PT_GETDATASETNAME ) +h5_int64_t +h5pt_getdatasetname ( + const h5_int64_t* const fh, + const h5_int64_t* index, + char* name, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, index=%lld, name='%s', l_name=%d", + (h5_file_p)f, (long long)*index, name, l_name); + h5_int64_t herr = h5u_get_dataset_info ( + f, *index - 1, name, l_name, NULL, NULL ); + h5_strc2for (name, l_name); + H5_API_RETURN (herr); +} + +#define h5pt_getdatasetinfo F77_NAME( \ + h5pt_getdatasetinfo, \ + h5pt_getdatasetinfo_, \ + H5PT_GETDATASETINFO) +h5_int64_t +h5pt_getdatasetinfo ( + const h5_int64_t* const fh, + const h5_int64_t* dataset_idx, + char* dataset_name, + h5_int64_t* dataset_type, + h5_int64_t* dataset_nelem, + const int l_dataset_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, " + "dataset_idx=%lld, " + "dataset_name=%p, " + "dataset_type=%p, " + "dataset_nelem=%p", + (h5_file_p)f, + (long long)*dataset_idx, + dataset_name, dataset_type, dataset_nelem); + h5_int64_t h5err = h5u_get_dataset_info ( + f, + *dataset_idx - 1, + dataset_name, l_dataset_name, + dataset_type, + (h5_size_t*)dataset_nelem); + h5_strc2for (dataset_name, l_dataset_name); + convert_type2for (dataset_type); + H5_API_RETURN (h5err); +} + +/*=============Setting and getting views================*/ + +#define h5pt_setview F77_NAME ( \ + h5pt_setview, \ + h5pt_setview_, \ + H5PT_SETVIEW ) +h5_int64_t +h5pt_setview ( + const h5_int64_t* const fh, + const h5_int64_t* const start, + const h5_int64_t* const end + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, start=%lld, end=%lld", + (h5_file_p)f, (long long)*start, (long long)*end); + H5_API_RETURN (h5u_set_view (f, (*start)-1, (*end)-1)); +} + +#define h5pt_setview_indices F77_NAME ( \ + h5pt_setview_indices, \ + h5pt_setview_indices_, \ + H5PT_SETVIEW_INDICES ) +h5_int64_t +h5pt_setview_indices ( + const h5_int64_t* const fh, + const h5_int64_t* const indices, + const h5_int64_t* const nelem + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, indices=%p, nelem=%lld", + (h5_file_p)f, indices, (long long)*nelem); + h5_size_t* findices; + TRY (findices = h5_calloc (*nelem, sizeof (*indices))); + for (size_t i = 0; i < *nelem; i++) + findices[i] = indices[i] - 1; + TRY (h5u_set_view_indices (f, findices, *nelem)); + TRY (h5_free (findices)); + H5_API_RETURN (H5_SUCCESS); +} + +#define h5pt_setnpoints F77_NAME ( \ + h5pt_setnpoints, \ + h5pt_setnpoints_, \ + H5PT_SETNPOINTS ) +h5_int64_t +h5pt_setnpoints ( + const h5_int64_t* const fh, + const h5_int64_t* const npoints + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, npoints=%lld", + (h5_file_p)f, (long long)*npoints); + H5_API_RETURN (h5u_set_num_particles (f, *npoints, 1)); +} + +#define h5pt_setnpoints_strided F77_NAME ( \ + h5pt_setnpoints_strided, \ + h5pt_setnpoints_strided_, \ + H5PT_SETNPOINTS_STRIDED ) +h5_int64_t +h5pt_setnpoints_strided ( + const h5_int64_t* const fh, + const h5_int64_t* const npoints, + const h5_int64_t* const stride + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, npoints=%lld, stride=%lld", + (h5_file_p)f, (long long)*npoints, (long long)*stride); + H5_API_RETURN (h5u_set_num_particles (f, *npoints, *stride)); +} + +#define h5pt_resetview F77_NAME ( \ + h5pt_resetview, \ + h5pt_resetview_, \ + H5PT_RESETVIEW ) +h5_int64_t +h5pt_resetview ( + const h5_int64_t* const fh + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p", + (h5_file_p)f); + H5_API_RETURN (h5u_reset_view (f)); +} + +#define h5pt_hasview F77_NAME ( \ + h5pt_hasview, \ + h5pt_hasview_, \ + H5PT_HASVIEW ) +h5_int64_t +h5pt_hasview ( + const h5_int64_t* const fh + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p", + (h5_file_p)f); + H5_API_RETURN (h5u_has_view (f)); +} + +#define h5pt_getview F77_NAME ( \ + h5pt_getview, \ + h5pt_getview_, \ + H5PT_GETVIEW ) +h5_int64_t +h5pt_getview ( + const h5_int64_t* const fh, + h5_int64_t* const start, + h5_int64_t* const end + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, start=%p, end=%p", + (h5_file_p)f, start, end); + TRY (h5u_get_view (f, start, end)); + *start += 1; + *end += 1; + H5_API_RETURN (H5_SUCCESS); +} diff --git a/src/Fortran/H5PartF.f90 b/src/Fortran/H5PartF.f90 new file mode 100644 index 0000000..d75ece9 --- /dev/null +++ b/src/Fortran/H5PartF.f90 @@ -0,0 +1,127 @@ +!!!!!!!! Setting up the Data Model !!!!!!!! + + +!> +!! \ingroup h5part_model_f +!! +!! See \ref H5PartSetNumParticles +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5pt_setnpoints ( filehandle, npoints ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + INTEGER*8, INTENT(IN) :: npoints !< the number of particles on *this* processor +END FUNCTION + +!> +!! \ingroup h5part_model_f +!! +!! See \ref H5PartSetNumParticlesStrided +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5pt_setnpoints_strided ( filehandle, npoints, stride ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + INTEGER*8, INTENT(IN) :: npoints !< the number of particles on *this* processor + INTEGER*8, INTENT(IN) :: stride !< the stride value (e.g. the number of fields in the particle data array) +END FUNCTION + +!> +!! \ingroup h5part_model_f +!! +!! See \ref H5PartGetNumDatasets +!! \return the number of datasets or error code +!< +INTEGER*8 FUNCTION h5pt_getndatasets (filehandle) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open +END FUNCTION + +!> +!! \ingroup h5part_model_f +!! +!! See \ref H5PartGetNumParticles +!! \return the number of particles or error code +!< +INTEGER*8 FUNCTION h5pt_getnpoints (filehandle) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open +END FUNCTION + +!> +!! \ingroup h5part_model_f +!! +!! See \ref H5PartGetDatasetName +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5pt_getdatasetname (filehandle,index,name) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + INTEGER*8, INTENT(IN) :: index !< index of dataset to query (starting from 0) + CHARACTER(LEN=*), INTENT(OUT) :: name !< buffer to read the dataset name into +END FUNCTION + +!> +!! \ingroup h5part_model_f +!! +!! See \ref H5PartGetDatasetInfo +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5pt_getdatasetinfo (filehandle, idx, name, type, num_elems) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + INTEGER*8,INTENT(IN) :: idx !< index of dataset being queried + CHARACTER(LEN=*), INTENT(OUT):: name !< name of datset + INTEGER*8,INTENT(OUT):: type !< type of datset + INTEGER*8,INTENT(OUT):: num_elems !< number of elements in the dataset +END FUNCTION + +!> +!! \ingroup h5part_model_f +!! +!! See \ref H5PartSetView +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5pt_setview (filehandle,start,end) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + INTEGER*8, INTENT(IN) :: start !< offset of the first particle in the view + INTEGER*8, INTENT(IN) :: end !< offset of the last particle in the view (inclusive) +END FUNCTION + +!> +!! \ingroup h5part_model_f +!! +!! See \ref H5PartSetViewIndices +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5pt_setview_indices (filehandle,indices,nelem) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + INTEGER*8, INTENT(IN) :: indices(*) !< list of indicies to select in this view + INTEGER*8, INTENT(IN) :: nelem !< number of particles in the list +END FUNCTION + +!> +!! \ingroup h5part_model_f +!! +!! See \ref H5PartResetView +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5pt_resetview (filehandle) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open +END FUNCTION + +!> +!! \ingroup h5part_model_f +!! +!! See \ref H5PartResetView +!! \return 1 if true, 0 if false, or error code +!< +INTEGER*8 FUNCTION h5pt_hasview (filehandle) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open +END FUNCTION + +!> +!! \ingroup h5part_model_f +!! +!! See \ref H5PartGetView +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5pt_getview (filehandle,start,end) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + INTEGER*8, INTENT(OUT) :: start !< buffer to store the offset of the first particle in the view + INTEGER*8, INTENT(OUT) :: end !< buffer to store the offset of the last particle in the view (inclusive) +END FUNCTION diff --git a/src/Fortran/H5Part_F.c b/src/Fortran/H5Part_F.c index 7c6fda0..83c623a 100755 --- a/src/Fortran/H5Part_F.c +++ b/src/Fortran/H5Part_F.c @@ -12,73 +12,73 @@ #error Error, no way to determine how to construct fortran bindings #endif -#if ! defined(F77_NO_UNDERSCORE) +#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 ) +#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 *n - ) { + const h5_int64_t *f, + h5_int64_t *n + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, n=%lld", fh, (long long)*n); @@ -87,14 +87,14 @@ h5pt_setnpoints ( h5_err_t h5pt_setnpoints_strided ( - const h5_int64_t *f, - h5_int64_t *n, - h5_int64_t *stride - ) { + const h5_int64_t *f, + h5_int64_t *n, + h5_int64_t *stride + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, n=%lld, stride=%lld", - fh, (long long)*n, (long long)*stride); + fh, (long long)*n, (long long)*stride); H5_API_RETURN(h5u_set_num_particles ( fh, *n, *stride )); } @@ -102,8 +102,8 @@ h5pt_setnpoints_strided ( h5_int64_t h5pt_getndatasets ( - const h5_int64_t *f - ) { + const h5_int64_t *f + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_int64_t, "f=%p", fh); @@ -112,8 +112,8 @@ h5pt_getndatasets ( h5_int64_t h5pt_getnpoints ( - const h5_int64_t *f - ) { + const h5_int64_t *f + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_int64_t, "f=%p", fh); @@ -121,18 +121,18 @@ h5pt_getnpoints ( } h5_err_t -h5pt_getdatasetname ( - const h5_int64_t *f, - const h5_int64_t *index, - char *name, - const int l_name - ) { +h5pt_getdatasetname ( + const h5_int64_t *f, + const h5_int64_t *index, + char *name, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, index=%lld, name='%s', l_name=%d", - fh, (long long)*index, name, l_name); + fh, (long long)*index, name, l_name); h5_err_t herr = h5u_get_dataset_info ( - fh, *index, name, l_name, NULL, NULL ); + fh, *index, name, l_name, NULL, NULL ); h5_strc2for ( name, l_name ); H5_API_RETURN(herr); } @@ -141,14 +141,14 @@ h5pt_getdatasetname ( h5_err_t h5pt_setview ( - const h5_int64_t *f, - const h5_int64_t *start, - const h5_int64_t *end - ) { + const h5_int64_t *f, + const h5_int64_t *start, + const h5_int64_t *end + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, start=%lld, end=%lld", - fh, (long long)*start, (long long)*end); + fh, (long long)*start, (long long)*end); H5_API_RETURN(h5u_set_view ( fh, (*start)-1, (*end)-1 )); } @@ -161,14 +161,14 @@ h5pt_setview_indices ( h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, indices=%p, nelem=%lld", - fh, indices, (long long)*nelem); + fh, indices, (long long)*nelem); H5_API_RETURN(h5u_set_view_indices ( fh, (const h5_size_t*const)indices, *nelem )); } h5_err_t h5pt_resetview ( - const h5_int64_t *f - ) { + const h5_int64_t *f + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p", fh); @@ -177,8 +177,8 @@ h5pt_resetview ( h5_err_t h5pt_hasview ( - const h5_int64_t *f - ) { + const h5_int64_t *f + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p", fh); @@ -187,14 +187,14 @@ h5pt_hasview ( h5_err_t h5pt_getview ( - const h5_int64_t *f, - h5_int64_t *start, - h5_int64_t *end - ) { + const h5_int64_t *f, + h5_int64_t *start, + h5_int64_t *end + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, start=%p, end=%p", - fh, start, end); + fh, start, end); H5_API_RETURN(h5u_get_view ( fh, start, end)); } @@ -202,68 +202,68 @@ h5pt_getview ( /*==================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 ) { + const h5_int64_t *f, + const char *name, + const h5_float64_t *data, + const int l_name ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d", - fh, name, data, l_name); + fh, name, data, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5u_write_data ( - fh, name2, (void*)data, H5T_NATIVE_DOUBLE ); + fh, name2, (void*)data, H5T_NATIVE_DOUBLE ); free ( name2 ); H5_API_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 ) { + const h5_int64_t *f, + const char *name, + const h5_float32_t *data, + const int l_name ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d", - fh, name, data, l_name); + fh, name, data, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5u_write_data ( - fh, name2, (void*)data, H5T_NATIVE_FLOAT ); + fh, name2, (void*)data, H5T_NATIVE_FLOAT ); free ( name2 ); H5_API_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 ) { + const h5_int64_t *f, + const char *name, + const h5_int64_t *data, + const int l_name ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d", - fh, name, data, l_name); + fh, name, data, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5u_write_data ( - fh, name2, (void*)data, H5T_NATIVE_INT64 ); + fh, name2, (void*)data, H5T_NATIVE_INT64 ); free ( name2 ); H5_API_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 ) { + const h5_int64_t *f, + const char *name, + const h5_int32_t *data, + const int l_name ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d", - fh, name, data, l_name); + fh, name, data, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5u_write_data ( - fh, name2, (void*)data, H5T_NATIVE_INT32 ); + fh, name2, (void*)data, H5T_NATIVE_INT32 ); free ( name2 ); H5_API_RETURN(herr); } @@ -272,54 +272,54 @@ h5pt_writedata_i4 ( /*==================Reading data ============*/ h5_err_t h5pt_readdata_r8 ( - const h5_int64_t *f, - const char *name, - h5_float64_t *data, - const int l_name - ) { + const h5_int64_t *f, + const char *name, + h5_float64_t *data, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d", - fh, name, data, l_name); + fh, name, data, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5u_read_data ( - fh, name2, data, H5T_NATIVE_DOUBLE ); + fh, name2, data, H5T_NATIVE_DOUBLE ); free ( name2 ); H5_API_RETURN(herr); } h5_err_t h5pt_readdata_r4 ( - const h5_int64_t *f, - const char *name, - h5_float32_t *data, - const int l_name - ) { + const h5_int64_t *f, + const char *name, + h5_float32_t *data, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d", - fh, name, data, l_name); + fh, name, data, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5u_read_data ( - fh, name2, data, H5T_NATIVE_FLOAT ); + fh, name2, data, H5T_NATIVE_FLOAT ); free ( name2 ); H5_API_RETURN(herr); } h5_err_t h5pt_readdata_i8 ( - const h5_int64_t *f, - const char *name, - h5_int64_t *data, - const int l_name - ) { + const h5_int64_t *f, + const char *name, + h5_int64_t *data, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d", - fh, name, data, l_name); + fh, name, data, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5u_read_data ( - fh, name2, data, H5T_NATIVE_INT64 ); + fh, name2, data, H5T_NATIVE_INT64 ); free ( name2 ); H5_API_RETURN(herr); @@ -327,18 +327,18 @@ h5pt_readdata_i8 ( h5_err_t h5pt_readdata_i4 ( - const h5_int64_t *f, - const char *name, - h5_int32_t *data, - const int l_name - ) { + const h5_int64_t *f, + const char *name, + h5_int32_t *data, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, name='%s', data=%p, l_name=%d", - fh, name, data, l_name); + fh, name, data, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); h5_err_t herr = h5u_read_data ( - fh, name2, data, H5T_NATIVE_INT32 ); + fh, name2, data, H5T_NATIVE_INT32 ); free ( name2 ); H5_API_RETURN(herr); } diff --git a/src/Fortran/H5Part_io.c b/src/Fortran/H5Part_io.c new file mode 100644 index 0000000..80b7fd5 --- /dev/null +++ b/src/Fortran/H5Part_io.c @@ -0,0 +1,190 @@ +/* + Copyright (c) 2006-2013, The Regents of the University of California, + through Lawrence Berkeley National Laboratory (subject to receipt of any + required approvals from the U.S. Dept. of Energy) and the Paul Scherrer + Institut (Switzerland). All rights reserved. + + License: see file COPYING in top level of source distribution. +*/ + +#include "h5_private.h" + +/*==================Writing data ============*/ +#define h5pt_writedata_r8 F77_NAME ( \ + h5pt_writedata_r8, \ + h5pt_writedata_r8_, \ + H5PT_WRITEDATA_R8 ) +h5_int64_t +h5pt_writedata_r8 ( + const h5_int64_t* const fh, + const char* const name, + const h5_float64_t* const data, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%s', data=%p, l_name=%d", + (h5_file_p)f, name, data, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_int64_t herr = h5u_write_data ( + f, name2, (void*)data, H5T_NATIVE_DOUBLE ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5pt_writedata_r4 F77_NAME ( \ + h5pt_writedata_r4, \ + h5pt_writedata_r4_, \ + H5PT_WRITEDATA_R4 ) +h5_int64_t +h5pt_writedata_r4 ( + const h5_int64_t* const fh, + const char* const name, + const h5_float32_t* const data, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%s', data=%p, l_name=%d", + (h5_file_p)f, name, data, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_int64_t herr = h5u_write_data ( + f, name2, (void*)data, H5T_NATIVE_FLOAT ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5pt_writedata_i8 F77_NAME ( \ + h5pt_writedata_i8, \ + h5pt_writedata_i8_, \ + H5PT_WRITEDATA_I8 ) +h5_int64_t +h5pt_writedata_i8 ( + const h5_int64_t* const fh, + const char* const name, + const h5_int64_t* const data, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%s', data=%p, l_name=%d", + (h5_file_p)f, name, data, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_int64_t herr = h5u_write_data ( + f, name2, (void*)data, H5T_NATIVE_INT64 ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5pt_writedata_i4 F77_NAME ( \ + h5pt_writedata_i4, \ + h5pt_writedata_i4_, \ + H5PT_WRITEDATA_I4 ) +h5_int64_t +h5pt_writedata_i4 ( + const h5_int64_t* const fh, + const char* const name, + const h5_int32_t* const data, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%s', data=%p, l_name=%d", + (h5_file_p)f, name, data, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_int64_t herr = h5u_write_data ( + f, name2, (void*)data, H5T_NATIVE_INT32 ); + free ( name2 ); + H5_API_RETURN(herr); +} + + +/*==================Reading data ============*/ +#define h5pt_readdata_r8 F77_NAME ( \ + h5pt_readdata_r8, \ + h5pt_readdata_r8_, \ + H5PT_READDATA_R8 ) +h5_int64_t +h5pt_readdata_r8 ( + const h5_int64_t* const fh, + const char* const name, + h5_float64_t* const data, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%s', data=%p, l_name=%d", + (h5_file_p)f, name, data, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_int64_t herr = h5u_read_data ( + f, name2, data, H5T_NATIVE_DOUBLE ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5pt_readdata_r4 F77_NAME ( \ + h5pt_readdata_r4, \ + h5pt_readdata_r4_, \ + H5PT_READDATA_R4 ) +h5_int64_t +h5pt_readdata_r4 ( + const h5_int64_t* const fh, + const char* const name, + h5_float32_t* const data, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%s', data=%p, l_name=%d", + (h5_file_p)f, name, data, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_int64_t herr = h5u_read_data ( + f, name2, data, H5T_NATIVE_FLOAT ); + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5pt_readdata_i8 F77_NAME ( \ + h5pt_readdata_i8, \ + h5pt_readdata_i8_, \ + H5PT_READDATA_I8 ) +h5_int64_t +h5pt_readdata_i8 ( + const h5_int64_t* const fh, + const char* const name, + h5_int64_t* const data, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%s', data=%p, l_name=%d", + (h5_file_p)f, name, data, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_int64_t herr = h5u_read_data ( + f, name2, data, H5T_NATIVE_INT64 ); + + free ( name2 ); + H5_API_RETURN(herr); +} + +#define h5pt_readdata_i4 F77_NAME ( \ + h5pt_readdata_i4, \ + h5pt_readdata_i4_, \ + H5PT_READDATA_I4 ) +h5_int64_t +h5pt_readdata_i4 ( + const h5_int64_t* const fh, + const char* const name, + h5_int32_t* const data, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c (fh); + H5_API_ENTER (h5_int64_t, + "hf=%p, name='%s', data=%p, l_name=%d", + (h5_file_p)f, name, data, l_name); + char *name2 = h5_strdupfor2c ( name, l_name ); + h5_int64_t herr = h5u_read_data ( + f, name2, data, H5T_NATIVE_INT32 ); + free ( name2 ); + H5_API_RETURN(herr); +} diff --git a/src/Fortran/H5Part_ioF.f90 b/src/Fortran/H5Part_ioF.f90 new file mode 100644 index 0000000..6535284 --- /dev/null +++ b/src/Fortran/H5Part_ioF.f90 @@ -0,0 +1,83 @@ +!!!!!!!! Reading and Writing Datasets !!!!!!!! + +!> +!! \ingroup h5part_data_f +!! See \ref H5PartWriteDataFloat64 +!! \return 0 on success or error code +INTEGER*8 FUNCTION h5pt_writedata_r8 ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset + REAL*8, INTENT(IN) :: data(*) !< the array of float64 data to write +END FUNCTION + +!> +!! \ingroup h5part_data_f +!! See \ref H5PartWriteDataFloat32 +!! \return 0 on success or error code +INTEGER*8 FUNCTION h5pt_writedata_r4 ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset + REAL, INTENT(IN) :: data(*) !< the array of float32 data to write +END FUNCTION + +!> +!! \ingroup h5part_data_f +!! See \ref H5PartWriteDataInt64 +!! \return 0 on success or error code +INTEGER*8 FUNCTION h5pt_writedata_i8 ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset + INTEGER*8, INTENT(IN) :: data(*) !< the array of int64 data to write +END FUNCTION + +!> +!! \ingroup h5part_data_f +!! See \ref H5PartWriteDataInt32 +!! \return 0 on success or error code +INTEGER*8 FUNCTION h5pt_writedata_i4 ( filehandle, name, data ) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset + INTEGER, INTENT(IN) :: data(*) !< the array of int32 data to write +END FUNCTION + + +!> +!! \ingroup h5part_data_f +!! See \ref H5PartReadDataFloat64 +!! \return 0 on success or error code +INTEGER*8 FUNCTION h5pt_readdata_r8 (filehandle,name,data) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset + REAL*8, INTENT(OUT) :: data(*) !< array to read float64 data into +END FUNCTION + +!> +!! \ingroup h5part_data_f +!! See \ref H5PartReadDataFloat32 +!! \return 0 on success or error code +INTEGER*8 FUNCTION h5pt_readdata_r4 (filehandle,name,data) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset + REAL, INTENT(OUT) :: data(*) !< array to read float32 data into +END FUNCTION + +!> +!! \ingroup h5part_data_f +!! See \ref H5PartReadDataInt64 +!! \return 0 on success or error code +INTEGER*8 FUNCTION h5pt_readdata_i8 (filehandle,name,data) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset + INTEGER*8, INTENT(OUT) :: data(*) !< array to read int64 data into +END FUNCTION + +!> +!! \ingroup h5part_data_f +!! See \ref H5PartReadDataInt32 +!! \return 0 on success or error code +INTEGER*8 FUNCTION h5pt_readdata_i4 (filehandle,name,data) + INTEGER*8, INTENT(IN) :: filehandle !< the handle returned during file open + CHARACTER(LEN=*), INTENT(IN) :: name !< the name of the dataset + INTEGER, INTENT(OUT) :: data(*) !< array to read int32 data into +END FUNCTION + diff --git a/src/Fortran/H5_F.c b/src/Fortran/H5_F.c index 005a23f..ffbda20 100644 --- a/src/Fortran/H5_F.c +++ b/src/Fortran/H5_F.c @@ -13,50 +13,50 @@ #error Error, no way to determine how to construct fortran bindings #endif -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) -#define h5_openr F77NAME ( \ - h5_openr_, \ - H5_OPENR ) -#define h5_openw F77NAME ( \ - h5_openw_, \ - H5_OPENW ) -#define h5_opena F77NAME ( \ - h5_opena_, \ - H5_OPENA ) -#define h5_openr_par F77NAME ( \ - h5_openr_par_, \ - H5_OPENR_PAR ) -#define h5_openw_par F77NAME ( \ - h5_openw_par_, \ - H5_OPENW_PAR ) -#define h5_opena_par F77NAME ( \ - h5_opena_par_, \ - H5_OPENA_PAR ) -#define h5_close F77NAME ( \ - h5_close_, \ - H5_CLOSE) -#define h5_check F77NAME ( \ - h5_check_, \ - H5_CHECK) -#define h5_setstep F77NAME ( \ - h5_setstep_, \ - H5_SETSTEP ) -#define h5_getnsteps F77NAME ( \ - h5_getnsteps_, \ - H5_GETNSTEPS ) -#define h5_set_verbosity_level F77NAME ( \ - h5_set_verbosity_level_, \ - H5_SET_VERBOSITY_LEVEL ) +#define h5_openr F77NAME ( \ + h5_openr_, \ + H5_OPENR ) +#define h5_openw F77NAME ( \ + h5_openw_, \ + H5_OPENW ) +#define h5_opena F77NAME ( \ + h5_opena_, \ + H5_OPENA ) +#define h5_openr_par_align F77NAME ( \ + h5_openr_par_align_, \ + H5_OPENR_PAR_ALIGN ) +#define h5_openw_par_align F77NAME ( \ + h5_openw_par_align_, \ + H5_OPENW_PAR_ALIGN ) +#define h5_opena_par_align F77NAME ( \ + h5_opena_par_align_, \ + H5_OPENA_PA_ALIGNR ) +#define h5_close F77NAME ( \ + h5_close_, \ + H5_CLOSE) +#define h5_check F77NAME ( \ + h5_check_, \ + H5_CHECK) +#define h5_setstep F77NAME ( \ + h5_setstep_, \ + H5_SETSTEP ) +#define h5_getnsteps F77NAME ( \ + h5_getnsteps_, \ + H5_GETNSTEPS ) +#define h5_set_verbosity_level F77NAME ( \ + h5_set_verbosity_level_, \ + H5_SET_VERBOSITY_LEVEL ) #endif /* open/close interface */ h5_err_t h5_openr ( - const char *name, - const int l_name - ) { + const char *name, + const int l_name + ) { H5_API_ENTER (h5_err_t, "name='%s', l_name=%d", name, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); @@ -67,9 +67,9 @@ h5_openr ( h5_err_t h5_openw ( - const char *name, - const int l_name - ) { + const char *name, + const int l_name + ) { H5_API_ENTER (h5_err_t, "name='%s', l_name=%d", name, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); @@ -79,10 +79,10 @@ h5_openw ( } h5_err_t -h5pt_opena ( - const char *name, - const int l_name - ) { +h5_opena ( + const char *name, + const int l_name + ) { H5_API_ENTER (h5_err_t, "name='%s', l_name=%d", name, l_name); char *name2 = h5_strdupfor2c ( name, l_name ); @@ -93,78 +93,82 @@ h5pt_opena ( #ifdef PARALLEL_IO h5_err_t -h5_openr_par ( - const char *name, - MPI_Fint *fcomm, - const char *flags, - const int l_name, - const int l_flags - ) { +h5_openr_par_align ( + const char *name, + MPI_Fint *fcomm, + const h5_int64_t *align, + const char *flags, + const int l_name, + const int l_flags + ) { - H5_API_ENTER (h5_err_t, "name='%s', fcomm=%d, flags=%s, " - "l_name=%d, l_flags=%d", - name, *fcomm, flags, l_name, l_flags); + H5_API_ENTER (h5_err_t, "name='%s', fcomm=%d, align=%lld, flags=%s, " + "l_name=%d, l_flags=%d", + name, *fcomm, (long long)*align, + flags, l_name, l_flags); MPI_Comm ccomm = MPI_Comm_f2c (*fcomm); char *name2 = h5_strdupfor2c ( name, l_name ); char *flags2 = h5_strdupfor2c ( flags, l_flags ); h5_int32_t fbits = H5_O_RDONLY | _flagsfor2c ( flags2 ); - h5_file_t* f = h5_open_file ( name2, fbits, ccomm ); + h5_file_t* f = h5_open_file ( name2, fbits, ccomm, 0 ); free ( name2 ); free ( flags2 ); - H5_API_RETURN((h5_int64_t)(size_t)f); + H5_API_RETURN((h5_int64_t)(size_t)f); } h5_err_t -h5_openw_par ( - const char *name, - MPI_Fint *fcomm, - const char *flags, - const int l_name, - const int l_flags - ) { +h5_openw_par_align ( + const char *name, + MPI_Fint *fcomm, + const h5_int64_t *align, + const char *flags, + const int l_name, + const int l_flags + ) { - H5_API_ENTER (h5_err_t, "name='%s', fcomm=%d, flags=%s, " - "l_name=%d, l_flags=%d", - name, *fcomm, flags, l_name, l_flags); + H5_API_ENTER (h5_err_t, "name='%s', fcomm=%d, align=%lld, flags=%s, " + "l_name=%d, l_flags=%d", + name, *fcomm, (long long)*align, + flags, l_name, l_flags); MPI_Comm ccomm = MPI_Comm_f2c (*fcomm); char *name2 = h5_strdupfor2c ( name, l_name ); char *flags2 = h5_strdupfor2c ( flags, l_flags ); h5_int32_t fbits = H5_O_WRONLY | _flagsfor2c ( flags2 ); - h5_file_t* f = h5_open_file ( name2, fbits, ccomm ); + h5_file_t* f = h5_open_file ( name2, fbits, ccomm, 0 ); free ( name2 ); free ( flags2 ); - H5_API_RETURN((h5_int64_t)(size_t)f); + H5_API_RETURN((h5_int64_t)(size_t)f); } h5_err_t -h5pt_opena_par_align ( - const char *name, - MPI_Fint *fcomm, - const h5_int64_t *align, - const char *flags, - const int l_name, - const int l_flags - ) { +h5_opena_par_align ( + const char *name, + MPI_Fint *fcomm, + const h5_int64_t *align, + const char *flags, + const int l_name, + const int l_flags + ) { H5_API_ENTER (h5_err_t, "name='%s', fcomm=%d, align=%lld, flags=%s, " - "l_name=%d, l_flags=%d", - name, *fcomm, (long long)*align, - flags, l_name, l_flags); + "l_name=%d, l_flags=%d", + name, *fcomm, (long long)*align, + flags, l_name, l_flags); MPI_Comm ccomm = MPI_Comm_f2c (*fcomm); char *name2 = h5_strdupfor2c ( name, l_name ); char *flags2 = h5_strdupfor2c ( flags, l_flags ); h5_int32_t fbits = H5_O_APPEND | _flagsfor2c ( flags2 ); - h5_file_t* f = h5_open_file ( name2, fbits, ccomm ); + h5_file_t* f = h5_open_file ( name2, fbits, ccomm, *align ); free ( name2 ); free ( flags2 ); - H5_API_RETURN((h5_int64_t)(size_t)f); + H5_API_RETURN((h5_int64_t)(size_t)f); } #endif h5_err_t h5_close ( - const h5_int64_t *f - ) { + const h5_int64_t *f + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p", fh); @@ -173,8 +177,8 @@ h5_close ( h5_err_t h5_check ( - const h5_int64_t *f - ) { + const h5_int64_t *f + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p", fh); @@ -183,8 +187,8 @@ h5_check ( h5_err_t h5_setstep ( - const h5_int64_t *f, - h5_int64_t *step ) { + const h5_int64_t *f, + h5_int64_t *step ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_err_t, "f=%p, step=%lld", fh, (long long)*step); @@ -193,8 +197,8 @@ h5_setstep ( h5_ssize_t h5_getnsteps ( - const h5_int64_t *f - ) { + const h5_int64_t *f + ) { h5_file_t *fh = h5_filehandlefor2c(f); H5_API_ENTER (h5_ssize_t, "f=%p", fh); @@ -203,8 +207,8 @@ h5_getnsteps ( h5_err_t h5_set_verbosity_level ( - const h5_int64_t *level - ) { + const h5_int64_t *level + ) { H5_API_ENTER (h5_err_t, "level=%lld", (long long)*level); H5_API_RETURN(h5_set_debuglevel ( *level )); diff --git a/src/Fortran/H5_attribs.c b/src/Fortran/H5_attribs.c new file mode 100644 index 0000000..28f4ca6 --- /dev/null +++ b/src/Fortran/H5_attribs.c @@ -0,0 +1,651 @@ +/* + Copyright (c) 2006-2012, The Regents of the University of California, + through Lawrence Berkeley National Laboratory (subject to receipt of any + required approvals from the U.S. Dept. of Energy) and the Paul Scherrer + Institut (Switzerland). All rights reserved. + + License: see file COPYING in top level of source distribution. +*/ + +#include "h5_private.h" +#include "h5core/h5_attribs.h" + +/* + __ _ _ _ _ _ _ _ + / _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ + | |_| | |/ _ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| + | _| | | __/ | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ + |_| |_|_|\___| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ + __ _ _ _ ___ _ __ _ _ + / _` | | | |/ _ \ '__| | | | + | (_| | |_| | __/ | | |_| | + \__, |\__,_|\___|_| \__, | + |_| |___/ +*/ + +#define h5_getnfileattribs F77_NAME( \ + h5_getnfileattribs, \ + h5_getnfileattribs_, \ + H5_GETNFILEATTRIBS) +h5_int64_t +h5_getnfileattribs ( + const h5_int64_t* const fh + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, "fh=%p", (h5_file_p)f); + H5_API_RETURN (h5_get_num_attribs (f, H5_ATTRIB_FILE)); +} + +#define h5_getfileattribinfo F77_NAME( \ + h5_getfileattribinfo, \ + h5_getfileattribinfo_, \ + H5_GETFILEATTRIBINFO) +h5_int64_t +h5_getfileattribinfo ( + const h5_int64_t* const fh, + const h5_int64_t* attrib_idx, + char* attrib_name, + h5_int64_t* attrib_type, + h5_int64_t* attrib_nelem, + const int l_attrib_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, " + "attrib_idx=%lld, " + "attrib_name=%p, " + "attrib_type=%p, " + "attrib_nelem=%p", + (h5_file_p)fh, + (long long)*attrib_idx, + attrib_name, attrib_type, attrib_nelem); + h5_int64_t h5err = h5_get_attrib_info ( + f, + H5_ATTRIB_FILE, + *attrib_idx - 1, + attrib_name, l_attrib_name, + attrib_type, + (h5_size_t*)attrib_nelem); + h5_strc2for (attrib_name, l_attrib_name); + convert_type2for (attrib_type); + H5_API_RETURN (h5err); +} + +/* + _ __ + (_) / /__ + | | / / _ \ + | |/ / (_) | + |_/_/ \___/ +*/ +static inline h5_int64_t +write_file_attrib ( + h5_file_t* const f, + const char* name, + const int l_name, + const hid_t type, + const void* buffer, + const hsize_t l_buffer + ) { + char *name2 = h5_strdupfor2c (name, l_name); + h5_int64_t herr = h5_write_attrib (f, H5_ATTRIB_FILE, name2, type, buffer, l_buffer ); + free (name2); + return herr; +} + +static inline h5_int64_t +read_file_attrib ( + h5_file_t* const f, + const char* name, + const int l_name, + const hid_t type, + void* const buffer + ) { + char* name2 = h5_strdupfor2c ( name, l_name ); + h5_int64_t herr = h5_read_attrib (f, H5_ATTRIB_FILE, name2, type, buffer); + free (name2); + return herr; +} + +/* + _ _ + ___| |_ _ __(_)_ __ __ _ + / __| __| '__| | '_ \ / _` | + \__ \ |_| | | | | | | (_| | + |___/\__|_| |_|_| |_|\__, | + |___/ +*/ +#define h5_writefileattrib_string F77_NAME ( \ + h5_writefileattrib_string, \ + h5_writefileattrib_string_, \ + H5_WRITEFILEATTRIB_STRING) +h5_int64_t +h5_writefileattrib_string ( + h5_int64_t *const fh, + const char *name, + const char *buffer, + const int l_name, + const int l_buffer + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%.*s', buffer='%.*s'", + (h5_file_p)f, l_name, name, l_buffer, buffer); + char *buffer2 = h5_strdupfor2c (buffer, l_buffer); + h5_int64_t herr = write_file_attrib ( + f, name, l_name, H5_STRING_T, buffer2, strlen(buffer2)+1 ); + free (buffer2); + H5_API_RETURN (herr); +} + +#define h5_readfileattrib_string F77_NAME ( \ + h5_readfileattrib_string, \ + h5_readfileattrib_string_, \ + H5_READFILEATTRIB_STRING) +h5_int64_t +h5_readfileattrib_string ( + h5_int64_t *const fh, + const char *name, + char *buffer, + const int l_name, + const int l_buffer + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%.*s', buffer='%.*s'", + (h5_file_p)f, l_name, name, l_buffer, buffer); + h5_int64_t herr = read_file_attrib (f, name, l_name, H5_STRING_T, buffer); + h5_strc2for (buffer, l_buffer); + H5_API_RETURN (herr); +} + +#define h5_writefileattrib_r8 F77_NAME ( \ + h5_writefileattrib_r8, \ + h5_writefileattrib_r8_, \ + H5_WRITEFILEATTRIB_R8) +h5_int64_t +h5_writefileattrib_r8 ( + const h5_int64_t *const fh, + const char *name, + const h5_int64_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%.*s', buffer=%p, nelem=%lld", + (h5_file_p)f, l_name, name, buffer, (long long)*nelem); + H5_API_RETURN (write_file_attrib( + f, + name, l_name, + H5_FLOAT64_T, + buffer, (hsize_t)*nelem)); +} + +#define h5_readfileattrib_r8 F77_NAME ( \ + h5_readfileattrib_r8, \ + h5_readfileattrib_r8_, \ + H5_READFILEATTRIB_R8 ) +h5_int64_t +h5_readfileattrib_r8 ( + h5_int64_t *const fh, + const char *name, + h5_int64_t *buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "(h5_file_p)fh=%p, name='%.*s', buffer=%p", + (h5_file_p)f, l_name, name, buffer); + H5_API_RETURN (read_file_attrib( + f, + name, l_name, + H5_FLOAT64_T, + (void*)buffer)); +} + +#define h5_writefileattrib_r4 F77_NAME ( \ + h5_writefileattrib_r4, \ + h5_writefileattrib_r4_, \ + H5_WRITEFILEATTRIB_R4 ) +h5_int64_t +h5_writefileattrib_r4 ( + const h5_int64_t *const fh, + const char *name, + const h5_int32_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%.*s', buffer=%p, nelem=%lld", + (h5_file_p)f, l_name, name, buffer, (long long)*nelem); + H5_API_RETURN (write_file_attrib( + f, + name, l_name, + H5_FLOAT32_T, + buffer, (hsize_t)*nelem)); +} + +#define h5_readfileattrib_r4 F77_NAME ( \ + h5_readfileattrib_r4, \ + h5_readfileattrib_r4_, \ + H5_READFILEATTRIB_R4 ) +h5_int64_t +h5_readfileattrib_r4 ( + const h5_int64_t *const fh, + const char *name, + h5_int32_t *buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "f=%p, name='%.*s', buffer=%p", + (h5_file_p)f, l_name, name, buffer); + H5_API_RETURN (read_file_attrib( + f, + name, l_name, + H5_FLOAT32_T, + buffer)); +} + +#define h5_writefileattrib_i8 F77_NAME ( \ + h5_writefileattrib_i8, \ + h5_writefileattrib_i8_, \ + H5_WRITEFILEATTRIB_I8) +h5_int64_t +h5_writefileattrib_i8 ( + const h5_int64_t *const fh, + const char *name, + const h5_int64_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%.*s', buffer=%p, nelem=%lld", + (h5_file_p)f, l_name, name, buffer, (long long)*nelem); + H5_API_RETURN (write_file_attrib( + f, + name, l_name, + H5_INT64_T, + buffer, (hsize_t)*nelem)); +} + +#define h5_readfileattrib_i8 F77_NAME ( \ + h5_readfileattrib_i8, \ + h5_readfileattrib_i8_, \ + H5_READFILEATTRIB_I8 ) +h5_int64_t +h5_readfileattrib_i8 ( + const h5_int64_t *const fh, + const char *name, + h5_int64_t *buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%.*s', buffer=%p", + (h5_file_p)f, l_name, name, buffer); + H5_API_RETURN (read_file_attrib( + f, + name, l_name, + H5_INT64_T, + buffer)); +} + +#define h5_writefileattrib_i4 F77_NAME ( \ + h5_writefileattrib_i4, \ + h5_writefileattrib_i4_, \ + H5_WRITEFILEATTRIB_I4 ) +h5_int64_t +h5_writefileattrib_i4 ( + h5_int64_t *const fh, + const char *name, + const h5_int32_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%.*s', buffer=%p, nelem=%lld", + (h5_file_p)f, l_name, name, buffer, (long long)*nelem); + H5_API_RETURN (write_file_attrib( + f, + name, l_name, + H5_INT32_T, + buffer, (hsize_t)*nelem)); +} + +#define h5_readfileattrib_i4 F77_NAME ( \ + h5_readfileattrib_i4, \ + h5_readfileattrib_i4_, \ + H5_READFILEATTRIB_I4 ) +h5_int64_t +h5_readfileattrib_i4 ( + h5_int64_t *const fh, + const char *name, + h5_int32_t *buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "fh=%p, name='%.*s', buffer=%p", + (h5_file_p)f, l_name, name, buffer); + H5_API_RETURN (read_file_attrib( + f, + name, l_name, + H5_INT32_T, + buffer)); +} + +/* + _ _ _ _ _ _ + ___| |_ ___ _ __ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ + / __| __/ _ \ '_ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| + \__ \ || __/ |_) | | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ + |___/\__\___| .__/ \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ + |_| + */ +#define h5_getnstepattribs F77_NAME( \ + h5_getnstepattribs, \ + h5_getnstepattribs_, \ + H5_GETNSTEPATTRIBS) +h5_int64_t +h5_getnstepattribs ( + const h5_int64_t* fh + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "fh=%p", + (h5_file_p)f); + H5_API_RETURN (h5_get_num_attribs (f, H5_ATTRIB_STEP)); +} + +#define h5_getstepattribinfo F77_NAME( \ + h5_getstepattribinfo, \ + h5_getstepattribinfo_, \ + H5_GETSTEPATTRIBINFO) +h5_int64_t +h5_getstepattribinfo ( + const h5_int64_t* fh, + const h5_int64_t* attrib_idx, + char* attrib_name, + h5_int64_t* attrib_type, + h5_int64_t* attrib_nelem, + const int l_attrib_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "f=%p, " + "attrib_idx=%lld, " + "attrib_name=%p, " + "attrib_type=%p, " + "attrib_nelem=%p", + (h5_file_p)f, + (long long)*attrib_idx, + attrib_name, attrib_type, attrib_nelem); + h5_int64_t h5err = h5_get_attrib_info ( + f, + H5_ATTRIB_STEP, + *attrib_idx - 1, + attrib_name, l_attrib_name, + attrib_type, + (h5_size_t*)attrib_nelem); + h5_strc2for (attrib_name, l_attrib_name); + convert_type2for (attrib_type); + H5_API_RETURN (h5err); +} + +static inline h5_int64_t +write_step_attrib ( + h5_file_t* const fh, + const char* name, + const int l_name, + const hid_t type, + const void* buffer, + const hsize_t l_buffer + ) { + char *name2 = h5_strdupfor2c (name, l_name); + h5_int64_t herr = h5_write_attrib (fh, H5_ATTRIB_STEP, name2, type, buffer, l_buffer ); + free (name2); + return herr; +} + +static inline h5_int64_t +read_step_attrib ( + h5_file_t* const fh, + const char* name, + const int l_name, + const hid_t type, + void* const buffer + ) { + char* name2 = h5_strdupfor2c ( name, l_name ); + h5_int64_t herr = h5_read_attrib (fh, H5_ATTRIB_STEP, name2, type, buffer); + free (name2); + return herr; +} + +#define h5_writestepattrib_string F77_NAME ( \ + h5_writestepattrib_string, \ + h5_writestepattrib_string_, \ + H5_WRITESTEPATTRIB_STRING) +h5_int64_t +h5_writestepattrib_string ( + const h5_int64_t *const fh, + const char *name, + const char *buffer, + const int l_name, + const int l_buffer + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "f=%p, name='%.*s', buffer='%.*s'", + (h5_file_p)f, l_name, name, l_buffer, buffer); + char *buffer2 = h5_strdupfor2c (buffer, l_buffer); + h5_int64_t herr = write_step_attrib ( + f, name, l_name, H5_STRING_T, buffer2, strlen(buffer2)+1 ); + free (buffer2); + H5_API_RETURN (herr); +} + +#define h5_readstepattrib_string F77_NAME ( \ + h5_readstepattrib_string, \ + h5_readstepattrib_string_, \ + H5_READSTEPATTRIB_STRING) +h5_int64_t +h5_readstepattrib_string ( + const h5_int64_t *const fh, + const char *name, + char *buffer, + const int l_name, + const int l_buffer + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "f=%p, name='%.*s', buffer='%.*s'", + (h5_file_p)f, l_name, name, l_buffer, buffer); + h5_int64_t herr = read_step_attrib (f, name, l_name, H5_STRING_T, buffer); + h5_strc2for (buffer, l_buffer); + H5_API_RETURN (herr); +} + +#define h5_writestepattrib_r8 F77_NAME ( \ + h5_writestepattrib_r8, \ + h5_writestepattrib_r8_, \ + H5_WRITESTEPATTRIB_R8) +h5_int64_t +h5_writestepattrib_r8 ( + const h5_int64_t *const fh, + const char *name, + const h5_float64_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "f=%p, name='%.*s', buffer=%p, nelem=%lld", + (h5_file_p)f, l_name, name, buffer, (long long)*nelem); + H5_API_RETURN (write_step_attrib( + f, + name, l_name, + H5_FLOAT64_T, + buffer, (hsize_t)*nelem)); +} + +#define h5_readstepattrib_r8 F77_NAME ( \ + h5_readstepattrib_r8, \ + h5_readstepattrib_r8_, \ + H5_READSTEPATTRIB_R8 ) +h5_int64_t +h5_readstepattrib_r8 ( + const h5_int64_t *const fh, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "f=%p, name='%.*s', buffer=%p", + (h5_file_p)f, l_name, name, buffer); + H5_API_RETURN (read_step_attrib( + f, + name, l_name, + H5_FLOAT64_T, + (void*)buffer)); +} + +#define h5_writestepattrib_r4 F77_NAME ( \ + h5_writestepattrib_r4, \ + h5_writestepattrib_r4_, \ + H5_WRITESTEPATTRIB_R4 ) +h5_int64_t +h5_writestepattrib_r4 ( + h5_int64_t *const fh, + const char *name, + const h5_float64_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "f=%p, name='%.*s', buffer=%p, nelem=%lld", + (h5_file_p)f, l_name, name, buffer, (long long)*nelem); + H5_API_RETURN (write_step_attrib( + f, + name, l_name, + H5_FLOAT32_T, + buffer, (hsize_t)*nelem)); +} + +#define h5_readstepattrib_r4 F77_NAME ( \ + h5_readstepattrib_r4, \ + h5_readstepattrib_r4_, \ + H5_READSTEPATTRIB_R4 ) +h5_int64_t +h5_readstepattrib_r4 ( + const h5_int64_t *const fh, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "f=%p, name='%.*s', buffer=%p", + (h5_file_p)f, l_name, name, buffer); + H5_API_RETURN (read_step_attrib( + f, + name, l_name, + H5_FLOAT32_T, + buffer)); +} + +#define h5_writestepattrib_i8 F77_NAME ( \ + h5_writestepattrib_i8, \ + h5_writestepattrib_i8_, \ + H5_WRITESTEPATTRIB_I8) +h5_int64_t +h5_writestepattrib_i8 ( + h5_int64_t *const fh, + const char *name, + const h5_float64_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "f=%p, name='%.*s', buffer=%p, nelem=%lld", + (h5_file_p)f, l_name, name, buffer, (long long)*nelem); + H5_API_RETURN (write_step_attrib( + f, + name, l_name, + H5_INT64_T, + buffer, (hsize_t)*nelem)); +} + +#define h5_readstepattrib_i8 F77_NAME ( \ + h5_readstepattrib_i8, \ + h5_readstepattrib_i8_, \ + H5_READSTEPATTRIB_I8 ) +h5_int64_t +h5_readstepattrib_i8 ( + const h5_int64_t *const fh, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "f=%p, name='%.*s', buffer=%p", + (h5_file_p)f, l_name, name, buffer); + H5_API_RETURN (read_step_attrib( + f, + name, l_name, + H5_INT64_T, + buffer)); +} + +#define h5_writestepattrib_i4 F77_NAME ( \ + h5_writestepattrib_i4, \ + h5_writestepattrib_i4_, \ + H5_WRITESTEPATTRIB_I4 ) +h5_int64_t +h5_writestepattrib_i4 ( + const h5_int64_t *const fh, + const char *name, + const h5_float64_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "f=%p, name='%.*s', buffer=%p, nelem=%lld", + (h5_file_p)f, l_name, name, buffer, (long long)*nelem); + H5_API_RETURN (write_step_attrib( + f, + name, l_name, + H5_INT32_T, + buffer, (hsize_t)*nelem)); +} + +#define h5_readstepattrib_i4 F77_NAME ( \ + h5_readstepattrib_i4, \ + h5_readstepattrib_i4_, \ + H5_READSTEPATTRIB_I4 ) +h5_int64_t +h5_readstepattrib_i4 ( + const h5_int64_t *const fh, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { + h5_file_t* f = h5_filehandlefor2c(fh); + H5_API_ENTER (h5_int64_t, + "f=%p, name='%.*s', buffer=%p", + (h5_file_p)f, l_name, name, buffer); + H5_API_RETURN (read_step_attrib( + f, + name, l_name, + H5_INT32_T, + buffer)); +} diff --git a/src/Fortran/H5_attribsF.f90 b/src/Fortran/H5_attribsF.f90 new file mode 100644 index 0000000..f98c45f --- /dev/null +++ b/src/Fortran/H5_attribsF.f90 @@ -0,0 +1,366 @@ +! __ _ _ _ _ _ _ _ +! / _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ +! | |_| | |/ _ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| +! | _| | | __/ | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ +! |_| |_|_|\___| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ +! __ _ _ _ ___ _ __ _ _ +! / _` | | | |/ _ \ '__| | | | +! | (_| | |_| | __/ | | |_| | +! \__, |\__,_|\___|_| \__, | +! |_| |___/ + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5GetNumFileAttribs +!! \return number of attributes or error code +!< +INTEGER*8 FUNCTION h5_getnfileattribs (filehandle) + INTEGER*8, INTENT(IN) :: filehandle !< file handle +END FUNCTION + +!> +!! \ingroup h5hut_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 !< file handle + INTEGER*8,INTENT(IN) :: idx !< index of attribute being queried + CHARACTER(LEN=*), INTENT(OUT):: attrib_name !< name of attribute + INTEGER*8,INTENT(OUT):: attrib_type !< type of attribute + INTEGER*8,INTENT(OUT):: attrib_nelem !< number of elements in the attrib array +END FUNCTION + +! __ _ _ _ _ _ _ _ +! / _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ +! | |_| | |/ _ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| +! | _| | | __/ | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ +! |_| |_|_|\___| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ +! _ __ _ _ +! (_) / /__ ___| |_ _ __(_)_ __ __ _ +! | | / / _ \ / __| __| '__| | '_ \ / _` | +! | |/ / (_) | \__ \ |_| | | | | | | (_| | +! |_/_/ \___/ |___/\__|_| |_|_| |_|\__, | +! |___/ + +!> +!! \ingroup h5hut_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 !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write + CHARACTER(LEN=*), INTENT(IN) :: attrib_value!< attribute data to be written +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_readfileattrib_string (filehandle, attrib_name, attrib_value) + INTEGER*8, INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of the attribute to read + CHARACTER(LEN=*), INTENT(IN) :: attrib_value!< attribute data will be read into this array +END FUNCTION + +! __ _ _ _ _ _ _ _ +! / _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ +! | |_| | |/ _ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| +! | _| | | __/ | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ +! |_| |_|_|\___| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ +! _ __ _ +! (_) / /__ _ __ ___ __ _| | +! | | / / _ \ | '__/ _ \/ _` | | +! | |/ / (_) | | | | __/ (_| | | +! |_/_/ \___/ |_| \___|\__,_|_| + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5WriteFileAttribFloat64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_writefileattrib_r8 (filehandle, attrib_name, attrib_value, attrib_nelem) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + REAL*8, INTENT(OUT):: attrib_value(*) !< attribute data to be written + INTEGER*8, INTENT(IN) :: attrib_nelem !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5ReadFileAttribFloat64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_readfileattrib_r8 (filehandle, attrib_name, attrib_value) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + REAL*8, INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5WriteFileAttribFloat32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_writefileattrib_r4 (filehandle, attrib_name, attrib_value, attrib_nelem) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + REAL*4, INTENT(OUT):: attrib_value(*) !< attribute data to be written + INTEGER*8, INTENT(IN) :: attrib_nelem !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5ReadFileAttribFloat32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_readfileattrib_r4 ( filehandle, attrib_name, attrib_value ) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + REAL*4, INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array +END FUNCTION + +! __ _ _ _ _ _ _ _ +! / _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ +! | |_| | |/ _ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| +! | _| | | __/ | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ +! |_| |_|_|\___| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ +! _ __ _ _ +! (_) / /__ (_)_ __ | |_ ___ __ _ ___ _ __ +! | | / / _ \ | | '_ \| __/ _ \/ _` |/ _ \ '__| +! | |/ / (_) | | | | | | || __/ (_| | __/ | +! |_/_/ \___/ |_|_| |_|\__\___|\__, |\___|_| +! |___/ + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5WriteFileAttribInt64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_writefileattrib_i8 (filehandle, attrib_name, attrib_value, attrib_nelem) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write + INTEGER*8,INTENT(OUT):: attrib_value(*) !< attribute data to be written + INTEGER*8, INTENT(IN) :: attrib_nelem !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5ReadFileAttribInt64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_readfileattrib_i8 (filehandle, attrib_name, attrib_value) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + INTEGER*8,INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5WriteFileAttribInt32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_writefileattrib_i4 (filehandle, attrib_name, attrib_value, attrib_nelem) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write + INTEGER*8,INTENT(OUT):: attrib_type !< type of attribute + INTEGER*4,INTENT(OUT):: attrib_value(*) !< attribute data to be written + INTEGER*8, INTENT(IN) :: attrib_nelem !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5ReadFileAttribInt32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_readfileattrib_i4 (filehandle, attrib_name, attrib_value) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + INTEGER*4,INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array +END FUNCTION + +! _ _ _ _ _ _ +! ___| |_ ___ _ __ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ +! / __| __/ _ \ '_ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| +! \__ \ || __/ |_) | | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ +! |___/\__\___| .__/ \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ +! |_| +! __ _ _ _ ___ _ __ _ _ +! / _` | | | |/ _ \ '__| | | | +! | (_| | |_| | __/ | | |_| | +! \__, |\__,_|\___|_| \__, | +! |_| |___/ + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5GetNumFileAttribs +!! \return number of attributes or error code +!< +INTEGER*8 FUNCTION h5_getnstepattribs (filehandle) + INTEGER*8, INTENT(IN) :: filehandle !< file handle +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5GetFileAttribInfo +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_getstepattribinfo (filehandle, idx, attrib_name, attrib_nelem) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + INTEGER*8,INTENT(IN) :: idx !< index of attribute being queried + CHARACTER(LEN=*), INTENT(OUT):: attrib_name !< name of attribute + INTEGER*8,INTENT(OUT):: attrib_nelem !< number of elements in the attrib array +END FUNCTION + +! _ _ _ _ _ _ +! ___| |_ ___ _ __ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ +! / __| __/ _ \ '_ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| +! \__ \ || __/ |_) | | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ +! |___/\__\___| .__/ \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ +! |_| +! _ __ _ _ +! (_) / /__ ___| |_ _ __(_)_ __ __ _ +! | | / / _ \ / __| __| '__| | '_ \ / _` | +! | |/ / (_) | \__ \ |_| | | | | | | (_| | +! |_/_/ \___/ |___/\__|_| |_|_| |_|\__, | +! |___/ + +!> +!! \ingroup h5hut_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 !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write + CHARACTER(LEN=*), INTENT(IN) :: attrib_value!< attribute data to be written +END FUNCTION + +!> +!! \ingroup h5hut_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 !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of the attribute to read + CHARACTER(LEN=*), INTENT(IN) :: attrib_value!< attribute data will be read into this array +END FUNCTION + +! _ _ _ _ _ _ +! ___| |_ ___ _ __ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ +! / __| __/ _ \ '_ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| +! \__ \ || __/ |_) | | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ +! |___/\__\___| .__/ \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ +! |_| +! _ __ _ +! (_) / /__ _ __ ___ __ _| | +! | | / / _ \ | '__/ _ \/ _` | | +! | |/ / (_) | | | | __/ (_| | | +! |_/_/ \___/ |_| \___|\__,_|_| + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5WriteStepAttribFloat64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_writestepattrib_r8 (filehandle, attrib_name, attrib_value, attrib_nelem) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + REAL*8, INTENT(OUT):: attrib_value(*) !< attribute data to be written + INTEGER*8, INTENT(IN) :: attrib_nelem !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5ReadStepAttribFloat64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_readstepattrib_r8 (filehandle, attrib_name, attrib_value) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + REAL*8, INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5WriteStepAttribFloat32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_writestepattrib_r4 (filehandle, attrib_name, attrib_value, attrib_nelem) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + REAL*4, INTENT(OUT):: attrib_value(*) !< attribute data to be written + INTEGER*8, INTENT(IN) :: attrib_nelem !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5ReadStepAttribFloat32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_readstepattrib_r4 ( filehandle, attrib_name, attrib_value ) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + REAL*4, INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array +END FUNCTION + +! _ _ _ _ _ _ +! ___| |_ ___ _ __ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ +! / __| __/ _ \ '_ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| +! \__ \ || __/ |_) | | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ +! |___/\__\___| .__/ \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ +! |_| +! _ __ _ _ +! (_) / /__ (_)_ __ | |_ ___ __ _ ___ _ __ +! | | / / _ \ | | '_ \| __/ _ \/ _` |/ _ \ '__| +! | |/ / (_) | | | | | | || __/ (_| | __/ | +! |_/_/ \___/ |_|_| |_|\__\___|\__, |\___|_| +! |___/ + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5WriteStepAttribInt64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_writestepattrib_i8 (filehandle, attrib_name, attrib_value, attrib_nelem) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write + INTEGER*8,INTENT(OUT):: attrib_value(*) !< attribute data to be written + INTEGER*8, INTENT(IN) :: attrib_nelem !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5ReadStepAttribInt64 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_readstepattrib_i8 (filehandle, attrib_name, attrib_value) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + INTEGER*8,INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5WriteStepAttribInt32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_writestepattrib_i4 (filehandle, attrib_name, attrib_value, attrib_nelem) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to write + INTEGER*4,INTENT(OUT):: attrib_value(*) !< attribute data to be written + INTEGER*8, INTENT(IN) :: attrib_nelem !< number of elements in data array +END FUNCTION + +!> +!! \ingroup h5hut_attrib_f +!! See \ref H5ReadStepAttribInt32 +!! \return 0 on success or error code +!< +INTEGER*8 FUNCTION h5_readstepattrib_i4 (filehandle, attrib_name, attrib_value) + INTEGER*8,INTENT(IN) :: filehandle !< file handle + CHARACTER(LEN=*), INTENT(IN) :: attrib_name !< name of attribute to read + INTEGER*4,INTENT(OUT):: attrib_value(*) !< attribute data will be read into this array +END FUNCTION diff --git a/src/Fortran/H5_attribs_F.c b/src/Fortran/H5_attribs_F.c index a7fa99e..5a58fd7 100644 --- a/src/Fortran/H5_attribs_F.c +++ b/src/Fortran/H5_attribs_F.c @@ -14,34 +14,33 @@ #error Error, no way to determine how to construct fortran bindings #endif -#if ! defined(F77_NO_UNDERSCORE) +#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 ) +#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 ( - h5_int64_t *const f, - const char *name, - const char *buffer, - const int l_name, - const int l_buffer - ) { + h5_int64_t *const f, + const char *name, + const char *buffer, + const int l_name, + const int l_buffer + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); char *buffer2 = h5_strdupfor2c ( buffer, l_buffer ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer='%s', l_name=%d, l_buffer=%d", - fh, name2, buffer2, l_name, l_buffer); + "f=%p, name='%s', buffer='%s', l_name=%d, l_buffer=%d", + fh, name2, buffer2, l_name, l_buffer); - h5_err_t herr = h5_write_attrib ( - fh, H5_ATTRIB_FILE, name2, - H5_STRING_T, buffer2, strlen(buffer2)+1 ); + h5_err_t herr = h5_write_file_attrib ( + fh, name2, H5_STRING_T, buffer2, strlen(buffer2)+1 ); free ( name2 ); free ( buffer2 ); @@ -50,23 +49,22 @@ h5_writefileattrib_string ( h5_err_t h5_writestepattrib_string ( - h5_int64_t *const f, - const char *name, - const char *buffer, - const int l_name, - const int l_buffer - ) { + h5_int64_t *const f, + const char *name, + const char *buffer, + const int l_name, + const int l_buffer + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); char *buffer2 = h5_strdupfor2c ( buffer, l_buffer ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer='%s', l_name=%d, l_buffer=%d", - fh, name2, buffer2, l_name, l_buffer); + "f=%p, name='%s', buffer='%s', l_name=%d, l_buffer=%d", + fh, name2, buffer2, l_name, l_buffer); - h5_err_t herr = h5_write_attrib ( - fh, H5_ATTRIB_STEP, name2, - H5_STRING_T, buffer2, strlen(buffer2)+1 ); + h5_err_t herr = h5_write_step_attrib ( + fh, name2, H5_STRING_T, buffer2, strlen(buffer2)+1 ); free ( name2 ); free ( buffer2 ); @@ -75,21 +73,21 @@ h5_writestepattrib_string ( h5_err_t h5_readfileattrib_string ( - h5_int64_t *const f, - const char *name, - char *buffer, - const int l_name, - const int l_buffer - ) { - + h5_int64_t *const f, + const char *name, + char *buffer, + const int l_name, + const int l_buffer + ) { + h5_file_t *fh = h5_filehandlefor2c(f); char * name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d, l_buffer=%d", - fh, name2, buffer, l_name, l_buffer); + "f=%p, name='%s', buffer=%p, l_name=%d, l_buffer=%d", + fh, name2, buffer, l_name, l_buffer); h5_err_t herr = h5_read_attrib ( - fh, H5_ATTRIB_FILE, name2, H5_STRING_T, buffer ); + fh, fh->root_gid, name2, H5_STRING_T, buffer ); h5_strc2for ( buffer, l_buffer ); @@ -99,21 +97,21 @@ h5_readfileattrib_string ( h5_err_t h5_readstepeattrib_string ( - h5_int64_t *const f, - const char *name, - char *buffer, - const int l_name, - const int l_buffer - ) { - + h5_int64_t *const f, + const char *name, + char *buffer, + const int l_name, + const int l_buffer + ) { + h5_file_t *fh = h5_filehandlefor2c(f); char * name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d, l_buffer=%d", - fh, name2, buffer, l_name, l_buffer); + "f=%p, name='%s', buffer=%p, l_name=%d, l_buffer=%d", + fh, name2, buffer, l_name, l_buffer); - h5_err_t herr = h5_read_attrib ( - fh, H5_ATTRIB_STEP, name2, H5_STRING_T, buffer ); + h5_err_t herr = h5_read_step_attrib ( + fh, name2, H5_STRING_T, buffer ); h5_strc2for ( buffer, l_buffer ); @@ -121,449 +119,442 @@ h5_readstepeattrib_string ( H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_writefileattrib_r8 F77NAME ( \ - h5_writefileattrib_r8_, \ - H5_WRITEFILEATTRIB_R8 ) + h5_writefileattrib_r8_, \ + H5_WRITEFILEATTRIB_R8 ) #endif h5_err_t h5_writefileattrib_r8 ( - h5_int64_t *const f, - const char *name, - const h5_float64_t *buffer, - const h5_int64_t *nelem, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_float64_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", - fh, name2, buffer, (long long)*nelem, l_name); + "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", + fh, name2, buffer, (long long)*nelem, l_name); - h5_err_t herr = h5_write_attrib( - fh, H5_ATTRIB_FILE, name2, - H5_FLOAT64_T, buffer, (hsize_t)*nelem); + h5_err_t herr = h5_write_file_attrib( + fh, name2, H5_FLOAT64_T, buffer, (hsize_t)*nelem); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_readfileattrib_r8 F77NAME ( \ - h5_readfileattrib_r8_, \ - H5_READFILEATTRIB_R8 ) + h5_readfileattrib_r8_, \ + H5_READFILEATTRIB_R8 ) #endif h5_err_t h5bl_readfileattrib_r8 ( - h5_int64_t *const f, - const char *name, - h5_float64_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name2, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name2, buffer, l_name); h5_err_t herr = h5_read_attrib( - fh, H5_ATTRIB_FILE, name2, H5_FLOAT64_T, buffer); + fh, fh->root_gid, name2, H5_FLOAT64_T, buffer); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_writefileattrib_r4 F77NAME ( \ - h5_writefileattrib_r4_, \ - H5_WRITEFILEATTRIB_R4 ) + h5_writefileattrib_r4_, \ + H5_WRITEFILEATTRIB_R4 ) #endif h5_err_t h5_writefileattrib_r4 ( - h5_int64_t *const f, - const char *name, - const h5_float32_t *buffer, - const h5_int64_t *nelem, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_float32_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", - fh, name2, buffer, (long long)*nelem, l_name); + "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", + fh, name2, buffer, (long long)*nelem, l_name); - h5_err_t herr = h5_write_attrib( - fh, H5_ATTRIB_FILE, name2, + h5_err_t herr = h5_write_file_attrib( + fh, name2, H5_FLOAT32_T, buffer, (hsize_t)*nelem); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_readfileattrib_r4 F77NAME ( \ - h5_readfileattrib_r4_, \ - H5_READFILEATTRIB_R4 ) + h5_readfileattrib_r4_, \ + H5_READFILEATTRIB_R4 ) #endif h5_err_t h5bl_readfileattrib_r4 ( - h5_int64_t *const f, - const char *name, - h5_float64_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name2, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name2, buffer, l_name); h5_err_t herr = h5_read_attrib( - fh, H5_ATTRIB_FILE, name2, H5_FLOAT32_T, buffer); + fh, fh->root_gid, name2, H5_FLOAT32_T, buffer); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_writefileattrib_i8 F77NAME ( \ - h5_writefileattrib_i8_, \ - H5_WRITEFILEATTRIB_I8 ) + h5_writefileattrib_i8_, \ + H5_WRITEFILEATTRIB_I8 ) #endif h5_err_t h5_writefileattrib_i8 ( - h5_int64_t *const f, - const char *name, - const h5_int64_t *buffer, - const h5_int64_t *nelem, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_int64_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", - fh, name2, buffer, (long long)*nelem, l_name); + "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", + fh, name2, buffer, (long long)*nelem, l_name); - h5_err_t herr = h5_write_attrib( - fh, H5_ATTRIB_FILE, name2, - H5_INT64_T, buffer, (hsize_t)*nelem); + h5_err_t herr = h5_write_file_attrib( + fh, name2, H5_INT64_T, buffer, (hsize_t)*nelem); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_readfileattrib_i8 F77NAME ( \ - h5_readfileattrib_i8_, \ - H5_READFILEATTRIB_I8 ) + h5_readfileattrib_i8_, \ + H5_READFILEATTRIB_I8 ) #endif h5_err_t h5bl_readfileattrib_i8 ( - h5_int64_t *const f, - const char *name, - h5_float64_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name2, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name2, buffer, l_name); h5_err_t herr = h5_read_attrib( - fh, H5_ATTRIB_FILE, name2, H5_INT64_T, buffer); + fh, fh->root_gid, name2, H5_INT64_T, buffer); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_writefileattrib_i4 F77NAME ( \ - h5_writefileattrib_i4_, \ - H5_WRITEFILEATTRIB_I4 ) + h5_writefileattrib_i4_, \ + H5_WRITEFILEATTRIB_I4 ) #endif h5_err_t h5_writefileattrib_i4 ( - h5_int64_t *const f, - const char *name, - const h5_int32_t *buffer, - const h5_int64_t *nelem, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_int32_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", - fh, name2, buffer, (long long)*nelem, l_name); + "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", + fh, name2, buffer, (long long)*nelem, l_name); - h5_err_t herr = h5_write_attrib( - fh, H5_ATTRIB_FILE, name2, - H5_INT32_T, buffer, (hsize_t)*nelem); + h5_err_t herr = h5_write_file_attrib( + fh, name2, H5_INT32_T, buffer, (hsize_t)*nelem); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_readfileattrib_i4 F77NAME ( \ - h5_readfileattrib_i4_, \ - H5_READFILEATTRIB_I4 ) + h5_readfileattrib_i4_, \ + H5_READFILEATTRIB_I4 ) #endif h5_err_t h5bl_readfileattrib_i4 ( - h5_int64_t *const f, - const char *name, - h5_float64_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name2, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name2, buffer, l_name); h5_err_t herr = h5_read_attrib( - fh, H5_ATTRIB_FILE, name2, H5_INT32_T, buffer); + fh, fh->root_gid, name2, H5_INT32_T, buffer); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_writestepattrib_r8 F77NAME ( \ - h5_writestepattrib_r8_, \ - H5_WRITESTEPATTRIB_R8 ) + h5_writestepattrib_r8_, \ + H5_WRITESTEPATTRIB_R8 ) #endif h5_err_t h5_writestepattrib_r8 ( - h5_int64_t *const f, - const char *name, - const h5_float64_t *buffer, - const h5_int64_t *nelem, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_float64_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", - fh, name2, buffer, (long long)*nelem, l_name); + "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", + fh, name2, buffer, (long long)*nelem, l_name); - h5_err_t herr = h5_write_attrib( - fh, H5_ATTRIB_STEP, name2, - H5_FLOAT64_T, buffer, (hsize_t)*nelem); + h5_err_t herr = h5_write_step_attrib( + fh, name2, H5_FLOAT64_T, buffer, (hsize_t)*nelem); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_readstepattrib_r8 F77NAME ( \ - h5_readstepattrib_r8_, \ - H5_READSTEPATTRIB_R8 ) + h5_readstepattrib_r8_, \ + H5_READSTEPATTRIB_R8 ) #endif h5_err_t h5bl_readstepattrib_r8 ( - h5_int64_t *const f, - const char *name, - h5_float64_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name2, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name2, buffer, l_name); - h5_err_t herr = h5_read_attrib( - fh, H5_ATTRIB_STEP, name2, H5_FLOAT64_T, buffer); + h5_err_t herr = h5_read_step_attrib( + fh, name2, H5_FLOAT64_T, buffer); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_writestepattrib_r4 F77NAME ( \ - h5_writestepattrib_r4_, \ - H5_WRITESTEPATTRIB_R4 ) + h5_writestepattrib_r4_, \ + H5_WRITESTEPATTRIB_R4 ) #endif h5_err_t h5_writestepattrib_r4 ( - h5_int64_t *const f, - const char *name, - const h5_float32_t *buffer, - const h5_int64_t *nelem, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_float32_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", - fh, name2, buffer, (long long)*nelem, l_name); + "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", + fh, name2, buffer, (long long)*nelem, l_name); - h5_err_t herr = h5_write_attrib( - fh, H5_ATTRIB_STEP, name2, - H5_FLOAT32_T, buffer, (hsize_t)*nelem); + h5_err_t herr = h5_write_step_attrib( + fh, name2, H5_FLOAT32_T, buffer, (hsize_t)*nelem); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_readstepattrib_r4 F77NAME ( \ - h5_readstepattrib_r4_, \ - H5_READSTEPATTRIB_R4 ) + h5_readstepattrib_r4_, \ + H5_READSTEPATTRIB_R4 ) #endif h5_err_t h5bl_readstepattrib_r4 ( - h5_int64_t *const f, - const char *name, - h5_float64_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name2, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name2, buffer, l_name); - h5_err_t herr = h5_read_attrib( - fh, H5_ATTRIB_STEP, name2, H5_FLOAT32_T, buffer); + h5_err_t herr = h5_read_step_attrib( + fh, name2, H5_FLOAT32_T, buffer); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_writestepattrib_i8 F77NAME ( \ - h5_writestepattrib_i8_, \ - H5_WRITESTEPATTRIB_I8 ) + h5_writestepattrib_i8_, \ + H5_WRITESTEPATTRIB_I8 ) #endif h5_err_t h5_writestepattrib_i8 ( - h5_int64_t *const f, - const char *name, - const h5_int64_t *buffer, - const h5_int64_t *nelem, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_int64_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", - fh, name2, buffer, (long long)*nelem, l_name); + "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", + fh, name2, buffer, (long long)*nelem, l_name); - h5_err_t herr = h5_write_attrib( - fh, H5_ATTRIB_STEP, name2, - H5_INT64_T, buffer, (hsize_t)*nelem); + h5_err_t herr = h5_write_step_attrib( + fh, name2, H5_INT64_T, buffer, (hsize_t)*nelem); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_readstepattrib_i8 F77NAME ( \ - h5_readstepattrib_i8_, \ - H5_READSTEPATTRIB_I8 ) + h5_readstepattrib_i8_, \ + H5_READSTEPATTRIB_I8 ) #endif h5_err_t h5bl_readstepattrib_i8 ( - h5_int64_t *const f, - const char *name, - h5_float64_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name2, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name2, buffer, l_name); - h5_err_t herr = h5_read_attrib( - fh, H5_ATTRIB_STEP, name2, H5_INT64_T, buffer); + h5_err_t herr = h5_read_step_attrib( + fh, name2, H5_INT64_T, buffer); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_writestepattrib_i4 F77NAME ( \ - h5_writestepattrib_i4_, \ - H5_WRITESTEPATTRIB_I4 ) + h5_writestepattrib_i4_, \ + H5_WRITESTEPATTRIB_I4 ) #endif h5_err_t h5_writestepattrib_i4 ( - h5_int64_t *const f, - const char *name, - const h5_int32_t *buffer, - const h5_int64_t *nelem, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + const h5_int32_t *buffer, + const h5_int64_t *nelem, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", - fh, name2, buffer, (long long)*nelem, l_name); + "f=%p, name='%s', buffer=%p, nelem=%lld, l_name=%d", + fh, name2, buffer, (long long)*nelem, l_name); - h5_err_t herr = h5_write_attrib( - fh, H5_ATTRIB_STEP, name2, - H5_INT32_T, buffer, (hsize_t)*nelem); + h5_err_t herr = h5_write_step_attrib( + fh, name2, H5_INT32_T, buffer, (hsize_t)*nelem); free ( name2 ); H5_API_RETURN(herr); } -#if ! defined(F77_NO_UNDERSCORE) +#if !defined(F77_NO_UNDERSCORE) #define h5_readstepattrib_i4 F77NAME ( \ - h5_readstepattrib_i4_, \ - H5_READSTEPATTRIB_I4 ) + h5_readstepattrib_i4_, \ + H5_READSTEPATTRIB_I4 ) #endif h5_err_t h5bl_readstepattrib_i4 ( - h5_int64_t *const f, - const char *name, - h5_float64_t *buffer, - const int l_name - ) { + h5_int64_t *const f, + const char *name, + h5_float64_t *buffer, + const int l_name + ) { h5_file_t *fh = h5_filehandlefor2c(f); char *name2 = h5_strdupfor2c ( name, l_name ); H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p, l_name=%d", - fh, name2, buffer, l_name); + "f=%p, name='%s', buffer=%p, l_name=%d", + fh, name2, buffer, l_name); - h5_err_t herr = h5_read_attrib( - fh, H5_ATTRIB_STEP, name2, H5_INT32_T, buffer); + h5_err_t herr = h5_read_step_attrib( + fh, name2, H5_INT32_T, buffer); free ( name2 ); H5_API_RETURN(herr); diff --git a/src/Fortran/H5_constF.f90 b/src/Fortran/H5_constF.f90 new file mode 100644 index 0000000..5ccf48a --- /dev/null +++ b/src/Fortran/H5_constF.f90 @@ -0,0 +1,61 @@ + +INTEGER*8 :: H5_STRING_T +INTEGER*8 :: H5_INT16_T +INTEGER*8 :: H5_INT32_T +INTEGER*8 :: H5_INT64_t +INTEGER*8 :: H5_FLOAT32_T +INTEGER*8 :: H5_FLOAT64_T + +PARAMETER (H5_STRING_T = 1) +PARAMETER (H5_INT16_T = 2) +PARAMETER (H5_INT32_T = 3) +PARAMETER (H5_INT64_T = 4) +PARAMETER (H5_FLOAT32_T = 5) +PARAMETER (H5_FLOAT64_T = 6) + +INTEGER*8 :: H5_MAX_NAME_LEN +PARAMETER (H5_MAX_NAME_LEN = 64) + +INTEGER*8 :: H5_SUCCESS +INTEGER*8 :: H5_OK +INTEGER*8 :: H5_NOK +INTEGER*8 :: H5_FAILURE +INTEGER*8 :: H5_ERR_BADF +INTEGER*8 :: H5_ERR_NOMEM +INTEGER*8 :: H5_ERR_INVAL +INTEGER*8 :: H5_ERR_BADFD + +INTEGER*8 :: H5_ERR_LAYOUT +INTEGER*8 :: H5_ERR_NOENTRY + +INTEGER*8 :: H5_ERR_MPI +INTEGER*8 :: H5_ERR_HDF5 +INTEGER*8 :: H5_ERR_H5 +INTEGER*8 :: H5_ERR_H5PART +INTEGER*8 :: H5_ERR_H5BLOCK +INTEGER*8 :: H5_ERR_H5FED + +INTEGER*8 :: H5_ERR_INTERNAL +INTEGER*8 :: H5_ERR_NOT_IMPLEMENTED + +PARAMETER (H5_SUCCESS = 0) +PARAMETER (H5_OK = H5_SUCCESS) +PARAMETER (H5_NOK = -1) +PARAMETER (H5_FAILURE = -2) +PARAMETER (H5_ERR_BADF = -9) +PARAMETER (H5_ERR_NOMEM = -12) +PARAMETER (H5_ERR_INVAL = -22) +PARAMETER (H5_ERR_BADFD = -77) + +PARAMETER (H5_ERR_LAYOUT = -100) +PARAMETER (H5_ERR_NOENTRY = -101) + +PARAMETER (H5_ERR_MPI = -201) +PARAMETER (H5_ERR_HDF5 = -202) +PARAMETER (H5_ERR_H5 = -203) +PARAMETER (H5_ERR_H5PART = -204) +PARAMETER (H5_ERR_H5BLOCK = -205) +PARAMETER (H5_ERR_H5FED = -206) + +PARAMETER (H5_ERR_INTERNAL = -253) +PARAMETER (H5_ERR_NOT_IMPLEMENTED = -254) diff --git a/src/Fortran/Makefile.am b/src/Fortran/Makefile.am index f10c799..9900fb5 100644 --- a/src/Fortran/Makefile.am +++ b/src/Fortran/Makefile.am @@ -2,22 +2,27 @@ if ENABLE_FORTRAN AM_CPPFLAGS += -I$(top_srcdir)/src/include -F90_FILES = H5.f90 \ - H5_attribs.f90 \ - H5Part.f90 \ - H5Block.f90 \ - H5Block_readwrite.f90 +F90_FILES = \ + H5F.f90 \ + H5_constF.f90 \ + H5_attribsF.f90 \ + H5PartF.f90 \ + H5Part_ioF.f90 \ + H5BlockF.f90 \ + H5Block_attribsF.f90 \ + H5Block_ioF.f90 EXTRA_HEADERS = # Extra files that I wish to include in the dist tar ball. -EXTRA_DIST = TestUnderscoreC.c \ - TestUnderscore.f \ - $(F90_FILES) +EXTRA_DIST = \ + TestUnderscoreC.c \ + TestUnderscore.f \ + $(F90_FILES) # Files that I don't want to include in the dist tar ball -#nodist_include_HEADERS = ../include/H5hutF.h @UNDERSCORE_H@ -nodist_include_HEADERS = $(top_srcdir)/src/include/H5hutF.h +nodist_include_HEADERS = \ + $(top_srcdir)/src//include/H5hutF.h # What to build... Will be determined by configure script. lib_LTLIBRARIES = libH5hutF.la @@ -25,23 +30,27 @@ lib_LTLIBRARIES = libH5hutF.la include_HEADERS = \ $(top_srcdir)/src/include/H5hutF.h -libH5hutF_la_SOURCES = \ - H5_F.c \ - H5_attribs_F.c \ - H5Part_F.c \ - H5Block_F.c \ - H5Block_readwrite_F.c +libH5hutF_la_SOURCES = \ + H5.c \ + H5_attribs.c \ + H5Part.c \ + H5Part_io.c \ + H5Block.c \ + H5Block_attribs.c \ + H5Block_io.c -libH5hutF_la_DEPENDENCIES = $(top_srcdir)/src/include/H5hutF.h +libH5hutF_la_DEPENDENCIES = \ + $(top_srcdir)/src/include/H5hutF.h libH5hutF_la_LDFLAGS = -version-info 2:0:0 -rpath '$(libdir)' $(top_srcdir)/src/include/H5hutF.h: $(F90_FILES) - awk '/INTEGER\*8 FUNCTION/{print "\t" $$1 " " $$3}' $^ >$@ + awk '/INTEGER\*8 :: /{print "\t" $$0}' $^ >$@ + awk '/PARAMETER /{print "\t" $$0}' $^ >> $@ + awk '/INTEGER\*8 FUNCTION/{print "\t" $$1 " " $$3}' $^ >>$@ -all-local: - $(INSTALL) -m755 -d ../lib - $(INSTALL) -m644 .libs/libH5hutF.a ../lib +all-local: $(top_srcdir)/src/include/H5hutF.h + $(INSTALL) -m644 .libs/libH5hutF.a $(top_srcdir)/src/lib endif clean: clean-am diff --git a/src/Fortran/TestUnderscoreC.c b/src/Fortran/TestUnderscoreC.c index 0beafb7..8f38296 100755 --- a/src/Fortran/TestUnderscoreC.c +++ b/src/Fortran/TestUnderscoreC.c @@ -1,36 +1,36 @@ #include void findunderscores(void){ - printf("#ifndef F77_NO_UNDERSCORE\n"); - printf("#define F77_NO_UNDERSCORE\n"); - printf("#endif\n"); - printf("#ifndef F77_NO_CAPS\n"); - printf("#define F77_NO_CAPS\n"); - printf("#endif\n"); + printf("#ifndef F77_NO_UNDERSCORE\n"); + printf("#define F77_NO_UNDERSCORE\n"); + printf("#endif\n"); + printf("#ifndef F77_NO_CAPS\n"); + printf("#define F77_NO_CAPS\n"); + printf("#endif\n"); } void FindUnderscores(void){ - printf("#ifndef F77_NO_UNDERSCORE\n"); - printf("#define F77_NO_UNDERSCORE\n"); - printf("#endif\n"); + printf("#ifndef F77_NO_UNDERSCORE\n"); + printf("#define F77_NO_UNDERSCORE\n"); + printf("#endif\n"); } void FindUnderscores_(void){ - printf("#ifndef F77_SINGLE_UNDERSCORE\n"); - printf("#define F77_SINGLE_UNDERSCORE\n"); - printf("#endif\n"); + printf("#ifndef F77_SINGLE_UNDERSCORE\n"); + printf("#define F77_SINGLE_UNDERSCORE\n"); + printf("#endif\n"); } void findunderscores_(void){ - printf("#ifndef F77_SINGLE_UNDERSCORE\n"); - printf("#define F77_SINGLE_UNDERSCORE\n"); - printf("#endif\n"); - printf("#ifndef F77_NO_CAPS\n"); - printf("#define F77_NO_CAPS\n"); - printf("#endif\n"); + printf("#ifndef F77_SINGLE_UNDERSCORE\n"); + printf("#define F77_SINGLE_UNDERSCORE\n"); + printf("#endif\n"); + printf("#ifndef F77_NO_CAPS\n"); + printf("#define F77_NO_CAPS\n"); + printf("#endif\n"); } void FINDUNDERSCORES(void){ - printf("#ifndef F77_CRAY_UNDERSCORE\n"); - printf("#define F77_CRAY_UNDERSCORE\n"); - printf("#endif\n"); + printf("#ifndef F77_CRAY_UNDERSCORE\n"); + printf("#define F77_CRAY_UNDERSCORE\n"); + printf("#endif\n"); }