From 02bd5082bc5e55b614fe47d9e6676e64cfbb6ee2 Mon Sep 17 00:00:00 2001 From: Samuel Cupp Date: Thu, 6 Oct 2022 10:16:41 -0600 Subject: [PATCH] Carpet: added logic check to presync recursion PreSync code originally synced all coarser timelevels whenever syncing. Now, it checks if the groups are already synced on those coarser levels before calling SyncProlongateBoundaries. --- Carpet/src/PreSync.cc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Carpet/src/PreSync.cc b/Carpet/src/PreSync.cc index 320d50958..168456261 100644 --- a/Carpet/src/PreSync.cc +++ b/Carpet/src/PreSync.cc @@ -305,8 +305,26 @@ void PreSyncGroups(cFunctionData *attribute, cGH *cctkGH, cctkGH->cctk_time = previous_time; } - // ask Carpet to do the SYNC, this will apply BC as well - SyncProlongateGroups(cctkGH, pre_groups, attribute); + std::vector check_groups; + std::set tmpgroups; + for (int g = 0; g < pre_groups.size(); g++) { + int gi = pre_groups[g]; + for (int vi = 0; vi < CCTK_NumVarsInGroupI(gi); vi++) { + int const map0 = 0; + ggf *const ff = arrdata.AT(gi).AT(map0).data.AT(vi); + assert(ff); + int const valid = ff->valid(mglevel, reflevel, timelevel); + if (not is_set(valid, CCTK_VALID_EVERYWHERE)) { + tmpgroups.insert(gi); + break; + } + } + } + check_groups.assign(tmpgroups.begin(), tmpgroups.end()); + if(!check_groups.empty()) { + // ask Carpet to do the SYNC, this will apply BC as well + SyncProlongateGroups(cctkGH, pre_groups, attribute); + } } /**