diff --git a/CarpetX/src/schedule.cxx b/CarpetX/src/schedule.cxx index 9d3138a8a..3cbd72158 100644 --- a/CarpetX/src/schedule.cxx +++ b/CarpetX/src/schedule.cxx @@ -1515,12 +1515,30 @@ void CycleTimelevels(cGH *restrict const cctkGH) { } // All time levels (except the current) must be valid everywhere for // checkpointed groups - if (groupdata.do_checkpoint) - for (int tl = (ntls == 1 ? 0 : 1); tl < ntls; ++tl) - for (int vi = 0; vi < groupdata.numvars; ++vi) + bool presync_only = CCTK_EQUALS(presync_mode, "presync-only"); + if (presync_only && groupdata.do_checkpoint) { + std::set sync_set; + for (int tl = (ntls == 1 ? 0 : 1); tl < ntls; ++tl) { + for (int vi = 0; vi < groupdata.numvars; ++vi) { + sync_set.insert(gi); + } + } + if (!sync_set.empty()) { + std::vector sync_vec(sync_set.begin(), sync_set.end()); + SyncGroupsByDirI(cctkGH, sync_vec.size(), sync_vec.data(), nullptr); + } + } + // check that what we have is correct + if (groupdata.do_checkpoint) { + std::set sync_set; + for (int tl = (ntls == 1 ? 0 : 1); tl < ntls; ++tl) { + for (int vi = 0; vi < groupdata.numvars; ++vi) { error_if_invalid(groupdata, vi, tl, make_valid_all(), []() { return "CycleTimelevels for the state vector"; }); + } + } + } }); for (int vi = 0; vi < groupdata0.numvars; ++vi) { if (ntls0 > 1)