summaryrefslogtreecommitdiffstats
path: root/src/H5Sall.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-07-19 08:09:49 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-07-19 08:09:49 (GMT)
commit1ff6aff53dacca3afaa96ad959c857693ea6f6d6 (patch)
treeb5592c43a2e492fe039f0f8361dc6acfc83456a2 /src/H5Sall.c
parentcf6e2c99a43cd794e85ac8e23fee2e45a35d9121 (diff)
downloadhdf5-1ff6aff53dacca3afaa96ad959c857693ea6f6d6.zip
hdf5-1ff6aff53dacca3afaa96ad959c857693ea6f6d6.tar.gz
hdf5-1ff6aff53dacca3afaa96ad959c857693ea6f6d6.tar.bz2
[svn-r19093] Description:
Bring r19092 from trunk to 1.8 branch: Bring "shape same" changes from LBL branch to trunk. These changes allow shapes that are the same, but projected into dataspaces with different ranks to be detected correctly, and also contains code to project a dataspace into greater/lesser number of dimensions, so the I/O can proceed in a faster way. These changes also contain several bug fixes and _lots_ of code cleanups to the MPI datatype creation code. Many other misc. code cleanup are included as well... Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode (h5committested on trunk)
Diffstat (limited to 'src/H5Sall.c')
-rw-r--r--src/H5Sall.c99
1 files changed, 83 insertions, 16 deletions
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 115d5d35..c98781a 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -47,6 +47,8 @@ static htri_t H5S_all_is_contiguous(const H5S_t *space);
static htri_t H5S_all_is_single(const H5S_t *space);
static htri_t H5S_all_is_regular(const H5S_t *space);
static herr_t H5S_all_adjust_u(H5S_t *space, const hsize_t *offset);
+static herr_t H5S_all_project_scalar(const H5S_t *space, hsize_t *offset);
+static herr_t H5S_all_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset);
static herr_t H5S_all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* Selection iteration callbacks */
@@ -76,6 +78,8 @@ const H5S_select_class_t H5S_sel_all[1] = {{
H5S_all_is_single,
H5S_all_is_regular,
H5S_all_adjust_u,
+ H5S_all_project_scalar,
+ H5S_all_project_simple,
H5S_all_iter_init,
}};
@@ -372,18 +376,18 @@ H5S_all_iter_release (H5S_sel_iter_t UNUSED * iter)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
-H5S_all_release (H5S_t UNUSED * space)
+static herr_t
+H5S_all_release(H5S_t *space)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5S_all_release);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_all_release)
/* Check args */
- assert (space);
+ HDassert(space);
/* Reset the number of elements in the selection */
- space->select.num_elem=0;
+ space->select.num_elem = 0;
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_all_release() */
@@ -406,18 +410,18 @@ H5S_all_release (H5S_t UNUSED * space)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-herr_t
+static herr_t
H5S_all_copy(H5S_t *dst, const H5S_t UNUSED *src, hbool_t UNUSED share_selection)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5S_all_copy);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_all_copy)
- assert(src);
- assert(dst);
+ HDassert(src);
+ HDassert(dst);
/* Set number of elements in selection */
- dst->select.num_elem=(hsize_t)H5S_GET_EXTENT_NPOINTS(dst);
+ dst->select.num_elem = (hsize_t)H5S_GET_EXTENT_NPOINTS(dst);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5S_all_copy() */
@@ -542,20 +546,20 @@ H5S_all_serialize (const H5S_t *space, uint8_t *buf)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_all_deserialize (H5S_t *space, const uint8_t UNUSED *buf)
+H5S_all_deserialize(H5S_t *space, const uint8_t UNUSED *buf)
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI(H5S_all_deserialize, FAIL);
+ FUNC_ENTER_NOAPI(H5S_all_deserialize, FAIL)
- assert(space);
+ HDassert(space);
/* Change to "all" selection */
if((ret_value = H5S_select_all(space, TRUE)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_all_deserialize() */
@@ -764,6 +768,69 @@ H5S_all_adjust_u(H5S_t UNUSED *space, const hsize_t UNUSED *offset)
} /* H5S_all_adjust_u() */
+/*-------------------------------------------------------------------------
+ * Function: H5S_all_project_scalar
+ *
+ * Purpose: Projects a single element 'all' selection into a scalar
+ * dataspace
+ *
+ * Return: non-negative on success, negative on failure.
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, July 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5S_all_project_scalar(const H5S_t UNUSED *space, hsize_t *offset)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_all_project_scalar)
+
+ /* Check args */
+ HDassert(space && H5S_SEL_ALL == H5S_GET_SELECT_TYPE(space));
+ HDassert(offset);
+
+ /* Set offset of selection in projected buffer */
+ *offset = 0;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5S_all_project_scalar() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5S_all_project_simple
+ *
+ * Purpose: Projects an 'all' selection onto/into a simple dataspace
+ * of a different rank
+ *
+ * Return: non-negative on success, negative on failure.
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, July 18, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5S_all_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5S_all_project_simple)
+
+ /* Check args */
+ HDassert(base_space && H5S_SEL_ALL == H5S_GET_SELECT_TYPE(base_space));
+ HDassert(new_space);
+ HDassert(offset);
+
+ /* Select the entire new space */
+ if(H5S_select_all(new_space, TRUE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to set all selection")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S_all_project_simple() */
+
+
/*--------------------------------------------------------------------------
NAME
H5S_select_all