summaryrefslogtreecommitdiffstats
path: root/src/H5Sall.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-04-09 12:47:34 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-04-09 12:47:34 (GMT)
commit1ffe083f61eacb68e0a91e46d6a6377813849d5a (patch)
treea6fb3175bd830445fdd56b285012032b187aa681 /src/H5Sall.c
parente403006cc276b29a4b5f3f8fc6c7b11796d1b8d0 (diff)
downloadhdf5-1ffe083f61eacb68e0a91e46d6a6377813849d5a.zip
hdf5-1ffe083f61eacb68e0a91e46d6a6377813849d5a.tar.gz
hdf5-1ffe083f61eacb68e0a91e46d6a6377813849d5a.tar.bz2
[svn-r5152] Purpose:
New Feature Description: Added new H5Dfill() routine to fill the elements in a selection for a memory buffer with a fill value. This is a user API wrapper around some internal routines which were needed for the fill-value modifications from Raymond as well as Pedro's code for reducing the size of a chunked dataset. Platforms tested: FreeBSD 4.5 (sleipnir) [and IRIX64 6.5 (modi4) in parallel, in a few minutes]
Diffstat (limited to 'src/H5Sall.c')
-rw-r--r--src/H5Sall.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/H5Sall.c b/src/H5Sall.c
index ea5eac5..d988de2 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -1057,3 +1057,57 @@ H5S_all_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op
FUNC_LEAVE (ret_value);
} /* H5S_all_select_iterate() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_all_select_fill
+ PURPOSE
+ Fill an "all" selection in memory with a value
+ USAGE
+ herr_t H5S_all_select_fill(fill,fill_size,space,buf)
+ const void *fill; IN: Pointer to fill value to use
+ size_t fill_size; IN: Size of elements in memory buffer & size of
+ fill value
+ H5S_t *space; IN: Dataspace describing memory buffer &
+ containing selection to use.
+ void *buf; IN/OUT: Memory buffer to fill selection in
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to fill elements in a memory buffer.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ The memory buffer elements are assumed to have the same datatype as the
+ fill value being placed into them.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5S_all_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *buf)
+{
+ hssize_t nelemts; /* Number of elements in dataspace */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER (H5S_all_select_fill, FAIL);
+
+ /* Check args */
+ assert(fill);
+ assert(fill_size>0);
+ assert(space);
+ assert(buf);
+
+ /* Fill the selection in the memory buffer */
+
+ /* Get the number of elements to iterate through */
+ if((nelemts=H5S_get_simple_extent_npoints(space))<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements");
+
+ /* Fill the elements in the buffer */
+ H5_CHECK_OVERFLOW(nelemts,hssize_t,size_t);
+ H5V_array_fill(buf, fill, fill_size, (size_t)nelemts);
+
+done:
+ FUNC_LEAVE (ret_value);
+} /* H5S_all_select_fill() */
+