diff options
-rw-r--r-- | Carpet/CarpetIOHDF5/src/Input.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Carpet/CarpetIOHDF5/src/Input.cc b/Carpet/CarpetIOHDF5/src/Input.cc index e3114e925..ff0ec64f8 100644 --- a/Carpet/CarpetIOHDF5/src/Input.cc +++ b/Carpet/CarpetIOHDF5/src/Input.cc @@ -1371,13 +1371,6 @@ static int ReadVar (const cGH* const cctkGH, } const hid_t datatype = CCTKtoHDF5_Datatype (cctkGH, group.vartype, 0); - const ivect stride = - group.grouptype == CCTK_GF ? - arrdata.AT(gindex).AT(patch->map).hh->baseextent(mglevel,reflevel).stride() : 1; - assert (all (stride % patch->ioffsetdenom == 0)); - ivect lower = patch->iorigin * stride + patch->ioffset * stride / patch->ioffsetdenom; - ivect upper = lower + (shape - 1) * stride; - // Traverse all local components on all maps hid_t filespace = -1, dataset = -1; hid_t xfer = H5P_DEFAULT; @@ -1390,6 +1383,14 @@ static int ReadVar (const cGH* const cctkGH, continue; } + // map patch into simulation grid, needs existing map + const ivect stride = + group.grouptype == CCTK_GF ? + arrdata.AT(gindex).AT(patch->map).hh->baseextent(mglevel,reflevel).stride() : 1; + assert (all (stride % patch->ioffsetdenom == 0)); + ivect lower = patch->iorigin * stride + patch->ioffset * stride / patch->ioffsetdenom; + ivect upper = lower + (shape - 1) * stride; + struct arrdesc& data = arrdata.at(gindex).at(Carpet::map); BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, group.grouptype) { |