diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-09-28 03:33:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-09-28 03:33:00 +0000 |
commit | 44ddb460c77695935de4d408d089946b26cdba94 (patch) | |
tree | e77f90e973c7322b13102f4bf7b3f3fed0a12fbc /Carpet | |
parent | db77a3c984414dabb3270999f12a743ba7bd7d51 (diff) |
CarpetRegrid2: Regrid at most once per iteration
Remember the iteration at which the last regridding happened, and
regrid only once per iteration.
darcs-hash:20060928033352-dae7b-5f92904364803097578bc43c9c394800cbf1cf4a.gz
Diffstat (limited to 'Carpet')
-rw-r--r-- | Carpet/CarpetRegrid2/src/regrid.cc | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Carpet/CarpetRegrid2/src/regrid.cc b/Carpet/CarpetRegrid2/src/regrid.cc index 765b1f758..78da21904 100644 --- a/Carpet/CarpetRegrid2/src/regrid.cc +++ b/Carpet/CarpetRegrid2/src/regrid.cc @@ -487,7 +487,12 @@ namespace CarpetRegrid2 { assert (Carpet::is_singlemap_mode()); // Decide whether to change the grid hierarchy - // (We always do) + static bool last_iteration_initialised = false; + static vector<int> last_iteration; + if (not last_iteration_initialised) { + last_iteration_initialised = true; + last_iteration.resize (maps, -1); + } bool do_recompose; if (force) { do_recompose = true; @@ -498,11 +503,15 @@ namespace CarpetRegrid2 { do_recompose = cctkGH->cctk_iteration == 0; } else { do_recompose = - cctkGH->cctk_iteration == 0 or - (cctkGH->cctk_iteration > 0 and - (cctkGH->cctk_iteration - 1) % regrid_every == 0); + (cctkGH->cctk_iteration == 0 or + (cctkGH->cctk_iteration > 0 and + (cctkGH->cctk_iteration - 1) % regrid_every == 0 and + cctkGH->cctk_iteration > last_iteration.at(Carpet::map))); } } + if (do_recompose) { + last_iteration.at(Carpet::map) = cctkGH->cctk_iteration; + } if (do_recompose) { @@ -562,7 +571,9 @@ namespace CarpetRegrid2 { cctkGH->cctk_iteration > last_iteration)); } } - last_iteration = cctkGH->cctk_iteration; + if (do_recompose) { + last_iteration = cctkGH->cctk_iteration; + } if (do_recompose) { |