Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CarpetX: CarpetX errors out when it cycles time levels if those levels are not valid everywhere. #328

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A std::vector<bool>(CCTK_Num_Groups()) would probably be faster.

for (int tl = (ntls == 1 ? 0 : 1); tl < ntls; ++tl) {
for (int vi = 0; vi < groupdata.numvars; ++vi) {
sync_set.insert(gi);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird. You insert the same number into the set several times.

}
}
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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unused.

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
Loading