diff options
author | Roland Haas <roland.haas@physics.gatech.edu> | 2012-06-28 14:31:29 -0700 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2012-09-11 18:23:28 +0100 |
commit | c6346d4090f31df49983a3aa4dcb97a6077f95e2 (patch) | |
tree | 3e2e6cd7a468a5ef09ddd6419e4be9c0f4512bb1 /Carpet/Carpet/src | |
parent | 57fc421df81a2c583de4d75ba60cf1d19b7efba1 (diff) |
Carpet: call POSTREGRID on all finer levels of a regridded level
Carpet assumes that a regridding operation always changes level N
and all finer levels so we should call POSTREGRID on all
finer levels
Diffstat (limited to 'Carpet/Carpet/src')
-rw-r--r-- | Carpet/Carpet/src/Evolve.cc | 10 | ||||
-rw-r--r-- | Carpet/Carpet/src/Initialise.cc | 31 |
2 files changed, 26 insertions, 15 deletions
diff --git a/Carpet/Carpet/src/Evolve.cc b/Carpet/Carpet/src/Evolve.cc index 32a2293ac..72526b8a8 100644 --- a/Carpet/Carpet/src/Evolve.cc +++ b/Carpet/Carpet/src/Evolve.cc @@ -305,12 +305,10 @@ namespace Carpet { bool const did_recompose = Recompose (cctkGH, rl, true); did_any_recompose = did_any_recompose or did_recompose; - // Do not omit the global mode call when the finest level - // does not change: - // if (did_recompose or (did_remove_level and rl == reflevels - 1)) { - if (did_recompose or - ((did_remove_level or did_any_recompose) and - rl == reflevels - 1)) + // Carpet assumes that a regridding operation always changes "level N + // and all finer levels" so we should call POSTREGRID on all finer levels + if (did_any_recompose or + (did_remove_level and rl == reflevels - 1)) { BEGIN_MGLEVEL_LOOP (cctkGH) { ENTER_LEVEL_MODE (cctkGH, rl) { diff --git a/Carpet/Carpet/src/Initialise.cc b/Carpet/Carpet/src/Initialise.cc index 7b316e874..44d4eb8b1 100644 --- a/Carpet/Carpet/src/Initialise.cc +++ b/Carpet/Carpet/src/Initialise.cc @@ -913,9 +913,13 @@ namespace Carpet { // Regrid Checkpoint ("Regrid"); + int const oldreflevels = reflevels; bool const did_regrid = Regrid (cctkGH, true, prolongate_initial_data); + bool const did_remove_level = reflevels < oldreflevels; + assert (not did_remove_level or did_regrid); if (did_regrid) { + bool did_any_recompose = false; BEGIN_META_MODE (cctkGH) { bool have_done_global_mode = false; @@ -926,11 +930,14 @@ namespace Carpet { for (int rl=0; rl<reflevels; ++rl) { bool did_recompose = false; - if (did_regrid) { - did_recompose = Recompose (cctkGH, rl, prolongate_initial_data); - } + did_recompose = Recompose (cctkGH, rl, prolongate_initial_data); + did_any_recompose = did_any_recompose or did_recompose; - if (did_recompose) { + // Carpet assumes that a regridding operation always changes "level N + // and all finer levels" so we should call POSTREGRID on all finer levels + if (did_any_recompose or + (did_remove_level and rl == reflevels - 1)) + { BEGIN_MGLEVEL_LOOP (cctkGH) { ENTER_LEVEL_MODE (cctkGH, rl) { BeginTimingLevel (cctkGH); @@ -1094,9 +1101,13 @@ namespace Carpet { // Regrid Checkpoint ("Regrid"); + int const oldreflevels = reflevels; bool const did_regrid = Regrid (cctkGH, true, prolongate_initial_data); + bool const did_remove_level = reflevels < oldreflevels; + assert (not did_remove_level or did_regrid); if (did_regrid) { + bool did_any_recompose = false; BEGIN_META_MODE (cctkGH) { bool have_done_global_mode = false; @@ -1106,12 +1117,14 @@ namespace Carpet { for (int rl=0; rl<reflevels; ++rl) { - bool did_recompose = false; - if (did_regrid) { - did_recompose = Recompose (cctkGH, rl, prolongate_initial_data); - } + bool did_recompose = Recompose (cctkGH, rl, prolongate_initial_data); + did_any_recompose = did_any_recompose or did_recompose; - if (did_recompose) { + // Carpet assumes that a regridding operation always changes "level N + // and all finer levels" so we should call POSTREGRID on all finer levels + if (did_any_recompose or + (did_remove_level and rl == reflevels - 1)) + { BEGIN_MGLEVEL_LOOP (cctkGH) { ENTER_LEVEL_MODE (cctkGH, rl) { BeginTimingLevel (cctkGH); |