summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorM. Scot Breitenfeld <brtnfld@hdfgroup.org>2019-04-24 17:57:30 (GMT)
committerM. Scot Breitenfeld <brtnfld@hdfgroup.org>2019-04-24 17:57:30 (GMT)
commit7dd53873f73ee67046607b50067b543f2a44cab3 (patch)
tree4d08558545b8403ed43ff27ebb5bd02b8503a52e /fortran
parent6682f51a1157dc9e88bd34528fff999aee50ca2a (diff)
parent4fbe80acc27bc0e84eec9880c3c4257802e5bae5 (diff)
downloadhdf5-7dd53873f73ee67046607b50067b543f2a44cab3.zip
hdf5-7dd53873f73ee67046607b50067b543f2a44cab3.tar.gz
hdf5-7dd53873f73ee67046607b50067b543f2a44cab3.tar.bz2
Merge branch 'develop' into H10621
Diffstat (limited to 'fortran')
-rw-r--r--fortran/Makefile.am6
-rw-r--r--fortran/src/H5Ff.c34
-rw-r--r--fortran/src/H5Fff.F9038
-rw-r--r--fortran/src/H5Sf.c6
-rw-r--r--fortran/src/H5Sff.F9013
-rw-r--r--fortran/src/H5f90proto.h3
-rw-r--r--fortran/src/hdf5_fortrandll.def.in1
-rw-r--r--fortran/test/tH5F.F9029
-rw-r--r--fortran/test/tH5MISC_1_8.F9033
9 files changed, 149 insertions, 14 deletions
diff --git a/fortran/Makefile.am b/fortran/Makefile.am
index 38084b9..ca0733f 100644
--- a/fortran/Makefile.am
+++ b/fortran/Makefile.am
@@ -30,6 +30,12 @@ endif
## Only recurse into subdirectories if HDF5 is configured to use Fortran.
if BUILD_FORTRAN_CONDITIONAL
SUBDIRS=src test $(TESTPARALLEL_DIR)
+
+# Test with just the native connector, with a single pass-through connector
+# and with a doubly-stacked pass-through.
+VOL_LIST = native "pass_through under_vol=0;under_info={}" \
+ "pass_through under_vol=505;under_info={under_vol=0;under_info={}}"
+
endif
# All directories that have Makefiles
diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c
index a4e786e..12fb7ed 100644
--- a/fortran/src/H5Ff.c
+++ b/fortran/src/H5Ff.c
@@ -632,6 +632,40 @@ done:
return ret_value;
}
+/****if* H5Ff/h5fget_fileno_c
+ * NAME
+ * h5fget_fileno_c
+ * PURPOSE
+ * Call H5Fget_fileno to get file number
+ * INPUTS
+ * file_id - file identifier
+ * OUTPUTS
+ * fileno - file number for open file
+ * RETURNS
+ * 0 on success, -1 on failure
+ * AUTHOR
+ * Quincey Koziol
+ * Saturday, April 13, 2019
+ * SOURCE
+*/
+int_f
+h5fget_fileno_c(hid_t_f *file_id, int_f *fileno)
+/******/
+{
+ unsigned long fileno_c;
+ herr_t ret_value=0; /* Return value */
+
+ /*
+ * Call H5Fget_filesize function
+ */
+ if ((ret_value = H5Fget_fileno((hid_t)*file_id, &fileno_c)) < 0)
+ HGOTO_DONE(FAIL);
+ *fileno = (hsize_t_f)fileno_c;
+
+done:
+ return ret_value;
+}
+
/****if* H5Ff/h5fget_file_image_c
* NAME
* h5fget_file_image_c
diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90
index cc51f37..ac3a1c0 100644
--- a/fortran/src/H5Fff.F90
+++ b/fortran/src/H5Fff.F90
@@ -886,6 +886,44 @@ CONTAINS
hdferr = h5fget_filesize_c(file_id, size)
END SUBROUTINE h5fget_filesize_f
+!****s* H5F/h5fget_fileno_f
+!
+! NAME
+! h5fget_fileno_f
+!
+! PURPOSE
+! Retrieves the file number of the HDF5 file.
+!
+! INPUTS
+! file_id - file identifier
+! OUTPUTS
+! fileno - file number
+! hdferr - Returns 0 if successful and -1 if fails
+!
+! AUTHOR
+! Quincey Koziol
+! April 13, 2019
+!
+! SOURCE
+ SUBROUTINE h5fget_fileno_f(file_id, fileno, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: file_id ! file identifier
+ INTEGER, INTENT(OUT) :: fileno ! File number
+ INTEGER, INTENT(OUT) :: hdferr ! Error code: 0 on success,
+ ! -1 if fail
+!*****
+ INTERFACE
+ INTEGER FUNCTION h5fget_fileno_c(file_id, fileno) &
+ BIND(C,NAME='h5fget_fileno_c')
+ IMPORT :: HID_T, HSIZE_T
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: file_id
+ INTEGER, INTENT(OUT) :: fileno
+ END FUNCTION h5fget_fileno_c
+ END INTERFACE
+ hdferr = h5fget_fileno_c(file_id, fileno)
+ END SUBROUTINE h5fget_fileno_f
+
!****s* H5F (F03)/h5fget_file_image_f_F03
!
! NAME
diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c
index 96540f7..8abea25 100644
--- a/fortran/src/H5Sf.c
+++ b/fortran/src/H5Sf.c
@@ -1149,7 +1149,7 @@ h5sdecode_c ( _fcd buf, hid_t_f *obj_id )
*/
int_f
-h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc )
+h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id )
/******/
{
int ret_value = -1;
@@ -1162,7 +1162,7 @@ h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc )
if (*nalloc == 0) {
- if(H5Sencode((hid_t)*obj_id, c_buf, &c_size) < 0)
+ if(H5Sencode2((hid_t)*obj_id, c_buf, &c_size, (hid_t)*fapl_id) < 0)
return ret_value;
*nalloc = (size_t_f)c_size;
@@ -1180,7 +1180,7 @@ h5sencode_c (_fcd buf, hid_t_f *obj_id, size_t_f *nalloc )
/*
* Call H5Sencode function.
*/
- if(H5Sencode((hid_t)*obj_id, c_buf, &c_size) < 0){
+ if(H5Sencode2((hid_t)*obj_id, c_buf, &c_size, (hid_t)*fapl_id) < 0){
return ret_value;
}
diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90
index 3af7755..bd3dcf4 100644
--- a/fortran/src/H5Sff.F90
+++ b/fortran/src/H5Sff.F90
@@ -1379,25 +1379,32 @@ CONTAINS
! M. Scot Breitenfeld
! March 26, 2008
! SOURCE
- SUBROUTINE h5sencode_f(obj_id, buf, nalloc, hdferr)
+ SUBROUTINE h5sencode_f(obj_id, buf, nalloc, hdferr, fapl_id)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id
CHARACTER(LEN=*), INTENT(OUT) :: buf
INTEGER(SIZE_T), INTENT(INOUT) :: nalloc
INTEGER, INTENT(OUT) :: hdferr
+ INTEGER(HID_T), OPTIONAL, INTENT(IN) :: fapl_id ! File access property list
!*****
+ INTEGER(HID_T) :: fapl_id_default
INTERFACE
- INTEGER FUNCTION h5sencode_c(buf, obj_id, nalloc) BIND(C,NAME='h5sencode_c')
+ INTEGER FUNCTION h5sencode_c(buf, obj_id, nalloc, fapl_id_default) BIND(C,NAME='h5sencode_c')
IMPORT :: C_CHAR
IMPORT :: HID_T, SIZE_T
INTEGER(HID_T), INTENT(IN) :: obj_id
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: buf
INTEGER(SIZE_T), INTENT(INOUT) :: nalloc
+ INTEGER(HID_T) :: fapl_id_default
END FUNCTION h5sencode_c
END INTERFACE
- hdferr = h5sencode_c(buf, obj_id, nalloc)
+ fapl_id_default = H5P_DEFAULT_F
+
+ IF(PRESENT(fapl_id)) fapl_id_default = fapl_id
+
+ hdferr = h5sencode_c(buf, obj_id, nalloc, fapl_id_default)
END SUBROUTINE h5sencode_f
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index 4f0e5ef..7945857 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -91,6 +91,7 @@ H5_FCDLL int_f h5fget_file_image_c(hid_t_f *file_id, void *buf_ptr, size_t_f *bu
H5_FCDLL int_f h5fflush_c(hid_t_f *obj_id, int_f *scope);
H5_FCDLL int_f h5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen);
H5_FCDLL int_f h5fget_filesize_c(hid_t_f *file_id, hsize_t_f *size);
+H5_FCDLL int_f h5fget_fileno_c(hid_t_f *file_id, int_f *fileno);
/*
* Functions from H5Sf.c
@@ -121,7 +122,7 @@ H5_FCDLL int_f h5sselect_hyperslab_c( hid_t_f *space_id , int_f *op, hsize_t_f *
H5_FCDLL int_f h5sget_select_type_c( hid_t_f *space_id , int_f *op);
H5_FCDLL int_f h5sselect_elements_c( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsize_t_f *coord);
H5_FCDLL int_f h5sdecode_c( _fcd buf, hid_t_f *obj_id );
-H5_FCDLL int_f h5sencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc );
+H5_FCDLL int_f h5sencode_c(_fcd buf, hid_t_f *obj_id, size_t_f *nalloc, hid_t_f *fapl_id );
H5_FCDLL int_f h5sextent_equal_c( hid_t_f * space1_id, hid_t_f *space2_id, hid_t_f *c_equal);
/*
diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in
index 7a4647f..390c2b7 100644
--- a/fortran/src/hdf5_fortrandll.def.in
+++ b/fortran/src/hdf5_fortrandll.def.in
@@ -98,6 +98,7 @@ H5F_mp_H5FGET_ACCESS_PLIST_F
H5F_mp_H5FIS_ACCESSIBLE_F
H5F_mp_H5FIS_HDF5_F
H5F_mp_H5FGET_NAME_F
+H5F_mp_H5FGET_FILENO_F
H5F_mp_H5FGET_FILESIZE_F
H5F_mp_H5FGET_FILE_IMAGE_F
H5F_mp_H5FGET_DSET_NO_ATTRS_HINT_F
diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90
index 2501996..b898c21 100644
--- a/fortran/test/tH5F.F90
+++ b/fortran/test/tH5F.F90
@@ -105,6 +105,10 @@ CONTAINS
INTEGER(SIZE_T) :: obj_count
INTEGER(HID_T) :: t1, t2, t3, t4
+ ! File numbers
+ INTEGER :: file_num1
+ INTEGER :: file_num2
+
!
!data buffers
!
@@ -287,6 +291,18 @@ CONTAINS
IF(obj_count.NE.2)THEN
total_error = total_error + 1
ENDIF
+
+ !
+ !Check file numbers
+ !
+ CALL h5fget_fileno_f(file1_id, file_num1, error)
+ CALL check("h5fget_fileno_f",error,total_error)
+ CALL h5fget_fileno_f(file2_id, file_num2, error)
+ CALL check("h5fget_fileno_f",error,total_error)
+ IF(file_num1 .EQ. file_num2) THEN
+ write(*,*) "file numbers aren't supposed to match"
+ END IF
+
!
!mount the second file under the first file's "/G" group.
!
@@ -431,6 +447,8 @@ CONTAINS
INTEGER, DIMENSION(4,6) :: dset_data, data_out
INTEGER(HSIZE_T), DIMENSION(2) :: data_dims
INTEGER(HSIZE_T) :: file_size
+ INTEGER :: file_num1
+ INTEGER :: file_num2
CHARACTER(LEN=80) :: file_name
INTEGER(SIZE_T) :: name_size
@@ -499,6 +517,17 @@ CONTAINS
CALL check("h5fget_filesize_f",error,total_error)
!
+ !Check file numbers
+ !
+ CALL h5fget_fileno_f(file_id, file_num1, error)
+ CALL check("h5fget_fileno_f",error,total_error)
+ CALL h5fget_fileno_f(reopen_id, file_num2, error)
+ CALL check("h5fget_fileno_f",error,total_error)
+ IF(file_num1 .NE. file_num2) THEN
+ write(*,*) "file numbers don't match"
+ END IF
+
+ !
!Open the dataset based on the reopen_id.
!
CALL h5dopen_f(reopen_id, dsetname, dset_id, error)
diff --git a/fortran/test/tH5MISC_1_8.F90 b/fortran/test/tH5MISC_1_8.F90
index 79fbf3e..b8c777c 100644
--- a/fortran/test/tH5MISC_1_8.F90
+++ b/fortran/test/tH5MISC_1_8.F90
@@ -189,8 +189,9 @@ SUBROUTINE test_h5s_encode(total_error)
INTEGER(hid_t) :: sid1, sid3! Dataspace ID
INTEGER(hid_t) :: decoded_sid1, decoded_sid3
+ INTEGER(hid_t) :: fapl ! File access property
INTEGER :: rank ! LOGICAL rank of dataspace
- INTEGER(size_t) :: sbuf_size=0, scalar_size=0
+ INTEGER(size_t) :: new_size = 0, old_size = 0, orig_size=0, scalar_size=0
! Make sure the size is large
CHARACTER(LEN=288) :: sbuf
@@ -228,18 +229,36 @@ SUBROUTINE test_h5s_encode(total_error)
! Encode simple data space in a buffer
- ! First find the buffer size
- CALL H5Sencode_f(sid1, sbuf, sbuf_size, error)
- CALL check("H5Sencode", error, total_error)
+ ! Find the buffer size without fapl
+ CALL H5Sencode_f(sid1, sbuf, orig_size, error)
+ CALL check("H5Sencode_f", error, total_error)
+ CALL verify("H5Sencode_f", INT(orig_size), 279, total_error)
+
+ ! Create file access property list
+ CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error)
+ CALL check("h5pcreate_f", error, total_error)
+
+ ! Find the buffer size with fapl (default old format)
+ CALL H5Sencode_f(sid1, sbuf, old_size, error, fapl)
+ CALL check("H5Sencode_f", error, total_error)
+ CALL verify("H5Sencode_f", INT(old_size), 279, total_error)
+ ! Set fapl to latest file format
+ CALL H5Pset_libver_bounds_f(fapl, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, error)
+ CALL check("H5Pset_libver_bounds_f",error, total_error)
- ! Try decoding bogus buffer
+ ! Find the buffer size with fapl set to latest format
+ CALL H5Sencode_f(sid1, sbuf, new_size, error, fapl)
+ CALL check("H5Sencode_f", error, total_error)
+ CALL verify("H5Sencode_f", INT(new_size), 101, total_error)
+ ! Try decoding bogus buffer
CALL H5Sdecode_f(sbuf, decoded_sid1, error)
CALL verify("H5Sdecode", error, -1, total_error)
- CALL H5Sencode_f(sid1, sbuf, sbuf_size, error)
- CALL check("H5Sencode", error, total_error)
+ ! Encode according to the latest file format
+ CALL H5Sencode_f(sid1, sbuf, new_size, error, fapl)
+ CALL check("H5Sencode_f", error, total_error)
! Decode from the dataspace buffer and return an object handle
CALL H5Sdecode_f(sbuf, decoded_sid1, error)