From 05ca2c5cbe5103c2969fb70849d6698640a16c44 Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Wed, 29 Jan 2020 15:54:22 +0100 Subject: [PATCH] [solver] Use structured bindings --- dumux/linear/istlsolverfactorybackend.hh | 25 ++++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/dumux/linear/istlsolverfactorybackend.hh b/dumux/linear/istlsolverfactorybackend.hh index 30862a982b..f622635aed 100644 --- a/dumux/linear/istlsolverfactorybackend.hh +++ b/dumux/linear/istlsolverfactorybackend.hh @@ -148,17 +148,16 @@ private: void convertParameterTree(const std::string& paramGroup="") { const auto& loggingTree = Parameters::getTree(); - auto matchingGroups = loggingTree.getSubGroups("LinearSolver", - paramGroup); + auto matchingGroups = loggingTree.getSubGroups("LinearSolver", paramGroup); - bool doThrow{}; + bool doThrow = false; - for (const auto& transPair : istl2DumuxSolverParams) + for (const auto& [istlKey, dumuxKey] : istl2DumuxSolverParams) { for (const auto fullGroup : matchingGroups) { - auto istlName = fullGroup+"."+transPair[0]; - auto dumuxName = fullGroup+"."+transPair[1]; + auto istlName = fullGroup + "." + istlKey; + auto dumuxName = fullGroup + "." + dumuxKey; if(loggingTree.hasKeyOrDefaultKey(dumuxName)) { if(loggingTree.hasKeyOrDefaultKey(istlName)) @@ -169,23 +168,23 @@ private: << ")." << std::endl; doThrow = true; } - params_[transPair[0]] = loggingTree.get<std::string>(dumuxName); + params_[istlKey] = loggingTree.get<std::string>(dumuxName); break; } else if (loggingTree.hasKey(istlName)) { - params_[transPair[0]] = loggingTree.get<std::string>(istlName); + params_[istlKey] = loggingTree.get<std::string>(istlName); break; } } } - for (const auto& transPair : istl2DumuxPreconditionerParams) + for (const auto& [istlKey, dumuxKey] : istl2DumuxPreconditionerParams) { for (const auto fullGroup : matchingGroups) { - auto istlName = fullGroup+".preconditioner."+transPair[0]; - auto dumuxName = fullGroup+"."+transPair[1]; + auto istlName = fullGroup + ".preconditioner." + istlKey; + auto dumuxName = fullGroup + "." + dumuxKey; if(loggingTree.hasKey(dumuxName)) { if(loggingTree.hasKeyOrDefaultKey(istlName)) @@ -196,12 +195,12 @@ private: << ")." << std::endl; doThrow = true; } - params_["preconditioner."+transPair[0]] = loggingTree.get<std::string>(dumuxName); + params_["preconditioner." + istlKey] = loggingTree.get<std::string>(dumuxName); break; } else if (loggingTree.hasKeyOrDefaultKey(istlName)) { - params_["preconditioner."+transPair[0]] = loggingTree.get<std::string>(istlName); + params_["preconditioner." + istlKey] = loggingTree.get<std::string>(istlName); break; } } -- GitLab