diff options
author | Quincey Koziol <koziol@lbl.gov> | 2019-08-04 23:38:36 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@lbl.gov> | 2019-08-04 23:38:36 (GMT) |
commit | 5fe1216a4e6af8feef0551f7bece8a0e193310a9 (patch) | |
tree | 357b147c218af566ce2cf8c6ef9c210d98b7829f /src/H5Spoint.c | |
parent | ab1ce69900caa0b249e07db8992e66f95b0af1dc (diff) | |
parent | 905d40aa6f6eb603c5507e7967130760e3a2e43c (diff) | |
download | hdf5-5fe1216a4e6af8feef0551f7bece8a0e193310a9.zip hdf5-5fe1216a4e6af8feef0551f7bece8a0e193310a9.tar.gz hdf5-5fe1216a4e6af8feef0551f7bece8a0e193310a9.tar.bz2 |
Merge pull request #1819 in HDFFV/hdf5 from ~KOZIOL/hdf5:develop to develop
* commit '905d40aa6f6eb603c5507e7967130760e3a2e43c':
Fix return type for H5Sselect_intersect_block().
Updated H5TRACE macro.
Add H5Sselect_shape_same and H5Sselect_intersect_block API routines, along with tests and minor cleanups and refactorings.
Diffstat (limited to 'src/H5Spoint.c')
-rw-r--r-- | src/H5Spoint.c | 76 |
1 files changed, 68 insertions, 8 deletions
diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 875c018..8e1175a 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -28,14 +28,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* ID Functions */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Spkg.h" /* Dataspace functions */ -#include "H5VMprivate.h" /* Vector functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* ID Functions */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Spkg.h" /* Dataspace functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ @@ -75,6 +75,8 @@ static htri_t H5S__point_is_contiguous(const H5S_t *space); static htri_t H5S__point_is_single(const H5S_t *space); static htri_t H5S__point_is_regular(const H5S_t *space); static htri_t H5S__point_shape_same(const H5S_t *space1, const H5S_t *space2); +static htri_t H5S__point_intersect_block(const H5S_t *space, const hsize_t *start, + const hsize_t *end); static herr_t H5S__point_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__point_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S__point_project_simple(const H5S_t *space, H5S_t *new_space, @@ -124,6 +126,7 @@ const H5S_select_class_t H5S_sel_point[1] = {{ H5S__point_is_single, H5S__point_is_regular, H5S__point_shape_same, + H5S__point_intersect_block, H5S__point_adjust_u, H5S__point_project_scalar, H5S__point_project_simple, @@ -1998,6 +2001,63 @@ done: /*-------------------------------------------------------------------------- NAME + H5S__point_intersect_block + PURPOSE + Detect intersections of selection with block + USAGE + htri_t H5S__point_intersect_block(space, start, end) + const H5S_t *space; IN: Dataspace with selection to use + const hsize_t *start; IN: Starting coordinate for block + const hsize_t *end; IN: Ending coordinate for block + RETURNS + Non-negative TRUE / FALSE on success, negative on failure + DESCRIPTION + Quickly detect intersections with a block + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +htri_t +H5S__point_intersect_block(const H5S_t *space, const hsize_t *start, + const hsize_t *end) +{ + H5S_pnt_node_t *pnt; /* Point information node */ + htri_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(space); + HDassert(H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space)); + HDassert(start); + HDassert(end); + + /* Loop over points */ + pnt = space->select.sel_info.pnt_lst->head; + while(pnt) { + unsigned u; /* Local index variable */ + + /* Verify that the point is within the block */ + for(u = 0; u < space->extent.rank; u++) + if(pnt->pnt[u] < start[u] || pnt->pnt[u] > end[u]) + break; + + /* Check if point was within block for all dimensions */ + if(u == space->extent.rank) + HGOTO_DONE(TRUE) + + /* Advance to next point */ + pnt = pnt->next; + } /* end while */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5S__point_intersect_block() */ + + +/*-------------------------------------------------------------------------- + NAME H5S__point_adjust_u PURPOSE Adjust a "point" selection by subtracting an offset |