summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5Ff.c34
-rw-r--r--fortran/src/H5Fff.F9038
-rw-r--r--fortran/src/H5f90proto.h1
-rw-r--r--fortran/test/tH5F.F9029
4 files changed, 102 insertions, 0 deletions
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/H5f90proto.h b/fortran/src/H5f90proto.h
index 554ad0f..b357715 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
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)