W4XMGPEHBCV6AAPJBI4SSEMCDB6KKCGRUC2X2F5YLBY22OR3ICPAC
UEZKNPXXK5WU6B5LYRKGGYGBZ6T6TAZI26CWTJFUBUW2SJJOMV2AC
M5R6KQLXLGYSVKHVAX5AJKD6NYE6IM5Z6WVTR3BTKPJDNNKF3ARAC
722HZ7UFINNE3YKSYKP2NHZ5XEG5QQLQHSKC7PREJZR3EX6RDYUAC
BSMJ4V7GV3EOGY4KCSTOJQUOFE2OOCIKQETE4WC2WRNLWBQIBW3QC
BVR7DVINVPQG7PA6Z7QYVYNQ43YZL7XCC6AOMSMWMGAAB2Q43STAC
BPRNUTY7MHK7LK4EY5MY5OFFG3ABOL7LWXD574L35M74YSQPULFAC
IV3MLV677VWS7GLESBQZ4HRFNW5TBFBIGIBWXTCHAER3FQ7VG3GQC
EHF2P5PKVTMAUL5R5QSZ3DS3VLE7Z6SHJTCZAGRBTQ66Y7HZKNYQC
KCIWCVZOHG44WBOLKI2XK33WPHPRI5FWCETF4AOGTPZISKCW3CLQC
RFUF3QUEOYDFA5H5BZJP7HVQ5LMCWCIO7MV32RQBDMVDULGQGO5QC
for (int level = min_level; level < max_level; ++level) {
const auto &restrict leveldata = ghext->leveldata.at(level);
cGroup group;
int ierr = CCTK_GroupData(rd.gi, &group);
assert(!ierr);
if (CCTK_GroupTypeI(rd.gi) == CCTK_GF) {
// TODO: something about this cast
// (https://stackoverflow.com/questions/6179314/casting-pointers-and-the-ternary-operator-have-i-reinvented-the-wheel)
const GHExt::CommonGroupData *groupdata =
group.grouptype == CCTK_GF
? static_cast<const GHExt::CommonGroupData *>(
&leveldata.groupdata.at(rd.gi))
: static_cast<const GHExt::CommonGroupData *>(
&globaldata.scalargroupdata.at(rd.gi));
for (int level = min_level; level < max_level; ++level) {
const auto &restrict leveldata = ghext->leveldata.at(level);
const auto &restrict groupdata = leveldata.groupdata.at(rd.gi);
const valid_t &need = rd.valid;
const valid_t &have = groupdata.valid.at(rd.tl).at(rd.vi);
// "x <= y" for booleans means "x implies y"
const bool cond = need.valid_int <= have.valid_int &&
need.valid_bnd <= have.valid_bnd;
if (!cond)
CCTK_VERROR(
"Found invalid input data: iteration %d %s: %s::%s, level %d, "
"variable %s%s: need %s, have %s",
cctkGH->cctk_iteration, attribute->where, attribute->thorn,
attribute->routine, leveldata.level,
CCTK_FullVarName(groupdata.firstvarindex + rd.vi),
string("_p", rd.tl).c_str(), string(need).c_str(),
string(have).c_str());
check_valid(leveldata, groupdata, rd.vi, rd.tl, [&]() {
ostringstream buf;
buf << "CallFunction iteration " << cctkGH->cctk_iteration << " "
<< attribute->where << ": " << attribute->thorn
<< "::" << attribute->routine << " checking input";
return buf.str();
});
}
} else { // CCTK_SCALAR
const auto &restrict scalargroupdata =
ghext->globaldata.scalargroupdata.at(rd.gi);
CCTK_VERROR(
"Found invalid input data: iteration %d %s: %s::%s, level %d, "
"variable %s%s: need %s, have %s",
cctkGH->cctk_iteration, attribute->where, attribute->thorn,
attribute->routine, leveldata.level,
CCTK_FullVarName(groupdata->firstvarindex + rd.vi),
string("_p", rd.tl).c_str(), string(need).c_str(),
string(have).c_str());
if (group.grouptype == CCTK_GF) {
check_valid(
leveldata, leveldata.groupdata.at(rd.gi), rd.vi, rd.tl, [&]() {
ostringstream buf;
buf << "CallFunction iteration " << cctkGH->cctk_iteration
<< " " << attribute->where << ": " << attribute->thorn
<< "::" << attribute->routine << " checking input";
return buf.str();
});
} else {
check_valid(
globaldata.scalargroupdata.at(rd.gi), rd.vi, rd.tl, [&]() {
ostringstream buf;
buf << "CallFunction iteration " << cctkGH->cctk_iteration
<< " " << attribute->where << ": " << attribute->thorn
<< "::" << attribute->routine << " checking input";
return buf.str();
});
}
CCTK_VERROR("Found invalid input data: iteration %d %s: %s::%s, "
"variable %s%s: need %s, have %s",
cctkGH->cctk_iteration, attribute->where,
attribute->thorn, attribute->routine,
CCTK_FullVarName(scalargroupdata.firstvarindex + rd.vi),
string("_p", rd.tl).c_str(), string(need).c_str(),
string(have).c_str());
check_valid(scalargroupdata, rd.vi, rd.tl, [&]() {
ostringstream buf;
buf << "CallFunction iteration " << cctkGH->cctk_iteration << " "
<< attribute->where << ": " << attribute->thorn
<< "::" << attribute->routine << " checking input";
return buf.str();
});
const valid_t &provided = wr.valid;
for (int level = min_level; level < max_level; ++level) {
auto &restrict leveldata = ghext->leveldata.at(level);
cGroup group;
int ierr = CCTK_GroupData(wr.gi, &group);
assert(!ierr);
if (CCTK_GroupTypeI(wr.gi) == CCTK_GF) {
for (int level = min_level; level < max_level; ++level) {
auto &restrict leveldata = ghext->leveldata.at(level);
auto &restrict groupdata = leveldata.groupdata.at(wr.gi);
const valid_t &provided = wr.valid;
valid_t &have = groupdata.valid.at(wr.tl).at(wr.vi);
have.valid_int &= need.valid_int || !provided.valid_int;
have.valid_bnd &= need.valid_bnd || !provided.valid_bnd;
poison_invalid(leveldata, groupdata, wr.vi, wr.tl);
}
} else { // CCTK_SCALAR
GHExt::CommonGroupData *groupdata =
group.grouptype == CCTK_GF
? static_cast<GHExt::CommonGroupData *>(
&leveldata.groupdata.at(wr.gi))
: static_cast<GHExt::CommonGroupData *>(
&globaldata.scalargroupdata.at(wr.gi));
valid_t &have = groupdata->valid.at(wr.tl).at(wr.vi);
auto &restrict scalargroupdata =
ghext->globaldata.scalargroupdata.at(wr.gi);
const valid_t &provided = wr.valid;
valid_t &have = scalargroupdata.valid.at(wr.tl).at(wr.vi);
for (int level = min_level; level < max_level; ++level) {
auto &restrict leveldata = ghext->leveldata.at(level);
cGroup group;
int ierr = CCTK_GroupData(wr.gi, &group);
assert(!ierr);
if (CCTK_GroupTypeI(wr.gi) == CCTK_GF) {
for (int level = min_level; level < max_level; ++level) {
auto &restrict leveldata = ghext->leveldata.at(level);
auto &restrict groupdata = leveldata.groupdata.at(wr.gi);
const valid_t &provided = wr.valid;
valid_t &have = groupdata.valid.at(wr.tl).at(wr.vi);
have.valid_int |= provided.valid_int;
have.valid_bnd |= provided.valid_bnd;
check_valid(leveldata, groupdata, wr.vi, wr.tl, [&]() {
ostringstream buf;
buf << "CallFunction iteration " << cctkGH->cctk_iteration << " "
<< attribute->where << ": " << attribute->thorn
<< "::" << attribute->routine << " checking output";
return buf.str();
});
}
} else { // CCTK_SCALAR
GHExt::CommonGroupData *groupdata =
group.grouptype == CCTK_GF
? static_cast<GHExt::CommonGroupData *>(
&leveldata.groupdata.at(wr.gi))
: static_cast<GHExt::CommonGroupData *>(
&globaldata.scalargroupdata.at(wr.gi));
auto &restrict scalargroupdata =
ghext->globaldata.scalargroupdata.at(wr.gi);
if (group.grouptype == CCTK_GF) {
check_valid(
leveldata, leveldata.groupdata.at(wr.gi), wr.vi, wr.tl, [&]() {
ostringstream buf;
buf << "CallFunction iteration " << cctkGH->cctk_iteration
<< " " << attribute->where << ": " << attribute->thorn
<< "::" << attribute->routine << " checking output";
return buf.str();
});
} else {
check_valid(
globaldata.scalargroupdata.at(wr.gi), wr.vi, wr.tl, [&]() {
ostringstream buf;
buf << "CallFunction iteration " << cctkGH->cctk_iteration
<< " " << attribute->where << ": " << attribute->thorn
<< "::" << attribute->routine << " checking output";
return buf.str();
});
}
check_valid(scalargroupdata, wr.vi, wr.tl, [&]() {
ostringstream buf;
buf << "CallFunction iteration " << cctkGH->cctk_iteration << " "
<< attribute->where << ": " << attribute->thorn
<< "::" << attribute->routine << " checking output";
return buf.str();
});
for (int level = min_level; level < max_level; ++level) {
auto &restrict leveldata = ghext->leveldata.at(level);
cGroup group;
int ierr = CCTK_GroupData(inv.gi, &group);
assert(!ierr);
if (CCTK_GroupTypeI(inv.gi) == CCTK_GF) {
for (int level = min_level; level < max_level; ++level) {
auto &restrict leveldata = ghext->leveldata.at(level);
auto &restrict groupdata = leveldata.groupdata.at(inv.gi);
const valid_t &provided = inv.valid;
valid_t &have = groupdata.valid.at(inv.tl).at(inv.vi);
have.valid_int &= !provided.valid_int;
have.valid_bnd &= !provided.valid_bnd;
check_valid(leveldata, groupdata, inv.vi, inv.tl, [&]() {
ostringstream buf;
buf << "CallFunction iteration " << cctkGH->cctk_iteration << " "
<< attribute->where << ": " << attribute->thorn
<< "::" << attribute->routine << " checking output";
return buf.str();
});
}
} else { // CCTK_SCALAR
GHExt::CommonGroupData *groupdata =
group.grouptype == CCTK_GF
? static_cast<GHExt::CommonGroupData *>(
&leveldata.groupdata.at(inv.gi))
: static_cast<GHExt::CommonGroupData *>(
&globaldata.scalargroupdata.at(inv.gi));
auto &restrict scalargroupdata =
ghext->globaldata.scalargroupdata.at(inv.gi);
if (group.grouptype == CCTK_GF) {
check_valid(
leveldata, leveldata.groupdata.at(inv.gi), inv.vi, inv.tl, [&]() {
ostringstream buf;
buf << "CallFunction iteration " << cctkGH->cctk_iteration
<< " " << attribute->where << ": " << attribute->thorn
<< "::" << attribute->routine << " checking output";
return buf.str();
});
} else {
check_valid(
globaldata.scalargroupdata.at(inv.gi), inv.vi, inv.tl, [&]() {
ostringstream buf;
buf << "CallFunction iteration " << cctkGH->cctk_iteration
<< " " << attribute->where << ": " << attribute->thorn
<< "::" << attribute->routine << " checking output";
return buf.str();
});
}
check_valid(scalargroupdata, inv.vi, inv.tl, [&]() {
ostringstream buf;
buf << "CallFunction iteration " << cctkGH->cctk_iteration << " "
<< attribute->where << ": " << attribute->thorn
<< "::" << attribute->routine << " checking output";
return buf.str();
});