Skip to content

Commit

Permalink
Merge branch 'lroberts36/add-more-careful-container-checking' into lr…
Browse files Browse the repository at this point in the history
…oberts36/add-cg-solver
  • Loading branch information
lroberts36 committed Oct 10, 2024
2 parents 068abc5 + 3a15cfe commit 5f455c9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
run: export DEBIAN_FRONTEND=noninteractive
- name: install dependencies
run: |
pip install sphinx
pip install sphinx-rtd-theme
pip install sphinx-multiversion
pip install --break-system-packages sphinx
pip install --break-system-packages sphinx-rtd-theme
pip install --break-system-packages sphinx-multiversion
- name: build docs
run: |
echo "Repo = ${GITHUB_REPOSITORY}"
Expand Down
15 changes: 5 additions & 10 deletions src/interface/meshblock_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,29 +196,24 @@ class MeshBlockData {
if (!found) add_var(src->GetVarPtr(flx_name));
}
}
} else if constexpr (std::is_same_v<SRC_t, MeshBlock> &&
std::is_same_v<ID_t, std::string>) {
} else if constexpr (std::is_same_v<SRC_t, MeshBlock>) {
for (const auto &v : vars) {
const auto &vid = resolved_packages->GetFieldVarID(v);
const auto &md = resolved_packages->GetFieldMetadata(v);
AddField(vid.base_name, md, vid.sparse_id);
// Add the associated flux as well if not explicitly
// asked for
if (md.IsSet(Metadata::WithFluxes)) {
auto flx_name = md.GetFluxName();
auto flx_vid = resolved_packages->GetFieldVarID(md.GetFluxName());
bool found = false;
for (const auto &v2 : vars)
if (v2 == flx_name) found = true;
if (resolved_packages->GetFieldVarID(v2) == flx_vid) found = true;
if (!found) {
const auto &vid = resolved_packages->GetFieldVarID(flx_name);
const auto &md = resolved_packages->GetFieldMetadata(flx_name);
AddField(vid.base_name, md, vid.sparse_id);
const auto &flx_md = resolved_packages->GetFieldMetadata(flx_vid);
AddField(flx_vid.base_name, flx_md, flx_vid.sparse_id);
}
}
}
} else {
PARTHENON_FAIL("Variable subset selection not yet implemented for MeshBlock "
"input with unique ids.");
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/interface/state_descriptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ class StateDescriptor {
// retrieve all swarm names
std::vector<std::string> Swarms() noexcept;

const auto GetFieldVarID(const VarID &id) const {
PARTHENON_REQUIRE_THROWS(
metadataMap_.count(id),
"Asking for a variable that is not in this StateDescriptor.");
return id;
}

const auto &GetFieldVarID(const std::string &label) const {
return labelToVidMap_.at(label);
}
Expand Down

0 comments on commit 5f455c9

Please sign in to comment.