diff options
-rw-r--r-- | src/H5Shyper.c | 41 | ||||
-rw-r--r-- | src/H5Spublic.h | 2 | ||||
-rw-r--r-- | src/H5Sselect.c | 39 |
3 files changed, 82 insertions, 0 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 492cd9e..153f4be 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -7025,6 +7025,47 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_adjust_s() */ +/*-------------------------------------------------------------------------- + NAME + H5Shyper_adjust_s + PURPOSE + Adjust a hyperslab selection by subtracting an offset + USAGE + herr_t H5Shyper_adjust_s(space_id,offset) + hid_t space_id; IN: ID of the dataspace to adjust + const hssize_t *offset; IN: Offset to subtract + RETURNS + Non-negative on success, negative on failure + DESCRIPTION + Moves a hyperslab selection by subtracting an offset from it. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5Shyper_adjust_s(hid_t space_id, const hssize_t *offset) +{ + H5S_t *space; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*Hs", space_id, offset); + + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection") + if(NULL == offset) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer") + + if(H5S_hyper_adjust_s(space, offset) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Shyper_adjust_s() */ + /*-------------------------------------------------------------------------- NAME diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 9e76b4b..a04f3c1 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -143,6 +143,7 @@ H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid); H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid); H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); H5_DLL htri_t H5Sselect_valid(hid_t spaceid); +H5_DLL herr_t H5Sselect_adjust_u(hid_t spaceid, const hsize_t *offset); H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[]); H5_DLL htri_t H5Sselect_shape_same(hid_t space1_id, hid_t space2_id); @@ -170,6 +171,7 @@ H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid); H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks, hsize_t buf[/*numblocks*/]); +H5_DLL herr_t H5Shyper_adjust_s(hid_t space_id, const hssize_t *offset); /* Operations on dataspace selection iterators */ H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index e632b11..1a13f2c 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -971,6 +971,45 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_adjust_u() */ +/*-------------------------------------------------------------------------- + NAME + H5Sselect_adjust_u + PURPOSE + Adjust a selection by subtracting an offset + USAGE + herr_t H5Sselect_adjust_u(space_id, offset) + hid_t space_id; IN: ID of dataspace to adjust + const hsize_t *offset; IN: Offset to subtract + RETURNS + Non-negative on success, negative on failure + DESCRIPTION + Moves a selection by subtracting an offset from it. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5Sselect_adjust_u(hid_t space_id, const hsize_t *offset) +{ + H5S_t *space; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*h", space_id, offset); + + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + if(NULL == offset) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer") + + if(H5S_select_adjust_u(space, offset) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Sselect_adjust_u() */ + /*-------------------------------------------------------------------------- NAME |