#2653: Carpet PreSync triggering syncs for all refinement levels unnecessarily
Reporter: Samuel Cupp Status: new Milestone: Version: Type: bug Priority: major Component: Carpet
Comment (by Samuel Cupp):
I attempted to put in some logic to check whether it should actually call SyncProlongateBoundaries. Leaving the recursion loop unchanged, I have
``` std::vector<int> check_groups; std::set<int> 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, check_groups, attribute); } ```
This loops over the groups in pre_groups. It then loops over the variables in each group and checks if they are valid everywhere. If not, then the group is added to tmpgroups and the loops are cycled to the next group. At the end, the vector check_groups is assigned all the group indices that need to be passed on. I mimicked what is done in the PreCheckValid function, so all of this should be fine.
I did this here because it will be a bit more complicated to do it in SyncProlongateBoundaries because we will have to do it separately for syncs and BC application. There’s also a ProlongateBoundaries call that I don’t know what logic I would need to use.
-- Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2653/carpet-presync-tri...