From 6786257fa7acb3cb8d477ba2a5e9cd86ba17ff77 Mon Sep 17 00:00:00 2001 From: Roland Haas Date: Sat, 2 Oct 2010 18:36:23 -0400 Subject: CarpetIOHDF5: fix way hyperslab is computed to compute the hyperslab one needs to base its location on the extent of the data in memory not in the extent that we want to output. --- Carpet/CarpetIOHDF5/src/OutputSlice.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'Carpet') diff --git a/Carpet/CarpetIOHDF5/src/OutputSlice.cc b/Carpet/CarpetIOHDF5/src/OutputSlice.cc index c503b95f0..4ee4ffe26 100644 --- a/Carpet/CarpetIOHDF5/src/OutputSlice.cc +++ b/Carpet/CarpetIOHDF5/src/OutputSlice.cc @@ -1319,10 +1319,19 @@ namespace CarpetIOHDF5 { if (not diagonal_output) { // not outputting the diagonal + // there are currently three "extent" variables in use: + // data_ext - the extent of the component in memory + // gfext - the bounding box of data to be written + // ext - gfext in the output dimension(s) + // data_ext and gfext are used to construct the hyperslab location and + // size, ext is just a shorthand. + // TODO: maybe transfer only ext instead of data_ext in copy_from const vect lo = gfext.lower()[dirs]; const vect up = gfext.upper()[dirs]; const vect str = gfext.stride()[dirs]; const bbox ext(lo,up,str); + const dh* const dd = arrdata.at(gi).at(m).dd; + const ibbox& data_ext = dd->light_boxes.at(ml).at(rl).at(c).exterior; // Check whether the output origin is contained in the extent of // the data that should be output @@ -1335,19 +1344,21 @@ namespace CarpetIOHDF5 { vector mem_shape(dim); vector slice_shape(rank, 1); for (int d = 0; d < dim; d++) { - mem_shape[dim-1-d] = gfext.shape()[d] / gfext.stride()[d]; + mem_shape[dim-1-d] = data_ext.shape()[d] / data_ext.stride()[d]; if (d < outdim) { slice_shape[outdim-1-d] = ext.shape()[d] / ext.stride()[d]; } } - ivect slice_lower(org - gfext.lower()); + ivect slice_lower(org - data_ext.lower()); for (int d = 0; d < outdim; d++) { - slice_lower[dirs[d]] = 0; + slice_lower[dirs[d]] = ext.lower()[d] - + data_ext.lower()[dirs[d]]; } ivect slice_upper(slice_lower); for (int d = 0; d < outdim; d++) { - slice_upper[dirs[d]] = ext.upper()[d] - ext.lower()[d]; + slice_upper[dirs[d]] = ext.upper()[d] - + data_ext.lower()[dirs[d]]; } slice_lower /= gfext.stride(); slice_upper /= gfext.stride(); -- cgit v1.2.3