diff options
author | schnetter <> | 2004-06-21 10:28:00 +0000 |
---|---|---|
committer | schnetter <> | 2004-06-21 10:28:00 +0000 |
commit | caceef5655eaead9dc1a94907a72ee3db162d1f3 (patch) | |
tree | 1c1d97f6717165e62f6daff9878effb14cc6a4e0 | |
parent | 01daea0cac415f7175769f3518cd6465893bb97d (diff) |
Make Regrid return a flag whether it changed the grid hierarchy. This
Make Regrid return a flag whether it changed the grid hierarchy. This
can be used to call the postregrid bin only when things changed.
darcs-hash:20040621102859-07bb3-8f6dd27a142f970982232ea008a89ce0bf9880f8.gz
-rw-r--r-- | Carpet/Carpet/src/Evolve.cc | 12 | ||||
-rw-r--r-- | Carpet/Carpet/src/Recompose.cc | 10 | ||||
-rw-r--r-- | Carpet/Carpet/src/carpet.hh | 4 |
3 files changed, 16 insertions, 10 deletions
diff --git a/Carpet/Carpet/src/Evolve.cc b/Carpet/Carpet/src/Evolve.cc index a64536f51..f7b4576c5 100644 --- a/Carpet/Carpet/src/Evolve.cc +++ b/Carpet/Carpet/src/Evolve.cc @@ -31,7 +31,7 @@ #include "carpet.hh" extern "C" { - static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Evolve.cc,v 1.46 2004/05/27 12:27:24 schnetter Exp $"; + static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Evolve.cc,v 1.47 2004/06/21 12:28:59 schnetter Exp $"; CCTK_FILEVERSION(Carpet_Carpet_Evolve_cc); } @@ -153,11 +153,13 @@ namespace Carpet { enter_level_mode (cgh, rl); Checkpoint ("Regrid"); - Regrid (cgh); + const bool did_change = Regrid (cgh); - // Postregrid - Checkpoint ("Scheduling POSTREGRID"); - CCTK_ScheduleTraverse ("CCTK_POSTREGRID", cgh, CallFunction); + if (true || did_change) { + // Postregrid + Checkpoint ("Scheduling POSTREGRID"); + CCTK_ScheduleTraverse ("CCTK_POSTREGRID", cgh, CallFunction); + } leave_level_mode (cgh); leave_global_mode (cgh); diff --git a/Carpet/Carpet/src/Recompose.cc b/Carpet/Carpet/src/Recompose.cc index dfd1d0ee1..d12f810ef 100644 --- a/Carpet/Carpet/src/Recompose.cc +++ b/Carpet/Carpet/src/Recompose.cc @@ -27,7 +27,7 @@ #include "modes.hh" extern "C" { - static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Recompose.cc,v 1.66 2004/06/02 07:11:22 bzink Exp $"; + static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Recompose.cc,v 1.67 2004/06/21 12:28:59 schnetter Exp $"; CCTK_FILEVERSION(Carpet_Carpet_Recompose_cc); } @@ -119,7 +119,7 @@ namespace Carpet { - void Regrid (const cGH* cgh, bool checkpoint_recovery) + bool Regrid (const cGH* cgh, bool checkpoint_recovery) { assert (is_level_mode()); @@ -129,9 +129,10 @@ namespace Carpet { CCTK_WARN (1, "No regridding routine has been provided. There will be no regridding. Maybe you forgot to activate a regridding thorn?"); didtell = true; } - return; + return false; } + bool did_change = false; BEGIN_MAP_LOOP(cgh, CCTK_GF) { gh<dim>::rexts bbsss = vhh.at(map)->extents; @@ -142,6 +143,7 @@ namespace Carpet { CCTK_INT const do_recompose = Carpet_Regrid (cgh, &bbsss, &obss, &pss, checkpoint_recovery); assert (do_recompose >= 0); + did_change = did_change || do_recompose; if (do_recompose) { @@ -172,6 +174,8 @@ namespace Carpet { // One cannot switch off the current level assert (reflevels > reflevel); + + return did_change; } diff --git a/Carpet/Carpet/src/carpet.hh b/Carpet/Carpet/src/carpet.hh index b1912ea31..b30efc845 100644 --- a/Carpet/Carpet/src/carpet.hh +++ b/Carpet/Carpet/src/carpet.hh @@ -1,4 +1,4 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/carpet.hh,v 1.29 2004/06/02 07:11:22 bzink Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/carpet.hh,v 1.30 2004/06/21 12:28:59 schnetter Exp $ #ifndef CARPET_HH #define CARPET_HH @@ -34,7 +34,7 @@ namespace Carpet { int CallFunction (void* function, cFunctionData* attribute, void* data); // Other functions - void Regrid (const cGH* cgh, bool checkpoint_recovery = false); + bool Regrid (const cGH* cgh, bool checkpoint_recovery = false); void CycleTimeLevels (const cGH* cgh); void FlipTimeLevels (const cGH* cgh); void Restrict (const cGH* cgh); |