summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@koziol.gov>2019-06-16 02:25:28 (GMT)
committerQuincey Koziol <koziol@koziol.gov>2019-06-16 02:25:28 (GMT)
commit0525ee122f1394439f42055cf2fb5ca33ed985bb (patch)
tree3a6731bdfd04e386513818d28ba82fd40f02f4a9 /fortran
parent462b924eca41b01c312d9533869f6bcaf4cc2d55 (diff)
downloadhdf5-0525ee122f1394439f42055cf2fb5ca33ed985bb.zip
hdf5-0525ee122f1394439f42055cf2fb5ca33ed985bb.tar.gz
hdf5-0525ee122f1394439f42055cf2fb5ca33ed985bb.tar.bz2
New hyperslab selection routines and new public selection iterator routines.
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5Sf.c159
-rw-r--r--fortran/src/H5Sff.F90304
-rw-r--r--fortran/src/H5f90proto.h3
3 files changed, 466 insertions, 0 deletions
diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c
index 8abea25..1031914 100644
--- a/fortran/src/H5Sf.c
+++ b/fortran/src/H5Sf.c
@@ -994,6 +994,165 @@ done:
return ret_value;
}
+/****if* H5Sf/h5scombine_hyperslab_c
+ * NAME
+ * h5scombine_hyperslab_c
+ * PURPOSE
+ * Call H5Scombine_hyperslab
+ * INPUTS
+ * space_id - identifier of the dataspace
+ * operator - defines how the new selection is combined
+ * start - offset of start of hyperslab
+ * count - number of blocks included in the hyperslab
+ * stride - hyperslab stride (interval between blocks)
+ * block - size of block in the hyperslab
+ * OUTPUTS
+ * hyper_id - identifier for the new dataspace
+ * RETURNS
+ * 0 on success, -1 on failure
+ * AUTHOR
+ * Elena Pourmal
+ * Monday, October 7, 2002
+ * HISTORY
+ *
+ * SOURCE
+*/
+
+int_f
+h5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id)
+/******/
+{
+ int ret_value = -1;
+ hid_t c_space_id;
+ hid_t c_hyper_id;
+ hsize_t *c_start = NULL;
+ hsize_t *c_count = NULL;
+ hsize_t *c_stride = NULL;
+ hsize_t *c_block = NULL;
+
+ H5S_seloper_t c_op;
+ herr_t status;
+ int rank;
+ int i;
+
+ rank = H5Sget_simple_extent_ndims(*space_id);
+ if (rank < 0 ) return ret_value;
+ c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
+ if (c_start == NULL) goto DONE;
+
+ c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
+ if (c_count == NULL) goto DONE;
+
+ c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
+ if (c_stride == NULL) goto DONE;
+
+ c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
+ if (c_block == NULL) goto DONE;
+
+
+ /*
+ * Reverse dimensions due to C-FORTRAN storage order.
+ */
+
+ for (i=0; i < rank; i++) {
+ int t= (rank - i) - 1;
+ c_start[i] = (hsize_t)start[t];
+ c_count[i] = (hsize_t)count[t];
+ c_stride[i] = (hsize_t)stride[t];
+ c_block[i] = (hsize_t)block[t];
+ }
+
+ c_op = (H5S_seloper_t)*op;
+
+ c_space_id = (hid_t)*space_id;
+ c_hyper_id = H5Scombine_hyperslab(c_space_id, c_op, c_start, c_stride, c_count, c_block);
+ if ( c_hyper_id < 0 ) goto DONE;
+ *hyper_id = (hid_t_f)c_hyper_id;
+ ret_value = 0;
+DONE:
+ if(c_start != NULL) HDfree(c_start);
+ if(c_count != NULL) HDfree(c_count);
+ if(c_stride!= NULL) HDfree(c_stride);
+ if(c_block != NULL) HDfree(c_block);
+ return ret_value;
+}
+/****if* H5Sf/h5scombine_select_c
+ * NAME
+ * h5scombine_select_c
+ * PURPOSE
+ * Call H5Scombine_ select
+ * INPUTS
+ * space1_id - identifier of the first dataspace
+ * operator - defines how the new selection is combined
+ * space2_id - identifier of the second dataspace
+ * OUTPUTS
+ * ds_id - identifier for the new dataspace
+ * RETURNS
+ * 0 on success, -1 on failure
+ * AUTHOR
+ * Elena Pourmal
+ * Monday, October 7, 2002
+ * HISTORY
+ *
+ * SOURCE
+*/
+
+int_f
+h5scombine_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_f *ds_id)
+/******/
+{
+ int ret_value = -1;
+ hid_t c_space1_id;
+ hid_t c_space2_id;
+ hid_t c_ds_id;
+ H5S_seloper_t c_op;
+
+ c_op = (H5S_seloper_t)*op;
+
+ c_space1_id = (hid_t)*space1_id;
+ c_space2_id = (hid_t)*space2_id;
+ c_ds_id = H5Scombine_select(c_space1_id, c_op, c_space2_id);
+ if ( c_ds_id < 0 ) return ret_value;
+ *ds_id = (hid_t_f)c_ds_id;
+ ret_value = 0;
+ return ret_value;
+}
+/****if* H5Sf/h5smodify_select_c
+ * NAME
+ * h5smodify_select_c
+ * PURPOSE
+ * Call H5Smodify_select
+ * INPUTS
+ * space1_id - identifier of the first dataspace to modify
+ * operator - defines how the new selection is combined
+ * space2_id - identifier of the second dataspace
+ * RETURNS
+ * 0 on success, -1 on failure
+ * AUTHOR
+ * Elena Pourmal
+ * Monday, October 7, 2002
+ * HISTORY
+ *
+ * SOURCE
+*/
+
+int_f
+h5smodify_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id)
+/******/
+{
+ int ret_value = -1;
+ hid_t c_space1_id;
+ hid_t c_space2_id;
+ H5S_seloper_t c_op;
+
+ c_op = (H5S_seloper_t)*op;
+
+ c_space1_id = (hid_t)*space1_id;
+ c_space2_id = (hid_t)*space2_id;
+ if( H5Smodify_select(c_space1_id, c_op, c_space2_id)< 0) return ret_value;
+ ret_value = 0;
+ return ret_value;
+}
/****if* H5Sf/h5sget_select_type_c
* NAME
diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90
index bd3dcf4..e6f8e4c 100644
--- a/fortran/src/H5Sff.F90
+++ b/fortran/src/H5Sff.F90
@@ -1275,6 +1275,310 @@ CONTAINS
DEALLOCATE(def_stride)
END SUBROUTINE h5sselect_hyperslab_f
+! !$!
+! !$!****s* H5S/h5scombine_hyperslab_f
+! !$!
+! !$! NAME
+! !$! h5scombine_hyperslab_f
+! !$!
+! !$! PURPOSE
+! !$! Combine a hyperslab selection with the current
+! !$! selection for a dataspace
+! !$!
+! !$! INPUTS
+! !$! space_id - dataspace of selection to use
+! !$! operator - flag, valid values are:
+! !$! H5S_SELECT_NOOP_F
+! !$! H5S_SELECT_SET_F
+! !$! H5S_SELECT_OR_F
+! !$! H5S_SELECT_AND_F
+! !$! H5S_SELECT_XOR_F
+! !$! H5S_SELECT_NOTB_F
+! !$! H5S_SELECT_NOTA_F
+! !$! H5S_SELECT_APPEND_F
+! !$! H5S_SELECT_PREPEND_F
+! !$! start - array with hyperslab offsets
+! !$! count - number of blocks included in the
+! !$! hyperslab
+! !$! OUTPUTS
+! !$! hyper_id - identifier for the new hyperslab
+! !$! hdferr: - error code
+! !$! Success: 0
+! !$! Failure: -1
+! !$! OPTIONAL PARAMETERS
+! !$! stride - array with hyperslab strides
+! !$! block - array with hyperslab block sizes
+! !$!
+! !$! AUTHOR
+! !$! Elena Pourmal
+! !$! October 7, 2002
+! !$!
+! !$! HISTORY
+! !$!
+! !$!
+! !$! NOTES
+! !$! Commented out until 1.6 ? 10/08/2002
+! !$!
+! !$! SOURCE
+! SUBROUTINE h5scombine_hyperslab_f(space_id, operator, start, count, &
+! hyper_id, hdferr, stride, block)
+! IMPLICIT NONE
+! INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier
+! INTEGER, INTENT(IN) :: operator ! Flag, valid values are:
+ ! H5S_SELECT_NOOP_F
+ ! H5S_SELECT_SET_F
+ ! H5S_SELECT_OR_F
+ ! H5S_SELECT_AND_F
+ ! H5S_SELECT_XOR_F
+ ! H5S_SELECT_NOTB_F
+ ! H5S_SELECT_NOTA_F
+ ! H5S_SELECT_APPEND_F
+ ! H5S_SELECT_PREPEND_F
+ !
+! INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: start
+ ! Starting coordinates of the hyperslab
+! INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: count
+ ! Number of blocks to select
+ ! from dataspace
+! INTEGER(HID_T), INTENT(OUT) :: hyper_id ! New hyperslab identifier
+! INTEGER, INTENT(OUT) :: hdferr ! Error code
+! INTEGER(HSIZE_T), DIMENSION(:), OPTIONAL, INTENT(IN) :: stride
+ ! Array of how many elements to move
+ ! in each direction
+! INTEGER(HSIZE_T), DIMENSION(:), OPTIONAL, INTENT(IN) :: block
+ ! Sizes of element block
+! INTEGER(HSIZE_T), DIMENSION(:), ALLOCATABLE :: def_block
+! INTEGER(HSIZE_T), DIMENSION(:), ALLOCATABLE :: def_stride
+! INTEGER :: rank
+! INTEGER :: error1, error2
+
+! INTERFACE
+! INTEGER FUNCTION h5scombine_hyperslab_c(space_id, operator, &
+! start, count, stride, block, hyper_id)
+! USE H5GLOBAL
+! !DEC$IF DEFINED(HDF5F90_WINDOWS)
+! !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SCOMBINE_HYPERSLAB_C'::h5scombine_hyperslab_c
+! !DEC$ENDIF
+! INTEGER(HID_T), INTENT(IN) :: space_id
+! INTEGER, INTENT(IN) :: operator
+! INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: start
+! INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: count
+! INTEGER(HSIZE_T), DIMENSION(*), OPTIONAL, INTENT(IN) :: stride
+! INTEGER(HSIZE_T), DIMENSION(*), OPTIONAL, INTENT(IN) :: block
+! INTEGER(HID_T), INTENT(OUT) :: hyper_id
+! END FUNCTION h5scombine_hyperslab_c
+! END INTERFACE
+
+! if (present(stride).and. present(block)) then
+! hdferr = h5scombine_hyperslab_c(space_id, operator, start, count, &
+! stride, block, hyper_id)
+! return
+! endif
+ ! Case of optional parameters.
+ !
+ ! Find the rank of the dataspace to allocate memory for
+ ! default stride and block arrays.
+ !
+! CALL h5sget_simple_extent_ndims_f(space_id, rank, hdferr)
+! if( hdferr .EQ. -1) return
+ !
+! if (present(stride).and. .not.present(block)) then
+! allocate(def_block(rank), stat=error1)
+! if (error1.NE.0) then
+! hdferr = -1
+! return
+! endif
+! def_block = 1
+! hdferr = h5scombine_hyperslab_c(space_id, operator, start, count, &
+! stride, def_block, hyper_id)
+! deallocate(def_block)
+! return
+! endif
+
+! if (.not.present(stride).and. present(block)) then
+! allocate(def_stride(rank), stat=error2)
+! if (error2.NE.0) then
+! hdferr = -1
+! return
+! endif
+! def_stride = 1
+! hdferr = h5scombine_hyperslab_c(space_id, operator, start, count, &
+! def_stride, block, hyper_id)
+! deallocate(def_stride)
+! return
+! endif
+! allocate(def_block(rank), stat=error1)
+! allocate(def_stride(rank), stat=error2)
+! if ((error1.NE.0) .OR. (error2.NE.0)) then
+! hdferr = -1
+! return
+! endif
+! def_block = 1
+! def_stride = 1
+! hdferr = h5scombine_hyperslab_c(space_id, operator, start, count, &
+! def_stride, def_block, hyper_id)
+! deallocate(def_block)
+! deallocate(def_stride)
+
+! END SUBROUTINE h5scombine_hyperslab_f
+
+! !$!
+! !$!****s* H5S/
+! !$!
+! !$! NAME
+! !$! h5scombine_select_f
+! !$!
+! !$! PURPOSE
+! !$! Combine two hyperslab selections with an operation
+! !$! and return a dataspace with resulting selection.
+! !$!
+! !$! INPUTS
+! !$! space1_id - dataspace of selection to use
+! !$! operator - flag, valid values are:
+! !$! H5S_SELECT_NOOP_F
+! !$! H5S_SELECT_SET_F
+! !$! H5S_SELECT_OR_F
+! !$! H5S_SELECT_AND_F
+! !$! H5S_SELECT_XOR_F
+! !$! H5S_SELECT_NOTB_F
+! !$! H5S_SELECT_NOTA_F
+! !$! H5S_SELECT_APPEND_F
+! !$! H5S_SELECT_PREPEND_F
+! !$! space2_id - dataspace of selection to use
+! !$! OUTPUTS
+! !$! ds_id - idataspace identifier with the new selection
+! !$! hdferr: - error code
+! !$! Success: 0
+! !$! Failure: -1
+! !$! OPTIONAL PARAMETERS - NONE
+! !$!
+! !$! AUTHOR
+! !$! Elena Pourmal
+! !$! October 7, 2002
+! !$!
+! !$! HISTORY
+! !$!
+! !$!
+! !$! NOTES commented out until 1.6 release(?) 10/08/2002
+! !$!
+
+! ! SOURCE
+! !$ SUBROUTINE h5scombine_select_f(space1_id, operator, space2_id, &
+! ds_id, hdferr)
+! IMPLICIT NONE
+! INTEGER(HID_T), INTENT(IN) :: space1_id ! First dataspace identifier
+! INTEGER(HID_T), INTENT(IN) :: space2_id ! Second dataspace identifier
+! INTEGER, INTENT(IN) :: operator ! Flag, valid values are:
+ ! H5S_SELECT_NOOP_F
+ ! H5S_SELECT_SET_F
+ ! H5S_SELECT_OR_F
+ ! H5S_SELECT_AND_F
+ ! H5S_SELECT_XOR_F
+ ! H5S_SELECT_NOTB_F
+ ! H5S_SELECT_NOTA_F
+ ! H5S_SELECT_APPEND_F
+ ! H5S_SELECT_PREPEND_F
+ !
+! INTEGER(HID_T), INTENT(OUT) :: ds_id ! New dataspace identifier
+! INTEGER, INTENT(OUT) :: hdferr ! Error code
+!
+! INTERFACE
+! INTEGER FUNCTION h5scombine_select_c(space1_id, operator, &
+! space2_id, ds_id)
+! USE H5GLOBAL
+! !DEC$IF DEFINED(HDF5F90_WINDOWS)
+! !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SCOMBINE_SELECT_C'::h5scombine_select_c
+! !DEC$ENDIF
+! INTEGER(HID_T), INTENT(IN) :: space1_id
+! INTEGER(HID_T), INTENT(IN) :: space2_id
+! INTEGER, INTENT(IN) :: operator
+! INTEGER(HID_T), INTENT(OUT) :: ds_id
+! END FUNCTION h5scombine_select_c
+! END INTERFACE
+
+! hdferr = h5scombine_select_c(space1_id, operator, space2_id, &
+! ds_id)
+! return
+
+! END SUBROUTINE h5scombine_select_f
+
+! !$!
+! !$!****s* H5S/
+! !$!
+! !$! NAME
+! !$! h5smodify_select_f
+! !$!
+! !$! PURPOSE
+! !$! Refine a hyperslab selection with an operation
+! !$! using second hyperslab
+! !$!
+! !$! INPUTS
+! !$! space1_id - dataspace of selection to modify
+! !$! operator - flag, valid values are:
+! !$! H5S_SELECT_NOOP_F
+! !$! H5S_SELECT_SET_F
+! !$! H5S_SELECT_OR_F
+! !$! H5S_SELECT_AND_F
+! !$! H5S_SELECT_XOR_F
+! !$! H5S_SELECT_NOTB_F
+! !$! H5S_SELECT_NOTA_F
+! !$! H5S_SELECT_APPEND_F
+! !$! H5S_SELECT_PREPEND_F
+! !$! space2_id - dataspace of selection to use
+! !$!
+! !$! OUTPUTS
+! !$! hdferr: - error code
+! !$! Success: 0
+! !$! Failure: -1
+! !$! OPTIONAL PARAMETERS - NONE
+! !$!
+! !$! AUTHOR
+! !$! Elena Pourmal
+! !$! October 7, 2002
+! !$!
+! !$! HISTORY
+! !$!
+! !$!
+! !$! NOTESCommented out until 1.6 release(?) 10/08/2002 EIP
+! !$!
+
+! ! SOURCE
+! SUBROUTINE h5smodify_select_f(space1_id, operator, space2_id, &
+! hdferr)
+! IMPLICIT NONE
+! INTEGER(HID_T), INTENT(INOUT) :: space1_id ! Dataspace identifier to
+ ! modify
+! INTEGER(HID_T), INTENT(IN) :: space2_id ! Second dataspace identifier
+! INTEGER, INTENT(IN) :: operator ! Flag, valid values are:
+ ! H5S_SELECT_NOOP_F
+ ! H5S_SELECT_SET_F
+ ! H5S_SELECT_OR_F
+ ! H5S_SELECT_AND_F
+ ! H5S_SELECT_XOR_F
+ ! H5S_SELECT_NOTB_F
+ ! H5S_SELECT_NOTA_F
+ ! H5S_SELECT_APPEND_F
+ ! H5S_SELECT_PREPEND_F
+ !
+! INTEGER, INTENT(OUT) :: hdferr ! Error code
+
+! INTERFACE
+! INTEGER FUNCTION h5smodify_select_c(space1_id, operator, &
+! space2_id)
+! USE H5GLOBAL
+! !DEC$IF DEFINED(HDF5F90_WINDOWS)
+! !DEC$ATTRIBUTES C,reference,decorate,alias:'H5SMODIFY_SELECT_C'::h5smodify_select_c
+! !DEC$ENDIF
+! INTEGER(HID_T), INTENT(INOUT) :: space1_id
+! INTEGER(HID_T), INTENT(IN) :: space2_id
+! INTEGER, INTENT(IN) :: operator
+! END FUNCTION h5smodify_select_c
+! END INTERFACE
+
+! hdferr = h5smodify_select_c(space1_id, operator, space2_id)
+! return
+
+! END SUBROUTINE h5smodify_select_f
!
!****s* H5S/h5sget_select_type_f
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index b357715..5faf4b4 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -121,6 +121,9 @@ H5_FCDLL int_f h5sset_extent_none_c( hid_t_f *space_id );
H5_FCDLL int_f h5sselect_hyperslab_c( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block);
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 h5scombine_hyperslab_c( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id);
+H5_FCDLL int_f h5scombine_select_c( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_f *ds_id);
+H5_FCDLL int_f h5smodify_select_c( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id);
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, 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);