diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2013-03-25 15:25:22 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2013-03-25 15:25:22 (GMT) |
commit | dbdedfdd2e5812b3c1d97e2f1f7361684db2d8e4 (patch) | |
tree | 963a5b4952cbb88253df8850d1cc19d70b6f614c /fortran | |
parent | ebb80dbae183e75ccf90f899f3ee1491946f93ec (diff) | |
parent | 6e1122dda4e446f6e9ad9ce4a9c2da8d40e441e3 (diff) | |
download | hdf5-dbdedfdd2e5812b3c1d97e2f1f7361684db2d8e4.zip hdf5-dbdedfdd2e5812b3c1d97e2f1f7361684db2d8e4.tar.gz hdf5-dbdedfdd2e5812b3c1d97e2f1f7361684db2d8e4.tar.bz2 |
[svn-r23443] merged from trunk
Diffstat (limited to 'fortran')
56 files changed, 1510 insertions, 623 deletions
diff --git a/fortran/Makefile.in b/fortran/Makefile.in index c4597cc..5a51c4b 100644 --- a/fortran/Makefile.in +++ b/fortran/Makefile.in @@ -226,6 +226,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -277,7 +278,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in index 0978ac5..3a65ac5 100644 --- a/fortran/examples/Makefile.in +++ b/fortran/examples/Makefile.in @@ -197,6 +197,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -248,7 +249,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 765bb65..c41916a 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -188,6 +188,7 @@ SET (f90_F_SRCS ${HDF5_F90_SRC_SOURCE_DIR}/H5Aff${F_STATUS}.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff${F_STATUS}.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Eff${F_STATUS}.f90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5Fff${F_STATUS}.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Lff${F_STATUS}.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Off${F_STATUS}.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Pff${F_STATUS}.f90 diff --git a/fortran/src/H5Aff.f90 b/fortran/src/H5Aff.f90 index 1926dd1..25f7fa7 100644 --- a/fortran/src/H5Aff.f90 +++ b/fortran/src/H5Aff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5A function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Aff_F03.f90 b/fortran/src/H5Aff_F03.f90 index b9e6c92..26c911a 100644 --- a/fortran/src/H5Aff_F03.f90 +++ b/fortran/src/H5Aff_F03.f90 @@ -61,7 +61,7 @@ ! (B) ! *** IMPORTANT *** ! If you add a new H5A function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Aff_F90.f90 b/fortran/src/H5Aff_F90.f90 index 7e14f7a..974b023 100644 --- a/fortran/src/H5Aff_F90.f90 +++ b/fortran/src/H5Aff_F90.f90 @@ -33,7 +33,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5A function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Dff.f90 b/fortran/src/H5Dff.f90 index b1e1df1..3ad868c 100644 --- a/fortran/src/H5Dff.f90 +++ b/fortran/src/H5Dff.f90 @@ -30,7 +30,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Dff_F03.f90 b/fortran/src/H5Dff_F03.f90 index 61d5dfc..be4bd69 100644 --- a/fortran/src/H5Dff_F03.f90 +++ b/fortran/src/H5Dff_F03.f90 @@ -74,7 +74,7 @@ ! ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Dff_F90.f90 b/fortran/src/H5Dff_F90.f90 index 3bb0fc0..46ea3ad 100644 --- a/fortran/src/H5Dff_F90.f90 +++ b/fortran/src/H5Dff_F90.f90 @@ -42,7 +42,7 @@ ! (3) ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5Eff.f90 b/fortran/src/H5Eff.f90 index 2e137df..7b56376 100644 --- a/fortran/src/H5Eff.f90 +++ b/fortran/src/H5Eff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5E function to the module you must add the function name -! to the Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! to the Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Eff_F03.f90 b/fortran/src/H5Eff_F03.f90 index 164f203..3ba3ce96 100644 --- a/fortran/src/H5Eff_F03.f90 +++ b/fortran/src/H5Eff_F03.f90 @@ -33,7 +33,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5E function to the module you must add the function name -! to the Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! to the Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Eff_F90.f90 b/fortran/src/H5Eff_F90.f90 index e698a84..158ec12 100644 --- a/fortran/src/H5Eff_F90.f90 +++ b/fortran/src/H5Eff_F90.f90 @@ -28,7 +28,7 @@ ! ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5FDmpioff.f90 b/fortran/src/H5FDmpioff.f90 index d9faef3..5c81bc8 100644 --- a/fortran/src/H5FDmpioff.f90 +++ b/fortran/src/H5FDmpioff.f90 @@ -26,7 +26,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5P function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c index 6dc0d18..fbfb0b2 100644 --- a/fortran/src/H5Ff.c +++ b/fortran/src/H5Ff.c @@ -682,3 +682,37 @@ nh5fget_filesize_c(hid_t_f *file_id, hsize_t_f *size) done: return ret_value; } + +/****if* H5Ff/h5fget_file_image_c + * NAME + * h5fget_file_image_c + * PURPOSE + * Calls h5fget_file_image + * INPUTS + * file_id - Target file identifier. + * buf_ptr - Pointer to the buffer into which the image of the HDF5 file is to be copied. + * buf_len - Size of the supplied buffer. + * OUTPUTS + * buf_req - The size in bytes of the buffer required to store the file image. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * November 26, 2012 + * SOURCE +*/ +int_f +nh5fget_file_image_c(hid_t_f *file_id, void *buf_ptr, size_t_f *buf_len, size_t_f *buf_req) +/******/ +{ + herr_t ret_value=0; /* Return value */ + + /* + * Call h5fget_file_image function + */ + if ((*buf_req = (size_t_f)H5Fget_file_image((hid_t)*file_id, buf_ptr, (size_t)*buf_len)) < 0) + HGOTO_DONE(FAIL); + +done: + return ret_value; +} diff --git a/fortran/src/H5Fff.f90 b/fortran/src/H5Fff.f90 index 44418a4..c3af8c4 100644 --- a/fortran/src/H5Fff.f90 +++ b/fortran/src/H5Fff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5F function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Fff_F03.f90 b/fortran/src/H5Fff_F03.f90 new file mode 100644 index 0000000..1ccd39a --- /dev/null +++ b/fortran/src/H5Fff_F03.f90 @@ -0,0 +1,104 @@ +!****h* ROBODoc/H5F (F03) +! +! NAME +! H5F_PROVISIONAL +! +! PURPOSE +! This file contains Fortran 2003 interfaces for H5F functions. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! NOTES +! *** IMPORTANT *** +! If you add a new H5T function you must add the function name to the +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. +! This is needed for Windows based operating systems. +! +!***** + + +MODULE H5F_PROVISIONAL + + USE H5GLOBAL + USE, INTRINSIC :: ISO_C_BINDING + + +CONTAINS +!****s* H5F (F03)/h5fget_file_image_f_F03 +! +! NAME +! h5fget_file_image_f +! +! PURPOSE +! Retrieves a copy of the image of an existing, open file. +! +! Inputs: +! file_id - Target file identifier. +! buf_ptr - Pointer to the buffer into which the image of the HDF5 file is to be copied. +! buf_len - Size of the supplied buffer. +! +! Outputs: +! hdferr - error code: +! 0 on success and -1 on failure +! Optional: +! buf_size - The size in bytes of the buffer required to store the file image. +! +! AUTHOR +! M. Scot Breitenfeld +! November 26, 2012 +! +! Fortran2003 Interface: + SUBROUTINE h5fget_file_image_f(file_id, buf_ptr, buf_len, hdferr, buf_size) + USE, INTRINSIC :: ISO_C_BINDING + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: file_id + TYPE(C_PTR) , INTENT(INOUT) :: buf_ptr + INTEGER(SIZE_T) , INTENT(IN) :: buf_len + INTEGER(SIZE_T) , INTENT(OUT), OPTIONAL :: buf_size + INTEGER , INTENT(OUT) :: hdferr +!***** + + INTEGER(SIZE_T) :: buf_size_default + + INTERFACE + INTEGER FUNCTION h5fget_file_image_c(file_id, buf_ptr, buf_len, buf_size) + USE, INTRINSIC :: ISO_C_BINDING + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5FGET_FILE_IMAGE_C'::h5fget_file_image_c + !DEC$ENDIF + INTEGER(HID_T) , INTENT(IN) :: file_id + TYPE(C_PTR) , VALUE :: buf_ptr + INTEGER(SIZE_T) , INTENT(IN) :: buf_len + INTEGER(SIZE_T), INTENT(IN) :: buf_size + END FUNCTION h5fget_file_image_c + END INTERFACE + + + IF(PRESENT(buf_size))THEN + buf_ptr = C_NULL_PTR + ENDIF + + hdferr = h5fget_file_image_c(file_id, buf_ptr, buf_len, buf_size_default) + + IF(PRESENT(buf_size))THEN + buf_size = buf_size_default + ENDIF + + END SUBROUTINE h5fget_file_image_f + +END MODULE H5F_PROVISIONAL diff --git a/fortran/src/H5Fff_F90.f90 b/fortran/src/H5Fff_F90.f90 new file mode 100644 index 0000000..b6e659b --- /dev/null +++ b/fortran/src/H5Fff_F90.f90 @@ -0,0 +1,43 @@ +!****h* ROBODoc/H5F (F90) +! +! NAME +! H5F_PROVISIONAL +! +! PURPOSE +! This file contains Fortran 90 interfaces for H5F functions. It +! containsthe same functions as H5Fff_F03.f90, when applicable, +! but excludes the Fortran 2003 functions and the interface listings. +! This file will be compiled instead of H5Fff_F03.f90 if Fortran 2003 +! functions are not enabled. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! NOTES +! *** IMPORTANT *** +! If you add a new H5F function you must add the function name to the +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. +! This is needed for Windows based operating systems. +! +!***** + + +MODULE H5F_PROVISIONAL + + USE H5GLOBAL + IMPLICIT NONE + +END MODULE H5F_PROVISIONAL diff --git a/fortran/src/H5Gff.f90 b/fortran/src/H5Gff.f90 index 155185a..d4d7496 100644 --- a/fortran/src/H5Gff.f90 +++ b/fortran/src/H5Gff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5G function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Iff.f90 b/fortran/src/H5Iff.f90 index 86e88b9..7c9a843 100644 --- a/fortran/src/H5Iff.f90 +++ b/fortran/src/H5Iff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5I function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Lf.c b/fortran/src/H5Lf.c index e5b01ed..c5138b6 100644 --- a/fortran/src/H5Lf.c +++ b/fortran/src/H5Lf.c @@ -725,7 +725,7 @@ nh5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, if(NULL == (c_name = (char *)HDmalloc(c_size))) HGOTO_DONE(FAIL) - if((*size = (size_t)H5Lget_name_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_field, + if((*size = (size_t_f)H5Lget_name_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_field, (H5_iter_order_t)*order, (hsize_t)*n,c_name, c_size, (hid_t)*lapl_id)) < 0) HGOTO_DONE(FAIL) diff --git a/fortran/src/H5Lff.f90 b/fortran/src/H5Lff.f90 index 8043d74..4660e52 100644 --- a/fortran/src/H5Lff.f90 +++ b/fortran/src/H5Lff.f90 @@ -27,7 +27,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5L function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Lff_F03.f90 b/fortran/src/H5Lff_F03.f90 index e2c54a7..83f80ac 100644 --- a/fortran/src/H5Lff_F03.f90 +++ b/fortran/src/H5Lff_F03.f90 @@ -32,7 +32,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5A function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Lff_F90.f90 b/fortran/src/H5Lff_F90.f90 index c802af7..dd62b7b 100644 --- a/fortran/src/H5Lff_F90.f90 +++ b/fortran/src/H5Lff_F90.f90 @@ -30,7 +30,7 @@ ! ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5Off.f90 b/fortran/src/H5Off.f90 index ce8c55c..1437e9f 100644 --- a/fortran/src/H5Off.f90 +++ b/fortran/src/H5Off.f90 @@ -31,7 +31,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5O function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Off_F03.f90 b/fortran/src/H5Off_F03.f90 index f4ddd3e..0cf4d46 100644 --- a/fortran/src/H5Off_F03.f90 +++ b/fortran/src/H5Off_F03.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5P function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Off_F90.f90 b/fortran/src/H5Off_F90.f90 index 53553d6..5688c5d 100644 --- a/fortran/src/H5Off_F90.f90 +++ b/fortran/src/H5Off_F90.f90 @@ -30,7 +30,7 @@ ! ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 6fc8487..dba2aa4 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -1937,28 +1937,29 @@ DONE: /****if* H5Pf/h5pset_external_c * NAME - * h5pset_external_c + * h5pset_external_c * PURPOSE - * Call H5Pset_external to add an external file to the - * list of external files. + * Call H5Pset_external to add an external file to the + * list of external files. * INPUTS - * prp_id - property list identifier - * name - Name of an external file - * namelen - length of name - * offset - Offset, in bytes, from the beginning of the file - * to the location in the file where the data starts. - * bytes - Number of bytes reserved in the file for the data. + * prp_id - property list identifier + * name - Name of an external file + * namelen - length of name + * offset - Offset, in bytes, from the beginning of the file + * to the location in the file where the data starts. + * bytes - Number of bytes reserved in the file for the data. * RETURNS - * 0 on success, -1 on failure + * 0 on success, -1 on failure * AUTHOR * Xiangyang Su - * Wednesday, February 23, 2000 + * Wednesday, February 23, 2000 * HISTORY - * + * Changed type of 'offset' from int_f to off_t_f -- MSB January 9, 2012 + * * SOURCE */ int_f -nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, int_f* offset, hsize_t_f*bytes) +nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, off_t_f* offset, hsize_t_f*bytes) /******/ { int ret_value = -1; @@ -2029,14 +2030,14 @@ nh5pget_external_count_c (hid_t_f *prp_id, int_f* count) /****if* H5Pf/h5pget_external_c * NAME - * h5pget_external_c + * h5pget_external_c * PURPOSE - * Call H5Pget_external to get nformation about an external file. + * Call H5Pget_external to get nformation about an external file. * INPUTS * prp_id - property list identifier * name_size - length of name * idx - External file index. - *OUTPUT + * OUTPUT * name - Name of an external file * offset - Offset, in bytes, from the beginning of the file * to the location in the file where the data starts. @@ -2047,11 +2048,12 @@ nh5pget_external_count_c (hid_t_f *prp_id, int_f* count) * Xiangyang Su * Wednesday, February 23, 2000 * HISTORY + * Changed type of 'offset' from integer to off_t -- MSB January 9, 2012 * * SOURCE */ int_f -nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, int_f* offset, hsize_t_f*bytes) +nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, off_t_f* offset, hsize_t_f*bytes) /******/ { int ret_value = -1; @@ -2079,7 +2081,7 @@ nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, if (status < 0) goto DONE; - *offset = (int_f)c_offset; + *offset = (off_t_f)c_offset; *bytes = (hsize_t_f)size; /* Note: if the size of the fortran buffer is larger then the returned string * from the function then we need to give HD5packFstring the fortran buffer size so diff --git a/fortran/src/H5Pff.f90 b/fortran/src/H5Pff.f90 index 4254b7f..a3c9a60 100644 --- a/fortran/src/H5Pff.f90 +++ b/fortran/src/H5Pff.f90 @@ -27,7 +27,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5P function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** @@ -2329,14 +2329,16 @@ CONTAINS ! HISTORY ! Explicit Fortran interfaces were added for ! called C functions (it is needed for Windows -! port). March 14, 2001 +! port). March 14, 2001 +! +! Changed type of 'offset' from integer to off_t -- MSB January 9, 2012 ! ! Fortran90 Interface: - SUBROUTINE h5pset_external_f(prp_id, name, offset,bytes, hdferr) + SUBROUTINE h5pset_external_f(prp_id, name, offset, bytes, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier CHARACTER(LEN=*), INTENT(IN) :: name ! Name of an external file - INTEGER, INTENT(IN) :: offset ! Offset, in bytes, from the beginning + INTEGER(OFF_T), INTENT(IN) :: offset ! Offset, in bytes, from the beginning ! of the file to the location in the file ! where the data starts. INTEGER(HSIZE_T), INTENT(IN) :: bytes ! Number of bytes reserved in the @@ -2347,9 +2349,6 @@ CONTAINS INTEGER :: namelen -! INTEGER, EXTERNAL :: h5pset_external_c -! MS FORTRAN needs explicit interface for C functions called here. -! INTERFACE INTEGER FUNCTION h5pset_external_c(prp_id, name,namelen, offset, bytes) USE H5GLOBAL @@ -2360,7 +2359,7 @@ CONTAINS INTEGER(HID_T), INTENT(IN) :: prp_id CHARACTER(LEN=*), INTENT(IN) :: name INTEGER :: namelen - INTEGER, INTENT(IN) :: offset + INTEGER(OFF_T), INTENT(IN) :: offset INTEGER(HSIZE_T), INTENT(IN) :: bytes END FUNCTION h5pset_external_c END INTERFACE @@ -2453,7 +2452,9 @@ CONTAINS ! HISTORY ! Explicit Fortran interfaces were added for ! called C functions (it is needed for Windows -! port). March 14, 2001 +! port). March 14, 2001 +! +! Changed type of 'offset' from integer to off_t -- MSB January 9, 2012 ! ! Fortran90 Interface: SUBROUTINE h5pget_external_f(prp_id, idx, name_size, name, offset,bytes, hdferr) @@ -2462,7 +2463,7 @@ CONTAINS INTEGER, INTENT(IN) :: idx ! External file index. INTEGER(SIZE_T), INTENT(IN) :: name_size ! Maximum length of name array CHARACTER(LEN=*), INTENT(OUT) :: name ! Name of an external file - INTEGER, INTENT(OUT) :: offset ! Offset, in bytes, from the beginning + INTEGER(OFF_T), INTENT(OUT) :: offset ! Offset, in bytes, from the beginning ! of the file to the location in the file ! where the data starts. INTEGER(HSIZE_T), INTENT(OUT) :: bytes ! Number of bytes reserved in the @@ -2485,7 +2486,7 @@ CONTAINS INTEGER, INTENT(IN) :: idx INTEGER(SIZE_T), INTENT(IN) :: name_size CHARACTER(LEN=*), INTENT(OUT) :: name - INTEGER, INTENT(OUT) :: offset + INTEGER(OFF_T), INTENT(OUT) :: offset INTEGER(HSIZE_T), INTENT(OUT) :: bytes END FUNCTION h5pget_external_c END INTERFACE diff --git a/fortran/src/H5Pff_F03.f90 b/fortran/src/H5Pff_F03.f90 index b601e69..7fb6ff9 100644 --- a/fortran/src/H5Pff_F03.f90 +++ b/fortran/src/H5Pff_F03.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5P function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Pff_F90.f90 b/fortran/src/H5Pff_F90.f90 index ebdd185..5b75643 100644 --- a/fortran/src/H5Pff_F90.f90 +++ b/fortran/src/H5Pff_F90.f90 @@ -29,7 +29,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5P function you must add the function name to the -! Windows dll file '*hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5Rff.f90 b/fortran/src/H5Rff.f90 index 89ffc10..64f1365 100644 --- a/fortran/src/H5Rff.f90 +++ b/fortran/src/H5Rff.f90 @@ -31,7 +31,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5R function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Rff_F03.f90 b/fortran/src/H5Rff_F03.f90 index 88ec8cf..7a9b080 100644 --- a/fortran/src/H5Rff_F03.f90 +++ b/fortran/src/H5Rff_F03.f90 @@ -31,7 +31,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5R function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** @@ -258,9 +258,7 @@ CONTAINS ! name - name of the object at the specified location ! Outputs: ! ref - reference to the specified object -! hdferr: - error code -! Success: 0 -! Failure: -1 +! hdferr - returns 0 if successful and -1 if fails ! AUTHOR ! Elena Pourmal ! August 12, 1999 @@ -309,9 +307,7 @@ CONTAINS ! space_id - dataspace identifier that describes selected region ! OUTPUTS ! ref - reference to the dataset region -! hdferr: - error code -! Success: 0 -! Failure: -1 +! hdferr - returns 0 if successful and -1 if fails ! AUTHOR ! Elena Pourmal ! August 12, 1999 @@ -376,9 +372,7 @@ CONTAINS ! H5T_STD_REF_DSETREG ! Outputs: ! ref - reference created by the function call. -! hdferr - error code -! Success: 0 -! Failure: -1 +! hdferr - returns 0 if successful and -1 if fails. ! OPTIONAL ! space_id - dataspace identifier that describes selected region ! @@ -425,9 +419,7 @@ CONTAINS ! ref - reference to open ! Outputs: ! obj_id - object_identifier -! hdferr: - error code -! Success: 0 -! Failure: -1 +! hdferr - returns 0 if successful and -1 if fails ! AUTHOR ! Elena Pourmal ! August 12, 1999 @@ -465,14 +457,12 @@ CONTAINS ! Opens the dataset region ! ! Inputs: -! dset_id - identifier of the dataset containing -! reference to teh regions -! ref - reference to open +! dset_id - identifier of the dataset containing +! reference to teh regions +! ref - reference to open ! Outputs: -! obj_id - dataspace identifier -! hdferr: - error code -! Success: 0 -! Failure: -1 +! obj_id - dataspace identifier +! hdferr - returns 0 if successful and -1 if fails ! ! AUTHOR ! Elena Pourmal @@ -517,9 +507,8 @@ CONTAINS ! ref - Reference to open. ! Outputs: ! ref_obj_id - identifier of referenced object -! hdferr - error code -! Success: 0 -! Failure: -1 +! hdferr - returns 0 if successful and -1 if fails +! ! AUTHOR ! M. Scot Breitenfeld ! June 20, 2008 @@ -553,37 +542,32 @@ CONTAINS ! Retrieves a name of a referenced object. ! ! Inputs: -! loc_id - Identifier for the dataset containing the reference or for the group that dataset is in. +! loc_id - Identifier for the file containing the reference or for any object in that file. ! ref - An object or dataset region reference. ! ! Outputs: ! name - A name associated with the referenced object or dataset region. -! -! hdferr: - error code -! Success: 0 -! Failure: -1 +! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: -! size - The size of the name buffer. +! size - The size of the name buffer, returning 0 (zero) if no name is associated +! with the identifier. ! ! AUTHOR ! M. Scot Breitenfeld ! March 28, 2008 ! -! Signature:S +! Signature: SUBROUTINE h5rget_name_object_f(loc_id, ref, name, hdferr, size) USE, INTRINSIC :: ISO_C_BINDING IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for the dataset containing the reference - ! or for the group that dataset is in. - TYPE(hobj_ref_t_f), INTENT(IN), TARGET :: ref ! Object reference - INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size ! The size of the name buffer, - ! returning 0 (zero) if no name is associated - ! with the identifier - CHARACTER(LEN=*), INTENT(OUT) :: name ! A name associated with the referenced object or dataset region. - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: loc_id + TYPE(hobj_ref_t_f), INTENT(IN), TARGET :: ref + INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr !***** - INTEGER(HADDR_T) :: ref_f ! Local buffer to pass reference + INTEGER(HADDR_T) :: ref_f ! Local buffer to pass reference INTEGER(SIZE_T) :: size_default INTEGER(SIZE_T) :: name_len @@ -595,7 +579,6 @@ CONTAINS hdferr = h5rget_name_ptr_c(loc_id, 0, f_ptr, name, name_len, size_default) - IF(PRESENT(size)) size = size_default END SUBROUTINE h5rget_name_object_f @@ -608,18 +591,15 @@ CONTAINS ! Retrieves a name of a dataset region. ! ! Inputs: -! loc_id - Identifier for the dataset containing the reference or -! for the group that dataset is in. +! loc_id - Identifier for the file containing the reference or for any object in that file. ! ref - An object or dataset region reference. ! ! Outputs: ! name - A name associated with the referenced object or dataset region. -! hdferr - error code -! Success: 0 -! Failure: -1 +! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: -! size - The size of the name buffer. +! size - The size of the name buffer, returning 0 (zero) if no name is associated with the identifier ! ! AUTHOR ! M. Scot Breitenfeld @@ -629,13 +609,11 @@ CONTAINS SUBROUTINE h5rget_name_region_f(loc_id, ref, name, hdferr, size) USE, INTRINSIC :: ISO_C_BINDING IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for the dataset containing the reference - ! or for the group that dataset is in. - TYPE(hdset_reg_ref_t_f), INTENT(IN), TARGET :: ref ! Object reference - INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size ! The size of the name buffer, - ! returning 0 (zero) if no name is associated with the identifier - CHARACTER(LEN=*), INTENT(OUT) :: name ! A name associated with the referenced object or dataset region. - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: loc_id + TYPE(hdset_reg_ref_t_f), INTENT(IN), TARGET :: ref + INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr !***** INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference INTEGER(SIZE_T) :: size_default @@ -661,20 +639,17 @@ CONTAINS ! Retrieves a name of a referenced object. ! ! Inputs: - ! loc_id - Identifier for the dataset containing the reference or - ! for the group that dataset is in. + ! loc_id - Identifier for the file containing the reference or for any object in that file. ! ref_type - Type of reference. ! ref - An object or dataset region reference. ! ! Outputs: ! name - A name associated with the referenced object or dataset ptr. - ! - ! hdferr - error code - ! Success: 0 - ! Failure: -1 + ! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: - ! size - The size of the name buffer. + ! size - The size of the name buffer, returning 0 (zero) if no name is associated + ! with the identifier ! ! AUTHOR ! M. Scot Breitenfeld @@ -684,15 +659,12 @@ CONTAINS SUBROUTINE h5rget_name_ptr_f(loc_id, ref_type, ref, name, hdferr, size) USE, INTRINSIC :: ISO_C_BINDING IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for the dataset containing the reference - ! or for the group that dataset is in. - INTEGER, INTENT(IN) :: ref_type ! Type of reference. - TYPE(C_PTR), INTENT(IN) :: ref ! An object or dataset region reference. - CHARACTER(LEN=*), INTENT(OUT) :: name ! A name associated with the referenced object or dataset ptr. - INTEGER, INTENT(OUT) :: hdferr ! Error code - INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size ! The size of the name buffer, - ! returning 0 (zero) if no name is associated - ! with the identifier + INTEGER(HID_T), INTENT(IN) :: loc_id + INTEGER, INTENT(IN) :: ref_type + TYPE(C_PTR), INTENT(IN) :: ref + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr + INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size !***** INTEGER(SIZE_T) :: size_default INTEGER(SIZE_T) :: name_len @@ -727,9 +699,7 @@ CONTAINS ! H5G_DATASET_F 2 ! H5G_TYPE_F 3 ! - ! hdferr - error code - ! Success: 0 - ! Failure: -1 + ! hdferr - Returns 0 if successful and -1 if fails. ! ! AUTHOR ! M. Scot Breitenfeld diff --git a/fortran/src/H5Rff_F90.f90 b/fortran/src/H5Rff_F90.f90 index 0190e57..3871d99 100644 --- a/fortran/src/H5Rff_F90.f90 +++ b/fortran/src/H5Rff_F90.f90 @@ -31,7 +31,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5R function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** @@ -386,7 +386,7 @@ CONTAINS ! Retrieves a name of a referenced object. ! ! INPUTS -! loc_id - Identifier for the dataset containing the reference or for the group that dataset is in. +! loc_id - Identifier for the file containing the reference or for any object in that file. ! ref - An object or dataset region reference. ! ! OUTPUTS @@ -397,7 +397,8 @@ CONTAINS ! Failure: -1 ! ! OPTIONAL PARAMETERS -! size - The size of the name buffer. +! size - The size of the name buffer, returning 0 (zero) if +! no name is associated with the identifier ! ! AUTHOR ! M. Scot Breitenfeld @@ -406,7 +407,8 @@ CONTAINS ! SOURCES SUBROUTINE h5rget_name_object_f(loc_id, ref, name, hdferr, size) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for the dataset containing the reference + INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for the file containing the reference or + ! for any object in that file. ! or for the group that dataset is in. TYPE(hobj_ref_t_f), INTENT(IN) :: ref ! Object reference INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size ! The size of the name buffer, @@ -453,8 +455,8 @@ CONTAINS ! Retrieves a name of a dataset region. ! ! INPUTS -! loc_id - Identifier for the dataset containing the reference or -! for the group that dataset is in. +! loc_id - Identifier for the file containing the reference or +! for any object in that file. ! ref - An object or dataset region reference. ! ! OUTPUTS @@ -464,7 +466,8 @@ CONTAINS ! Failure: -1 ! ! OPTIONAL PARAMETERS -! size - The size of the name buffer. +! size - The size of the name buffer, returning 0 (zero) if no +! name is associated with the identifier ! ! AUTHOR ! M. Scot Breitenfeld @@ -473,14 +476,11 @@ CONTAINS ! SOURCE SUBROUTINE h5rget_name_region_f(loc_id, ref, name, hdferr, size) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for the dataset containing the reference - ! or for the group that dataset is in. - TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Object reference - INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size ! The size of the name buffer, - ! returning 0 (zero) if no name is associated - ! with the identifier - CHARACTER(LEN=*), INTENT(OUT) :: name ! A name associated with the referenced object or dataset region. - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: loc_id + TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref + INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr !***** INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference INTEGER(SIZE_T) :: size_default diff --git a/fortran/src/H5Sff.f90 b/fortran/src/H5Sff.f90 index 9ef8ca8..1bae584 100644 --- a/fortran/src/H5Sff.f90 +++ b/fortran/src/H5Sff.f90 @@ -31,7 +31,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5S function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Tff.f90 b/fortran/src/H5Tff.f90 index fd857a8..89bd972 100644 --- a/fortran/src/H5Tff.f90 +++ b/fortran/src/H5Tff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5T function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Tff_F03.f90 b/fortran/src/H5Tff_F03.f90 index 902e2ac..d16553a 100644 --- a/fortran/src/H5Tff_F03.f90 +++ b/fortran/src/H5Tff_F03.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5T function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Tff_F90.f90 b/fortran/src/H5Tff_F90.f90 index 021773d..a95b31f 100644 --- a/fortran/src/H5Tff_F90.f90 +++ b/fortran/src/H5Tff_F90.f90 @@ -30,7 +30,7 @@ ! ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5Zff.f90 b/fortran/src/H5Zff.f90 index ec68286..7b67b5b 100644 --- a/fortran/src/H5Zff.f90 +++ b/fortran/src/H5Zff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5Z function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5_ff.f90 b/fortran/src/H5_ff.f90 index c51b039..f9c20ac 100644 --- a/fortran/src/H5_ff.f90 +++ b/fortran/src/H5_ff.f90 @@ -30,7 +30,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5_ff_F03.f90 b/fortran/src/H5_ff_F03.f90 index f3e7098..d418ed5 100644 --- a/fortran/src/H5_ff_F03.f90 +++ b/fortran/src/H5_ff_F03.f90 @@ -27,7 +27,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 47394a3..6b2728b 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -93,6 +93,7 @@ typedef struct H5O_info_t_f { #define nh5fget_obj_count_c H5_FC_FUNC_(h5fget_obj_count_c, H5FGET_OBJ_COUNT_C) #define nh5fget_obj_ids_c H5_FC_FUNC_(h5fget_obj_ids_c, H5FGET_OBJ_IDS_C) #define nh5fget_freespace_c H5_FC_FUNC_(h5fget_freespace_c, H5FGET_FREESPACE_C) +#define nh5fget_file_image_c H5_FC_FUNC_(h5fget_file_image_c, H5FGET_FILE_IMAGE_C) #define nh5fget_name_c H5_FC_FUNC_(h5fget_name_c, H5FGET_NAME_C) #define nh5fget_filesize_c H5_FC_FUNC_(h5fget_filesize_c, H5FGET_FILESIZE_C) @@ -108,6 +109,7 @@ H5_FCDLL int_f nh5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id); H5_FCDLL int_f nh5fget_obj_count_c (hid_t_f *file_id, int_f *obj_type, size_t_f *obj_count); H5_FCDLL int_f nh5fget_obj_ids_c (hid_t_f *file_id, int_f *obj_type, size_t_f *max_objs, hid_t_f *obj_ids, size_t_f *num_objs); H5_FCDLL int_f nh5fget_freespace_c (hid_t_f *file_id, hssize_t_f *free_space); +H5_FCDLL int_f nh5fget_file_image_c(hid_t_f *file_id, void *buf_ptr, size_t_f *buf_len, size_t_f *buf_req); H5_FCDLL int_f nh5fflush_c (hid_t_f *obj_id, int_f *scope); H5_FCDLL int_f nh5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen); H5_FCDLL int_f nh5fget_filesize_c(hid_t_f *file_id, hsize_t_f *size); @@ -1063,9 +1065,9 @@ H5_FCDLL int_f nh5pmodify_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags H5_FCDLL int_f nh5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters); H5_FCDLL int_f nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name, int_f* filter_id); H5_FCDLL int_f nh5pget_filter_by_id_c(hid_t_f *prp_id, int_f* filter_id, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name); -H5_FCDLL int_f nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, int_f* offset, hsize_t_f*bytes); +H5_FCDLL int_f nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, off_t_f* offset, hsize_t_f*bytes); H5_FCDLL int_f nh5pget_external_count_c (hid_t_f *prp_id, int_f* count); -H5_FCDLL int_f nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, int_f* offset, hsize_t_f*bytes); +H5_FCDLL int_f nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, off_t_f* offset, hsize_t_f*bytes); H5_FCDLL int_f nh5pget_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right); H5_FCDLL int_f nh5pset_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right); H5_FCDLL int_f nh5pget_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info); diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 4c83d21..eb30775 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -321,6 +321,19 @@ int main(void) return -1; #endif + /* off_t */ +#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_OFF_T >= 8 + writeToFiles("OFF_T", "off_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND); +#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_OFF_T >= 4 + writeToFiles("OFF_T", "off_t_f", 4, H5_FORTRAN_HAS_INTEGER_4_KIND); +#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_OFF_T >= 2 + writeToFiles("OFF_T", "off_t_f", 2, H5_FORTRAN_HAS_INTEGER_2_KIND); +#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_OFF_T >= 1 + writeToFiles("OFF_T", "off_t_f", 1, H5_FORTRAN_HAS_INTEGER_1_KIND); +#else + /* Error: couldn't find a size for off_t */ + return -1; +#endif /* size_t */ #if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_SIZE_T >= 8 diff --git a/fortran/src/HDF5.f90 b/fortran/src/HDF5.f90 index cb3d8bf..75af333 100644 --- a/fortran/src/HDF5.f90 +++ b/fortran/src/HDF5.f90 @@ -30,6 +30,7 @@ MODULE HDF5 USE H5GLOBAL USE H5F + USE H5F_PROVISIONAL USE H5G USE H5E USE H5E_PROVISIONAL diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index e6ef610..12c38e2 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -76,7 +76,7 @@ libhdf5_fortran_la_SOURCES=H5f90global.f90 \ H5_DBLE_Interface$(F_DBLE).f90 \ H5f90kit.c H5_f.c H5Af.c H5Df.c H5Ef.c H5Ff.c H5Gf.c \ H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c \ - H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ + H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Fff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 $(PARALLEL_COND_SRC) # HDF5 Fortran library depends on HDF5 Library. @@ -201,6 +201,7 @@ H5Dff.lo: $(srcdir)/H5Dff.f90 H5f90global.lo H5Aff$(F_STATUS).lo: $(srcdir)/H5Aff$(F_STATUS).f90 H5f90global.lo H5Dff$(F_STATUS).lo: $(srcdir)/H5Dff$(F_STATUS).f90 H5f90global.lo H5Eff$(F_STATUS).lo: $(srcdir)/H5Eff$(F_STATUS).f90 H5f90global.lo +H5Fff$(F_STATUS).lo: $(srcdir)/H5Fff$(F_STATUS).f90 H5f90global.lo H5Lff$(F_STATUS).lo: $(srcdir)/H5Lff$(F_STATUS).f90 H5f90global.lo H5Off$(F_STATUS).lo: $(srcdir)/H5Off$(F_STATUS).f90 H5f90global.lo H5Pff$(F_STATUS).lo: $(srcdir)/H5Pff$(F_STATUS).f90 H5f90global.lo @@ -217,11 +218,11 @@ H5Rff.lo: $(srcdir)/H5Rff.f90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.f90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.f90 H5f90global.lo H5Zff.lo: $(srcdir)/H5Zff.f90 H5f90global.lo -H5_DBLE_Interface$(F_DBLE).lo: $(srcdir)/H5_DBLE_Interface$(F_DBLE).f90 H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo H5Eff$(F_STATUS).lo H5Pff$(F_STATUS).lo +H5_DBLE_Interface$(F_DBLE).lo: $(srcdir)/H5_DBLE_Interface$(F_DBLE).f90 H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo H5Fff$(F_STATUS).lo H5Eff$(F_STATUS).lo H5Pff$(F_STATUS).lo HDF5.lo: $(srcdir)/HDF5.f90 H5f90global.lo H5_ff$(F_STATUS).lo H5_ff.lo H5Aff.lo H5Aff$(F_STATUS).lo \ H5Dff.lo H5Dff$(F_STATUS).lo \ H5Eff.lo H5Eff$(F_STATUS).lo \ - H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ + H5Fff.lo H5Fff$(F_STATUS).lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ H5Off.lo H5Off$(F_STATUS).lo H5Pff.lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Tff$(F_STATUS).lo H5Zff.lo \ H5_DBLE_Interface$(F_DBLE).lo @@ -230,7 +231,7 @@ HDF5mpio.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo H5_ff$(F_STATUS).lo H5Aff.lo H5Aff$(F_STATUS).lo \ H5Dff.lo H5Dff$(F_STATUS).lo \ H5Eff.lo H5Eff$(F_STATUS).lo \ - H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ + H5Fff.lo H5Fff$(F_STATUS).lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ H5Off.lo H5Off$(F_STATUS).lo H5Pff.lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Tff$(F_STATUS).lo H5Zff.lo \ H5_DBLE_Interface$(F_DBLE).lo H5FDmpioff.lo diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 9c47c1d..3ac0d6b 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -129,9 +129,10 @@ am__libhdf5_fortran_la_SOURCES_DIST = H5f90global.f90 \ H5_DBLE_Interface$(F_DBLE).f90 H5f90kit.c H5_f.c H5Af.c H5Df.c \ H5Ef.c H5Ff.c H5Gf.c H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c \ H5Tf.c H5Zf.c H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 \ - H5Eff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 H5Off$(F_STATUS).f90 \ - H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 \ - HDF5.f90 H5FDmpiof.c HDF5mpio.f90 H5FDmpioff.f90 + H5Eff$(F_STATUS).f90 H5Fff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ + H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 \ + H5Tff$(F_STATUS).f90 HDF5.f90 H5FDmpiof.c HDF5mpio.f90 \ + H5FDmpioff.f90 @BUILD_PARALLEL_CONDITIONAL_FALSE@am__objects_1 = HDF5.lo @BUILD_PARALLEL_CONDITIONAL_TRUE@am__objects_1 = H5FDmpiof.lo \ @BUILD_PARALLEL_CONDITIONAL_TRUE@ HDF5mpio.lo H5FDmpioff.lo @@ -142,9 +143,9 @@ am_libhdf5_fortran_la_OBJECTS = H5f90global.lo H5fortran_types.lo \ H5f90kit.lo H5_f.lo H5Af.lo H5Df.lo H5Ef.lo H5Ff.lo H5Gf.lo \ H5If.lo H5Lf.lo H5Of.lo H5Pf.lo H5Rf.lo H5Sf.lo H5Tf.lo \ H5Zf.lo H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo \ - H5Eff$(F_STATUS).lo H5Lff$(F_STATUS).lo H5Off$(F_STATUS).lo \ - H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Tff$(F_STATUS).lo \ - $(am__objects_1) + H5Eff$(F_STATUS).lo H5Fff$(F_STATUS).lo H5Lff$(F_STATUS).lo \ + H5Off$(F_STATUS).lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo \ + H5Tff$(F_STATUS).lo $(am__objects_1) libhdf5_fortran_la_OBJECTS = $(am_libhdf5_fortran_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -309,6 +310,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -360,7 +362,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -507,7 +508,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 132 +LT_VERS_REVISION = 139 LT_VERS_AGE = 0 # Include src directory in both Fortran and C flags (C compiler is used @@ -546,7 +547,7 @@ libhdf5_fortran_la_SOURCES = H5f90global.f90 \ H5_DBLE_Interface$(F_DBLE).f90 \ H5f90kit.c H5_f.c H5Af.c H5Df.c H5Ef.c H5Ff.c H5Gf.c \ H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c \ - H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ + H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Fff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 $(PARALLEL_COND_SRC) @@ -1091,6 +1092,7 @@ H5Dff.lo: $(srcdir)/H5Dff.f90 H5f90global.lo H5Aff$(F_STATUS).lo: $(srcdir)/H5Aff$(F_STATUS).f90 H5f90global.lo H5Dff$(F_STATUS).lo: $(srcdir)/H5Dff$(F_STATUS).f90 H5f90global.lo H5Eff$(F_STATUS).lo: $(srcdir)/H5Eff$(F_STATUS).f90 H5f90global.lo +H5Fff$(F_STATUS).lo: $(srcdir)/H5Fff$(F_STATUS).f90 H5f90global.lo H5Lff$(F_STATUS).lo: $(srcdir)/H5Lff$(F_STATUS).f90 H5f90global.lo H5Off$(F_STATUS).lo: $(srcdir)/H5Off$(F_STATUS).f90 H5f90global.lo H5Pff$(F_STATUS).lo: $(srcdir)/H5Pff$(F_STATUS).f90 H5f90global.lo @@ -1107,11 +1109,11 @@ H5Rff.lo: $(srcdir)/H5Rff.f90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.f90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.f90 H5f90global.lo H5Zff.lo: $(srcdir)/H5Zff.f90 H5f90global.lo -H5_DBLE_Interface$(F_DBLE).lo: $(srcdir)/H5_DBLE_Interface$(F_DBLE).f90 H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo H5Eff$(F_STATUS).lo H5Pff$(F_STATUS).lo +H5_DBLE_Interface$(F_DBLE).lo: $(srcdir)/H5_DBLE_Interface$(F_DBLE).f90 H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo H5Fff$(F_STATUS).lo H5Eff$(F_STATUS).lo H5Pff$(F_STATUS).lo HDF5.lo: $(srcdir)/HDF5.f90 H5f90global.lo H5_ff$(F_STATUS).lo H5_ff.lo H5Aff.lo H5Aff$(F_STATUS).lo \ H5Dff.lo H5Dff$(F_STATUS).lo \ H5Eff.lo H5Eff$(F_STATUS).lo \ - H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ + H5Fff.lo H5Fff$(F_STATUS).lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ H5Off.lo H5Off$(F_STATUS).lo H5Pff.lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Tff$(F_STATUS).lo H5Zff.lo \ H5_DBLE_Interface$(F_DBLE).lo @@ -1120,7 +1122,7 @@ HDF5mpio.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo H5_ff$(F_STATUS).lo H5Aff.lo H5Aff$(F_STATUS).lo \ H5Dff.lo H5Dff$(F_STATUS).lo \ H5Eff.lo H5Eff$(F_STATUS).lo \ - H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ + H5Fff.lo H5Fff$(F_STATUS).lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ H5Off.lo H5Off$(F_STATUS).lo H5Pff.lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Tff$(F_STATUS).lo H5Zff.lo \ H5_DBLE_Interface$(F_DBLE).lo H5FDmpioff.lo diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in index 2d7b5b4..37f7c71 100644 --- a/fortran/src/h5fc.in +++ b/fortran/src/h5fc.in @@ -80,12 +80,11 @@ FLINKERBASE="@FC@" # FFLAGS and LDFLAGS are reserved for use by the script user. # FLAGS brought from the hdf5 build are put in H5BLD_*FLAGS. -# User's FFLAGS come after their H5BLD counterparts to override -# them. User's LDFLAGS come just before clibpath, user's LIBS come after -# $link_objs and before the hdf5 libraries in $link_args, followed by any -# external library paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS -# or LIBS carried in from the hdf5 build. - +# User's FFLAGS come after their H5BLD counterparts. User's LDFLAGS come just +# before clibpath, user's LIBS come after $link_objs and before the hdf5 +# libraries in $link_args, followed by any external library paths and libraries +# from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in from the hdf5 build. +# The order of the flags is intended to give precedence to the user's flags. H5BLD_FFLAGS="@AM_FCFLAGS@ @FCFLAGS@" F9XMODFLAG="@F9XMODFLAG@" F9XSUFFIXFLAG="@F9XSUFFIXFLAG@" @@ -98,7 +97,16 @@ FFLAGS="${HDF5_FFLAGS:-$FFLAGSBASE}" LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}" LIBS="${HDF5_LIBS:-$LIBSBASE}" -USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" +# If a static library is available, the default will be to use it. If the only +# available library is shared, it will be used by default. The user can +# override either default, although choosing an unavailable library will result +# in link errors. +STATIC_AVAILABLE="@enable_static@" +if test "${STATIC_AVAILABLE}" = "yes"; then + USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" +else + USE_SHARED_LIB="${HDF5_USE_SHLIB:-yes}" +fi usage() { # A wonderfully informative "usage" message. @@ -233,8 +241,13 @@ for arg in $@ ; do *) allargs="$allargs $arg" if [ -s "$arg" ] ; then ext=`expr "$arg" : '.*\(\..*\)'` - if [ "$ext" = ".f" -o "$ext" = ".F" -o "$ext" = ".f90" -o \ - "$ext" = ".for" -o "$ext" = ".FOR" -o "$ext" = ".F90" ] ; then + if [ "$ext" = ".f" -o "$ext" = ".F" -o \ + "$ext" = ".for" -o "$ext" = ".FOR" -o \ + "$ext" = ".ftn" -o "$ext" = ".FTN" -o \ + "$ext" = ".f90" -o "$ext" = ".F90" -o \ + "$ext" = ".f95" -o "$ext" = ".F95" -o \ + "$ext" = ".f03" -o "$ext" = ".F03" -o \ + "$ext" = ".f08" -o "$ext" = ".F08" ] ; then do_compile="yes" compile_args="$compile_args $arg" fname=`basename $arg $ext` @@ -303,6 +316,20 @@ if test "x$do_link" = "xyes"; then if test -n "$flag"; then shared_link="${flag}${libdir}" + # Any libraries in LDFLAGS or H5BLD_LDFLAGS also should have rpaths embedded + # in the executables created by h5cc (reduces need for LD_LIBRARY_PATH). + if test -n "$LDFLAGS"; then + for entry in $LDFLAGS; do + extdir=`echo $entry | sed '/^-L/ s/^-L//'` + shared_link="${shared_link} ${flag}${extdir}" + done + fi + if test -n "$H5BLD_LDFLAGS"; then + for entry in $H5BLD_LDFLAGS; do + extdir=`echo $entry | sed '/^-L/ s/^-L//'` + shared_link="${shared_link} ${flag}${extdir}" + done + fi fi if test "x$USE_SHARED_LIB" != "xyes"; then @@ -344,11 +371,11 @@ if test "x$do_link" = "xyes"; then # module. It's okay if they're included twice in the compile line. link_args="$link_args $H5BLD_LDFLAGS $H5BLD_LIBS" - # User's FFLAGS come after their H5BLD counterparts to override - # them. User's LDFLAGS come just before clibpath, user's LIBS come after - # $link_objs and before the hdf5 libraries in $link_args, followed by any - # external library paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS - # or LIBS carried in from the hdf5 build. + # User's FFLAGS come after their H5BLD counterparts. User's LDFLAGS come just + # before clibpath, user's LIBS come after $link_objs and before the hdf5 + # libraries in $link_args, followed by any external library paths and libraries + # from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in from the hdf5 build. + # The order of the flags is intended to give precedence to the user's flags. $SHOW $FLINKER $FFLAGS $H5BLD_FFLAGS $F9XSUFFIXFLAG $LDFLAGS $fmodules $link_objs $LIBS $link_args $shared_link status=$? fi diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index bf7596d..4ce185b 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -228,6 +228,7 @@ H5F_mp_H5FGET_ACCESS_PLIST_F H5F_mp_H5FIS_HDF5_F
H5F_mp_H5FGET_NAME_F
H5F_mp_H5FGET_FILESIZE_F
+@H5_NOF03EXP@H5F_PROVISIONAL_mp_H5FGET_FILE_IMAGE_F
; H5G
H5G_mp_H5GOPEN_F
H5G_mp_H5GCREATE_F
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 5b41a32..5b9ca11 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -105,6 +105,7 @@ IF (HDF5_ENABLE_F2003) fortranlib_test_F03.f90 tH5F.f90 tH5E_F03.f90 + tH5F_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index 42dd127..84f55e5 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -68,7 +68,7 @@ fortranlib_test_1_8_SOURCES = fortranlib_test_1_8.f90 \ if FORTRAN_2003_CONDITIONAL_F fortranlib_test_F03_SOURCES = fortranlib_test_F03.f90 \ - tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 + tH5F.f90 tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 endif diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index 9b3fc44..d14fec7 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -136,11 +136,12 @@ fortranlib_test_1_8_LDADD = $(LDADD) fortranlib_test_1_8_DEPENDENCIES = libh5test_fortran.la $(LIBH5TEST) \ $(LIBH5F) $(LIBHDF5) am__fortranlib_test_F03_SOURCES_DIST = fortranlib_test_F03.f90 \ - tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 \ - tH5T_F03.f90 + tH5F.f90 tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 tH5O_F03.f90 \ + tH5P_F03.f90 tH5T_F03.f90 @FORTRAN_2003_CONDITIONAL_F_TRUE@am_fortranlib_test_F03_OBJECTS = fortranlib_test_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5E_F03.$(OBJEXT) \ +@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5L_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5O_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5P_F03.$(OBJEXT) \ @@ -294,6 +295,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -345,7 +347,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ @@ -517,7 +518,7 @@ fortranlib_test_1_8_SOURCES = fortranlib_test_1_8.f90 \ tH5F.f90 tH5O.f90 tH5A_1_8.f90 tH5G_1_8.f90 @FORTRAN_2003_CONDITIONAL_F_TRUE@fortranlib_test_F03_SOURCES = fortranlib_test_F03.f90 \ -@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 +@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.f90 tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 fflush1_SOURCES = fflush1.f90 fflush2_SOURCES = fflush2.f90 diff --git a/fortran/test/fortranlib_test_F03.f90 b/fortran/test/fortranlib_test_F03.f90 index a03241c..1d9615f 100644 --- a/fortran/test/fortranlib_test_F03.f90 +++ b/fortran/test/fortranlib_test_F03.f90 @@ -82,6 +82,10 @@ PROGRAM fortranlibtest_F03 CALL write_test_status(ret_total_error, ' Testing writing/reading enum dataset, using C_LOC', total_error) ret_total_error = 0 + CALL t_enum_conv(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing enumeration conversions', total_error) + + ret_total_error = 0 CALL t_bit(ret_total_error) CALL write_test_status(ret_total_error, ' Testing writing/reading bitfield dataset, using C_LOC', total_error) @@ -141,7 +145,10 @@ PROGRAM fortranlibtest_F03 CALL test_nbit(ret_total_error) CALL write_test_status(ret_total_error, ' Testing nbit filter', total_error) - + ret_total_error = 0 + CALL external_test_offset(cleanup, ret_total_error) + CALL write_test_status(ret_total_error, ' Testing external dataset with offset', total_error) + ! write(*,*) ! write(*,*) '=========================================' ! write(*,*) 'Testing GROUP interface ' @@ -159,6 +166,11 @@ PROGRAM fortranlibtest_F03 CALL obj_info(ret_total_error) CALL write_test_status(ret_total_error, ' Testing object info functions ', total_error) + ret_total_error = 0 + CALL test_get_file_image(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing get file image ', total_error) + + WRITE(*,*) WRITE(*,*) ' ============================================ ' diff --git a/fortran/test/tH5F_F03.f90 b/fortran/test/tH5F_F03.f90 new file mode 100644 index 0000000..dea9a5d --- /dev/null +++ b/fortran/test/tH5F_F03.f90 @@ -0,0 +1,175 @@ +!****h* root/fortran/test/tH5F_F03.f90 +! +! NAME +! tH5F_F03.f90 +! +! FUNCTION +! Test FORTRAN HDF5 H5F APIs which are dependent on FORTRAN 2003 +! features. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! NOTES +! Tests the H5F APIs functionalities of: +! h5fget_file_image_f +! +! CONTAINS SUBROUTINES +! test_get_file_image +! +!***** + +! ***************************************** +! *** H 5 F T E S T S +! ***************************************** + +SUBROUTINE test_get_file_image(total_error) + ! + ! Tests the wrapper for h5fget_file_image + ! + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error ! returns error + + CHARACTER(kind=c_char), ALLOCATABLE, DIMENSION(:), TARGET :: file_image_ptr ! Image from file + CHARACTER(kind=c_char), ALLOCATABLE, DIMENSION(:), TARGET :: image_ptr ! Image from h5fget_file_image_f + + INTEGER, DIMENSION(1:100), TARGET :: data ! Write data + INTEGER :: i, file_sz + INTEGER(hid_t) :: file_id = -1 ! File identifier + INTEGER(hid_t) :: dset_id = -1 ! Dataset identifier + INTEGER(hid_t) :: space_id = -1 ! Dataspace identifier + INTEGER(hsize_t), DIMENSION(1:2) :: dims ! Dataset dimensions + INTEGER(size_t) :: itmp_a, itmp_b ! General purpose integers + INTEGER(size_t) :: image_size ! Size of image + TYPE(C_PTR) :: f_ptr ! Pointer + INTEGER(hid_t) :: fapl ! File access property + INTEGER :: error ! Error flag + + + RETURN ! DEBUG, PGI COMPILERS seem to have a bug in the INQUIRE functions, + ! waiting for an answer from PGI how to resolve the problem. + + ! Create new properties for file access + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) + CALL check("h5pcreate_f", error, total_error) + + ! Set standard I/O driver + CALL h5pset_fapl_stdio_f(fapl, error) + CALL check("h5pset_fapl_stdio_f", error, total_error) + + ! Create the file + CALL h5fcreate_f("tget_file_image.h5", H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl) + CALL check("h5fcreate_f", error, total_error) + + ! Set up data space for new data set + dims(1:2) = (/10,10/) + + CALL h5screate_simple_f(2, dims, space_id, error) + CALL check("h5screate_simple_f", error, total_error) + + ! Create a dataset + CALL h5dcreate_f(file_id, "dset 0", H5T_NATIVE_INTEGER, space_id, dset_id, error) + CALL check("h5dcreate_f", error, total_error) + + ! Write some data to the data set + DO i = 1, 100 + data(i) = i + ENDDO + + f_ptr = C_LOC(data(1)) + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, f_ptr, error) + CALL check("h5dwrite_f",error, total_error) + + ! Flush the file + CALL h5fflush_f(file_id, H5F_SCOPE_GLOBAL_F, error) + CALL check("h5fflush_f",error, total_error) + + ! Open the test file using standard I/O calls + OPEN(UNIT=10,FILE='tget_file_image.h5', ACCESS='STREAM') + ! Get the size of the test file + ! + ! Since we use the eoa to calculate the image size, the file size + ! may be larger. This is OK, as long as (in this specialized instance) + ! the remainder of the file is all '\0's. + ! + ! With latest mods to truncate call in core file drive, + ! file size should match image size; get the file size + INQUIRE(UNIT=10, SIZE=file_sz) + CLOSE(UNIT=10) + + ! I. Get buffer size needed to hold the buffer + + ! A. Preferred way to get the size + f_ptr = C_NULL_PTR + CALL h5fget_file_image_f(file_id, f_ptr, INT(0, size_t), error, image_size) + CALL check("h5fget_file_image_f",error, total_error) + CALL verify("h5fget_file_image_f", file_sz, INT(image_size), total_error) + + ! B. f_ptr set to point to an incorrect buffer, should pass anyway + f_ptr = C_LOC(data(1)) + itmp_a = 1 + CALL h5fget_file_image_f(file_id, f_ptr, itmp_a, error, image_size) + CALL check("h5fget_file_image_f",error, total_error) + CALL VERIFY("h5fget_file_image_f", INT(itmp_a), 1, total_error) ! Routine should not change the value + CALL VERIFY("h5fget_file_image_f", file_sz, INT(image_size), total_error) + + ! Allocate a buffer of the appropriate size + ALLOCATE(image_ptr(1:image_size)) + + ! Load the image of the file into the buffer + f_ptr = C_LOC(image_ptr(1)(1:1)) + CALL h5fget_file_image_f(file_id, f_ptr, image_size, error) + CALL check("h5fget_file_image_f",error, total_error) + + ! Close dset and space + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5sclose_f(space_id, error) + CALL check("h5sclose_f", error, total_error) + ! Close the test file + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f",error, total_error) + + ! Allocate a buffer for the test file image + ALLOCATE(file_image_ptr(1:image_size)) + + ! Open the test file using standard I/O calls + OPEN(UNIT=10,FILE='tget_file_image.h5', ACCESS='STREAM') + + ! Read the test file from disk into the buffer + DO i = 1, image_size + READ(10) file_image_ptr(i) + ENDDO + + CLOSE(10) + + ! verify the file and the image contain the same data + DO i = 1, image_size + ! convert one byte to an unsigned integer + IF( ICHAR(file_image_ptr(i)) .NE. ICHAR(image_ptr(i)))THEN + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + + ! release resources + DEALLOCATE(file_image_ptr,image_ptr) + +END SUBROUTINE test_get_file_image diff --git a/fortran/test/tH5P.f90 b/fortran/test/tH5P.f90 index 3faaac2..4c78334 100644 --- a/fortran/test/tH5P.f90 +++ b/fortran/test/tH5P.f90 @@ -27,385 +27,376 @@ ! !***** - SUBROUTINE external_test(cleanup, total_error) +SUBROUTINE external_test(cleanup, total_error) ! This subroutine tests following functionalities: ! h5pset_external_f, h5pget_external_count_f, ! h5pget_external_f - USE HDF5 ! This module contains all necessary modules - - IMPLICIT NONE - LOGICAL, INTENT(IN) :: cleanup - INTEGER, INTENT(OUT) :: total_error - - CHARACTER(LEN=8), PARAMETER :: filename = "external" - CHARACTER(LEN=80) :: fix_filename - INTEGER(HID_T) :: file_id - INTEGER(HID_T) :: plist_id - INTEGER(HID_T) :: space_id - INTEGER(HID_T) :: dataset_id - INTEGER(HSIZE_T), DIMENSION(1) :: cur_size !data space current size - INTEGER(HSIZE_T), DIMENSION(1) :: max_size !data space maximum size - CHARACTER(LEN=256) :: name !external file name - INTEGER :: file_offset !external file offset - INTEGER(HSIZE_T) :: file_size !sizeof external file segment - INTEGER :: error !error code - INTEGER(SIZE_T) :: int_size !size of integer - INTEGER(HSIZE_T) :: file_bytes !Number of bytes reserved - !in the file for the data - INTEGER :: RANK = 1 !dataset rank - INTEGER :: count !number of external files for the - !specified dataset - INTEGER(SIZE_T) :: namesize - INTEGER(HSIZE_T) :: size, buf_size - INTEGER :: idx - - buf_size = 4*1024*1024 - - ! - !Create file "external.h5" using default properties. - ! - CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) - if (error .ne. 0) then - write(*,*) "Cannot modify filename" - stop - endif - CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) - CALL check("h5fcreate_f",error,total_error) - - - CALL h5pcreate_f(H5P_DATASET_XFER_F, plist_id, error) - CALL check("h5pcreate_f", error, total_error) - CALL h5pset_buffer_f(plist_id, buf_size, error) - CALL check("h5pset_buffer_f", error, total_error) - CALL h5pget_buffer_f(plist_id, size, error) - CALL check("h5pget_buffer_f", error, total_error) - if (size .ne.buf_size) then - total_error = total_error + 1 - write(*,*) "h5pget_buffer_f returned wrong size, error" - endif - CALL h5pclose_f(plist_id, error) - CALL check("h5pclose_f", error, total_error) - - CALL h5pcreate_f(H5P_DATASET_CREATE_F, plist_id, error) - CALL check("h5pcreate_f",error,total_error) - cur_size(1) =100 - max_size(1) = 100; - call h5tget_size_f(H5T_NATIVE_INTEGER, int_size, error) - CALL check("h5tget_size_f",error,total_error) - file_size = int_size * max_size(1); - CALL h5pset_external_f(plist_id, "ext1.data", 0, file_size, error) - CALL check("h5pset_external_f",error,total_error) - CALL h5screate_simple_f(RANK, cur_size, space_id, error, max_size) - CALL check("h5screate_simple_f", error, total_error) - CALL h5dcreate_f(file_id, "dset1", H5T_NATIVE_INTEGER, space_id, & - dataset_id, error, plist_id) - CALL check("h5dcreate_f", error, total_error) - - CALL h5dclose_f(dataset_id, error) - CALL check("h5dclose_f", error, total_error) - CALL h5pclose_f(plist_id, error) - CALL check("h5pclose_f", error, total_error) - CALL h5sclose_f(space_id, error) - CALL check("h5sclose_f", error, total_error) - CALL h5fclose_f(file_id, error) - - CALL h5fopen_f(fix_filename, H5F_ACC_RDWR_F, file_id, error) - CALL h5dopen_f(file_id, "dset1", dataset_id, error) - CALL check("h5dopen_f",error,total_error) - - ! Read dataset creation information - CALL h5dget_create_plist_f(dataset_id, plist_id, error) - CALL check("h5dget_create_plist_f",error,total_error) - CALL h5pget_external_count_f(plist_id, count, error) - CALL check("h5pget_external_count_f",error,total_error) - if(count .ne. 1 ) then - write (*,*) "got external_count is not correct" - total_error = total_error + 1 - end if - namesize = 10 - idx = 0 - CALL h5pget_external_f(plist_id, idx, namesize, name, file_offset, & - file_bytes, error) - CALL check("h5pget_external_f",error,total_error) - if(file_offset .ne. 0 ) then - write (*,*) "got external file offset is not correct" - total_error = total_error + 1 - end if - if(file_bytes .ne. file_size ) then - write (*,*) "got external file size is not correct" - total_error = total_error + 1 - end if - - CALL h5dclose_f(dataset_id, error) - CALL check("h5dclose_f", error, total_error) - CALL h5pclose_f(plist_id, error) - CALL check("h5pclose_f", error, total_error) - CALL h5fclose_f(file_id, error) - CALL check("h5fclose_f", error, total_error) - - - if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=8), PARAMETER :: filename = "external" + CHARACTER(LEN=80) :: fix_filename + INTEGER(HID_T) :: file_id + INTEGER(HID_T) :: plist_id + INTEGER(HID_T) :: space_id + INTEGER(HID_T) :: dataset_id + INTEGER(HSIZE_T), DIMENSION(1) :: cur_size !data space current size + INTEGER(HSIZE_T), DIMENSION(1) :: max_size !data space maximum size + CHARACTER(LEN=256) :: name !external file name + INTEGER(OFF_T) :: file_offset !external file offset + INTEGER(HSIZE_T) :: file_size !sizeof external file segment + INTEGER :: error !error code + INTEGER(SIZE_T) :: int_size !size of integer + INTEGER(HSIZE_T) :: file_bytes !Number of bytes reserved + !in the file for the data + INTEGER :: RANK = 1 !dataset rank + INTEGER :: count !number of external files for the + !specified dataset + INTEGER(SIZE_T) :: namesize + INTEGER(HSIZE_T) :: size, buf_size + INTEGER :: idx + + buf_size = 4*1024*1024 + + ! + !Create file "external.h5" using default properties. + ! + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + IF (error .NE. 0) THEN + STOP "Cannot modify filename" + ENDIF + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error) + CALL check("h5fcreate_f",error,total_error) + + CALL h5pcreate_f(H5P_DATASET_XFER_F, plist_id, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_buffer_f(plist_id, buf_size, error) + CALL check("h5pset_buffer_f", error, total_error) + CALL h5pget_buffer_f(plist_id, size, error) + CALL check("h5pget_buffer_f", error, total_error) + IF (size .NE.buf_size) THEN + total_error = total_error + 1 + WRITE(*,*) "h5pget_buffer_f returned wrong size, error" + ENDIF + CALL h5pclose_f(plist_id, error) + CALL check("h5pclose_f", error, total_error) + + CALL h5pcreate_f(H5P_DATASET_CREATE_F, plist_id, error) + CALL check("h5pcreate_f",error,total_error) + cur_size(1) =100 + max_size(1) = 100 + CALL h5tget_size_f(H5T_NATIVE_INTEGER, int_size, error) + CALL check("h5tget_size_f",error,total_error) + file_size = int_size * max_size(1) + CALL h5pset_external_f(plist_id, "ext1.data", INT(0,off_t), file_size, error) + CALL check("h5pset_external_f",error,total_error) + CALL h5screate_simple_f(RANK, cur_size, space_id, error, max_size) + CALL check("h5screate_simple_f", error, total_error) + CALL h5dcreate_f(file_id, "dset1", H5T_NATIVE_INTEGER, space_id, & + dataset_id, error, plist_id) + CALL check("h5dcreate_f", error, total_error) + + CALL h5dclose_f(dataset_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5pclose_f(plist_id, error) + CALL check("h5pclose_f", error, total_error) + CALL h5sclose_f(space_id, error) + CALL check("h5sclose_f", error, total_error) + CALL h5fclose_f(file_id, error) + + CALL h5fopen_f(fix_filename, H5F_ACC_RDWR_F, file_id, error) + CALL h5dopen_f(file_id, "dset1", dataset_id, error) + CALL check("h5dopen_f",error,total_error) + + ! Read dataset creation information + CALL h5dget_create_plist_f(dataset_id, plist_id, error) + CALL check("h5dget_create_plist_f",error,total_error) + CALL h5pget_external_count_f(plist_id, count, error) + CALL check("h5pget_external_count_f",error,total_error) + IF(count .NE. 1 ) THEN + WRITE (*,*) "got external_count is not correct" + total_error = total_error + 1 + END IF + namesize = 10 + idx = 0 + CALL h5pget_external_f(plist_id, idx, namesize, name, file_offset, & + file_bytes, error) + CALL check("h5pget_external_f",error,total_error) + IF(file_offset .NE. 0 ) THEN + WRITE (*,*) "got external file offset is not correct" + total_error = total_error + 1 + END IF + IF(file_bytes .NE. file_size ) THEN + WRITE (*,*) "got external file size is not correct" + total_error = total_error + 1 + END IF + + CALL h5dclose_f(dataset_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5pclose_f(plist_id, error) + CALL check("h5pclose_f", error, total_error) + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + + IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + RETURN +END SUBROUTINE external_test + +SUBROUTINE multi_file_test(cleanup, total_error) + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + LOGICAL, INTENT(IN) :: cleanup + INTEGER, INTENT(OUT) :: total_error + + CHARACTER(LEN=9), PARAMETER :: filename = "multidset" ! File name + CHARACTER(LEN=80) :: fix_filename + CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dspace_id ! Dataspace identifier + INTEGER(HID_T) :: dtype_id ! Datatype identifier + INTEGER(HID_T) :: fapl, fapl_1 ! File access property list identifier + INTEGER, DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_map, memb_map_out + INTEGER(HID_T), DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_fapl, memb_fapl_out + CHARACTER(LEN=20), DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_name, memb_name_out + REAL, DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_addr, memb_addr_out + !INTEGER(HADDR_T), DIMENSION(0:H5FD_MEM_NTYPES_F) :: memb_addr + LOGICAL :: relax = .TRUE. + LOGICAL :: relax_out = .TRUE. + + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions + INTEGER :: rank = 2 ! Dataset rank + + INTEGER, DIMENSION(4,6) :: dset_data, data_out ! Data buffers + INTEGER :: error ! Error flag + INTEGER(HID_T) :: driver + INTEGER :: i, j !general purpose integers + INTEGER(HSIZE_T), DIMENSION(2) :: data_dims + INTEGER :: mdc_nelmts + INTEGER(SIZE_T) :: rdcc_nelmts + INTEGER(SIZE_T) :: rdcc_nbytes + REAL :: rdcc_w0 + memb_fapl = H5P_DEFAULT_F + memb_map = H5FD_MEM_SUPER_F + memb_addr = 0. + memb_map(H5FD_MEM_SUPER_F) = H5FD_MEM_SUPER_F + memb_addr(H5FD_MEM_SUPER_F) = 0. + memb_map(H5FD_MEM_BTREE_F) = H5FD_MEM_BTREE_F + memb_addr(H5FD_MEM_BTREE_F) = 0.1 + memb_map(H5FD_MEM_DRAW_F) = H5FD_MEM_DRAW_F + memb_addr(H5FD_MEM_DRAW_F) = 0.5 + memb_map(H5FD_MEM_GHEAP_F) = H5FD_MEM_GHEAP_F + memb_addr(H5FD_MEM_GHEAP_F) = 0.2 + memb_map(H5FD_MEM_LHEAP_F) = H5FD_MEM_LHEAP_F + memb_addr(H5FD_MEM_LHEAP_F) = 0.3 + memb_map(H5FD_MEM_OHDR_F) = H5FD_MEM_OHDR_F + memb_addr(H5FD_MEM_OHDR_F) = 0.4 + + memb_name = ' ' + memb_name(H5FD_MEM_SUPER_F) = '%s-s.h5' + memb_name(H5FD_MEM_BTREE_F) = '%s-b.h5' + memb_name(H5FD_MEM_DRAW_F) = '%s-r.h5' + memb_name(H5FD_MEM_GHEAP_F) = '%s-g.h5' + memb_name(H5FD_MEM_LHEAP_F) = '%s-l.h5' + memb_name(H5FD_MEM_OHDR_F) = '%s-o.h5' + + ! + ! Initialize the dset_data array. + ! + DO i = 1, 4 + DO j = 1, 6 + dset_data(i,j) = (i-1)*6 + j + END DO + END DO + + ! + ! Create a new file using default properties. + ! + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + IF (error .NE. 0) THEN + WRITE(*,*) "Cannot modify filename" + STOP + ENDIF + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_fapl_multi_f(fapl, memb_map, memb_fapl, memb_name, memb_addr, relax, error) + CALL check("h5pset_fapl_multi_f", error, total_error) + CALL h5pget_fapl_multi_f(fapl, memb_map_out, memb_fapl_out, memb_name_out, & + memb_addr_out, relax_out, error) + CALL check("h5pget_fapl_multi_f", error, total_error) + CALL h5pget_driver_f(fapl, driver, error) + CALL check("h5pget_driver_f",error, total_error) + IF(driver .NE. H5FD_MULTI_F) THEN + WRITE(*,*) "Wrong value for driver" + ENDIF + ! + ! Let's check h5pget(set)cache_f APIs here for now + ! + CALL h5pget_cache_f(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, & + rdcc_w0, error) + CALL check("h5pget_cache_f", error, total_error) + + ! + ! Set cache to some number + ! + rdcc_nbytes = 1024*1024 + CALL h5pset_cache_f(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, & + rdcc_w0, error) + CALL check("h5pset_cache_f", error, total_error) + CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = fapl) + CALL check("h5fcreate_f", error, total_error) + IF(error .NE. 0) THEN + WRITE(*,*) "Cannot create file using multi-file driver... Exiting...." + total_error = 1 + CALL h5pclose_f(fapl, error) RETURN - END SUBROUTINE external_test - - SUBROUTINE multi_file_test(cleanup, total_error) - USE HDF5 ! This module contains all necessary modules - - IMPLICIT NONE - LOGICAL, INTENT(IN) :: cleanup - INTEGER, INTENT(OUT) :: total_error - - CHARACTER(LEN=9), PARAMETER :: filename = "multidset" ! File name - CHARACTER(LEN=80) :: fix_filename - CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name - - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dset_id ! Dataset identifier - INTEGER(HID_T) :: dspace_id ! Dataspace identifier - INTEGER(HID_T) :: dtype_id ! Datatype identifier - INTEGER(HID_T) :: fapl, fapl_1 ! File access property list identifier - INTEGER, DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_map, memb_map_out - INTEGER(HID_T), DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_fapl, memb_fapl_out - CHARACTER(LEN=20), DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_name, memb_name_out - REAL, DIMENSION(0:H5FD_MEM_NTYPES_F-1) :: memb_addr, memb_addr_out - !INTEGER(HADDR_T), DIMENSION(0:H5FD_MEM_NTYPES_F) :: memb_addr - LOGICAL :: relax = .TRUE. - LOGICAL :: relax_out = .TRUE. - - INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions - INTEGER :: rank = 2 ! Dataset rank - - INTEGER, DIMENSION(4,6) :: dset_data, data_out ! Data buffers - INTEGER :: error ! Error flag - INTEGER(HID_T) :: driver - INTEGER :: i, j !general purpose integers - INTEGER(HSIZE_T), DIMENSION(2) :: data_dims - INTEGER :: mdc_nelmts - INTEGER(SIZE_T) :: rdcc_nelmts - INTEGER(SIZE_T) :: rdcc_nbytes - REAL :: rdcc_w0 - memb_fapl = H5P_DEFAULT_F - memb_map = H5FD_MEM_SUPER_F - memb_addr = 0. - memb_map(H5FD_MEM_SUPER_F) = H5FD_MEM_SUPER_F - memb_addr(H5FD_MEM_SUPER_F) = 0. - memb_map(H5FD_MEM_BTREE_F) = H5FD_MEM_BTREE_F - memb_addr(H5FD_MEM_BTREE_F) = 0.1 - memb_map(H5FD_MEM_DRAW_F) = H5FD_MEM_DRAW_F - memb_addr(H5FD_MEM_DRAW_F) = 0.5 - memb_map(H5FD_MEM_GHEAP_F) = H5FD_MEM_GHEAP_F - memb_addr(H5FD_MEM_GHEAP_F) = 0.2 - memb_map(H5FD_MEM_LHEAP_F) = H5FD_MEM_LHEAP_F - memb_addr(H5FD_MEM_LHEAP_F) = 0.3 - memb_map(H5FD_MEM_OHDR_F) = H5FD_MEM_OHDR_F - memb_addr(H5FD_MEM_OHDR_F) = 0.4 - - memb_name = ' ' - memb_name(H5FD_MEM_SUPER_F) = '%s-s.h5' - memb_name(H5FD_MEM_BTREE_F) = '%s-b.h5' - memb_name(H5FD_MEM_DRAW_F) = '%s-r.h5' - memb_name(H5FD_MEM_GHEAP_F) = '%s-g.h5' - memb_name(H5FD_MEM_LHEAP_F) = '%s-l.h5' - memb_name(H5FD_MEM_OHDR_F) = '%s-o.h5' - - ! - ! Initialize the dset_data array. - ! - do i = 1, 4 - do j = 1, 6 - dset_data(i,j) = (i-1)*6 + j; - end do - end do - - ! - ! Create a new file using default properties. - ! - CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) - if (error .ne. 0) then - write(*,*) "Cannot modify filename" - stop - endif - CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) - CALL check("h5pcreate_f", error, total_error) - CALL h5pset_fapl_multi_f(fapl, memb_map, memb_fapl, memb_name, memb_addr, relax, error) - CALL check("h5pset_fapl_multi_f", error, total_error) - CALL h5pget_fapl_multi_f(fapl, memb_map_out, memb_fapl_out, memb_name_out, & - memb_addr_out, relax_out, error) - CALL check("h5pget_fapl_multi_f", error, total_error) - CALL h5pget_driver_f(fapl, driver, error) - CALL check("h5pget_driver_f",error, total_error) - if(driver .ne. H5FD_MULTI_F) then - write(*,*) "Wrong value for driver" - endif - ! - ! Let's check h5pget(set)cache_f APIs here for now - ! - CALL h5pget_cache_f(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, & - rdcc_w0, error) - CALL check("h5pget_cache_f", error, total_error) - - - ! Set cache to some number - ! - rdcc_nbytes = 1024*1024 - CALL h5pset_cache_f(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, & - rdcc_w0, error) - CALL check("h5pset_cache_f", error, total_error) - CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = fapl) - CALL check("h5fcreate_f", error, total_error) - if(error .ne. 0) then - write(*,*) "Cannot create file using multi-file driver... Exiting...." - total_error = 1 - call h5pclose_f(fapl, error) - return - endif - - ! - ! Create the dataspace. - ! - CALL h5screate_simple_f(rank, dims, dspace_id, error) - CALL check("h5screate_simple_f", error, total_error) - - - ! - ! Create the dataset with default properties. - ! - CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, & - dset_id, error) - CALL check("h5dcreate_f", error, total_error) - - ! - ! Write the dataset. - ! - data_dims(1) = 4 - data_dims(2) = 6 - CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, data_dims, error) - CALL check("h5dwrite_f", error, total_error) - - - ! - ! End access to the dataset and release resources used by it. - ! - CALL h5dclose_f(dset_id, error) - CALL check("h5dclose_f", error, total_error) - - ! - ! Terminate access to the data space. - ! - CALL h5sclose_f(dspace_id, error) - CALL check("h5sclose_f", error, total_error) - - ! - ! Close the file. - ! - CALL h5fclose_f(file_id, error) - CALL check("h5fclose_f", error, total_error) - CALL h5pclose_f(fapl, error) - CALL check("h5pclose_f", error, total_error) - ! - ! Open the existing file. - ! - CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) - CALL check("h5pcreate_f", error, total_error) - CALL h5pset_fapl_multi_f(fapl, relax, error) - CALL check("h5pset_fapl_multi_f", error, total_error) - CALL h5fopen_f (fix_filename, H5F_ACC_RDWR_F, file_id, error, access_prp = fapl) - CALL check("h5fopen_f", error, total_error) - ! - CALL h5fget_access_plist_f(file_id, fapl_1, error) - CALL check("h5fget_access_plist_f", error, total_error) - !It doesn't work on Windows. - !CALL h5pget_fapl_multi_f(fapl_1, memb_map_out, memb_fapl_out, memb_name_out, & - ! memb_addr_out, relax_out, error) - ! write(*,*) memb_map_out - ! write(*,*) memb_fapl_out - ! write(*,*) memb_name_out - ! write(*,*) memb_addr_out - ! CALL check("h5pget_fapl_multi_f", error, total_error) - - ! - ! Open the existing dataset. - ! - CALL h5dopen_f(file_id, dsetname, dset_id, error) - CALL check("h5dopen_f", error, total_error) - - ! - ! Get the dataset type. - ! - CALL h5dget_type_f(dset_id, dtype_id, error) - CALL check("h5dget_type_f", error, total_error) - - ! - ! Get the data space. - ! - CALL h5dget_space_f(dset_id, dspace_id, error) - CALL check("h5dget_space_f", error, total_error) - - ! - ! Read the dataset. - ! - CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error) - CALL check("h5dread_f", error, total_error) - - ! - !Compare the data. - ! - do i = 1, 4 - do j = 1, 6 - IF (data_out(i,j) .NE. dset_data(i, j)) THEN - write(*, *) "dataset test error occured" - write(*,*) "data read is not the same as the data writen" - END IF - end do - end do - - ! - ! End access to the dataset and release resources used by it. - ! - CALL h5dclose_f(dset_id, error) - CALL check("h5dclose_f", error, total_error) - - ! - ! Terminate access to the data space. - ! - CALL h5sclose_f(dspace_id, error) - CALL check("h5sclose_f", error, total_error) - - ! - ! Terminate access to the data type. - ! - CALL h5tclose_f(dtype_id, error) - CALL check("h5tclose_f", error, total_error) - ! - ! Close the file. - ! - CALL h5fclose_f(file_id, error) - CALL check("h5fclose_f", error, total_error) - CALL h5pclose_f(fapl, error) - CALL check("h5pclose_f", error, total_error) - CALL h5pclose_f(fapl_1, error) - CALL check("h5pclose_f", error, total_error) - IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - - IF(cleanup) CALL h5_cleanup_f(filename//'.h5-b', H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - IF(cleanup) CALL h5_cleanup_f(filename//'.h5-g', H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - IF(cleanup) CALL h5_cleanup_f(filename//'.h5-l', H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - IF(cleanup) CALL h5_cleanup_f(filename//'.h5-o', H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - IF(cleanup) CALL h5_cleanup_f(filename//'.h5-r', H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - IF(cleanup) CALL h5_cleanup_f(filename//'.h5-s', H5P_DEFAULT_F, error) - CALL check("h5_cleanup_f", error, total_error) - - RETURN - END SUBROUTINE multi_file_test + ENDIF + ! + ! Create the dataspace. + ! + CALL h5screate_simple_f(rank, dims, dspace_id, error) + CALL check("h5screate_simple_f", error, total_error) + ! + ! Create the dataset with default properties. + ! + CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, & + dset_id, error) + CALL check("h5dcreate_f", error, total_error) + ! + ! Write the dataset. + ! + data_dims(1) = 4 + data_dims(2) = 6 + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, data_dims, error) + CALL check("h5dwrite_f", error, total_error) + ! + ! End access to the dataset and release resources used by it. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + ! Terminate access to the data space. + ! + CALL h5sclose_f(dspace_id, error) + CALL check("h5sclose_f", error, total_error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + CALL h5pclose_f(fapl, error) + CALL check("h5pclose_f", error, total_error) + ! + ! Open the existing file. + ! + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_fapl_multi_f(fapl, relax, error) + CALL check("h5pset_fapl_multi_f", error, total_error) + CALL h5fopen_f (fix_filename, H5F_ACC_RDWR_F, file_id, error, access_prp = fapl) + CALL check("h5fopen_f", error, total_error) + ! + CALL h5fget_access_plist_f(file_id, fapl_1, error) + CALL check("h5fget_access_plist_f", error, total_error) + !It doesn't work on Windows. + !CALL h5pget_fapl_multi_f(fapl_1, memb_map_out, memb_fapl_out, memb_name_out, & + ! memb_addr_out, relax_out, error) + ! write(*,*) memb_map_out + ! write(*,*) memb_fapl_out + ! write(*,*) memb_name_out + ! write(*,*) memb_addr_out + ! CALL check("h5pget_fapl_multi_f", error, total_error) + + ! + ! Open the existing dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + CALL check("h5dopen_f", error, total_error) + + ! + ! Get the dataset type. + ! + CALL h5dget_type_f(dset_id, dtype_id, error) + CALL check("h5dget_type_f", error, total_error) + + ! + ! Get the data space. + ! + CALL h5dget_space_f(dset_id, dspace_id, error) + CALL check("h5dget_space_f", error, total_error) + + ! + ! Read the dataset. + ! + CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error) + CALL check("h5dread_f", error, total_error) + + ! + !Compare the data. + ! + DO i = 1, 4 + DO j = 1, 6 + IF (data_out(i,j) .NE. dset_data(i, j)) THEN + WRITE(*, *) "dataset test error occured" + WRITE(*,*) "data read is not the same as the data writen" + END IF + END DO + END DO + + ! + ! End access to the dataset and release resources used by it. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + + ! + ! Terminate access to the data space. + ! + CALL h5sclose_f(dspace_id, error) + CALL check("h5sclose_f", error, total_error) + + ! + ! Terminate access to the data type. + ! + CALL h5tclose_f(dtype_id, error) + CALL check("h5tclose_f", error, total_error) + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f", error, total_error) + CALL h5pclose_f(fapl, error) + CALL check("h5pclose_f", error, total_error) + CALL h5pclose_f(fapl_1, error) + CALL check("h5pclose_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + + IF(cleanup) CALL h5_cleanup_f(filename//'.h5-b', H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename//'.h5-g', H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename//'.h5-l', H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename//'.h5-o', H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename//'.h5-r', H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + IF(cleanup) CALL h5_cleanup_f(filename//'.h5-s', H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + + RETURN +END SUBROUTINE multi_file_test !------------------------------------------------------------------------- ! Function: test_chunk_cache @@ -432,24 +423,24 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) IMPLICIT NONE LOGICAL, INTENT(IN) :: cleanup INTEGER, INTENT(OUT) :: total_error - + CHARACTER(LEN=14), PARAMETER :: filename="chunk_cache" CHARACTER(LEN=80) :: fix_filename - INTEGER(hid_t) :: fid = -1 ! /* File ID */ + INTEGER(hid_t) :: fid = -1 ! File ID INTEGER(hid_t) :: file - INTEGER(hid_t) :: fapl_local = -1 ! /* Local fapl */ - INTEGER(hid_t) :: fapl_def = -1 ! /* Default fapl */ - INTEGER(hid_t) :: dcpl = -1 !/* Dataset creation property list ID */ - INTEGER(hid_t) :: dapl1 = -1 !/* Dataset access property list ID */ - INTEGER(hid_t) :: dapl2 = -1 !/* Dataset access property list ID */ - INTEGER(hid_t) :: sid = -1 !/* Dataspace ID */ - INTEGER(hid_t) :: dsid = -1 !/* Dataset ID */ - INTEGER(hsize_t), DIMENSION(1:1) :: chunk_dim, NDIM = (/100/) !/* Dataset and chunk dimensions */ - INTEGER(size_t) :: nslots_1, nslots_2, nslots_3, nslots_4 !/* rdcc number of elements */ - INTEGER(size_t) :: nbytes_1, nbytes_2, nbytes_3, nbytes_4 !/* rdcc number of bytes */ + INTEGER(hid_t) :: fapl_local = -1 ! Local fapl + INTEGER(hid_t) :: fapl_def = -1 ! Default fapl + INTEGER(hid_t) :: dcpl = -1 ! Dataset creation property list ID + INTEGER(hid_t) :: dapl1 = -1 ! Dataset access property list ID + INTEGER(hid_t) :: dapl2 = -1 ! Dataset access property list ID + INTEGER(hid_t) :: sid = -1 ! Dataspace ID + INTEGER(hid_t) :: dsid = -1 ! Dataset ID + INTEGER(hsize_t), DIMENSION(1:1) :: chunk_dim, NDIM = (/100/) ! Dataset and chunk dimensions + INTEGER(size_t) :: nslots_1, nslots_2, nslots_3, nslots_4 ! rdcc number of elements + INTEGER(size_t) :: nbytes_1, nbytes_2, nbytes_3, nbytes_4 ! rdcc number of bytes INTEGER :: mdc_nelmts - INTEGER(size_t) ::nlinks !/* Number of link traversals */ - REAL :: w0_1, w0_2, w0_3, w0_4; !/* rdcc preemption policy */ + INTEGER(size_t) ::nlinks ! Number of link traversals + REAL :: w0_1, w0_2, w0_3, w0_4 ! rdcc preemption policy INTEGER :: error INTEGER(size_t) rdcc_nelmts INTEGER(size_t) rdcc_nbytes @@ -462,7 +453,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) STOP ENDIF - !/* Create a default fapl and dapl */ + ! Create a default fapl and dapl CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl_def, error) CALL check("H5Pcreate_f", error, total_error) CALL H5Pcreate_f(H5P_DATASET_ACCESS_F, dapl1, error) @@ -481,7 +472,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL VERIFYlogical("H5Pget_chunk_cache_f", .TRUE., .FALSE., total_error) ENDIF - ! /* Set a lapl property on dapl1 (to verify inheritance) */ + ! Set a lapl property on dapl1 (to verify inheritance) CALL H5Pset_nlinks_f(dapl1, 134_size_t , error) CALL check("H5Pset_nlinks_f", error, total_error) CALL H5Pget_nlinks_f(dapl1, nlinks, error) @@ -494,7 +485,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) ! Turn off the chunk cache, so all the chunks are immediately written to disk CALL H5Pget_cache_f(fapl_local, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0, error) CALL check("H5Pget_cache_f", error, total_error) - rdcc_nbytes = 0; + rdcc_nbytes = 0 CALL H5Pset_cache_f(fapl_local, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0, error) CALL check("H5Pset_cache_f", error, total_error) @@ -506,29 +497,29 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL H5Pset_cache_f(fapl_local, 0, nslots_2, nbytes_2, w0_2, error) CALL check("H5Pset_cache_f", error, total_error) - !/* Create file */ + ! Create file CALL H5Fcreate_f(fix_filename, H5F_ACC_TRUNC_F, fid, error, H5P_DEFAULT_F, fapl_local) CALL check("H5Fcreate_f", error, total_error) - !/* Create dataset creation property list */ + ! Create dataset creation property list CALL H5Pcreate_f(H5P_DATASET_CREATE_F, dcpl, error) CALL check("H5Pcreate_f", error, total_error) - !/* Set chunking */ - chunk_dim(1) = 10; + ! Set chunking + chunk_dim(1) = 10 CALL H5Pset_chunk_f(dcpl, 1, chunk_dim, error) CALL check("H5Pset_chunk_f", error, total_error) - !/* Create 1-D dataspace */ + ! Create 1-D dataspace ndim(1) = 100 CALL H5Screate_simple_f(1, ndim, sid, error) CALL check("H5Pcreate_f", error, total_error) - ! /* Create dataset with default dapl */ + ! Create dataset with default dapl CALL H5Dcreate_f(fid, "dset", H5T_NATIVE_INTEGER, sid, dsid, error, dcpl, H5P_DEFAULT_F, dapl1) CALL check("H5Pcreate_f", error, total_error) - ! /* Retrieve dapl from dataset, verify cache values are the same as on fapl_local */ + ! Retrieve dapl from dataset, verify cache values are the same as on fapl_local CALL H5Dget_access_plist_f(dsid, dapl2, error) CALL check("H5Dget_access_plist_f", error, total_error) CALL H5Pget_chunk_cache_f(dapl2, nslots_4, nbytes_4, w0_4, error) @@ -538,7 +529,8 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) IF(w0_2.NE.w0_4)THEN CALL VERIFYlogical("H5Pget_chunk_cache_f", .TRUE., .FALSE., total_error) ENDIF - CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl2,error) + CALL check("H5Pclose_f", error, total_error) ! Set new values on dapl1. nbytes will be set to default, so the file ! property will override this setting @@ -550,7 +542,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL H5Pset_chunk_cache_f(dapl1, nslots_3, nbytes_3, w0_3, error) CALL check("H5Pset_chunk_cache_f", error, total_error) - ! Close dataset, reopen with dapl1. Note the use of a dapl with H5Oopen */ + ! Close dataset, reopen with dapl1. Note the use of a dapl with H5Oopen CALL H5Dclose_f(dsid, error) CALL H5Oopen_f(fid, "dset", dsid, error, dapl1) @@ -569,10 +561,12 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) IF(w0_3.NE.w0_4)THEN CALL VERIFYlogical("H5Pget_chunk_cache_f4", .TRUE., .FALSE., total_error) ENDIF - CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl2,error) + CALL check("H5Pclose_f", error, total_error) ! Close dataset, reopen with H5P_DEFAULT as dapl - CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) + CALL H5Dclose_f(dsid, error) + CALL check("H5Dclose_f", error, total_error) CALL H5Oopen_f(fid, "dset", dsid, error) CALL check("H5Oopen_f", error, total_error) @@ -587,10 +581,12 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) IF(w0_2.NE.w0_4)THEN CALL VERIFYlogical("H5Pget_chunk_cache_f", .TRUE., .FALSE., total_error) ENDIF - CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl2,error) + CALL check("H5Pclose_f", error, total_error) ! Similary, test use of H5Dcreate2 with H5P_DEFAULT - CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) + CALL H5Dclose_f(dsid, error) + CALL check("H5Dclose_f", error, total_error) CALL H5Dcreate_f(fid, "dset2", H5T_NATIVE_INTEGER, sid, dsid, error, dcpl, H5P_DEFAULT_F, H5P_DEFAULT_F) CALL check("H5Pcreate_f", error, total_error) @@ -615,8 +611,10 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) ! Close and reopen file with new fapl_local - CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) - CALL H5Fclose_f(fid,error); CALL check("h5fclose_f", error, total_error) + CALL H5Dclose_f(dsid, error) + CALL check("H5Dclose_f", error, total_error) + CALL H5Fclose_f(fid,error) + CALL check("h5fclose_f", error, total_error) CALL H5Fopen_f (fix_filename, H5F_ACC_RDWR_F, fid, error, fapl_local) CALL check("h5fopen_f", error, total_error) @@ -628,7 +626,8 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL h5dopen_f (fid, "dset", dsid, error, dapl2) CALL check("h5dopen_f", error, total_error) - CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) ! Close dapl2, to avoid id leak + CALL H5Pclose_f(dapl2,error) + CALL check("H5Pclose_f", error, total_error) ! Close dapl2, to avoid id leak CALL H5Dget_access_plist_f(dsid, dapl2, error) CALL check("H5Dget_access_plist_f", error, total_error) @@ -647,11 +646,13 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL H5Pset_chunk_cache_f(dapl2, nslots_2, nbytes_2, w0_2, error) CALL check("H5Pset_chunk_cache_f", error, total_error) - CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) + CALL H5Dclose_f(dsid, error) + CALL check("H5Dclose_f", error, total_error) CALL h5dopen_f (fid, "dset", dsid, error, dapl2) CALL check("h5dopen_f", error, total_error) - CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl2,error) + CALL check("H5Pclose_f", error, total_error) CALL H5Dget_access_plist_f(dsid, dapl2, error) CALL check("H5Dget_access_plist_f", error, total_error) @@ -665,17 +666,24 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) ! Close - CALL H5Dclose_f(dsid, error); CALL check("H5Dclose_f", error, total_error) - CALL H5Sclose_f(sid,error); CALL check("H5Sclose_f", error, total_error) - CALL H5Pclose_f(fapl_local,error); CALL check("H5Pclose_f", error, total_error) - CALL H5Pclose_f(fapl_def,error); CALL check("H5Pclose_f", error, total_error) - CALL H5Pclose_f(dapl1,error); CALL check("H5Pclose_f", error, total_error) - CALL H5Pclose_f(dapl2,error); CALL check("H5Pclose_f", error, total_error) - CALL H5Pclose_f(dcpl,error); CALL check("H5Pclose_f", error, total_error) - CALL H5Fclose_f(fid,error); CALL check("H5Fclose_f", error, total_error) + CALL H5Dclose_f(dsid, error) + CALL check("H5Dclose_f", error, total_error) + CALL H5Sclose_f(sid,error) + CALL check("H5Sclose_f", error, total_error) + CALL H5Pclose_f(fapl_local,error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(fapl_def,error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl1,error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dapl2,error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Pclose_f(dcpl,error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Fclose_f(fid,error) + CALL check("H5Fclose_f", error, total_error) IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) CALL check("h5_cleanup_f", error, total_error) END SUBROUTINE test_chunk_cache - diff --git a/fortran/test/tH5P_F03.f90 b/fortran/test/tH5P_F03.f90 index aec8a26..02ca9dc 100644 --- a/fortran/test/tH5P_F03.f90 +++ b/fortran/test/tH5P_F03.f90 @@ -362,3 +362,144 @@ SUBROUTINE test_genprop_class_callback(total_error) CALL check("h5pclose_class_f", error, total_error) END SUBROUTINE test_genprop_class_callback + +!------------------------------------------------------------------------- +! Function: external_test_offset +! +! Purpose: Tests APIs: +! h5pset_external_f (with offsets not equal to zero), h5pget_external_f +! +! Return: Success: 0 +! Failure: -1 +! +! FORTRAN Programmer: M. Scot Breitenfeld +! January 10, 2012 +!------------------------------------------------------------------------- +! +SUBROUTINE external_test_offset(cleanup,total_error) + + USE ISO_C_BINDING + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + INTEGER, INTENT(OUT) :: total_error + LOGICAL, INTENT(IN) :: cleanup + + INTEGER(hid_t) :: fapl=-1 ! file access property list + INTEGER(hid_t) :: file=-1 ! file to write to + INTEGER(hid_t) :: dcpl=-1 ! dataset creation properties + INTEGER(hid_t) :: space=-1 ! data space + INTEGER(hid_t) :: dset=-1 ! dataset + INTEGER(hid_t) :: grp=-1 ! group to emit diagnostics + INTEGER(size_t) :: i, j ! miscellaneous counters + CHARACTER(LEN=180) :: filename ! file names + INTEGER, DIMENSION(1:25) :: part ! raw data buffers + INTEGER, DIMENSION(1:100), TARGET :: whole ! raw data buffers + INTEGER(hsize_t), DIMENSION(1:1) :: cur_size ! current data space size + INTEGER(hid_t) :: hs_space ! hyperslab data space + INTEGER(hsize_t), DIMENSION(1:1) :: hs_start = (/30/) ! hyperslab starting offset + INTEGER(hsize_t), DIMENSION(1:1) :: hs_count = (/25/) ! hyperslab size + CHARACTER(LEN=1) :: ichr1 ! character conversion holder + INTEGER :: error ! error status + TYPE(C_PTR) :: f_ptr ! fortran pointer + + CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:30) :: temparray + + temparray(1:30)(1:1) = '0' ! 1 byte character + + ! Write the data to external files directly + DO i = 1, 4 + DO j = 1, 25 + part(j) = (i-1)*25+(j-1) + ENDDO + WRITE(ichr1,'(I1.1)') i + filename = "extern_"//ichr1//"a.raw" + OPEN(10, FILE=filename, ACCESS='STREAM', form='UNFORMATTED') + + WRITE(10) temparray(1:(i-1)*10) + WRITE(10) part + CLOSE(10) + ENDDO + ! + ! Create the file and an initial group. + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) + CALL h5fcreate_f('extren_raw.h5', H5F_ACC_TRUNC_F, file, error, access_prp=fapl) + CALL check("h5fcreate_f",error,total_error) + + CALL h5gcreate_f(file, "emit-diagnostics", grp, error) + CALL check("h5gcreate_f",error, total_error) + + ! Create the dataset + CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_external_f(dcpl, "extern_1a.raw", INT(0,off_t), INT(SIZEOF(part), hsize_t), error) + CALL check("h5pset_external_f",error,total_error) + CALL h5pset_external_f(dcpl, "extern_2a.raw", INT(10,off_t), INT(SIZEOF(part), hsize_t), error) + CALL check("h5pset_external_f",error,total_error) + CALL h5pset_external_f(dcpl, "extern_3a.raw", INT(20,off_t), INT(SIZEOF(part), hsize_t), error) + CALL check("h5pset_external_f",error,total_error) + CALL h5pset_external_f(dcpl, "extern_4a.raw", INT(30,off_t), INT(SIZEOF(part), hsize_t), error) + CALL check("h5pset_external_f",error,total_error) + + cur_size(1) = 100 + CALL h5screate_simple_f(1, cur_size, space, error) + CALL check("h5screate_simple_f", error, total_error) + CALL h5dcreate_f(file, "dset1", H5T_NATIVE_INTEGER, space, dset,error,dcpl_id=dcpl) + CALL check("h5dcreate_f", error, total_error) + + ! + ! Read the entire dataset and compare with the original + whole(:) = 0 + f_ptr = C_LOC(whole(1)) + CALL h5dread_f(dset, H5T_NATIVE_INTEGER, f_ptr, error, mem_space_id=space, file_space_id=space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, 100 + IF(whole(i) .NE. i-1)THEN + WRITE(*,*) "Incorrect value(s) read." + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + ! + ! Read the middle of the dataset + CALL h5scopy_f(space, hs_space, error) + CALL check("h5scopy_f", error, total_error) + CALL h5sselect_hyperslab_f(hs_space, H5S_SELECT_SET_F, hs_start, hs_count, error) + CALL check("h5sselect_hyperslab_f", error, total_error) + + whole(:) = 0 + f_ptr = C_LOC(whole(1)) + CALL h5dread_f(dset, H5T_NATIVE_INTEGER, f_ptr, error, mem_space_id=hs_space, file_space_id=hs_space) + CALL check("h5dread_f", error, total_error) + + CALL h5sclose_f(hs_space, error) + CALL check("h5sclose_f", error, total_error) + DO i = hs_start(1)+1, hs_start(1)+hs_count(1) + IF(whole(i) .NE. i-1)THEN + WRITE(*,*) "Incorrect value(s) read." + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + CALL h5pclose_f(dcpl, error) + CALL check("h5pclose_f", error, total_error) + CALL h5sclose_f(space, error) + CALL check("h5sclose_f", error, total_error) + CALL h5fclose_f(file, error) + CALL check("h5fclose_f", error, total_error) + + ! cleanup + DO i = 1, 4 + WRITE(ichr1,'(I1.1)') i + filename = "extern_"//ichr1//"a.raw" + CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + ENDDO + IF(cleanup) CALL h5_cleanup_f("extren_raw.h5", H5P_DEFAULT_F, error) + CALL check("h5_cleanup_f", error, total_error) + +END SUBROUTINE external_test_offset diff --git a/fortran/test/tH5T_F03.f90 b/fortran/test/tH5T_F03.f90 index 1c4da8b..f7efcc4 100644 --- a/fortran/test/tH5T_F03.f90 +++ b/fortran/test/tH5T_F03.f90 @@ -405,7 +405,7 @@ END SUBROUTINE test_array_compound_atomic CALL check("h5tarray_create_f", error, total_error) ! Insert character array field - CALL h5tinsert_f(tid2, "c", H5OFFSETOF(C_LOC(wdata(1,1)),C_LOC(wdata(1,1)%c(1))), tid4, error) + CALL h5tinsert_f(tid2, "c", H5OFFSETOF(C_LOC(wdata(1,1)),C_LOC(wdata(1,1)%c(1)(1:1))), tid4, error) CALL check("h5tinsert2_f", error, total_error) ! Close array of floats field datatype @@ -551,7 +551,7 @@ END SUBROUTINE test_array_compound_atomic CALL H5Tget_member_offset_f(tid2, 2, off, error) CALL check("H5Tget_member_offset_f", error, total_error) CALL VERIFY("H5Tget_member_offset_f",INT(off),& - INT(H5OFFSETOF(C_LOC(wdata(1,1)),C_LOC(wdata(1,1)%c(1)))), total_error) + INT(H5OFFSETOF(C_LOC(wdata(1,1)),C_LOC(wdata(1,1)%c(1)(1:1)))), total_error) ! Check the 3rd field's datatype CALL H5Tget_member_type_f(tid2, 2, mtid2, error) @@ -1028,8 +1028,8 @@ END SUBROUTINE test_array_compound_atomic INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(Fortran_INTEGER_4) !should map to INTEGER*4 on most modern processors INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(Fortran_INTEGER_8) !should map to INTEGER*8 on most modern processors - INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors - INTEGER, PARAMETER :: real_kind_15 = SELECTED_REAL_KIND(Fortran_REAL_8) !should map to REAL*8 on most modern processors + INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors + INTEGER, PARAMETER :: real_kind_15 = SELECTED_REAL_KIND(Fortran_REAL_8) !should map to REAL*8 on most modern processors CHARACTER(LEN=12), PARAMETER :: filename = "dsetf_F03.h5" ! File name CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name @@ -1710,7 +1710,7 @@ SUBROUTINE t_opaque(total_error) ! CALL h5dcreate_f(file, dataset, dtype, space, dset, error) CALL check("h5dcreate_f",error, total_error) - f_ptr = C_LOC(wdata(1)) + f_ptr = C_LOC(wdata(1)(1:1)) CALL h5dwrite_f(dset, dtype, f_ptr, error) CALL check("h5dwrite_f",error, total_error) ! @@ -1774,7 +1774,7 @@ SUBROUTINE t_opaque(total_error) ! ! Read the data. ! - f_ptr = C_LOC(rdata(1)) + f_ptr = C_LOC(rdata(1)(1:1)) CALL h5dread_f(dset, dtype, f_ptr, error) CALL check("H5Dread_f",error, total_error) ! @@ -2123,7 +2123,7 @@ SUBROUTINE t_regref(total_error) CALL h5screate_simple_f(1, dims3, memspace, error) CALL check("h5screate_simple_f",error, total_error) - f_ptr = C_LOC(rdata2(1)) + f_ptr = C_LOC(rdata2(1)(1:1)) CALL h5dread_f( dset2, H5T_NATIVE_INTEGER_1, f_ptr, error, memspace, space) CALL check("H5Dread_f",error, total_error) CALL verifystring("h5dread_f",rdata2(1)(1:npoints),TRIM(chrref_correct(i)), total_error) @@ -2473,24 +2473,24 @@ SUBROUTINE t_vlstring_readwrite(total_error) ! Initialize array of C pointers - wdata(1) = C_LOC(A(1)) - wdata(2) = C_LOC(B(1)) - wdata(3) = C_LOC(C(1)) - wdata(4) = C_LOC(D(1)) + wdata(1) = C_LOC(A(1)(1:1)) + wdata(2) = C_LOC(B(1)(1:1)) + wdata(3) = C_LOC(C(1)(1:1)) + wdata(4) = C_LOC(D(1)(1:1)) data_w(1) = A(1) data_w(2) = B(1) data_w(3) = C(1) data_w(4) = D(1) - wdata2D(1,1) = C_LOC(A11(1)) - wdata2D(1,2) = C_LOC(A12(1)) - wdata2D(1,3) = C_LOC(A13(1)) - wdata2D(1,4) = C_LOC(A14(1)) - wdata2D(2,1) = C_LOC(A21(1)) - wdata2D(2,2) = C_LOC(A22(1)) - wdata2D(2,3) = C_LOC(A23(1)) - wdata2D(2,4) = C_LOC(A24(1)) + wdata2D(1,1) = C_LOC(A11(1)(1:1)) + wdata2D(1,2) = C_LOC(A12(1)(1:1)) + wdata2D(1,3) = C_LOC(A13(1)(1:1)) + wdata2D(1,4) = C_LOC(A14(1)(1:1)) + wdata2D(2,1) = C_LOC(A21(1)(1:1)) + wdata2D(2,2) = C_LOC(A22(1)(1:1)) + wdata2D(2,3) = C_LOC(A23(1)(1:1)) + wdata2D(2,4) = C_LOC(A24(1)(1:1)) data2D_w(1,1) = A11(1) data2D_w(1,2) = A12(1) @@ -3092,3 +3092,350 @@ SUBROUTINE test_nbit(cleanup, total_error ) END SUBROUTINE test_nbit +SUBROUTINE t_enum_conv(total_error) + +!------------------------------------------------------------------------- +! Subroutine: t_enum_conv +! +! Purpose: Tests converting data from enumeration datatype +! to numeric (integer or floating-point number) +! datatype. Tests various KINDs of INTEGERs +! and REALs. Checks reading enum data into +! INTEGER and REAL KINDs. +! +! Return: Success: 0 +! Failure: number of errors +! +! Programmer: M. Scot Breitenfeld +! October 27, 2012 +! +! Note: Adapted from C test (enum.c -- test_conv) +! No reliance on C tests. +!------------------------------------------------------------------------- +! + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(Fortran_INTEGER_4) !should map to INTEGER*4 on most modern processors + INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(Fortran_INTEGER_8)!should map to INTEGER*8 on most modern processors + + INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors + + INTEGER(hid_t) :: cwg=-1, dtype=-1, space=-1, dset=-1, memtype ! Handles + INTEGER(hid_t) :: file ! Handles + + ! Enumerated type + ENUM, BIND(C) + ENUMERATOR :: E1_RED, E1_GREEN, E1_BLUE, E1_WHITE, E1_BLACK + END ENUM + + INTEGER :: val + + ! Enumerated data array + ! Some values are out of range for testing. The library should accept them + INTEGER(KIND(E1_RED)), DIMENSION(1:20), TARGET :: data1 = (/E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,& + E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED,& + E1_RED, E1_BLUE, E1_GREEN, E1_BLACK, E1_WHITE,& + E1_RED, E1_WHITE, INT(0,KIND(E1_RED)), INT(-1,KIND(E1_RED)), INT(-2,KIND(E1_RED))/) + + ! Reading array for enum data + INTEGER(KIND(E1_RED)), DIMENSION(1:20), TARGET :: data2 + + ! Reading array's for converted enum data + INTEGER(C_SHORT), DIMENSION(1:20), TARGET :: data_short + INTEGER(C_INT), DIMENSION(1:20), TARGET :: data_int + REAL(C_DOUBLE), DIMENSION(1:20), TARGET :: data_double + + INTEGER(int_kind_8), DIMENSION(1:20), TARGET :: data_i8 + INTEGER(int_kind_16), DIMENSION(1:20), TARGET :: data_i16 + REAL(real_kind_7), DIMENSION(1:20), TARGET :: data_r7 + + INTEGER(hsize_t), DIMENSION(1:1) :: ds_size = (/20/) + INTEGER(size_t) :: i + INTEGER :: error + TYPE(C_PTR) :: f_ptr + INTEGER(HID_T) :: m_baset ! Memory base type + ! + ! Create a new file using the default properties. + ! + CALL h5fcreate_f("enum1.h5", H5F_ACC_TRUNC_F, file, error) + CALL check("h5fcreate_f", error, total_error) + ! + ! Create a new group using the default properties. + ! + CALL h5gcreate_f(file, "test_conv", cwg, error) + CALL check("h5gcreate_f",error, total_error) + ! + ! Create a enum type + ! + CALL H5Tcreate_f(H5T_ENUM_F, H5OFFSETOF(C_LOC(data1(1)), C_LOC(data1(2))), dtype, error) + CALL check("h5tcreate_f",error, total_error) + ! + ! Initialize enum data. + ! + val = E1_RED + CALL H5Tenum_insert_f(dtype, "RED", val, error) + CALL check("h5tenum_insert_f",error, total_error) + val = E1_GREEN + CALL H5Tenum_insert_f(dtype, "GREEN", val, error) + CALL check("h5tenum_insert_f",error, total_error) + val = E1_BLUE + CALL H5Tenum_insert_f(dtype, "BLUE", val, error) + CALL check("h5tenum_insert_f",error, total_error) + val = E1_WHITE + CALL H5Tenum_insert_f(dtype, "WHITE", val, error) + CALL check("h5tenum_insert_f",error, total_error) + val = E1_BLACK + CALL H5Tenum_insert_f(dtype, "BLACK", val, error) + CALL check("h5tenum_insert_f",error, total_error) + ! + ! Create dataspace. Setting maximum size to be the current size. + ! + CALL h5screate_simple_f(1, ds_size, space, error) + CALL check("h5screate_simple_f", error, total_error) + + ! *************************************** + ! * Dataset of enumeration type + ! *************************************** + ! + ! Create a dataset of enum type and write enum data to it + + CALL h5dcreate_f(cwg, "color_table1", dtype, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check(" h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + + f_ptr = C_LOC(data2(1)) + CALL h5dread_f(dset, dtype, f_ptr, error, space, space) + CALL check(" h5dread_f", error, total_error) + + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. data2(i))THEN + total_error = total_error + 1 + WRITE(*,'(" 1. data1(",I0,")=",I0," .NE. data2(",I0,")=",I0)') i, data1(i),i,data2(i) + EXIT + ENDIF + ENDDO + + ! Test converting the data to integer (KIND=C_SHORT). Read enum data back as integer + m_baset = h5kind_to_type(KIND(data_short(1)), H5_INTEGER_KIND) ! Memory base type + f_ptr = C_LOC(data_short(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. data_short(i))THEN + total_error = total_error + 1 + WRITE(*,'(" 2. data1(",I0,")=",I0," .NE. data_short(",I0,")=",I0)') i, data1(i),i,data_short(i) + EXIT + ENDIF + ENDDO + + ! Test converting the data to (KIND=C_double) number. + ! Read enum data back as (KIND=C_double) number + + m_baset = h5kind_to_type(KIND(data_double(1)), H5_REAL_KIND) ! Memory base type + f_ptr = C_LOC(data_double(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_double(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 3. data_double(",I0,")=",I0," .NE. data_double(",I0,")=",I0)') & + i, INT(data1(i)), i, INT(data_double(i)) + EXIT + ENDIF + ENDDO + + ! Test converting the data to (SELECTED_INT_KIND(Fortran_INTEGER_4)) number. + ! Read enum data back as (SELECTED_INT_KIND(Fortran_INTEGER_4)) number + + m_baset = h5kind_to_type(int_kind_8, H5_INTEGER_KIND) ! Memory base type + f_ptr = C_LOC(data_i8(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_i8(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 4. data_i8(",I0,")=",I0," .NE. data_i8(",I0,")=",I0)') & + i, INT(data1(i)), i, INT(data_i8(i)) + EXIT + ENDIF + ENDDO + + ! Test converting the data to (SELECTED_INT_KIND(Fortran_INTEGER_8)) number. + ! Read enum data back as (SELECTED_INT_KIND(Fortran_INTEGER_8)) number + + m_baset = h5kind_to_type(int_kind_16, H5_INTEGER_KIND) ! Memory base type + f_ptr = C_LOC(data_i16(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_i16(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 5. data_i16(",I0,")=",I0," .NE. data_i16(",I0,")=",I0)') & + i, INT(data1(i)), i, INT(data_i16(i)) + EXIT + ENDIF + ENDDO + + ! Test converting the data to SELECTED_REAL_KIND(Fortran_REAL_4) number. + ! Read enum data back as SELECTED_REAL_KIND(Fortran_REAL_4) number + + m_baset = h5kind_to_type(KIND(data_r7(1)), H5_REAL_KIND) ! Memory base type + f_ptr = C_LOC(data_r7(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_r7(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 6. data_r7(",I0,")=",I0," .NE. data_r7(",I0,")=",I0)') & + i, INT(data1(i)), i, INT(data_r7(i)) + EXIT + ENDIF + ENDDO + + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + ! *************************************** + ! * Dataset of C_int type + ! *************************************** + + ! Create a integer dataset of KIND=C_INT and write enum data to it + m_baset = h5kind_to_type(KIND(data_int(1)), H5_INTEGER_KIND) ! Memory base type + CALL h5dcreate_f(cwg, "color_table2", m_baset, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + ! Write the enum data + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check("h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + f_ptr = C_LOC(data_int(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, ds_size(1) + IF(data1(i) .NE. data_int(i))THEN + total_error = total_error + 1 + WRITE(*,'(" 7. data1(",I0,")=",I0," .NE. data_int(",I0,")=",I0)') i, data1(i),i,data_int(i) + EXIT + ENDIF + ENDDO + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + !************************************** + !* Dataset of C_double type + !************************************** + + ! Create a dataset of KIND=C_DOUBLE and write enum data to it + m_baset = h5kind_to_type(KIND(data_double(1)), H5_REAL_KIND) ! Memory base type + CALL h5dcreate_f(cwg, "color_table3", m_baset, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check("h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + f_ptr = C_LOC(data_double(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_double(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 8. data1(",I0,")=",I0," .NE. data_double(",I0,")=",I0)') i, data1(i),i,INT(data_double(i)) + EXIT + ENDIF + ENDDO + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + !********************************************************* + !* Dataset of real SELECTED_REAL_KIND(Fortran_REAL_4) type + !********************************************************* + + ! Create a dataset of SELECTED_REAL_KIND(Fortran_REAL_4) and write enum data to it + m_baset = h5kind_to_type(KIND(data_r7(1)), H5_REAL_KIND) ! Memory base type + CALL h5dcreate_f(cwg, "color_table4", m_baset, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check("h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + f_ptr = C_LOC(data_r7(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_r7(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 9. data1(",I0,")=",I0," .NE. data_r7(",I0,")=",I0)') i, data1(i),i,INT(data_r7(i)) + EXIT + ENDIF + ENDDO + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + ! ***************************************************************** + ! * Dataset of integer SELECTED_INT_KIND(Fortran_INTEGER_8) type + ! ***************************************************************** + + ! Create a integer dataset of (SELECTED_INT_KIND(Fortran_INTEGER_8)) and write enum data to it + m_baset = h5kind_to_type(KIND(data_i16(1)), H5_INTEGER_KIND) ! Memory base type + CALL h5dcreate_f(cwg, "color_table5", m_baset, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + ! Write the enum data + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check("h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + f_ptr = C_LOC(data_i16(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, ds_size(1) + IF(data1(i) .NE. data_i16(i))THEN + total_error = total_error + 1 + WRITE(*,'(" 10. data1(",I0,")=",I0," .NE. data_i16(",I0,")=",I0)') i, data1(i),i,data_i16(i) + EXIT + ENDIF + ENDDO + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + ! + ! Close and release resources. + ! + CALL h5sclose_f(space, error) + CALL check("H5Sclose_f", error, total_error) + CALL h5tclose_f(dtype, error) + CALL check("H5Tclose_f", error, total_error) + CALL h5gclose_f(cwg, error) + CALL check("h5gclose_f",error, total_error) + CALL h5fclose_f(file, error) + CALL check("H5Fclose_f", error, total_error) + +END SUBROUTINE t_enum_conv + diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in index 3fc3dd9..f279182 100644 --- a/fortran/testpar/Makefile.in +++ b/fortran/testpar/Makefile.in @@ -221,6 +221,7 @@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ @@ -272,7 +273,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ -PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ |