summaryrefslogtreecommitdiffstats
path: root/src/H5Sselect.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-06-16 22:17:29 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-06-16 22:17:29 (GMT)
commitdb2c4c497abab139485dbf6797e56b1340e4577d (patch)
treef7dfb321a3643658ed24aaf776ec4c1e48bc76a3 /src/H5Sselect.c
parent55af47c47c3c0c7bc17266968f5e0e782189e819 (diff)
downloadhdf5-db2c4c497abab139485dbf6797e56b1340e4577d.zip
hdf5-db2c4c497abab139485dbf6797e56b1340e4577d.tar.gz
hdf5-db2c4c497abab139485dbf6797e56b1340e4577d.tar.bz2
[svn-r15221] Description:
Bring changes from trunk from the time the branch was created (r14280) up to the 1.8.0 release (r14525) back into the metadata journaling branch. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5Sselect.c')
-rw-r--r--src/H5Sselect.c68
1 files changed, 55 insertions, 13 deletions
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 31fd05e..ed3c740 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -62,17 +62,20 @@ static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter);
herr_t
H5S_select_offset(H5S_t *space, const hssize_t *offset)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5S_select_offset);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_select_offset)
/* Check args */
- assert(space);
- assert(space->extent.rank);
- assert(offset);
+ HDassert(space);
+ HDassert(space->extent.rank);
+ HDassert(offset);
/* Copy the offset over */
- HDmemcpy(space->select.offset,offset,sizeof(hssize_t)*space->extent.rank);
+ HDmemcpy(space->select.offset, offset, sizeof(hssize_t)*space->extent.rank);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ /* Indicate that the offset was changed */
+ space->select.offset_changed = TRUE;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_select_offset() */
@@ -488,8 +491,8 @@ done:
USAGE
herr_t H5S_get_select_bounds(space, start, end)
hid_t dsid; IN: Dataspace ID of selection to query
- hsize_t *start; OUT: Starting coordinate of bounding box
- hsize_t *end; OUT: Opposite coordinate of bounding box
+ hsize_t start[]; OUT: Starting coordinate of bounding box
+ hsize_t end[]; OUT: Opposite coordinate of bounding box
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -511,7 +514,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Sget_select_bounds(hid_t spaceid, hsize_t *start, hsize_t *end)
+H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[])
{
H5S_t *space = NULL; /* Dataspace to modify selection of */
herr_t ret_value; /* return value */
@@ -579,6 +582,46 @@ H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
/*--------------------------------------------------------------------------
NAME
+ H5S_get_select_offset
+ PURPOSE
+ Gets the linear offset of the first element for the selection.
+ USAGE
+ herr_t H5S_get_select_offset(space, offset)
+ const H5S_t *space; IN: Dataspace pointer of selection to query
+ hsize_t *offset; OUT: Linear offset of first element in selection
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Retrieves the linear offset (in "units" of elements) of the first element
+ selected within the dataspace.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ The offset calculation _does_ include the current offset of the
+ selection within the dataspace extent.
+
+ Calling this function on a "none" selection returns fail.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5S_get_select_offset(const H5S_t *space, hsize_t *offset)
+{
+ herr_t ret_value; /* return value */
+
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_get_select_offset)
+
+ /* Check args */
+ HDassert(space);
+ HDassert(offset);
+
+ ret_value = (*space->select.type->offset)(space, offset);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S_get_select_offset() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5S_select_is_contiguous
PURPOSE
Determines if a selection is contiguous in the dataspace
@@ -758,10 +801,9 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s
/* Save the dataspace's rank */
sel_iter->rank=space->extent.rank;
- if(sel_iter->rank>0) {
- /* Point to the dataspace dimensions */
- sel_iter->dims=space->extent.size;
- } /* end if */
+ /* Point to the dataspace dimensions, if there are any */
+ if(sel_iter->rank > 0)
+ sel_iter->dims = space->extent.size;
else
sel_iter->dims = NULL;