aboutsummaryrefslogtreecommitdiff
path: root/Carpet
diff options
context:
space:
mode:
authorRoland Haas <rhaas@tapir.caltech.edu>2013-08-13 13:29:38 -0700
committerRoland Haas <rhaas@tapir.caltech.edu>2013-08-18 16:08:23 -0700
commit493f90970931ccdc8421bf5882bb14237508f70c (patch)
treeae2abf0e3e11b5f5eb3193793d63d8ebbd4a06f2 /Carpet
parent66a468f4fc38188cd7a71261234a073f2a3e8c73 (diff)
CarpetIOHDF5: check whether map exists before accessing it
this allows data files from multipatch runs to be read in with the file reader into cartesian runs if only the inner cartesian patch is required.CarpetIOHDF5: check wehter map exists before accessing it this allows data files from multipatch runs to be read in with the file reader into cartesian runs if only the inner cartesian patch is required.
Diffstat (limited to 'Carpet')
-rw-r--r--Carpet/CarpetIOHDF5/src/Input.cc15
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) {