2BSBB53DVGURXHAIBJQI2YO6V42HYBLMF5IULSCYMZQPN4EH7IMQC
// Ensure a state vector has valid data everywhere
void statecomp_t::check_valid() const {
for (const varid_t &varid : varids) {
if (varid.gi >= 0) {
assert(varid.vi >= 0 && varid.tl >= 0);
for (const auto &leveldata : CarpetX::ghext->leveldata) {
const auto &groupdata = *leveldata.groupdata.at(varid.gi);
CarpetX::check_valid(leveldata, groupdata, varid.vi, varid.tl, [&]() {
return "ODESolver before calculating state vector";
});
}
}
}
}
for (const auto &groupdata : leveldata.groupdata) {
const int rhs_gi = get_group_rhs(groupdata->groupindex);
for (const auto &groupdataptr : leveldata.groupdata) {
const auto &groupdata = *groupdataptr;
const int rhs_gi = get_group_rhs(groupdata.groupindex);
const auto &rhs_groupdata = leveldata.groupdata.at(rhs_gi);
assert(rhs_groupdata->numvars == groupdata->numvars);
for (int vi = 0; vi < groupdata->numvars; ++vi) {
const auto &rhs_groupdata = *leveldata.groupdata.at(rhs_gi);
assert(rhs_groupdata.numvars == groupdata.numvars);
for (int vi = 0; vi < groupdata.numvars; ++vi) {
CCTK_FullVarName(groupdata->firstvarindex + vi));
var.mfabs.push_back(groupdata->mfab.at(tl).get());
CCTK_FullVarName(groupdata.firstvarindex + vi));
var.varids.push_back(varid_t{groupdata.groupindex, vi, tl});
var.mfabs.push_back(groupdata.mfab.at(tl).get());
CCTK_FullVarName(rhs_groupdata->firstvarindex + vi));
rhs.mfabs.push_back(rhs_groupdata->mfab.at(tl).get());
CCTK_FullVarName(rhs_groupdata.firstvarindex + vi));
rhs.varids.push_back(varid_t{rhs_groupdata.groupindex, vi, tl});
rhs.mfabs.push_back(rhs_groupdata.mfab.at(tl).get());