diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-07-20 16:51:49 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-07-20 16:51:49 (GMT) |
commit | de3a870bcd4953a3654b3e9dc92edab86fe858cd (patch) | |
tree | 8bf2fc6e0814f67b1388c23136aaff9e4a7cba96 /src/H5Sall.c | |
parent | 98754fa9d12090f5e048fdb05cc5e9ce9111676f (diff) | |
download | hdf5-de3a870bcd4953a3654b3e9dc92edab86fe858cd.zip hdf5-de3a870bcd4953a3654b3e9dc92edab86fe858cd.tar.gz hdf5-de3a870bcd4953a3654b3e9dc92edab86fe858cd.tar.bz2 |
[svn-r19110] Description:
Bring r19049:19109 from trunk to revise_chunks branch
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'src/H5Sall.c')
-rw-r--r-- | src/H5Sall.c | 99 |
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 |