Skip to content

Commit

Permalink
Fix a coordinate output bug by updating Parthenon
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Prather committed Sep 6, 2023
1 parent 9f4b92a commit d4fc511
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions kharma/kharma.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,23 @@ Packages_t ProcessPackages(std::unique_ptr<ParameterInput>& pin);
* Check whether a given field is anywhere in outputs.
* Used to avoid calculating expensive fields (jcon, divB) if they
* will not even be written.
* Note this compares the field name as a substring rather than
* an exact match to a vector element, so sub-names like `prims.`
* or `coords.` will match any field which contains them.
*/
inline bool FieldIsOutput(ParameterInput *pin, std::string name)
{
InputBlock *pib = pin->pfirst_block;
while (pib != nullptr) {
if (pib->block_name.compare(0, 16, "parthenon/output") == 0 &&
// For every output block with a 'variables' entry...
if (pib->block_name.find("parthenon/output") != std::string::npos &&
pin->DoesParameterExist(pib->block_name, "variables")) {
std::string allvars = pin->GetString(pib->block_name, "variables");
if (allvars.find(name) != std::string::npos) {
return true;
}
}
pib = pib->pnext; // move to next input block name
pib = pib->pnext;
}
return false;
}
Expand Down

0 comments on commit d4fc511

Please sign in to comment.