diff options
Diffstat (limited to 'Carpet')
-rw-r--r-- | Carpet/CarpetIOHDF5/schedule.ccl | 9 | ||||
-rw-r--r-- | Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh | 6 | ||||
-rw-r--r-- | Carpet/CarpetIOHDF5/src/Input.cc | 29 |
3 files changed, 24 insertions, 20 deletions
diff --git a/Carpet/CarpetIOHDF5/schedule.ccl b/Carpet/CarpetIOHDF5/schedule.ccl index b586376ad..0ff1986a5 100644 --- a/Carpet/CarpetIOHDF5/schedule.ccl +++ b/Carpet/CarpetIOHDF5/schedule.ccl @@ -57,15 +57,6 @@ if (! CCTK_Equals (recover, "no") && *recover_file) } "Overwrite 'CarpetRegird::refinement_levels' with the number of levels found in the checkpoint file" } - if (use_grid_structure_from_checkpoint) - { - schedule CarpetIOHDF5_RecoverGridStructure at RECOVER_PARAMETERS - { - LANG:C - OPTIONS: meta - } "Grid structure recovery routine" - } - schedule CarpetIOHDF5_CloseFiles at POST_RECOVER_VARIABLES { LANG: C diff --git a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh index 1101a2545..0210adcff 100644 --- a/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh +++ b/Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh @@ -113,13 +113,13 @@ namespace CarpetIOHDF5 int CarpetIOHDF5_Startup (void); void CarpetIOHDF5_Init (CCTK_ARGUMENTS); - void CarpetIOHDF5_SetNumRefinementLevels (void); + int CarpetIOHDF5_SetNumRefinementLevels (void); void CarpetIOHDF5_CloseFiles (CCTK_ARGUMENTS); void CarpetIOHDF5_InitialDataCheckpoint (CCTK_ARGUMENTS); void CarpetIOHDF5_EvolutionCheckpoint (CCTK_ARGUMENTS); void CarpetIOHDF5_TerminationCheckpoint (CCTK_ARGUMENTS); - void CarpetIOHDF5_RecoverParameters (void); - void CarpetIOHDF5_RecoverGridStructure (void); + int CarpetIOHDF5_RecoverParameters (void); + void CarpetIOHDF5_RecoverGridStructure (CCTK_ARGUMENTS); } // extern "C" diff --git a/Carpet/CarpetIOHDF5/src/Input.cc b/Carpet/CarpetIOHDF5/src/Input.cc index 225fc9b55..6495eb276 100644 --- a/Carpet/CarpetIOHDF5/src/Input.cc +++ b/Carpet/CarpetIOHDF5/src/Input.cc @@ -84,17 +84,17 @@ static int ReadVar (const cGH* const cctkGH, ////////////////////////////////////////////////////////////////////////////// // Register with the Cactus Recovery Interface ////////////////////////////////////////////////////////////////////////////// -void CarpetIOHDF5_RecoverParameters () +int CarpetIOHDF5_RecoverParameters () { - IOUtil_RecoverParameters (Recover, ".h5", "HDF5"); + return IOUtil_RecoverParameters (Recover, ".h5", "HDF5"); } ////////////////////////////////////////////////////////////////////////////// // Recover the grid structure ////////////////////////////////////////////////////////////////////////////// -void CarpetIOHDF5_RecoverGridStructure () +void CarpetIOHDF5_RecoverGridStructure (CCTK_ARGUMENTS) { - cGH const * const cctkGH = 0; // fake it + DECLARE_CCTK_ARGUMENTS; fileset_t & fileset = * filesets.begin(); @@ -128,10 +128,11 @@ void CarpetIOHDF5_RecoverGridStructure () Carpet::MakeMultigridBoxes (cctkGH, bbss, obss, bbsss); // Regrid - Carpet::vhh.at(m)->recompose (bbsss, obss, pss, false); - Carpet::OutputGrids (cctkGH, m, * Carpet::vhh.at(m)); + Recompose (cctkGH, m, bbsss, obss, pss, false); } // for m + + PostRecompose (); } ////////////////////////////////////////////////////////////////////////////// @@ -141,7 +142,7 @@ void CarpetIOHDF5_RecoverGridStructure () // Note that this has to be done after parameter recovery in order to have // any effect of steering "CarpetRegrid::refinement_levels". ////////////////////////////////////////////////////////////////////////////// -void CarpetIOHDF5_SetNumRefinementLevels () +int CarpetIOHDF5_SetNumRefinementLevels () { DECLARE_CCTK_PARAMETERS; @@ -162,6 +163,8 @@ void CarpetIOHDF5_SetNumRefinementLevels () buffer); assert (retval == 0); } + + return 0; } @@ -243,6 +246,16 @@ int Recover (cGH* cctkGH, const char *basefilename, int called_from) // set global Cactus/Carpet variables if (in_recovery) { + + if (use_grid_structure_from_checkpoint) { + // recover the grid structure only once + static bool is_first = true; + if (is_first) { + is_first = false; + CarpetIOHDF5_RecoverGridStructure (cctkGH); + } + } + global_time = fileset->global_time; delta_time = fileset->delta_time; CCTK_SetMainLoopIndex (fileset->main_loop_index); @@ -636,7 +649,7 @@ static void ReadMetadata (fileset_t& fileset, hid_t file) // Read grid structure if it is present hid_t dataset; H5E_BEGIN_TRY { - dataset = H5Dopen (metadata, METADATA_GROUP "/" GRID_STRUCTURE); + dataset = H5Dopen (metadata, GRID_STRUCTURE); } H5E_END_TRY; if (dataset >= 0) { vector<char> gs_cstr (H5Dget_storage_size (dataset) + 1); |