diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2002-02-07 20:20:40 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2002-02-07 20:20:40 (GMT) |
commit | 472c42233cbd207bb0c3f97b12ee57dd5cec030b (patch) | |
tree | c5dfea35d484215d7ad0811cd15184585400b183 /src/H5S.c | |
parent | d8626dd40f82baf616134cfd179b894429fce501 (diff) | |
download | hdf5-472c42233cbd207bb0c3f97b12ee57dd5cec030b.zip hdf5-472c42233cbd207bb0c3f97b12ee57dd5cec030b.tar.gz hdf5-472c42233cbd207bb0c3f97b12ee57dd5cec030b.tar.bz2 |
[svn-r4921]
Description:
modified the below files to inlude a new public function H5Dset_extend, similar
to H5Dextend, but it can lower the dimension
this function requires 2 more new private functions:
H5D_set_extend
H5S_set_extend
Platforms tested:
Diffstat (limited to 'src/H5S.c')
-rw-r--r-- | src/H5S.c | 62 |
1 files changed, 62 insertions, 0 deletions
@@ -1654,6 +1654,68 @@ H5S_extend (H5S_t *space, const hsize_t *size) FUNC_LEAVE (ret_value); } + + + + +/*------------------------------------------------------------------------- + * Function: H5S_set_extend + * + * Purpose: Modify the dimensions of a data space. Based on H5S_extend + * + * Return: Success: Number of dimensions whose size increased. + * + * Failure: Negative + * + * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * + * Date: November 26, 2001 + * + *------------------------------------------------------------------------- + */ + +int +H5S_set_extend (H5S_t *space, const hsize_t *size) +{ + int ret_value=0; + unsigned u; + + FUNC_ENTER (H5S_extend, FAIL); + + /* Check args */ + assert (space && H5S_SIMPLE==space->extent.type); + assert (size); + + for (u=0; u<space->extent.u.simple.rank; u++) + { + + if (space->extent.u.simple.max && + H5S_UNLIMITED!=space->extent.u.simple.max[u] && + space->extent.u.simple.max[u]<size[u]) + { + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,"dimension cannot be increased"); + } + + ret_value++; + + } + + /* Update */ + if (ret_value) + { + for (u=0; u<space->extent.u.simple.rank; u++) + { + + space->extent.u.simple.size[u] = size[u]; + + } + } + + FUNC_LEAVE (ret_value); +} + + + /*------------------------------------------------------------------------- * Function: H5Screate_simple |