diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2011-01-03 22:59:44 -0500 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2011-12-14 18:25:53 +0000 |
commit | 33bba04684049f70919c71e3b5ca5efcce2d99bd (patch) | |
tree | 5fc7a31fe68f4d729f76d325db20133d36368c1f /Carpet/CarpetIOHDF5 | |
parent | 7367d17e7a4730b09ee26cbd85925359c03921ed (diff) |
CarpetIOHDF5: Checkpoint and recover delta times (time step sizes)
Diffstat (limited to 'Carpet/CarpetIOHDF5')
-rw-r--r-- | Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc | 8 | ||||
-rw-r--r-- | Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh | 2 | ||||
-rw-r--r-- | Carpet/CarpetIOHDF5/src/Input.cc | 14 |
3 files changed, 20 insertions, 4 deletions
diff --git a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc index 13410d47c..d4abcccbd 100644 --- a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc +++ b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.cc @@ -1269,6 +1269,13 @@ int WriteMetadata (const cGH * const cctkGH, int const nioprocs, } } } + vector <vector <CCTK_REAL> > grid_delta_times (mglevels); + for (int ml = 0; ml < mglevels; ++ ml) { + grid_delta_times.at(ml).resize(vhh.at(0)->reflevels()); + for (int rl = 0; rl < vhh.at(0)->reflevels(); ++ rl) { + grid_delta_times.at(ml).at(rl) = tt->get_delta(ml, rl); + } + } ostringstream gs_buf; gs_buf << setprecision(17); // We could write this information only into one of the checkpoint @@ -1279,6 +1286,7 @@ int WriteMetadata (const cGH * const cctkGH, int const nioprocs, // only into one of the checkpoint files gs_buf << "grid_structure:" << grid_structure << ","; gs_buf << "grid_times:" << grid_times << ","; + gs_buf << "grid_delta_times:" << grid_delta_times << ","; // gs_buf << "grid_leveltimes:" << leveltimes << ","; gs_buf << "grid_ghosts:" << grid_ghosts << ","; gs_buf << "grid_buffers:" << grid_buffers << ","; diff --git a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh index f22605430..e8f44e9b9 100644 --- a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh +++ b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh @@ -17,7 +17,7 @@ // some macros for HDF5 group names #define METADATA_GROUP "Parameters and Global Attributes" #define ALL_PARAMETERS "All Parameters" -#define GRID_STRUCTURE "Grid Structure v4" +#define GRID_STRUCTURE "Grid Structure v5" // atomic HDF5 datatypes for the generic CCTK datatypes // (the one for CCTK_COMPLEX is created at startup as a compound HDF5 datatype) diff --git a/Carpet/CarpetIOHDF5/src/Input.cc b/Carpet/CarpetIOHDF5/src/Input.cc index c29bc7b9a..21c61cea8 100644 --- a/Carpet/CarpetIOHDF5/src/Input.cc +++ b/Carpet/CarpetIOHDF5/src/Input.cc @@ -64,6 +64,7 @@ typedef struct { vector<vector<vector<region_t> > > grid_superstructure; // [map][reflevel][component] vector<vector<vector<region_t> > > grid_structure; // [map][reflevel][component] vector<vector<vector<CCTK_REAL> > > grid_times; // [mglevel][reflevel][timelevel] + vector<vector<CCTK_REAL> > grid_delta_times; // [mglevel][reflevel] // vector<vector<CCTK_REAL> > leveltimes; // [mglevel][reflevel] vector <vector <i2vect> > grid_ghosts; // [map] vector <vector <i2vect> > grid_buffers; // [map] @@ -203,6 +204,7 @@ void CarpetIOHDF5_RecoverGridStructure (CCTK_ARGUMENTS) for (int tl = 0; tl < tt->timelevels; ++ tl) { tt->set_time (ml, rl, tl, fileset.grid_times.at(ml).at(rl).at(tl)); } + tt->set_delta (ml, rl, fileset.grid_delta_times.at(ml).at(rl)); } } // We are in level mode here (we probably shouldn't be, but that's @@ -214,11 +216,10 @@ void CarpetIOHDF5_RecoverGridStructure (CCTK_ARGUMENTS) // manually assert (reflevel != -1); int const tl = 0; - // ignore fileset.global_time - global_time = tt->get_time (mglevel, reflevel, tl); - cctkGH->cctk_time = global_time; delta_time = fileset.delta_time; cctkGH->cctk_delta_time = delta_time; + global_time = fileset.global_time; + cctkGH->cctk_time = tt->get_time (mglevel, reflevel, tl); } PostRegrid (cctkGH); @@ -948,6 +949,13 @@ static void ReadMetadata (fileset_t& fileset, hid_t file) skipws (gs_buf); consume (gs_buf, ","); + skipws (gs_buf); + consume (gs_buf, "grid_delta_times:"); + skipws (gs_buf); + gs_buf >> fileset.grid_delta_times; + skipws (gs_buf); + consume (gs_buf, ","); + // skipws (gs_buf); // consume (gs_buf, "grid_leveltimes:"); // skipws (gs_buf); |