Skip to content

Commit

Permalink
[Input] Replace operator [] by AnyMap::at for phases field in C++
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Jun 30, 2020
1 parent f378702 commit 561fdae
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/thermo/IonsFromNeutralVPSSTP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,10 @@ void IonsFromNeutralVPSSTP::initThermo()
neutralName = string(slash.end(), neutralName.end());
AnyMap infile = AnyMap::fromYamlFile(fileName,
m_input.getString("__file__", ""));
AnyMap& phaseNode = infile["phases"].getMapWhere("name", neutralName);
AnyMap& phaseNode = infile.at("phases").getMapWhere("name", neutralName);
setNeutralMoleculePhase(newPhase(phaseNode, infile));
} else {
AnyMap& phaseNode = m_rootNode["phases"].getMapWhere("name", neutralName);
AnyMap& phaseNode = m_rootNode.at("phases").getMapWhere("name", neutralName);
setNeutralMoleculePhase(newPhase(phaseNode, m_rootNode));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/thermo/LatticeSolidPhase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ void LatticeSolidPhase::initThermo()
if (m_input.hasKey("composition")) {
compositionMap composition = m_input["composition"].asMap<double>();
for (auto& item : composition) {
AnyMap& node = m_rootNode["phases"].getMapWhere("name", item.first);
AnyMap& node = m_rootNode.at("phases").getMapWhere("name", item.first);
addLattice(newPhase(node, m_rootNode));
}
setLatticeStoichiometry(composition);
Expand Down
2 changes: 1 addition & 1 deletion src/thermo/ThermoFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ ThermoPhase* newPhase(const std::string& infile, std::string id)

if (extension == "yml" || extension == "yaml") {
AnyMap root = AnyMap::fromYamlFile(infile);
AnyMap& phase = root["phases"].getMapWhere("name", id);
AnyMap& phase = root.at("phases").getMapWhere("name", id);
unique_ptr<ThermoPhase> t(newThermoPhase(phase["thermo"].asString()));
setupPhase(*t, phase, root);
return t.release();
Expand Down
2 changes: 1 addition & 1 deletion src/thermo/ThermoPhase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ void ThermoPhase::initThermoFile(const std::string& inputFile,

if (extension == "yml" || extension == "yaml") {
AnyMap root = AnyMap::fromYamlFile(inputFile);
auto& phase = root["phases"].getMapWhere("name", id);
auto& phase = root.at("phases").getMapWhere("name", id);
setupPhase(*this, phase, root);
} else {
XML_Node* fxml = get_XML_File(inputFile);
Expand Down

0 comments on commit 561fdae

Please sign in to comment.