Skip to content

Commit

Permalink
CarpetX: CarpetX errors out when it cycles time levels if those level…
Browse files Browse the repository at this point in the history
…s are not valid everywhere.

This breaks code using presync. This commit causes CarpetX to sync these grid functions
instead of erroring out.

Co-authored-by: Max Morris <[email protected]>
  • Loading branch information
stevenrbrandt and mmor115 committed Jan 6, 2025
1 parent ad15372 commit 6b00b88
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions CarpetX/src/schedule.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> 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<int> 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<int> 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)
Expand Down

0 comments on commit 6b00b88

Please sign in to comment.