diff options
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | fortran/src/H5Pff.F90 | 99 | ||||
-rw-r--r-- | fortran/src/H5VLff.F90 | 315 | ||||
-rw-r--r-- | fortran/src/H5_f.c | 16 | ||||
-rw-r--r-- | fortran/src/H5_ff.F90 | 27 | ||||
-rw-r--r-- | fortran/src/H5f90global.F90 | 35 | ||||
-rw-r--r-- | fortran/src/HDF5.F90 | 1 | ||||
-rw-r--r-- | fortran/src/Makefile.am | 3 | ||||
-rw-r--r-- | fortran/src/hdf5_fortrandll.def.in | 10 | ||||
-rw-r--r-- | fortran/test/CMakeLists.txt | 61 | ||||
-rw-r--r-- | fortran/test/CMakeTests.cmake | 8 | ||||
-rw-r--r-- | fortran/test/Makefile.am | 3 | ||||
-rw-r--r-- | fortran/test/vol_connector.F90 | 281 |
13 files changed, 833 insertions, 27 deletions
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index f71e820..83ee82c 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -217,6 +217,7 @@ set (f90_F_BASE_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Rff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Sff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Tff.F90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5VLff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Zff.F90 ) diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 13a2953..0c0500d 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -9,7 +9,7 @@ ! COPYRIGHT ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * -! Copyright by the Board of Trustees of the University of Illinois. *S +! 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 * @@ -7929,7 +7929,7 @@ SUBROUTINE h5pget_virtual_filename_f(dcpl_id, index, name, hdferr, name_len) INTERFACE INTEGER(SIZE_T) FUNCTION h5pget_virtual_filename(dcpl_id, index, name, size) BIND(C, NAME='H5Pget_virtual_filename') - IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR + IMPORT :: HID_T, SIZE_T, C_PTR IMPLICIT NONE INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id INTEGER(SIZE_T), INTENT(IN), VALUE :: index @@ -7997,7 +7997,7 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len) INTERFACE INTEGER(SIZE_T) FUNCTION h5pget_virtual_dsetname(dcpl_id, index, name, size) BIND(C, NAME='H5Pget_virtual_dsetname') - IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR + IMPORT :: HID_T, SIZE_T, C_PTR IMPLICIT NONE INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id INTEGER(SIZE_T), INTENT(IN), VALUE :: index @@ -8018,7 +8018,6 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len) ELSE CALL HD5c2fstring(name,c_name,LEN(name)) ENDIF - ENDIF END SUBROUTINE h5pget_virtual_dsetname_f @@ -8115,5 +8114,97 @@ END SUBROUTINE h5pget_virtual_dsetname_f END SUBROUTINE h5pset_dset_no_attrs_hint_f +!****s* H5P/H5Pset_vol_f +! +! NAME +! H5Pset_vol_f +! +! PURPOSE +! Set the file VOL connector (VOL_ID) for a file access +! property list (PLIST_ID) +! INPUTS +! plist_id - access property list identifier. +! new_vol_id - VOL connector id. +! +! OUTPUTS +! hdferr - error code: +! 0 on success and -1 on failure +! +! OPTIONAL +! new_vol_info - VOL connector info. +! +! AUTHOR +! M.S. Breitenfeld +! May 2019 +! +! Fortran Interface: + SUBROUTINE h5pset_vol_f(plist_id, new_vol_id, hdferr, new_vol_info) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + INTEGER(HID_T) , INTENT(IN) :: new_vol_id + INTEGER , INTENT(OUT) :: hdferr + TYPE(C_PTR) , OPTIONAL :: new_vol_info +!***** + + TYPE(C_PTR) :: new_vol_info_default + + INTERFACE + INTEGER FUNCTION h5pset_vol(plist_id, new_vol_id, new_vol_info) BIND(C, NAME='H5Pset_vol') + IMPORT :: HID_T, C_PTR + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: plist_id + INTEGER(HID_T), INTENT(IN), VALUE :: new_vol_id + TYPE(C_PTR) , INTENT(IN), VALUE :: new_vol_info + END FUNCTION h5pset_vol + END INTERFACE + + new_vol_info_default = C_NULL_PTR + IF(PRESENT(new_vol_info)) new_vol_info_default=new_vol_info + + hdferr = INT(h5pset_vol(plist_id, new_vol_id, new_vol_info_default)) + + END SUBROUTINE h5pset_vol_f + +!****s* H5P/H5Pget_vol_id_f +! +! NAME +! H5Pget_vol_id_f +! +! PURPOSE +! Get the file VOL connector (VOL_ID) for a file access +! property list (PLIST_ID) +! INPUTS +! plist_id - access property list identifier. +! +! OUTPUTS +! vol_id - VOL connector id. +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! M.S. Breitenfeld +! May 2019 +! +! Fortran Interface: + SUBROUTINE h5pget_vol_id_f(plist_id, vol_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + INTEGER(HID_T) , INTENT(OUT) :: vol_id + INTEGER , INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION h5pget_vol_id(plist_id, vol_id) BIND(C, NAME='H5Pget_vol_id') + IMPORT :: HID_T, C_PTR + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: plist_id + INTEGER(HID_T), INTENT(OUT) :: vol_id + END FUNCTION h5pget_vol_id + END INTERFACE + + hdferr = INT(h5pget_vol_id(plist_id, vol_id)) + + END SUBROUTINE h5pget_vol_id_f + END MODULE H5P diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 new file mode 100644 index 0000000..0c5e8fd --- /dev/null +++ b/fortran/src/H5VLff.F90 @@ -0,0 +1,315 @@ +!****h* ROBODoc/H5VL +! +! NAME +! MODULE H5VL +! +! PURPOSE +! This file contains Fortran interfaces for H5VL (VOL) 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 COPYING file, which can be found at the root of the source code * +! distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * +! If you do not have access to either file, you may request a copy from * +! help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! NOTES +! _____ __ __ _____ ____ _____ _______ _ _ _______ +! |_ _| \/ | __ \ / __ \| __ \__ __|/\ | \ | |__ __| +! **** | | | \ / | |__) | | | | |__) | | | / \ | \| | | | **** +! **** | | | |\/| | ___/| | | | _ / | | / /\ \ | . ` | | | **** +! **** _| |_| | | | | | |__| | | \ \ | |/ ____ \| |\ | | | **** +! |_____|_| |_|_| \____/|_| \_\ |_/_/ \_\_| \_| |_| +! +! If you add a new H5VL 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 H5VL + + USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_FUNPTR, C_CHAR, C_INT64_T, C_INT + USE H5GLOBAL + USE H5fortkit + + IMPLICIT NONE + +CONTAINS + +! H5VLregister_connector + +! +!****s* H5VL/H5VLregister_connector_by_name_f +! +! NAME +! H5VLregister_connector_by_name_f +! +! PURPOSE +! Registers a new VOL connector as a member of the virtual object +! layer class by name. +! +! INPUTS +! name - Connector name +! OUTPUTS +! vol_id - VOL id +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLregister_connector_by_name_f(name, vol_id, hdferr, vipl_id) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(HID_T), INTENT(OUT) :: vol_id + INTEGER, INTENT(OUT) :: hdferr + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: vipl_id +!***** + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + INTEGER(HID_T) :: vipl_id_default + + INTERFACE + INTEGER(HID_T) FUNCTION H5VLregister_connector_by_name(name, vipl_id) & + BIND(C,NAME='H5VLregister_connector_by_name') + IMPORT :: C_CHAR + IMPORT :: HID_T + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name + INTEGER(HID_T), INTENT(IN), VALUE :: vipl_id + END FUNCTION H5VLregister_connector_by_name + END INTERFACE + + vipl_id_default = H5P_DEFAULT_F + IF(PRESENT(vipl_id)) vipl_id_default = vipl_id + + c_name = TRIM(name)//C_NULL_CHAR + vol_id = H5VLregister_connector_by_name(c_name, vipl_id_default) + + hdferr = 0 + IF(vol_id.LT.0) hdferr = H5I_INVALID_HID_F + + END SUBROUTINE H5VLregister_connector_by_name_f + + SUBROUTINE H5VLregister_connector_by_value_f(connector_value, vol_id, hdferr, vipl_id) + IMPLICIT NONE + INTEGER, INTENT(IN) :: connector_value + INTEGER(HID_T), INTENT(OUT) :: vol_id + INTEGER, INTENT(OUT) :: hdferr + INTEGER(HID_T), OPTIONAL, INTENT(IN) :: vipl_id +!***** + INTEGER(HID_T) :: vipl_id_default + + INTERFACE + INTEGER(HID_T) FUNCTION H5VLregister_connector_by_value(connector_value, vipl_id) & + BIND(C,NAME='H5VLregister_connector_by_value') + IMPORT :: HID_T + IMPORT :: C_INT + INTEGER(C_INT), VALUE :: connector_value + INTEGER(HID_T), INTENT(IN), VALUE :: vipl_id + END FUNCTION H5VLregister_connector_by_value + END INTERFACE + + vipl_id_default = H5P_DEFAULT_F + IF(PRESENT(vipl_id)) vipl_id_default = vipl_id + + vol_id = H5VLregister_connector_by_value(INT(connector_value,C_INT), vipl_id_default) + + hdferr = 0 + IF(vol_id.LT.0) hdferr = H5I_INVALID_HID_F + + END SUBROUTINE H5VLregister_connector_by_value_f + +! +!****s* H5VL/H5VLis_connector_registered_f +! +! NAME +! H5VLis_connector_registered_f +! +! PURPOSE +! Tests whether a VOL class has been registered or not. +! +! INPUTS +! name - Connector name +! OUTPUTS +! registered - state of VOL class registration +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLis_connector_registered_f(name, registered, hdferr) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name + LOGICAL, INTENT(OUT) :: registered + INTEGER, INTENT(OUT) :: hdferr +!***** + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + INTEGER(C_INT) :: registered_c + + INTERFACE + INTEGER(C_INT) FUNCTION H5VLis_connector_registered(name) BIND(C,NAME='H5VLis_connector_registered') + IMPORT :: C_CHAR + IMPORT :: C_INT + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name + END FUNCTION H5VLis_connector_registered + END INTERFACE + + c_name = TRIM(name)//C_NULL_CHAR + registered_c = H5VLis_connector_registered(c_name) + + hdferr = 0 + registered = .FALSE. + IF(registered_c .GT. 0) registered = .TRUE. + IF(registered_c .LT. 0) hdferr = INT(registered_c) + + END SUBROUTINE H5VLis_connector_registered_f + +! +!****s* H5VL/H5VLis_connector_registered_f +! +! NAME +! H5VLis_connector_registered_f +! +! PURPOSE +! Retrieves the ID for a registered VOL connector. +! +! INPUTS +! name - Connector name +! OUTPUTS +! vol_id - Connector id +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLget_connector_id_f(name, vol_id, hdferr) + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(HID_T), INTENT(OUT) :: vol_id + INTEGER, INTENT(OUT) :: hdferr +!***** + CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name + + INTERFACE + INTEGER(HID_T) FUNCTION H5VLget_connector_id(name) BIND(C,NAME='H5VLget_connector_id') + IMPORT :: C_CHAR + IMPORT :: HID_T + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name + END FUNCTION H5VLget_connector_id + END INTERFACE + + c_name = TRIM(name)//C_NULL_CHAR + vol_id = H5VLget_connector_id(c_name) + + IF(vol_id.LT.0)THEN + hdferr = -1 + vol_id = H5I_INVALID_HID_F + ENDIF + + END SUBROUTINE H5VLget_connector_id_f + + SUBROUTINE H5VLget_connector_name_f(obj_id, name, hdferr, name_len) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr + INTEGER(SIZE_T), OPTIONAL :: name_len +!***** + CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:LEN(name)+1), TARGET :: c_name + INTEGER(SIZE_T) :: l + TYPE(C_PTR) :: f_ptr + + INTERFACE + INTEGER(SIZE_T) FUNCTION H5VLget_connector_name(obj_id, name, size) BIND(C,NAME='H5VLget_connector_name') + IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: obj_id + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: name + ! TYPE(C_PTR), value :: name + INTEGER(SIZE_T), INTENT(IN), VALUE :: size + END FUNCTION H5VLget_connector_name + END INTERFACE + + hdferr = 0 + IF(PRESENT(name_len))THEN + name_len = INT(H5VLget_connector_name(obj_id, c_name, 0_SIZE_T), SIZE_T) + IF(name_len.LT.0) hdferr = H5I_INVALID_HID_F + ELSE + l = INT(LEN(name)+1,SIZE_T) + IF(INT(H5VLget_connector_name(obj_id, c_name, l), SIZE_T).LT.0)THEN + hdferr = H5I_INVALID_HID_F + ELSE + CALL HD5c2fstring(name,c_name,LEN(name)) + ENDIF + ENDIF + + END SUBROUTINE H5VLget_connector_name_f + +! +! +!****s* H5VL/H5VLclose_f +! +! NAME +! H5VLclose_f +! +! PURPOSE +! Closes a VOL connector ID. +! +! INPUTS +! vol_id - A valid identifier of the connectory to unregister. +! +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLclose_f(vol_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: vol_id + INTEGER, INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION H5VLclose(vol_id) BIND(C, NAME='H5VLclose') + IMPORT :: HID_T + INTEGER(HID_T), INTENT(IN), VALUE :: vol_id + END FUNCTION H5VLclose + END INTERFACE + + hdferr = INT(H5VLclose(vol_id)) + + END SUBROUTINE H5VLclose_f + +! +!****s* H5VL/H5VLunregister_connector_f +! +! NAME +! H5VLunregister_connector_f +! +! PURPOSE +! Removes a VOL connector ID from the library. +! +! INPUTS +! plugin_id - A valid identifier of the connector to unregister. +! +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLunregister_connector_f(plugin_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: plugin_id + INTEGER, INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION H5VLunregister_connector(plugin_id) BIND(C, NAME='H5VLunregister_connector') + IMPORT :: HID_T + INTEGER(HID_T), INTENT(IN), VALUE :: plugin_id + END FUNCTION H5VLunregister_connector + END INTERFACE + + hdferr = INT(H5VLunregister_connector(plugin_id)) + + END SUBROUTINE H5VLunregister_connector_f + +END MODULE H5VL diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 69ba8b3..2d1c6e7 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -498,6 +498,16 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5i_flags[4] = (int_f)H5I_DATASET; h5i_flags[5] = (int_f)H5I_ATTR; h5i_flags[6] = (int_f)H5I_BADID; + h5i_flags[7] = (int_f)H5I_UNINIT; + h5i_flags[8] = (int_f)H5I_VFL; + h5i_flags[9] = (int_f)H5I_VOL; + h5i_flags[10] = (int_f)H5I_GENPROP_CLS; + h5i_flags[11] = (int_f)H5I_GENPROP_LST; + h5i_flags[12] = (int_f)H5I_ERROR_CLASS; + h5i_flags[13] = (int_f)H5I_ERROR_MSG; + h5i_flags[14] = (int_f)H5I_ERROR_STACK; + h5i_flags[15] = (int_f)H5I_NTYPES; + h5i_flags[16] = (int_f)H5I_INVALID_HID; /* * H5L flags */ @@ -632,7 +642,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5s_flags[15] = (int_f)H5S_SEL_POINTS; h5s_flags[16] = (int_f)H5S_SEL_HYPERSLABS; h5s_flags[17] = (int_f)H5S_SEL_ALL; - /* * H5T flags */ @@ -671,7 +680,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5t_flags[32] = (int_f)H5T_ARRAY; h5t_flags[33] = (int_f)H5T_DIR_ASCEND; h5t_flags[34] = (int_f)H5T_DIR_DESCEND; - /* * H5Z flags */ @@ -695,10 +703,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5z_flags[17] = (int_f)H5Z_SO_FLOAT_ESCALE; h5z_flags[18] = (int_f)H5Z_SO_INT; h5z_flags[19] = (int_f)H5Z_SO_INT_MINBITS_DEFAULT; -/* - * H5A flags - */ - /* * H5 Generic flags introduced in version 1.8 diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 84529e4..443be79 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -88,7 +88,7 @@ MODULE H5LIB ! ! H5I flags declaration ! - INTEGER, PARAMETER :: H5I_FLAGS_LEN = 7 + INTEGER, PARAMETER :: H5I_FLAGS_LEN = 17 INTEGER, DIMENSION(1:H5I_FLAGS_LEN) :: H5I_flags ! ! H5L flags declaration @@ -129,6 +129,7 @@ MODULE H5LIB ! INTEGER, PARAMETER :: H5T_FLAGS_LEN = 35 INTEGER, DIMENSION(1:H5T_FLAGS_LEN) :: H5T_flags + ! ! H5Z flags declaration ! @@ -443,13 +444,23 @@ CONTAINS ! ! H5I flags declaration ! - H5I_FILE_F = H5I_flags(1) - H5I_GROUP_F = H5I_flags(2) - H5I_DATATYPE_F = H5I_flags(3) - H5I_DATASPACE_F = H5I_flags(4) - H5I_DATASET_F = H5I_flags(5) - H5I_ATTR_F = H5I_flags(6) - H5I_BADID_F = H5I_flags(7) + H5I_FILE_F = H5I_flags(1) + H5I_GROUP_F = H5I_flags(2) + H5I_DATATYPE_F = H5I_flags(3) + H5I_DATASPACE_F = H5I_flags(4) + H5I_DATASET_F = H5I_flags(5) + H5I_ATTR_F = H5I_flags(6) + H5I_BADID_F = H5I_flags(7) + H5I_UNINIT_F = H5I_flags(8) + H5I_VFL_F = H5I_flags(9) + H5I_VOL_F = H5I_flags(10) + H5I_GENPROP_CLS_F = H5I_flags(11) + H5I_GENPROP_LST_F = H5I_flags(12) + H5I_ERROR_CLASS_F = H5I_flags(13) + H5I_ERROR_MSG_F = H5I_flags(14) + H5I_ERROR_STACK_F = H5I_flags(15) + H5I_NTYPES_F = H5I_flags(16) + H5I_INVALID_HID_F = H5I_flags(17) ! ! H5L flags ! diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index b705cc1..02e3bc3 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -435,15 +435,36 @@ MODULE H5GLOBAL !DEC$ATTRIBUTES DLLEXPORT :: H5I_DATASET_F !DEC$ATTRIBUTES DLLEXPORT :: H5I_ATTR_F !DEC$ATTRIBUTES DLLEXPORT :: H5I_BADID_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_UNINIT_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_VFL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_VOL_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_GENPROP_CLS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_GENPROP_LST_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_ERROR_CLASS_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_ERROR_MSG_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_ERROR_STACK_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_NTYPES_F + !DEC$ATTRIBUTES DLLEXPORT :: H5I_INVALID_HID_F !DEC$endif - INTEGER :: H5I_FILE_F - INTEGER :: H5I_GROUP_F - INTEGER :: H5I_DATATYPE_F - INTEGER :: H5I_DATASPACE_F - INTEGER :: H5I_DATASET_F - INTEGER :: H5I_ATTR_F - INTEGER :: H5I_BADID_F + INTEGER :: H5I_FILE_F + INTEGER :: H5I_GROUP_F + INTEGER :: H5I_DATATYPE_F + INTEGER :: H5I_DATASPACE_F + INTEGER :: H5I_DATASET_F + INTEGER :: H5I_ATTR_F + INTEGER :: H5I_BADID_F + INTEGER :: H5I_UNINIT_F + INTEGER :: H5I_VFL_F + INTEGER :: H5I_VOL_F + INTEGER :: H5I_GENPROP_CLS_F + INTEGER :: H5I_GENPROP_LST_F + INTEGER :: H5I_ERROR_CLASS_F + INTEGER :: H5I_ERROR_MSG_F + INTEGER :: H5I_ERROR_STACK_F + INTEGER :: H5I_NTYPES_F + INTEGER :: H5I_INVALID_HID_F + ! ! H5L flags declaration ! diff --git a/fortran/src/HDF5.F90 b/fortran/src/HDF5.F90 index 0370224..fe38b7d 100644 --- a/fortran/src/HDF5.F90 +++ b/fortran/src/HDF5.F90 @@ -38,6 +38,7 @@ MODULE HDF5 USE H5O USE H5P USE H5R + USE H5VL USE H5Z USE H5_gen USE H5LIB diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 666f6cb..4009439 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -44,7 +44,7 @@ endif libhdf5_fortran_la_SOURCES=H5f90global.F90 \ H5fortran_types.F90 H5_ff.F90 H5Aff.F90 H5Dff.F90 H5Eff.F90 \ H5Fff.F90 H5Gff.F90 H5Iff.F90 H5Lff.F90 H5Off.F90 H5Pff.F90 H5Rff.F90 H5Sff.F90 \ - H5Tff.F90 H5Zff.F90 H5_gen.F90 H5fortkit.F90 \ + H5Tff.F90 H5VLff.F90 H5Zff.F90 H5_gen.F90 H5fortkit.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 HDF5.F90 @@ -155,6 +155,7 @@ H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo H5fortkit.lo H5Rff.lo: $(srcdir)/H5Rff.F90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.F90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.F90 H5f90global.lo +H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo H5Zff.lo: $(srcdir)/H5Zff.F90 H5f90global.lo H5_gen.lo: H5_gen.F90 H5f90global.lo H5Aff.lo H5Dff.lo H5Pff.lo HDF5.lo: $(srcdir)/HDF5.F90 H5f90global.lo H5_ff.lo H5Aff.lo \ diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 3a0ca81..e31a582 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -335,6 +335,8 @@ H5P_mp_H5PGET_VIRTUAL_FILENAME_F H5P_mp_H5PGET_VIRTUAL_DSETNAME_F H5P_mp_H5PGET_DSET_NO_ATTRS_HINT_F H5P_mp_H5PSET_DSET_NO_ATTRS_HINT_F +H5P_mp_H5PSET_VOL_F +H5P_mp_H5PGET_VOL_ID_F ; Parallel @H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F @@ -452,6 +454,14 @@ H5T_mp_H5TGET_NATIVE_TYPE_F H5T_mp_H5TCONVERT_F H5T_mp_H5TENUM_INSERT_F90 H5T_mp_H5TENUM_INSERT_F03 +; H5VL +H5VL_mp_H5VLREGISTER_CONNECTOR_BY_NAME_F +H5VL_mp_H5VLREGISTER_CONNECTOR_BY_VALUE_F +H5VL_mp_H5VLIS_CONNECTOR_REGISTERED_F +H5VL_mp_H5VLGET_CONNECTOR_ID_F +H5VL_mp_H5VLGET_CONNECTOR_NAME_F +H5VL_mp_H5VLCLOSE_F +H5VL_mp_H5VLUNREGISTER_CONNECTOR_F ; H5Z H5Z_mp_H5ZUNREGISTER_F H5Z_mp_H5ZFILTER_AVAIL_F diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index b862fcd..719a9f3 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -569,4 +569,65 @@ if (BUILD_SHARED_LIBS) add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () +#-- Adding test for vol_connector +add_executable (vol_connector vol_connector.F90) +target_include_directories (vol_connector + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/static +) +target_compile_options(vol_connector + PRIVATE + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> +) +target_link_libraries (vol_connector + PRIVATE + ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> +) +#set_property(TARGET vol_connector APPEND PROPERTY +# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +#) +#set_property(TARGET vol_connector APPEND PROPERTY +# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +#) +if(MSVC) + set_property(TARGET vol_connector PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") +endif() +set_target_properties (vol_connector PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static +) +add_dependencies (vol_connector ${HDF5_F90_TEST_LIB_TARGET}) + +if (BUILD_SHARED_LIBS) + add_executable (vol_connector-shared vol_connector.F90) + target_include_directories (vol_connector-shared + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + target_compile_options(vol_connector-shared + PRIVATE + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (vol_connector-shared + PRIVATE + ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> + ) +# set_property(TARGET vol_connector-shared APPEND PROPERTY +# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET vol_connector-shared APPEND PROPERTY +# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET vol_connector-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") + endif() + set_target_properties (vol_connector-shared PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + add_dependencies (vol_connector-shared ${HDF5_F90_TEST_LIBSH_TARGET}) +endif () + include (CMakeTests.cmake) diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 5fa10f4..306a3f8 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -130,6 +130,10 @@ set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear- add_test (NAME FORTRAN_fflush2 COMMAND $<TARGET_FILE:fflush2>) set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1) +#-- Adding test for vol_connector +add_test (NAME FORTRAN_vol_connector COMMAND $<TARGET_FILE:vol_connector>) +set_tests_properties (FORTRAN_vol_connector PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) + if (BUILD_SHARED_LIBS) add_test ( NAME FORTRAN_testhdf5-shared-clear-objects @@ -239,4 +243,8 @@ if (BUILD_SHARED_LIBS) #-- Adding test for fflush2 add_test (NAME FORTRAN_fflush2-shared COMMAND $<TARGET_FILE:fflush2-shared>) set_tests_properties (FORTRAN_fflush2-shared PROPERTIES DEPENDS FORTRAN_fflush1-shared) + + #-- Adding test for vol_connector + add_test (NAME FORTRAN_vol_connector-shared COMMAND $<TARGET_FILE:vol_connector-shared>) + set_tests_properties (FORTRAN_vol_connector-shared PROPERTIES DEPENDS FORTRAN_vol_connector-shared) endif () diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index 8613cf9..f0d7f03 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -35,7 +35,7 @@ else endif # Our main targets, the tests themselves -TEST_PROG=fortranlib_test fflush1 fflush2 fortranlib_test_1_8 fortranlib_test_F03 +TEST_PROG=fortranlib_test fflush1 fflush2 fortranlib_test_1_8 fortranlib_test_F03 vol_connector check_PROGRAMS=$(TEST_PROG) @@ -50,6 +50,7 @@ fortranlib_test_1_8_SOURCES = tH5O.F90 tH5A_1_8.F90 tH5G_1_8.F90 tH5MISC_1_8.F90 fortranlib_test_F03_SOURCES = tH5E_F03.F90 tH5F_F03.F90 tH5L_F03.F90 \ tH5O_F03.F90 tH5P_F03.F90 tH5T_F03.F90 tHDF5_F03.F90 fortranlib_test_F03.F90 +vol_connector_SOURCES=vol_connector.F90 fflush1_SOURCES=fflush1.F90 fflush2_SOURCES=fflush2.F90 diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 new file mode 100644 index 0000000..62e3f8d --- /dev/null +++ b/fortran/test/vol_connector.F90 @@ -0,0 +1,281 @@ +!****h* root/fortran/test/vol_connector.F90 +! +! NAME +! vol_connector.F90 +! +! FUNCTION +! +! Tests basic Fortran VOL plugin operations (registration, etc.). +! Uses the null VOL connector (built with the testing code) +! which is loaded as a dynamic plugin. +! +! 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 COPYING file, which can be found at the root of the source code * +! distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * +! If you do not have access to either file, you may request a copy from * +! help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +!***** + +MODULE VOL_TMOD + + USE HDF5 + USE THDF5_F03 + IMPLICIT NONE + + INTEGER, PARAMETER :: NATIVE_VOL_CONNECTOR_VALUE = 0 + CHARACTER(LEN=6), PARAMETER :: NATIVE_VOL_CONNECTOR_NAME = "native" + +CONTAINS + + !------------------------------------------------------------------------- + ! Function: test_registration_by_name() + ! + ! Purpose: Tests if we can load, register, and close a VOL + ! connector by name. + ! + !------------------------------------------------------------------------- + ! + + SUBROUTINE test_registration_by_name(total_error) + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + INTEGER :: error = 0 + + LOGICAL :: is_registered = .FALSE. + INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1 + CHARACTER(LEN=64) :: name + INTEGER(SIZE_T) :: name_len + INTEGER(hid_t) :: file_id + INTEGER :: cmp = -1 + + ! The null VOL connector should not be registered at the start of the test + CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + ! Register the connector by name + CALL H5VLregister_connector_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id, error) + CALL check("H5VLregister_connector_by_name_f",error,total_error) + + ! The connector should be registered now + CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) + + CALL H5VLget_connector_id_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error) + CALL check("H5VLget_connector_id_f",error,total_error) + + CALL H5Fcreate_f("voltest.h5",H5F_ACC_TRUNC_F, file_id, error) + CALL check("H5F_create_f",error,total_error) + + CALL H5VLget_connector_name_f(file_id, name, error, name_len) + CALL check("H5VLget_connector_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_name_f", INT(name_len), LEN_TRIM(NATIVE_VOL_CONNECTOR_NAME), total_error) + + CALL H5VLget_connector_name_f(file_id, name, error) + CALL check("H5VLget_connector_name_f",error,total_error) + CALL VERIFY("H5VLget_connector_name_f", name, NATIVE_VOL_CONNECTOR_NAME, total_error) + + CALL H5Fclose_f(file_id, error) + CALL check("H5Fclose_f",error,total_error) + + CALL H5VLclose_f(vol_id_out, error) + CALL check("H5VLclose_f",error, total_error) + + ! Unregister the connector + CALL H5VLunregister_connector_f(vol_id, error) + CALL check("H5VLunregister_connector_f", error, total_error) + + END SUBROUTINE test_registration_by_name + + !------------------------------------------------------------------------- + ! Function: test_registration_by_value() + ! + ! Purpose: Tests if we can load, register, and close a VOL + ! connector by value. + ! + !------------------------------------------------------------------------- + + SUBROUTINE test_registration_by_value(total_error) + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + INTEGER :: error = 0 + + LOGICAL :: is_registered = .FALSE. + INTEGER(hid_t) :: vol_id = 0 + + + ! The null VOL connector should not be registered at the start of the test + CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + ! Register the connector by value + CALL H5VLregister_connector_by_value_f(NATIVE_VOL_CONNECTOR_VALUE, vol_id, error) + CALL check("H5VLregister_connector_by_value_f", error, total_error) + + ! The connector should be registered now + CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) + + ! Unregister the connector + CALL H5VLunregister_connector_f(vol_id, error) + CALL check("H5VLunregister_connector_f", error, total_error) + + END SUBROUTINE test_registration_by_value + + + !------------------------------------------------------------------------- + ! Function: test_registration_by_name() + ! + ! Purpose: Tests if we can load, register, and close a VOL + ! connector by name. + ! + !------------------------------------------------------------------------- + ! + + SUBROUTINE test_registration_by_fapl(total_error) + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + INTEGER :: error = 0 + + LOGICAL :: is_registered = .FALSE. + INTEGER(hid_t) :: vol_id = 0, vol_id_out = 1 + CHARACTER(LEN=64) :: name + INTEGER(SIZE_T) :: name_len + INTEGER(hid_t) :: file_id + INTEGER :: cmp = -1 + INTEGER(hid_t) :: fapl_id + TYPE(C_PTR) :: f_ptr + INTEGER(hid_t), TARGET :: under_fapl + + CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + + ! The null VOL connector should not be registered at the start of the test + CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + + CALL H5VLregister_connector_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id, error) + CALL check("H5VLregister_connector_by_name_f",error,total_error) + + ! The connector should be registered now + CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) + + ! Register the connector + CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl_id, error) + CALL check("H5Pcreate_f",error,total_error) + + f_ptr = C_NULL_PTR + CALL H5Pset_vol_f(fapl_id, vol_id, error) + CALL check("H5Pset_vol_f",error,total_error) + + CALL H5Pget_vol_id_f(fapl_id, vol_id_out, error) + CALL check("H5Pget_vol_id_f",error,total_error) + CALL VERIFY("H5Pget_vol_id_f", vol_id_out, vol_id, total_error) + + f_ptr = C_NULL_PTR + CALL H5Pset_vol_f(fapl_id, vol_id, error, f_ptr) + CALL check("H5Pset_vol_f",error,total_error) + + CALL H5Pget_vol_id_f(fapl_id, vol_id_out, error) + CALL check("H5Pget_vol_id_f",error,total_error) + CALL VERIFY("H5Pget_vol_id_f", vol_id_out, vol_id, total_error) + + CALL H5VLget_connector_id_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error) + CALL check("H5VLget_connector_id_f",error,total_error) + CALL VERIFY("H5VLget_connector_id_f", vol_id_out, vol_id, total_error) + + CALL H5Fcreate_f("voltest.h5",H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl_id) + CALL check("H5F_create_f",error,total_error) + + CALL H5VLclose_f(vol_id_out, error) + CALL check("H5VLclose_f",error, total_error) + + CALL H5VLclose_f(vol_id, error) + CALL check("H5VLclose_f",error, total_error) + + ! Unregister the connector + CALL H5VLunregister_connector_f(vol_id, error) + CALL check("H5VLunregister_connector_f", error, total_error) + + CALL H5Fclose_f(file_id, error) + CALL check("H5Fclose_f",error,total_error) + + CALL H5Pclose_f(fapl_id, error) + CALL check("H5Pclose_f",error,total_error) + + END SUBROUTINE test_registration_by_fapl + + +END MODULE VOL_TMOD + + +PROGRAM vol_connector + + USE HDF5 + USE THDF5_F03 + USE VOL_TMOD + + IMPLICIT NONE + INTEGER :: total_error = 0 + INTEGER :: error + INTEGER :: ret_total_error + LOGICAL :: cleanup, status + + CALL h5open_f(error) + + cleanup = .TRUE. + CALL h5_env_nocleanup_f(status) + IF(status) cleanup=.FALSE. + + WRITE(*,'(18X,A)') '==============================' + WRITE(*,'(24X,A)') 'FORTRAN VOL tests' + WRITE(*,'(18X,A)') '==============================' + + WRITE(*,'(A)') "Testing VOL connector plugin functionality." + ret_total_error = 0 + CALL test_registration_by_name(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing VOL registration by name', total_error) + + ret_total_error = 0 + CALL test_registration_by_value(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing VOL registration by value', total_error) + + ret_total_error = 0 + CALL test_registration_by_fapl(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing VOL registration by fapl', total_error) + + WRITE(*, fmt = '(/18X,A)') '============================================' + WRITE(*, fmt = '(19X, A)', advance='NO') ' FORTRAN VOL tests completed with ' + WRITE(*, fmt = '(I4)', advance='NO') total_error + WRITE(*, fmt = '(A)' ) ' error(s) ! ' + WRITE(*,'(18X,A)') '============================================' + + CALL h5close_f(error) + + ! if errors detected, exit with non-zero code. + IF (total_error .NE. 0) CALL h5_exit_f(1) + +END PROGRAM vol_connector |