diff options
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 |