Skip to content
Snippets Groups Projects
Commit 05ca2c5c authored by Timo Koch's avatar Timo Koch
Browse files

[solver] Use structured bindings

parent d6284598
No related branches found
No related tags found
1 merge request!1845Feature/istl solver factory
...@@ -148,17 +148,16 @@ private: ...@@ -148,17 +148,16 @@ private:
void convertParameterTree(const std::string& paramGroup="") void convertParameterTree(const std::string& paramGroup="")
{ {
const auto& loggingTree = Parameters::getTree(); const auto& loggingTree = Parameters::getTree();
auto matchingGroups = loggingTree.getSubGroups("LinearSolver", auto matchingGroups = loggingTree.getSubGroups("LinearSolver", paramGroup);
paramGroup);
bool doThrow{}; bool doThrow = false;
for (const auto& transPair : istl2DumuxSolverParams) for (const auto& [istlKey, dumuxKey] : istl2DumuxSolverParams)
{ {
for (const auto fullGroup : matchingGroups) for (const auto fullGroup : matchingGroups)
{ {
auto istlName = fullGroup+"."+transPair[0]; auto istlName = fullGroup + "." + istlKey;
auto dumuxName = fullGroup+"."+transPair[1]; auto dumuxName = fullGroup + "." + dumuxKey;
if(loggingTree.hasKeyOrDefaultKey(dumuxName)) if(loggingTree.hasKeyOrDefaultKey(dumuxName))
{ {
if(loggingTree.hasKeyOrDefaultKey(istlName)) if(loggingTree.hasKeyOrDefaultKey(istlName))
...@@ -169,23 +168,23 @@ private: ...@@ -169,23 +168,23 @@ private:
<< ")." << std::endl; << ")." << std::endl;
doThrow = true; doThrow = true;
} }
params_[transPair[0]] = loggingTree.get<std::string>(dumuxName); params_[istlKey] = loggingTree.get<std::string>(dumuxName);
break; break;
} }
else if (loggingTree.hasKey(istlName)) else if (loggingTree.hasKey(istlName))
{ {
params_[transPair[0]] = loggingTree.get<std::string>(istlName); params_[istlKey] = loggingTree.get<std::string>(istlName);
break; break;
} }
} }
} }
for (const auto& transPair : istl2DumuxPreconditionerParams) for (const auto& [istlKey, dumuxKey] : istl2DumuxPreconditionerParams)
{ {
for (const auto fullGroup : matchingGroups) for (const auto fullGroup : matchingGroups)
{ {
auto istlName = fullGroup+".preconditioner."+transPair[0]; auto istlName = fullGroup + ".preconditioner." + istlKey;
auto dumuxName = fullGroup+"."+transPair[1]; auto dumuxName = fullGroup + "." + dumuxKey;
if(loggingTree.hasKey(dumuxName)) if(loggingTree.hasKey(dumuxName))
{ {
if(loggingTree.hasKeyOrDefaultKey(istlName)) if(loggingTree.hasKeyOrDefaultKey(istlName))
...@@ -196,12 +195,12 @@ private: ...@@ -196,12 +195,12 @@ private:
<< ")." << std::endl; << ")." << std::endl;
doThrow = true; doThrow = true;
} }
params_["preconditioner."+transPair[0]] = loggingTree.get<std::string>(dumuxName); params_["preconditioner." + istlKey] = loggingTree.get<std::string>(dumuxName);
break; break;
} }
else if (loggingTree.hasKeyOrDefaultKey(istlName)) else if (loggingTree.hasKeyOrDefaultKey(istlName))
{ {
params_["preconditioner."+transPair[0]] = loggingTree.get<std::string>(istlName); params_["preconditioner." + istlKey] = loggingTree.get<std::string>(istlName);
break; break;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment