aboutsummaryrefslogtreecommitdiff
path: root/Carpet
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2006-05-08 19:36:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2006-05-08 19:36:00 +0000
commitdc26cbb4265060db4ff6cdfd5980f23c1b2a9973 (patch)
treeb3f67484d905f346818fb7a7fd480c679c32c8f1 /Carpet
parenta4615da04e93539e86611c6ab414601787abad97 (diff)
CarpetIOHDF5: Correct handling of "use_grid_structure_from_checkpoint"
Correct errors in the handling of the parameter "use_grid_structure_from_checkpoint". darcs-hash:20060508193609-dae7b-c5cf907171eb31e8298669cf4bd4aa03f2c79429.gz
Diffstat (limited to 'Carpet')
-rw-r--r--Carpet/CarpetIOHDF5/schedule.ccl9
-rw-r--r--Carpet/CarpetIOHDF5/src/CarpetIOHDF5.hh6
-rw-r--r--Carpet/CarpetIOHDF5/src/Input.cc29
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);