summaryrefslogtreecommitdiffstats
path: root/src/H5Sall.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-06-04 15:45:11 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-06-04 15:45:11 (GMT)
commit4d8f148d0953939baed118399fffe6db05b3a98e (patch)
treec2b8f599d940da1f922be72eb2f482e5984d95f6 /src/H5Sall.c
parent2a7cf2ea942db24f2c759d43533c0e4df018efe6 (diff)
downloadhdf5-4d8f148d0953939baed118399fffe6db05b3a98e.zip
hdf5-4d8f148d0953939baed118399fffe6db05b3a98e.tar.gz
hdf5-4d8f148d0953939baed118399fffe6db05b3a98e.tar.bz2
[svn-r6957] Purpose:
Code cleanup & performance improvements Description: Optimize hyperslabs that are built to detect situations where "regular" hyperslabs can be recovered from span tree descriptions. Also, improve "same shape" routine to correctly work with all the different combinations of selections. Platforms tested: FreeBSD 4.8 (sleipnir) w/C++ FreeBSD 4.8 (sleipnir) w/parallel h5committested
Diffstat (limited to 'src/H5Sall.c')
-rw-r--r--src/H5Sall.c158
1 files changed, 129 insertions, 29 deletions
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 08dc8d3..ea6d6b1 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -27,11 +27,22 @@
#include "H5Spkg.h" /* Dataspace functions */
#include "H5Vprivate.h" /* Vector functions */
-/* Interface initialization */
+/* Pablo mask */
#define PABLO_MASK H5Sall_mask
+
+/* Interface initialization */
#define INTERFACE_INIT NULL
static int interface_initialize_g = 0;
+/* Static function prototypes */
+static herr_t H5S_all_iter_coords(const H5S_sel_iter_t *iter, hssize_t *coords);
+static herr_t H5S_all_iter_block(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end);
+static hsize_t H5S_all_iter_nelmts(const H5S_sel_iter_t *iter);
+static htri_t H5S_all_iter_has_next_block(const H5S_sel_iter_t *iter);
+static herr_t H5S_all_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
+static herr_t H5S_all_iter_next_block(H5S_sel_iter_t *sel_iter);
+static herr_t H5S_all_iter_release(H5S_sel_iter_t *sel_iter);
+
/*-------------------------------------------------------------------------
* Function: H5S_all_iter_init
@@ -66,8 +77,11 @@ H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space, size_t UNUSED elmt_
/* Initialize methods for selection iterator */
iter->iter_coords=H5S_all_iter_coords;
+ iter->iter_block=H5S_all_iter_block;
iter->iter_nelmts=H5S_all_iter_nelmts;
+ iter->iter_has_next_block=H5S_all_iter_has_next_block;
iter->iter_next=H5S_all_iter_next;
+ iter->iter_next_block=H5S_all_iter_next_block;
iter->iter_release=H5S_all_iter_release;
done:
@@ -90,12 +104,12 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5S_all_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5S_all_iter_coords, FAIL);
+ FUNC_ENTER_NOINIT(H5S_all_iter_coords);
/* Check args */
assert (iter);
@@ -111,6 +125,46 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5S_all_iter_block
+ *
+ * Purpose: Retrieve the current block of iterator for current
+ * selection
+ *
+ * Return: non-negative on success, negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, June 2, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5S_all_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end)
+{
+ unsigned u; /* Local index variable */
+
+ FUNC_ENTER_NOINIT(H5S_all_iter_block);
+
+ /* Check args */
+ assert (iter);
+ assert (start);
+ assert (end);
+
+ /* Get the start of the 'all' block */
+ /* (Always '0' coordinates for now) */
+ HDmemset(start,0,sizeof(hssize_t)*iter->rank);
+
+ /* Compute the end of the 'all' block */
+ /* (Always size of the extent for now) */
+ for(u=0; u<iter->rank; u++)
+ end[u]=iter->dims[u]-1;
+
+ FUNC_LEAVE_NOAPI(SUCCEED);
+} /* H5S_all_iter_coords() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5S_all_iter_nelmts
*
* Purpose: Return number of elements left to process in iterator
@@ -124,21 +178,15 @@ done:
*
*-------------------------------------------------------------------------
*/
-hsize_t
+static hsize_t
H5S_all_iter_nelmts (const H5S_sel_iter_t *iter)
{
- hsize_t ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_all_iter_nelmts, 0);
+ FUNC_ENTER_NOINIT(H5S_all_iter_nelmts);
/* Check args */
assert (iter);
- /* Set return value */
- ret_value=iter->elmt_left;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(iter->elmt_left);
} /* H5S_all_iter_nelmts() */
@@ -146,6 +194,35 @@ done:
NAME
H5S_all_iter_next
PURPOSE
+ Check if there is another block left in the current iterator
+ USAGE
+ htri_t H5S_all_iter_has_next_block(iter)
+ const H5S_sel_iter_t *iter; IN: Pointer to selection iterator
+ RETURNS
+ Non-negative (TRUE/FALSE) on success/Negative on failure
+ DESCRIPTION
+ Check if there is another block available in the selection iterator.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static htri_t
+H5S_all_iter_has_next_block (const H5S_sel_iter_t UNUSED *iter)
+{
+ FUNC_ENTER_NOINIT(H5S_all_iter_has_next_block);
+
+ /* Check args */
+ assert (iter);
+
+ FUNC_LEAVE_NOAPI(FALSE);
+} /* H5S_all_iter_has_next_block() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_all_iter_next
+ PURPOSE
Increment selection iterator
USAGE
herr_t H5S_all_iter_next(iter, nelem)
@@ -160,12 +237,10 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_all_iter_next(H5S_sel_iter_t *iter, size_t nelem)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_all_iter_next, FAIL);
+ FUNC_ENTER_NOINIT(H5S_all_iter_next);
/* Check args */
assert (iter);
@@ -174,13 +249,41 @@ H5S_all_iter_next(H5S_sel_iter_t *iter, size_t nelem)
/* Increment the iterator */
iter->u.all.offset+=nelem;
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_all_iter_next() */
/*--------------------------------------------------------------------------
NAME
+ H5S_all_iter_next_block
+ PURPOSE
+ Increment selection iterator to next block
+ USAGE
+ herr_t H5S_all_iter_next_block(iter)
+ H5S_sel_iter_t *iter; IN: Pointer to selection iterator
+ RETURNS
+ Non-negative on success/Negative on failure
+ DESCRIPTION
+ Advance selection iterator to the next block in the selection.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S_all_iter_next_block(H5S_sel_iter_t UNUSED *iter)
+{
+ FUNC_ENTER_NOINIT(H5S_all_iter_next_block);
+
+ /* Check args */
+ assert (iter);
+
+ FUNC_LEAVE_NOAPI(FAIL);
+} /* H5S_all_iter_next_block() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5S_all_iter_release
PURPOSE
Release "all" selection iterator information for a dataspace
@@ -196,18 +299,15 @@ done:
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_all_iter_release (H5S_sel_iter_t UNUSED * iter)
{
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_all_iter_release, FAIL);
+ FUNC_ENTER_NOINIT(H5S_all_iter_release);
/* Check args */
assert (iter);
-done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_all_iter_release() */
@@ -436,10 +536,10 @@ done:
PURPOSE
Gets the bounding box containing the selection.
USAGE
- herr_t H5S_all_bounds(space, hsize_t *start, hsize_t *end)
+ herr_t H5S_all_bounds(space, start, end)
H5S_t *space; IN: Dataspace pointer of selection to query
- hsize_t *start; OUT: Starting coordinate of bounding box
- hsize_t *end; OUT: Opposite coordinate of bounding box
+ hssize_t *start; OUT: Starting coordinate of bounding box
+ hssize_t *end; OUT: Opposite coordinate of bounding box
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -456,7 +556,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
+H5S_all_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
{
int rank; /* Dataspace rank */
int i; /* index variable */
@@ -474,7 +574,7 @@ H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
/* Just copy over the complete extent */
for(i=0; i<rank; i++) {
start[i]=0;
- end[i]=space->extent.u.simple.size[i]-1;
+ H5_ASSIGN_OVERFLOW(end[i],space->extent.u.simple.size[i]-1,hsize_t,hssize_t);
} /* end for */
done: