diff options
-rw-r--r-- | fortran/src/H5Df.c | 242 | ||||
-rw-r--r-- | fortran/src/H5Dff.f90 | 97 | ||||
-rw-r--r-- | fortran/src/H5Pf.c | 24 | ||||
-rw-r--r-- | fortran/src/H5Rf.c | 72 | ||||
-rw-r--r-- | fortran/src/H5Rff.f90 | 40 | ||||
-rw-r--r-- | fortran/src/H5f90.h | 5 | ||||
-rw-r--r-- | fortran/src/H5f90proto.h | 31 |
7 files changed, 408 insertions, 103 deletions
diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c index 968e9a1..d4d70c0 100644 --- a/fortran/src/H5Df.c +++ b/fortran/src/H5Df.c @@ -167,6 +167,127 @@ nh5dwrite_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_ return ret_value; } +/*---------------------------------------------------------------------------- + * Name: h5dwrite_ref_obj_c + * Purpose: Call H5Dwrite to write a dataset of object references + * Inputs: dset_id - dataset identifier + * mem_type_id - memory datatype identifier + * mem_space_id - memory dataspace identifier + * file_space_id - memory dataspace identifier + * xfer_pr - identifier of transfer property list + * buf - data buffer with references to the objects. + * n - number of references to be stored. + * Returns: 0 on success,e-1 on failure + * Programmer: Elena Pourmal + * Monday, July 24, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5dwrite_ref_obj_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, int_f *n) +{ + int ret_value = -1; + herr_t ret; + hid_t c_dset_id; + hid_t c_mem_type_id; + hid_t c_mem_space_id; + hid_t c_file_space_id; + hid_t c_xfer_prp; + hobj_ref_t *buf_c; + int i; + + /* + * Define transfer property + */ + c_xfer_prp = *xfer_prp; + if ( H5P_DEFAULT_F == c_xfer_prp ) c_xfer_prp = H5P_DEFAULT; + + /* + * Allocate temporary buffer and copy references from Fortran. + */ + buf_c = (hobj_ref_t*)HDmalloc(sizeof(hobj_ref_t)*(*n)); + if ( buf_c != NULL ) { + for (i = 0; i < *n; i++) { + HDmemcpy(buf_c[i].oid, buf, H5R_OBJ_REF_BUF_SIZE); + buf = buf + REF_OBJ_BUF_LEN_F; + } + } + else return ret_value; + + /* + * Call H5Dwrite function. + */ + c_dset_id = (hid_t)*dset_id; + c_mem_type_id = (hid_t)*mem_type_id; + c_mem_space_id = (hid_t)*mem_space_id; + c_file_space_id = (hid_t)*file_space_id; + ret = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf_c); + HDfree(buf_c); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5dwrite_ref_reg_c + * Purpose: Call H5Dwrite to write a dataset of dataset region references + * Inputs: dset_id - dataset identifier + * mem_type_id - memory datatype identifier + * mem_space_id - memory dataspace identifier + * file_space_id - memory dataspace identifier + * xfer_pr - identifier of transfer property list + * buf - data buffer with references to the objects. + * n - number of references to be stored. + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Monday, July 24, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5dwrite_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, int_f *n) +{ + int ret_value = -1; + herr_t ret; + hid_t c_dset_id; + hid_t c_mem_type_id; + hid_t c_mem_space_id; + hid_t c_file_space_id; + hid_t c_xfer_prp; + hdset_reg_ref_t *buf_c; + int i; + + /* + * Define transfer property + */ + c_xfer_prp = *xfer_prp; + if ( H5P_DEFAULT_F == c_xfer_prp ) c_xfer_prp = H5P_DEFAULT; + + /* + * Allocate temporary buffer and copy references from Fortran. + */ + buf_c = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t)*(*n)); + if ( buf_c != NULL ) { + for (i = 0; i < *n; i++) { + HDmemcpy(buf_c[i].heapid, buf, H5R_DSET_REG_REF_BUF_SIZE); + buf = buf + REF_REG_BUF_LEN_F; + } + } + else return ret_value; + + + /* + * Call H5Dwrite function. + */ + c_dset_id = (hid_t)*dset_id; + c_mem_type_id = (hid_t)*mem_type_id; + c_mem_space_id = (hid_t)*mem_space_id; + c_file_space_id = (hid_t)*file_space_id; + ret = H5Dwrite(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf_c); + HDfree(buf_c); + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + /*---------------------------------------------------------------------------- * Name: h5dreadc_c @@ -241,6 +362,127 @@ nh5dread_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t } /*---------------------------------------------------------------------------- + * Name: h5dread_ref_obj_c + * Purpose: Call H5Dread to read a dataset of object references + * Inputs: dset_id - dataset identifier + * mem_type_id - memory datatype identifier + * mem_space_id - memory dataspace identifier + * file_space_id - memory dataspace identifier + * xfer_pr - identifier of transfer property list + * buf - data buffer to store references to the objects. + * n - number of references to be stored. + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Monday, July 24, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5dread_ref_obj_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f * buf, int_f *n) +{ + int ret_value = -1; + herr_t ret; + hid_t c_dset_id; + hid_t c_mem_type_id; + hid_t c_mem_space_id; + hid_t c_file_space_id; + hid_t c_xfer_prp; + hobj_ref_t *buf_c; + int i; + + /* + * Define transfer property + */ + c_xfer_prp = *xfer_prp; + if ( H5P_DEFAULT_F == c_xfer_prp ) c_xfer_prp = H5P_DEFAULT; + + /* + * Allocate temporary buffer. + */ + buf_c = (hobj_ref_t*)HDmalloc(sizeof(hobj_ref_t)*(*n)); + if ( buf_c != NULL ) { + /* + * Call H5Dread function. + */ + c_dset_id = (hid_t)*dset_id; + c_mem_type_id = (hid_t)*mem_type_id; + c_mem_space_id = (hid_t)*mem_space_id; + c_file_space_id = (hid_t)*file_space_id; + ret = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf_c); + if (ret >=0) { + for (i = 0; i < *n; i++) { + HDmemcpy(buf, buf_c[i].oid, H5R_OBJ_REF_BUF_SIZE); + buf = buf + REF_OBJ_BUF_LEN_F; + } + } + if ( buf_c != NULL ) HDfree(buf_c); + } + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + +/*---------------------------------------------------------------------------- + * Name: h5dread_ref_reg_c + * Purpose: Call H5Dread to read a dataset of dataset region references + * Inputs: dset_id - dataset identifier + * mem_type_id - memory datatype identifier + * mem_space_id - memory dataspace identifier + * file_space_id - memory dataspace identifier + * xfer_pr - identifier of transfer property list + * buf - data buffer to store references to the objects. + * n - number of references to be stored. + * Returns: 0 on success, -1 on failure + * Programmer: Elena Pourmal + * Monday, July 24, 2000 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5dread_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f * buf, int_f *n) +{ + int ret_value = -1; + herr_t ret; + hid_t c_dset_id; + hid_t c_mem_type_id; + hid_t c_mem_space_id; + hid_t c_file_space_id; + hid_t c_xfer_prp; + hdset_reg_ref_t *buf_c; + int i; + + /* + * Define transfer property + */ + c_xfer_prp = *xfer_prp; + if ( H5P_DEFAULT_F == c_xfer_prp ) c_xfer_prp = H5P_DEFAULT; + + /* + * Allocate temporary buffer. + */ + buf_c = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t)*(*n)); + if ( buf_c != NULL ) { + /* + * Call H5Dread function. + */ + c_dset_id = (hid_t)*dset_id; + c_mem_type_id = (hid_t)*mem_type_id; + c_mem_space_id = (hid_t)*mem_space_id; + c_file_space_id = (hid_t)*file_space_id; + ret = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, buf_c); + if (ret >=0) { + for (i = 0; i < *n; i++) { + HDmemcpy(buf, buf_c[i].heapid, H5R_DSET_REG_REF_BUF_SIZE); + buf = buf + REF_REG_BUF_LEN_F; + } + } + if ( buf_c != NULL ) HDfree(buf_c); + } + if (ret < 0) return ret_value; + ret_value = 0; + return ret_value; +} + + +/*---------------------------------------------------------------------------- * Name: h5dclose_c * Purpose: Call H5Dclose to close a dataset * Inputs: dset_id - identifier of the dataset to be closed diff --git a/fortran/src/H5Dff.f90 b/fortran/src/H5Dff.f90 index 5af83b8..000dd40 100644 --- a/fortran/src/H5Dff.f90 +++ b/fortran/src/H5Dff.f90 @@ -137,13 +137,14 @@ END SUBROUTINE h5dclose_f - SUBROUTINE h5dwrite_reference_obj(dset_id, mem_type_id, buf, hdferr, & + SUBROUTINE h5dwrite_reference_obj(dset_id, mem_type_id, buf, n, hdferr, & mem_space_id, file_space_id, xfer_prp) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier - TYPE(hobj_ref_t_f), DIMENSION(:), INTENT(IN) :: buf ! Data buffer + TYPE(hobj_ref_t_f), DIMENSION(N), INTENT(IN) :: buf ! Data buffer + INTEGER, INTENT(IN) :: n ! size of the bufffer buf INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id ! Memory dataspace identfier @@ -155,7 +156,9 @@ INTEGER(HID_T) :: xfer_prp_default INTEGER(HID_T) :: mem_space_id_default INTEGER(HID_T) :: file_space_id_default - INTEGER, EXTERNAL :: h5dwrite_c + INTEGER, ALLOCATABLE, DIMENSION(:) :: ref_buf + INTEGER :: i,j + INTEGER, EXTERNAL :: h5dwrite_ref_obj_c xfer_prp_default = H5P_DEFAULT_F mem_space_id_default = H5S_ALL_F @@ -164,19 +167,32 @@ if (present(xfer_prp)) xfer_prp_default = xfer_prp if (present(mem_space_id)) mem_space_id_default = mem_space_id if (present(file_space_id)) file_space_id_default = file_space_id - - hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & - file_space_id_default, xfer_prp_default, buf) + + allocate(ref_buf(REF_OBJ_BUF_LEN*n), stat=hdferr) + if (hdferr .NE. 0 ) then + hdferr = -1 + return + else + do j = 1, n + do i = 1, REF_OBJ_BUF_LEN + ref_buf(REF_OBJ_BUF_LEN*(j-1) + i ) = buf(j)%ref(i) + enddo + enddo + endif + hdferr = h5dwrite_ref_obj_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, ref_buf, n) + deallocate(ref_buf) END SUBROUTINE h5dwrite_reference_obj - SUBROUTINE h5dwrite_reference_dsetreg(dset_id, mem_type_id, buf, hdferr, & + SUBROUTINE h5dwrite_reference_dsetreg(dset_id, mem_type_id, buf, n, hdferr, & mem_space_id, file_space_id, xfer_prp) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier TYPE(hdset_reg_ref_t_f), DIMENSION(:), INTENT(IN) :: buf ! Data buffer + INTEGER, INTENT(IN) :: n ! size of the bufffer buf INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id ! Memory dataspace identfier @@ -188,7 +204,9 @@ INTEGER(HID_T) :: xfer_prp_default INTEGER(HID_T) :: mem_space_id_default INTEGER(HID_T) :: file_space_id_default - INTEGER, EXTERNAL :: h5dwrite_c + INTEGER, ALLOCATABLE, DIMENSION(:) :: ref_buf + INTEGER :: i,j + INTEGER, EXTERNAL :: h5dwrite_ref_reg_c xfer_prp_default = H5P_DEFAULT_F mem_space_id_default = H5S_ALL_F @@ -198,8 +216,20 @@ if (present(mem_space_id)) mem_space_id_default = mem_space_id if (present(file_space_id)) file_space_id_default = file_space_id - hdferr = h5dwrite_c(dset_id, mem_type_id, mem_space_id_default, & - file_space_id_default, xfer_prp_default, buf) + allocate(ref_buf(REF_REG_BUF_LEN*n), stat=hdferr) + if (hdferr .NE. 0 ) then + hdferr = -1 + return + else + do j = 1, n + do i = 1, REF_REG_BUF_LEN + ref_buf(REF_REG_BUF_LEN*(j-1) + i) = buf(j)%ref(i) + enddo + enddo + endif + hdferr = h5dwrite_ref_reg_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, ref_buf, n) + deallocate(ref_buf) END SUBROUTINE h5dwrite_reference_dsetreg @@ -1265,13 +1295,14 @@ END SUBROUTINE h5dwrite_double_7 - SUBROUTINE h5dread_reference_obj(dset_id, mem_type_id, buf, hdferr, & + SUBROUTINE h5dread_reference_obj(dset_id, mem_type_id, buf, n, hdferr, & mem_space_id, file_space_id, xfer_prp) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier - TYPE(hobj_ref_t_f), DIMENSION(:), INTENT(INOUT) :: buf ! Data buffer + TYPE(hobj_ref_t_f), DIMENSION(N), INTENT(INOUT) :: buf ! Data buffer + INTEGER, INTENT(IN) :: n ! Size of the budffer buf INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id ! Memory dataspace identfier @@ -1283,7 +1314,14 @@ INTEGER(HID_T) :: xfer_prp_default INTEGER(HID_T) :: mem_space_id_default INTEGER(HID_T) :: file_space_id_default - INTEGER, EXTERNAL :: h5dread_c + INTEGER, EXTERNAL :: h5dread_ref_obj_c + INTEGER, ALLOCATABLE, DIMENSION(:) :: ref_buf + INTEGER :: i,j + allocate(ref_buf(REF_OBJ_BUF_LEN*n), stat=hdferr) + if (hdferr .NE. 0) then + hdferr = -1 + return + endif xfer_prp_default = H5P_DEFAULT_F mem_space_id_default = H5S_ALL_F @@ -1293,18 +1331,24 @@ if (present(mem_space_id)) mem_space_id_default = mem_space_id if (present(file_space_id)) file_space_id_default = file_space_id - hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & - file_space_id_default, xfer_prp_default, buf) - + hdferr = h5dread_ref_obj_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, ref_buf, n) + do j = 1, n + do i = 1, REF_OBJ_BUF_LEN + buf(j)%ref(i) = ref_buf(REF_OBJ_BUF_LEN*(j-1) + i) + enddo + enddo + deallocate(ref_buf) END SUBROUTINE h5dread_reference_obj - SUBROUTINE h5dread_reference_dsetreg(dset_id, mem_type_id, buf, hdferr, & + SUBROUTINE h5dread_reference_dsetreg(dset_id, mem_type_id, buf, n, hdferr, & mem_space_id, file_space_id, xfer_prp) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier TYPE(hdset_reg_ref_t_f), DIMENSION(:), INTENT(INOUT) :: buf ! Data buffer + INTEGER, INTENT(IN) :: n ! Size of the buffer buf INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id ! Memory dataspace identfier @@ -1316,7 +1360,14 @@ INTEGER(HID_T) :: xfer_prp_default INTEGER(HID_T) :: mem_space_id_default INTEGER(HID_T) :: file_space_id_default - INTEGER, EXTERNAL :: h5dread_c + INTEGER, ALLOCATABLE, DIMENSION(:) :: ref_buf + INTEGER :: i,j + INTEGER, EXTERNAL :: h5dread_ref_reg_c + allocate(ref_buf(REF_REG_BUF_LEN*n), stat=hdferr) + if (hdferr .NE. 0) then + hdferr = -1 + return + endif xfer_prp_default = H5P_DEFAULT_F mem_space_id_default = H5S_ALL_F @@ -1326,9 +1377,15 @@ if (present(mem_space_id)) mem_space_id_default = mem_space_id if (present(file_space_id)) file_space_id_default = file_space_id - hdferr = h5dread_c(dset_id, mem_type_id, mem_space_id_default, & - file_space_id_default, xfer_prp_default, buf) + hdferr = h5dread_ref_reg_c(dset_id, mem_type_id, mem_space_id_default, & + file_space_id_default, xfer_prp_default, ref_buf, n) + do j = 1, n + do i = 1, REF_REG_BUF_LEN + buf(j)%ref(i) = ref_buf(REF_REG_BUF_LEN*(j-1) + i) + enddo + enddo + deallocate(ref_buf) END SUBROUTINE h5dread_reference_dsetreg diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 038e083..77cfaea 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -735,16 +735,20 @@ int_f nh5pget_driver_c (hid_t_f *prp_id, int_f* driver) { int ret_value = -1; + /* hid_t c_prp_id; H5F_driver_t c_driver; + */ /* * Call H5Pget_driver function. */ + /* c_prp_id = *prp_id; c_driver = H5Pget_driver(c_prp_id); *driver = (int_f) c_driver; if (c_driver < 0) return ret_value; + */ ret_value = 0; return ret_value; } @@ -769,7 +773,7 @@ nh5pset_stdio_c (hid_t_f *prp_id) * Call H5Pset_stdio function. */ c_prp_id = *prp_id; - ret = H5Pset_stdio(c_prp_id); + /* ret = H5Pset_stdio(c_prp_id); */ if (ret < 0) return ret_value; ret_value = 0; return ret_value; @@ -797,7 +801,7 @@ nh5pget_stdio_c (hid_t_f *prp_id, int_f* io) * Call H5Pget_stdio function. */ c_prp_id = *prp_id; - ret = H5Pget_stdio(c_prp_id); + /* ret = H5Pget_stdio(c_prp_id); */ if (ret < 0) return ret_value; *io = (int_f)ret; ret_value = 0; @@ -824,7 +828,7 @@ nh5pset_sec2_c (hid_t_f *prp_id) * Call H5Pset_sec2 function. */ c_prp_id = *prp_id; - ret = H5Pset_sec2(c_prp_id); + /* ret = H5Pset_sec2(c_prp_id); */ if (ret < 0) return ret_value; ret_value = 0; return ret_value; @@ -852,7 +856,7 @@ nh5pget_sec2_c (hid_t_f *prp_id, int_f* sec2) * Call H5Pget_sec2 function. */ c_prp_id = *prp_id; - ret = H5Pget_sec2(c_prp_id); + /* ret = H5Pget_sec2(c_prp_id); */ if (ret < 0) return ret_value; *sec2 = (int_f)ret; ret_value = 0; @@ -945,7 +949,7 @@ nh5pset_core_c (hid_t_f *prp_id, size_t_f* increment) * Call H5Pset_core function. */ c_prp_id = *prp_id; - ret = H5Pset_core(c_prp_id, c_increment); + /* ret = H5Pset_core(c_prp_id, c_increment); */ if (ret < 0) return ret_value; ret_value = 0; return ret_value; @@ -973,7 +977,7 @@ nh5pget_core_c (hid_t_f *prp_id, size_t_f* increment) * Call H5Pset_increment function. */ c_prp_id = *prp_id; - ret = H5Pget_core(c_prp_id, &c_increment); + /* ret = H5Pget_core(c_prp_id, &c_increment); */ if (ret < 0) return ret_value; *increment = (size_t_f)c_increment; ret_value = 0; @@ -1007,7 +1011,7 @@ nh5pset_family_c(hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist ) * Call H5Pset_family function. */ c_prp_id = *prp_id; - ret = H5Pset_family(c_prp_id, c_memb_size, c_memb_plist); + /* ret = H5Pset_family(c_prp_id, c_memb_size, c_memb_plist); */ if (ret < 0) return ret_value; ret_value = 0; return ret_value; @@ -1038,7 +1042,7 @@ nh5pget_family_c(hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist) * Call H5Pget_family function. */ c_prp_id = *prp_id; - ret = H5Pget_family(c_prp_id, &c_memb_size, &c_memb_plist); + /* ret = H5Pget_family(c_prp_id, &c_memb_size, &c_memb_plist); */ if (ret < 0) return ret_value; *memb_size = (hsize_t_f)c_memb_size; *memb_plist = (hsize_t_f)c_memb_plist; @@ -1166,7 +1170,7 @@ nh5pset_split_c(hid_t_f *prp_id, int_f* meta_len, _fcd meta_ext, hid_t_f* meta_p c_prp_id = *prp_id; c_meta_plist = *meta_plist; c_raw_plist = *raw_plist; - ret = H5Pset_split(c_prp_id, c_meta_ext, c_meta_plist, c_raw_ext, c_raw_plist ); + /*ret = H5Pset_split(c_prp_id, c_meta_ext, c_meta_plist, c_raw_ext, c_raw_plist );*/ if (ret < 0) return ret_value; ret_value = 0; return ret_value; @@ -1213,7 +1217,7 @@ nh5pget_split_c(hid_t_f *prp_id, size_t_f* meta_ext_size , _fcd meta_ext, hid_t_ * Call H5Pget_split function. */ c_prp_id = *prp_id; - ret = H5Pget_split(c_prp_id, c_meta_ext_size, c_meta_ext,&c_meta_plist, c_raw_ext_size, c_raw_ext, &c_raw_plist ); + /*ret = H5Pget_split(c_prp_id, c_meta_ext_size, c_meta_ext,&c_meta_plist, c_raw_ext_size, c_raw_ext, &c_raw_plist ); */ if (ret < 0) return ret_value; *meta_plist = c_meta_plist; diff --git a/fortran/src/H5Rf.c b/fortran/src/H5Rf.c index 16e0f4a..ecfd46c 100644 --- a/fortran/src/H5Rf.c +++ b/fortran/src/H5Rf.c @@ -13,7 +13,7 @@ * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rcreate_object_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen) +nh5rcreate_object_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen) { int ret_value = -1; hid_t c_loc_id; @@ -35,18 +35,14 @@ nh5rcreate_object_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen) */ c_loc_id = *loc_id; ret_value_c = H5Rcreate(&ref_c, c_loc_id, c_name, H5R_OBJECT, -1); + HDfree(c_name); - if (ret_value_c >= 0) { - for(i=0; i < H5R_OBJ_REF_BUF_SIZE; i++) - { -#if defined(_UNICOS) - ref.c_pointer[i]=ref_c.oid[i]; -#else - ref[i]=ref_c.oid[i]; -#endif - } + if (ret_value_c >= 0) { + HDmemcpy(ref, ref_c.oid, H5R_OBJ_REF_BUF_SIZE); ret_value = 0; } + + ret_value = 0; return ret_value; } @@ -65,7 +61,7 @@ nh5rcreate_object_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen) * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rcreate_region_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id) +nh5rcreate_region_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id) { int ret_value = -1; hid_t c_loc_id; @@ -89,16 +85,10 @@ nh5rcreate_region_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t c_loc_id = *loc_id; c_space_id = *space_id; ret_value_c = H5Rcreate(&ref_c, c_loc_id, c_name, H5R_DATASET_REGION, c_space_id); + HDfree(c_name); if (ret_value_c >= 0) { - for(i=0; i < H5R_DSET_REG_REF_BUF_SIZE; i++) - { -#if defined(_UNICOS) - ref.c_pointer[i]=ref_c.heapid[i]; -#else - ref[i]=ref_c.heapid[i]; -#endif - } + HDmemcpy (ref, ref_c.heapid, H5R_DSET_REG_REF_BUF_SIZE); ret_value = 0; } return ret_value; @@ -116,7 +106,7 @@ nh5rcreate_region_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rdereference_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id) +nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id) { int ret_value = -1; hid_t c_dset_id; @@ -124,14 +114,7 @@ nh5rdereference_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id) hid_t c_obj_id; int i; - for(i=0; i < H5R_DSET_REG_REF_BUF_SIZE; i++) { - -#if defined(_UNICOS) - ref_c.heapid[i]=ref.c_pointer[i]; -#else - ref_c.heapid[i]=ref[i]; -#endif - } + HDmemcpy (ref_c.heapid, ref, H5R_DSET_REG_REF_BUF_SIZE); /* * Call H5Rdereference function. @@ -157,7 +140,7 @@ nh5rdereference_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id) * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rdereference_object_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id) +nh5rdereference_object_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id) { int ret_value = -1; hid_t c_dset_id; @@ -165,14 +148,7 @@ nh5rdereference_object_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id) hobj_ref_t ref_c; int i; - for(i=0; i < H5R_OBJ_REF_BUF_SIZE; i++) { - -#if defined(_UNICOS) - ref_c.oid[i]=ref.c_pointer[i]; -#else - ref_c.oid[i]=ref[i]; -#endif - } + HDmemcpy (ref_c.oid, ref, H5R_OBJ_REF_BUF_SIZE); /* * Call H5Rdereference function. @@ -197,7 +173,7 @@ nh5rdereference_object_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id) * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rget_region_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *space_id) +nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id) { int ret_value = -1; hid_t c_dset_id; @@ -205,14 +181,7 @@ nh5rget_region_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *space_id) hdset_reg_ref_t ref_c; int i; - for(i=0; i < H5R_DSET_REG_REF_BUF_SIZE; i++) { - -#if defined(_UNICOS) - ref_c.heapid[i]=ref.c_pointer[i]; -#else - ref_c.heapid[i]=ref[i]; -#endif - } + HDmemcpy (ref_c.heapid, ref, H5R_DSET_REG_REF_BUF_SIZE); /* * Call H5Rget_region function. @@ -238,7 +207,7 @@ nh5rget_region_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *space_id) * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5rget_object_type_obj_c (hid_t_f *dset_id, _fcd ref, int_f *obj_type) +nh5rget_object_type_obj_c (hid_t_f *dset_id, int_f *ref, int_f *obj_type) { int ret_value = -1; hid_t c_dset_id; @@ -246,14 +215,7 @@ nh5rget_object_type_obj_c (hid_t_f *dset_id, _fcd ref, int_f *obj_type) hobj_ref_t ref_c; int i; - for(i=0; i < H5R_OBJ_REF_BUF_SIZE; i++) { - -#if defined(_UNICOS) - ref_c.oid[i]=ref.c_pointer[i]; -#else - ref_c.oid[i]=ref[i]; -#endif - } + HDmemcpy (ref_c.oid, ref, H5R_OBJ_REF_BUF_SIZE); /* * Call H5Rget_object_type function. diff --git a/fortran/src/H5Rff.f90 b/fortran/src/H5Rff.f90 index 3fd9142..b9d373e 100644 --- a/fortran/src/H5Rff.f90 +++ b/fortran/src/H5Rff.f90 @@ -4,15 +4,17 @@ MODULE H5R USE H5FORTRAN_TYPES USE H5FORTRAN_FLAGS +! If you change the value of these parameters, do not forget to change corresponding +! values in the H5f90.h file. + INTEGER, PARAMETER :: REF_OBJ_BUF_LEN = 2 + INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 TYPE hobj_ref_t_f - !INTEGER(KIND=4) ref(2) could cause trouble on Crays - CHARACTER ref(8) + INTEGER ref(REF_OBJ_BUF_LEN) END TYPE TYPE hdset_reg_ref_t_f - !INTEGER(KIND=4) reg_ref(3) could cause troubles on Crays - CHARACTER ref(12) + INTEGER ref(REF_REG_BUF_LEN) END TYPE INTERFACE h5rcreate_f @@ -54,11 +56,15 @@ INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER :: namelen ! Name length + INTEGER :: ref_f(REF_OBJ_BUF_LEN) ! Local buffer to pass reference INTEGER, EXTERNAL :: h5rcreate_object_c namelen = LEN(name) - hdferr = h5rcreate_object_c(ref, loc_id, name, namelen ) - + ref_f = 0 + hdferr = h5rcreate_object_c(ref_f, loc_id, name, namelen ) + ref%ref = ref_f + END SUBROUTINE h5rcreate_object_f + SUBROUTINE h5rcreate_region_f(loc_id, name, space_id, ref, hdferr) IMPLICIT NONE @@ -70,9 +76,12 @@ INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER :: namelen ! Name length + INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference INTEGER, EXTERNAL :: h5rcreate_region_c namelen = LEN(name) - hdferr = h5rcreate_region_c(ref, loc_id, name, namelen, space_id ) + ref_f = 0 + hdferr = h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id ) + ref%ref = ref_f END SUBROUTINE h5rcreate_region_f @@ -84,9 +93,10 @@ INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER :: ref_type ! Reference type + INTEGER :: ref_f(REF_OBJ_BUF_LEN) ! Local buffer to pass reference INTEGER, EXTERNAL :: h5rdereference_object_c - ref_type = H5R_OBJECT_F - hdferr = h5rdereference_object_c(dset_id, ref, obj_id ) + ref_f = ref%ref + hdferr = h5rdereference_object_c(dset_id, ref_f, obj_id ) END SUBROUTINE h5rdereference_object_f @@ -98,9 +108,11 @@ INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER :: ref_type ! Reference type + INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference INTEGER, EXTERNAL :: h5rdereference_region_c ref_type = H5R_DATASET_REGION_F - hdferr = h5rdereference_region_c(dset_id, ref, obj_id ) + ref_f = ref%ref + hdferr = h5rdereference_region_c(dset_id, ref_f, obj_id ) END SUBROUTINE h5rdereference_region_f @@ -111,9 +123,11 @@ TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference INTEGER(HID_T), INTENT(OUT) :: space_id ! Space identifier INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference INTEGER, EXTERNAL :: h5rget_region_region_c - hdferr = h5rget_region_region_c(dset_id, ref, space_id ) + ref_f = ref%ref + hdferr = h5rget_region_region_c(dset_id, ref_f, space_id ) END SUBROUTINE h5rget_region_region_f @@ -129,9 +143,11 @@ ! H5G_TYPE_F 3 INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER :: ref_f(REF_OBJ_BUF_LEN) ! Local buffer to pass reference INTEGER, EXTERNAL :: h5rget_object_type_obj_c - hdferr = h5rget_object_type_obj_c(dset_id, ref, obj_type ) + ref_f = ref%ref + hdferr = h5rget_object_type_obj_c(dset_id, ref_f, obj_type ) END SUBROUTINE h5rget_object_type_obj_f diff --git a/fortran/src/H5f90.h b/fortran/src/H5f90.h index c01cd1f..68ff0ad 100644 --- a/fortran/src/H5f90.h +++ b/fortran/src/H5f90.h @@ -32,6 +32,11 @@ #define H5S_ALL_F -2 +/* Constants used in H5Rff.f90 and H5Rf.c files */ + +#define REF_OBJ_BUF_LEN_F 2 +#define REF_REG_BUF_LEN_F 3 + /* Constants used in H5Sf.c and H5Sff.f90 files */ #define H5S_NO_CLASS_F -1 diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index f759038..eec43d1 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -173,8 +173,12 @@ extern int_f nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *ne # define nh5dclose_c FNAME(H5DCLOSE_C) # define nh5dopen_c FNAME(H5DOPEN_C) # define nh5dwrite_c FNAME(H5DWRITE_C) +# define nh5dwrite_ref_obj_c FNAME(H5DWRITE_REF_OBJ_C) +# define nh5dwrite_ref_reg_c FNAME(H5DWRITE_REF_REG_C) # define nh5dwritec_c FNAME(H5DWRITEC_C) # define nh5dread_c FNAME(H5DREAD_C) +# define nh5dread_ref_reg_c FNAME(H5DREAD_REF_REG_C) +# define nh5dread_ref_obj_c FNAME(H5DREAD_REF_OBJ_C) # define nh5dreadc_c FNAME(H5DREADC_C) # define nh5dget_space_c FNAME(H5DGET_SPACE_C) # define nh5dget_type_c FNAME(H5DGET_TYPE_C) @@ -186,7 +190,11 @@ extern int_f nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *ne # define nh5dopen_c FNAME(h5dopen_c) # define nh5dwrite_c FNAME(h5dwrite_c) # define nh5dwritec_c FNAME(h5dwritec_c) +# define nh5dwrite_ref_obj_c FNAME(h5dwrite_ref_obj_c) +# define nh5dwrite_ref_reg_c FNAME(h5dwrite_ref_reg_c) # define nh5dread_c FNAME(h5dread_c) +# define nh5dread_ref_reg_c FNAME(h5dread_ref_reg_c) +# define nh5dread_ref_obj_c FNAME(h5dread_ref_obj_c) # define nh5dreadc_c FNAME(h5dreadc_c) # define nh5dget_space_c FNAME(h5dget_space_c) # define nh5dget_type_c FNAME(h5dget_type_c) @@ -205,6 +213,11 @@ extern int_f nh5dclose_c ( hid_t_f *dset_id ); extern int_f nh5dwrite_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf); +extern int_f nh5dwrite_ref_obj_c +(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, int_f *n); + +extern int_f nh5dwrite_ref_reg_c +(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, int_f *n); extern int_f nh5dwritec_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf); @@ -213,6 +226,12 @@ extern int_f nh5dread_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf); +extern int_f nh5dread_ref_obj_c +(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, int_f *n); + +extern int_f nh5dread_ref_reg_c +(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, int_f *n); + extern int_f nh5dreadc_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf); @@ -793,23 +812,23 @@ nh5pset_xfer_c(hid_t_f *prp_id, int_f* data_xfer_mode); #endif /* H5Rf90_FNAMES */ extern int_f -nh5rcreate_object_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen); +nh5rcreate_object_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen); extern int_f -nh5rcreate_region_c (_fcd ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id); +nh5rcreate_region_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id); extern int_f -nh5rdereference_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id); +nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id); extern int_f -nh5rdereference_object_c (hid_t_f *dset_id, _fcd ref, hid_t_f *obj_id); +nh5rdereference_object_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id); extern int_f -nh5rget_region_region_c (hid_t_f *dset_id, _fcd ref, hid_t_f *space_id); +nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id); extern int_f -nh5rget_object_type_obj_c (hid_t_f *dset_id, _fcd ref, int_f *obj_type); +nh5rget_object_type_obj_c (hid_t_f *dset_id, int_f *ref, int_f *obj_type); /* * Functions from H5If.c |