summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2002-10-02 19:15:43 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2002-10-02 19:15:43 (GMT)
commitacb356d30928d02170dd275073d19344e2f0cb9b (patch)
tree5a9e0a7c45954580f5e7eea33378807e4f99ea35 /fortran
parent26cd535ff23e4f6f440a4aa28e409f474ef92f66 (diff)
downloadhdf5-acb356d30928d02170dd275073d19344e2f0cb9b.zip
hdf5-acb356d30928d02170dd275073d19344e2f0cb9b.tar.gz
hdf5-acb356d30928d02170dd275073d19344e2f0cb9b.tar.bz2
[svn-r5958]
Purpose: Added missing fortran functions h5set(get)_buffer_f. Also added docs and tests for them. Solution: Currently functions do not accept conversion and background buffers. This corresponds to H5set(get)_buffer call with buffer pointers set to NULL. If there is a demand, I can overload the functions to have new parameters and go through all trouble creating functions for all supported datatypes. Platforms tested: Solaris 2.7, Linux 2.2., IRIX64-6.5
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5Pf.c51
-rw-r--r--fortran/src/H5Pff.f90103
-rw-r--r--fortran/src/H5f90proto.h6
-rw-r--r--fortran/test/tH5P.f9018
4 files changed, 178 insertions, 0 deletions
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c
index 438b07d..0e08e28 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -1886,3 +1886,54 @@ nh5pset_fclose_degree_c ( hid_t_f *fapl_id , int_f *degree)
ret_value = 0;
return ret_value;
}
+
+/*----------------------------------------------------------------------------
+ * Name: h5pset_buffer_c
+ * Purpose: Call H5Pset_buffer to set size of conversion buffer
+ * Inputs: prp_id - t`dataset trasfer property list identifier
+ * size - size of the buffer
+ * Outputs: NONE
+ * Returns: 0 on success, -1 on failure
+ * Programmer: Elena Pourmal
+ * Wednesday, October 2, 2002
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5pset_buffer_c ( hid_t_f *prp_id , hsize_t_f *size)
+{
+ int ret_value = 0;
+ hid_t c_prp_id;
+ hsize_t c_size;
+
+ c_prp_id = (hid_t)*prp_id;
+ c_size = (hsize_t)*size;
+ if ( H5Pset_buffer(c_prp_id, c_size, NULL, NULL) < 0 ) ret_value = -1;
+ return ret_value;
+}
+
+/*----------------------------------------------------------------------------
+ * Name: h5pget_buffer_c
+ * Purpose: Call H5Pget_buffer to get size of conversion buffer
+ * Inputs: prp_id - t`dataset trasfer property list identifier
+ * Outputs: size - size of conversion buffer
+ * Returns: 0 on success, -1 on failure
+ * Programmer: Elena Pourmal
+ * Wednesday, October 2, 2002
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5pget_buffer_c ( hid_t_f *prp_id , hsize_t_f *size)
+{
+ int ret_value = -1;
+ hid_t c_prp_id;
+ hsize_t c_size;
+
+ c_prp_id = (hid_t)*prp_id;
+ c_size = H5Pget_buffer(c_prp_id, NULL, NULL);
+ if ( c_size < 0 ) return ret_value;
+ *size = (hsize_t)c_size;
+ ret_value = 0;
+ return ret_value;
+}
diff --git a/fortran/src/H5Pff.f90 b/fortran/src/H5Pff.f90
index b2eed09..f360660 100644
--- a/fortran/src/H5Pff.f90
+++ b/fortran/src/H5Pff.f90
@@ -3327,4 +3327,107 @@
if (c_flag .GT. 0) flag = .TRUE.
END SUBROUTINE h5pequal_f
+!----------------------------------------------------------------------
+! Name: h5pset_buffer_f
+!
+! Purpose: Sets sixe for conversion buffer
+!
+! Inputs:
+! plist_id - data transfer property list identifier
+! size - buffer size
+! Outputs:
+! hdferr: - error code
+! Success: 0
+! Failure: -1
+! Optional parameters:
+! NONE
+!
+! Programmer: Elena Pourmal
+! October 2, 2002
+!
+! Modifications:
+!
+! Comment:
+!----------------------------------------------------------------------
+
+ SUBROUTINE h5pset_buffer_f(plist_id, size, hdferr)
+!
+!This definition is needed for Windows DLLs
+!DEC$if defined(BUILD_HDF5_DLL)
+!DEC$attributes dllexport :: h5pset_buffer_f
+!DEC$endif
+!
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: plist_id ! Data transfer property list identifier
+ INTEGER(HSIZE_T), INTENT(IN) :: size ! Buffer size in bytes;
+ ! buffer is allocated and freed by
+ ! the library.
+ INTEGER, INTENT(OUT) :: hdferr ! Error code
+
+ INTERFACE
+ INTEGER FUNCTION h5pset_buffer_c(plist_id, size)
+ USE H5GLOBAL
+ !DEC$ IF DEFINED(HDF5F90_WINDOWS)
+ !MS$ATTRIBUTES C,reference,alias:'_H5PSET_BUFFER_C'::h5pset_buffer_c
+ !DEC$ ENDIF
+ INTEGER(HID_T), INTENT(IN) :: plist_id
+ INTEGER(HSIZE_T), INTENT(IN) :: size
+ END FUNCTION h5pset_buffer_c
+ END INTERFACE
+
+ hdferr = h5pset_buffer_c(plist_id, size)
+ END SUBROUTINE h5pset_buffer_f
+
+!----------------------------------------------------------------------
+! Name: h5pget_buffer_f
+!
+! Purpose: Gets size for conversion buffer
+!
+! Inputs:
+! plist_id - data transfer property list identifier
+! Outputs:
+! size - buffer size
+! hdferr: - error code
+! Success: 0
+! Failure: -1
+! Optional parameters:
+! NONE
+!
+! Programmer: Elena Pourmal
+! October 2, 2002
+!
+! Modifications:
+!
+! Comment:
+!----------------------------------------------------------------------
+
+ SUBROUTINE h5pget_buffer_f(plist_id, size, hdferr)
+!
+!This definition is needed for Windows DLLs
+!DEC$if defined(BUILD_HDF5_DLL)
+!DEC$attributes dllexport :: h5pget_buffer_f
+!DEC$endif
+!
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: plist_id ! Data transfer property list identifier
+ INTEGER(HSIZE_T), INTENT(OUT) :: size ! Buffer size in bytes;
+ ! buffer is allocated and freed by
+ ! the library.
+ INTEGER, INTENT(OUT) :: hdferr ! Error code
+
+ INTERFACE
+ INTEGER FUNCTION h5pget_buffer_c(plist_id, size)
+ USE H5GLOBAL
+ !DEC$ IF DEFINED(HDF5F90_WINDOWS)
+ !MS$ATTRIBUTES C,reference,alias:'_H5PGET_BUFFER_C'::h5pget_buffer_c
+ !DEC$ ENDIF
+ INTEGER(HID_T), INTENT(IN) :: plist_id
+ INTEGER(HSIZE_T), INTENT(OUT) :: size
+ END FUNCTION h5pget_buffer_c
+ END INTERFACE
+
+ hdferr = h5pget_buffer_c(plist_id, size)
+ END SUBROUTINE h5pget_buffer_f
+
+
END MODULE H5P
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index b87f898..129c7a5 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -657,6 +657,8 @@ nh5tget_super_c ( hid_t_f *type_id , hid_t_f *base_type_id);
# define nh5pget_dxpl_mpio_c FNAME(H5PGET_DXPL_MPIO_C)
# define nh5pget_fclose_degree_c FNAME(H5PGET_FCLOSE_DEGREE_C)
# define nh5pset_fclose_degree_c FNAME(H5PSET_FCLOSE_DEGREE_C)
+# define nh5pset_buffer_c FNAME(H5PSET_BUFFER_C)
+# define nh5pget_buffer_c FNAME(H5PGET_BUFFER_C)
#else
# define nh5pcreate_c FNAME(h5pcreate_c)
@@ -717,6 +719,8 @@ nh5tget_super_c ( hid_t_f *type_id , hid_t_f *base_type_id);
# define nh5pget_dxpl_mpio_c FNAME(h5pget_dxpl_mpio_c)
# define nh5pget_fclose_degree_c FNAME(h5pget_fclose_degree_c)
# define nh5pset_fclose_degree_c FNAME(h5pset_fclose_degree_c)
+# define nh5pset_buffer_c FNAME(h5pset_buffer_c)
+# define nh5pget_buffer_c FNAME(h5pget_buffer_c)
#endif
@@ -841,6 +845,8 @@ H5_DLL int_f
nh5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f* data_xfer_mode);
H5_DLL int_f nh5pset_fclose_degree_c(hid_t_f *fapl, int_f *degree);
H5_DLL int_f nh5pget_fclose_degree_c(hid_t_f *fapl, int_f *degree);
+H5_DLL int_f nh5pget_buffer_c(hid_t_f *plist, hsize_t_f *size);
+H5_DLL int_f nh5pset_buffer_c(hid_t_f *plist, hsize_t_f *size);
/*
* Functions frome H5Rf.c
*/
diff --git a/fortran/test/tH5P.f90 b/fortran/test/tH5P.f90
index 440f814..2c8ad2e 100644
--- a/fortran/test/tH5P.f90
+++ b/fortran/test/tH5P.f90
@@ -44,6 +44,10 @@
INTEGER :: count !number of external files for the
!specified dataset
INTEGER(SIZE_T) :: namesize
+ INTEGER(HSIZE_T) :: size, buf_size
+
+ buf_size = 4*1024*1024
+
!
@@ -57,6 +61,20 @@
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