aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOHDF5/src
diff options
context:
space:
mode:
authorThomas Radke <tradke@aei.mpg.de>2006-01-20 16:45:00 +0000
committerThomas Radke <tradke@aei.mpg.de>2006-01-20 16:45:00 +0000
commitae767f18e6390477b2ac752c1f1cc2fe595edf5b (patch)
treefa11fd25ea6464371c86206c79d6cd20aa4b3183 /Carpet/CarpetIOHDF5/src
parent347dfe539174e3b8012cab57f03e588a89ed4960 (diff)
CarpetIOHDF5: fix recovery of multiple map grid variables
The recovery code didn't properly recover grid functions with multiple maps: all maps were initialised with the data from map 0. This patch fixes the problem so that checkpointing/recovery should work now also for multipatch applications. The patch only affects recovery code, meaning it will also work with older checkpoint files. darcs-hash:20060120164515-776a0-68f93cb5fb197f805beedfdc176fd8da9b7bfc49.gz
Diffstat (limited to 'Carpet/CarpetIOHDF5/src')
-rw-r--r--Carpet/CarpetIOHDF5/src/Input.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/Carpet/CarpetIOHDF5/src/Input.cc b/Carpet/CarpetIOHDF5/src/Input.cc
index c8ebc3c5d..03bd8f635 100644
--- a/Carpet/CarpetIOHDF5/src/Input.cc
+++ b/Carpet/CarpetIOHDF5/src/Input.cc
@@ -20,6 +20,7 @@ using namespace Carpet;
typedef struct {
string patchname;
int vindex;
+ int map;
int mglevel;
int reflevel;
int timestep;
@@ -642,7 +643,13 @@ static herr_t BrowseDatasets (hid_t group, const char *objectname, void *arg)
HDF5_ERROR (H5Aclose (attr));
HDF5_ERROR (H5Dclose (dataset));
- // try to obtain the component number from the patch's name
+ // try to obtain the map and component number from the patch's name
+ // (cleaner way would be to store attributes with the dataset)
+ patch.map = 0;
+ const char* map_string = strstr (objectname, " m=");
+ if (map_string) {
+ sscanf (map_string, " m=%d", &patch.map);
+ }
patch.component = -1;
const char* component_string = strstr (objectname, " c=");
if (component_string) {
@@ -650,7 +657,7 @@ static herr_t BrowseDatasets (hid_t group, const char *objectname, void *arg)
}
// add this patch to our list
- if (patch.vindex >=0 and patch.vindex < CCTK_NumVars ()) {
+ if (patch.vindex >= 0 and patch.vindex < CCTK_NumVars ()) {
patch.patchname = objectname;
file->patches.push_back (patch);
} else {
@@ -713,6 +720,12 @@ static int ReadVar (const cGH* const cctkGH,
// Traverse all local components on all maps
hid_t filespace = -1, dataset = -1;
BEGIN_MAP_LOOP (cctkGH, group.grouptype) {
+
+ // skip this dataset if it belongs to another map
+ if (group.grouptype == CCTK_GF and patch->map != Carpet::map) {
+ continue;
+ }
+
struct arrdesc& data = arrdata.at(gindex).at(Carpet::map);
BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, group.grouptype) {