diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-05-08 19:35:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-05-08 19:35:00 +0000 |
commit | a4615da04e93539e86611c6ab414601787abad97 (patch) | |
tree | c570e1aa0f3f21d5946fbb2f3d06a05caae403ac | |
parent | 0efdd8c1f954fdf58e6d8dfdac6d1371e2cc1268 (diff) |
Carpet: Offer an API to recompose the grid hierarchy from outside Carpet
Offer an API to recompose the grid hierarchy from outside Carpet.
This is used by CarpetIOHDF5 during recovery.
darcs-hash:20060508193546-dae7b-64580a0cd5cf6289054a97e61163f196ca40ffca.gz
-rw-r--r-- | Carpet/Carpet/src/Recompose.cc | 64 | ||||
-rw-r--r-- | Carpet/Carpet/src/functions.hh | 9 |
2 files changed, 52 insertions, 21 deletions
diff --git a/Carpet/Carpet/src/Recompose.cc b/Carpet/Carpet/src/Recompose.cc index e288de958..6d438c1b1 100644 --- a/Carpet/Carpet/src/Recompose.cc +++ b/Carpet/Carpet/src/Recompose.cc @@ -115,8 +115,10 @@ namespace Carpet { } - - bool Regrid (const cGH* cgh, const bool force_recompose, const bool do_init) + + bool Regrid (const cGH* cgh, + const bool force_recompose, + const bool do_init) { DECLARE_CCTK_PARAMETERS; @@ -145,26 +147,48 @@ namespace Carpet { did_change = did_change or do_recompose; if (do_recompose) { - - CCTK_INFO ("Recomposing the grid hierarchy"); - - // Check the regions - CheckRegions (bbsss, obss, pss); - // TODO: check also that the current and all coarser levels - // did not change - - // Write grid structure to file - OutputGridStructure (cgh, map, bbsss, obss, pss); - - // Recompose - vhh.at(map)->recompose (bbsss, obss, pss, do_init); - - if (verbose) OutputGrids (cgh, map, *vhh.at(map)); - + Recompose (cgh, map, bbsss, obss, pss, do_init); } - + } END_MAP_LOOP; + PostRecompose (); + + return did_change; + } + + + + void Recompose (cGH const * const cctkGH, + int const m, + gh::mexts const & bbsss, + gh::rbnds const & obss, + gh::rprocs const & pss, + bool const do_init) + { + DECLARE_CCTK_PARAMETERS; + + CCTK_VInfo (CCTK_THORNSTRING, + "Recomposing the grid hierarchy for map %d", m); + + // Check the regions + CheckRegions (bbsss, obss, pss); + // TODO: check also that the current and all coarser levels did + // not change + + // Write grid structure to file + OutputGridStructure (cctkGH, m, bbsss, obss, pss); + + // Recompose + vhh.at(m)->recompose (bbsss, obss, pss, do_init); + + if (verbose) OutputGrids (cctkGH, m, *vhh.at(m)); + } + + + + void PostRecompose () + { // Calculate new number of levels int const oldreflevels = reflevels; reflevels = vhh.at(0)->reflevels(); @@ -191,8 +215,6 @@ namespace Carpet { leveltimes.at(ml).resize (reflevels, leveltimes.at(ml).at(oldreflevels-1)); } - - return did_change; } diff --git a/Carpet/Carpet/src/functions.hh b/Carpet/Carpet/src/functions.hh index fbd24115e..8fe744dcf 100644 --- a/Carpet/Carpet/src/functions.hh +++ b/Carpet/Carpet/src/functions.hh @@ -75,6 +75,15 @@ namespace Carpet { // Helpers for recomposing the grid hierarchy + void Recompose (cGH const * const cctkGH, + int const m, + gh::mexts const & bbsss, + gh::rbnds const & obss, + gh::rprocs const & pss, + bool const do_init); + + void PostRecompose (); + void CheckRegions (const gh::mexts & bbsss, const gh::rbnds & obss, const gh::rprocs& pss); |