aboutsummaryrefslogtreecommitdiff
path: root/Carpet
diff options
context:
space:
mode:
authorRoland Haas <roland.haas@physics.gatech.edu>2010-10-02 18:36:23 -0400
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 18:25:33 +0000
commit6786257fa7acb3cb8d477ba2a5e9cd86ba17ff77 (patch)
tree12fa8be0ac4f0713c2591fc9690b920a4fdd42ed /Carpet
parent116af5710a4ff435bb7365d21778c82d2b756047 (diff)
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.
Diffstat (limited to 'Carpet')
-rw-r--r--Carpet/CarpetIOHDF5/src/OutputSlice.cc19
1 files changed, 15 insertions, 4 deletions
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<int,outdim> lo = gfext.lower()[dirs];
const vect<int,outdim> up = gfext.upper()[dirs];
const vect<int,outdim> str = gfext.stride()[dirs];
const bbox<int,outdim> 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<hsize_t> mem_shape(dim);
vector<hsize_t> 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();