diff options
-rw-r--r-- | src/Hyperslab.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/Hyperslab.c b/src/Hyperslab.c index 3a8603a..9c482e6 100644 --- a/src/Hyperslab.c +++ b/src/Hyperslab.c @@ -297,6 +297,28 @@ int Hyperslab_GetLocalHyperslab (const cGH *GH, /* set the default return code */ retval = 0; + /* check for zero-size hyperslab */ + totals = 1; + for (vdim = 0; vdim < hdim; vdim++) + { + totals *= extents[vdim]; + } + if (totals == 0) + { + /* initialize output parameters to all zeros */ + for (vdim = 0; vdim < hdim; vdim++) + { + hsize[vdim] = hsize_global[vdim] = 0; + if (hoffset_global) + { + hoffset_global[vdim] = 0; + } + } + *hdata = NULL; + + return (retval); + } + /* get the info on the variable to extract a hyperslab from */ CCTK_GroupData (CCTK_GroupIndexFromVarI (vindex), &vinfo); @@ -1088,13 +1110,9 @@ static const char *checkParameters (const cGH *GH, int vindex, int vtimelvl, return ("NULL pointer(s) passed as parameters"); } - /* check the extent and downsample parameters */ + /* check the downsample parameter */ for (dim = 0; dim < hdim; dim++) { - if (extents[dim] == 0) - { - return ("Invalid hyperslab extent parameters"); - } if (downsample_[dim] <= 0) { return ( "Invalid hyperslab downsample parameters"); |