From 61af9c65328befe482d75fb1ca10751308ab3f77 Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Fri, 20 Oct 2017 18:02:06 +0200 Subject: [PATCH] [params] Replace some deprecated macros by the new free getParam function --- dumux/assembly/cclocalassembler.hh | 6 +++-- dumux/io/vtkoutputmodule.hh | 10 ++++---- dumux/nonlinear/newtoncontroller.hh | 23 ++++++++++--------- .../implicit/velocityoutput.hh | 3 ++- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/dumux/assembly/cclocalassembler.hh b/dumux/assembly/cclocalassembler.hh index 7d16cc2227..357a69a053 100644 --- a/dumux/assembly/cclocalassembler.hh +++ b/dumux/assembly/cclocalassembler.hh @@ -265,7 +265,8 @@ private: // // ////////////////////////////////////////////////////////////////////////////////////////////////// - static const int numericDifferenceMethod = GET_PARAM_FROM_GROUP(TypeTag, int, Implicit, NumericDifferenceMethod); + static const std::string group = GET_PROP_VALUE(TypeTag, ModelParameterGroup); + static const int numericDifferenceMethod = getParamFromGroup<int>(group, "Implicit.NumericDifferenceMethod"); // get stencil informations const auto numNeighbors = connectivityMap[globalI].size(); @@ -798,7 +799,8 @@ private: // derivatives are non-zero. // ////////////////////////////////////////////////////////////////////////////////////////////////// - static const int numericDifferenceMethod = GET_PARAM_FROM_GROUP(TypeTag, int, Implicit, NumericDifferenceMethod); + static const std::string group = GET_PROP_VALUE(TypeTag, ModelParameterGroup); + static const int numericDifferenceMethod = getParamFromGroup<int>(group, "Implicit.NumericDifferenceMethod"); // reference to the element's scv (needed later) and corresponding vol vars const auto& scv = fvGeometry.scv(globalI); diff --git a/dumux/io/vtkoutputmodule.hh b/dumux/io/vtkoutputmodule.hh index 6b5e7a2a6e..083deb6cf3 100644 --- a/dumux/io/vtkoutputmodule.hh +++ b/dumux/io/vtkoutputmodule.hh @@ -86,6 +86,8 @@ class VtkOutputModule struct PriVarVectorDataInfo { std::vector<unsigned int> pvIdx; std::string name; }; struct SecondVarScalarDataInfo { std::function<Scalar(const VolumeVariables&)> get; std::string name; }; + const std::string modelParamGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); + public: VtkOutputModule(const Problem& problem, @@ -220,8 +222,8 @@ public: // maybe allocate space for the process rank std::vector<Scalar> rank; - if (GET_PARAM_FROM_GROUP(TypeTag, bool, Vtk, AddProcessRank)) - rank.resize(numCells); + static bool addProcessRank = getParamFromGroup<bool>(modelParamGroup, "Vtk.AddProcessRank"); + if (addProcessRank) rank.resize(numCells); for (const auto& element : elements(gridGeom_.gridView(), Dune::Partitions::interior)) { @@ -288,7 +290,7 @@ public: velocityOutput.calculateVelocity(velocity[phaseIdx], elemVolVars, fvGeometry, element, phaseIdx); //! the rank - if (GET_PARAM_FROM_GROUP(TypeTag, bool, Vtk, AddProcessRank)) + if (addProcessRank) rank[eIdxGlobal] = gridGeom_.gridView().comm().rank(); } @@ -330,7 +332,7 @@ public: } // the process rank - if (GET_PARAM_FROM_GROUP(TypeTag, bool, Vtk, AddProcessRank)) + if (addProcessRank) sequenceWriter_.addCellData(rank, "process rank"); // also register additional (non-standardized) user fields diff --git a/dumux/nonlinear/newtoncontroller.hh b/dumux/nonlinear/newtoncontroller.hh index 138cbf5a32..9908e992a3 100644 --- a/dumux/nonlinear/newtoncontroller.hh +++ b/dumux/nonlinear/newtoncontroller.hh @@ -602,12 +602,13 @@ protected: void initParams_() { - useLineSearch_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Newton, UseLineSearch); - enableAbsoluteResidualCriterion_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Newton, EnableAbsoluteResidualCriterion); - enableShiftCriterion_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Newton, EnableShiftCriterion); - enableResidualCriterion_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Newton, EnableResidualCriterion) - || enableAbsoluteResidualCriterion_; - satisfyResidualAndShiftCriterion_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Newton, SatisfyResidualAndShiftCriterion); + const std::string group = GET_PROP_VALUE(TypeTag, ModelParameterGroup); + + useLineSearch_ = getParamFromGroup<bool>(group, "Newton.UseLineSearch"); + enableAbsoluteResidualCriterion_ = getParamFromGroup<bool>(group, "Newton.EnableAbsoluteResidualCriterion"); + enableShiftCriterion_ = getParamFromGroup<bool>(group, "Newton.EnableShiftCriterion"); + enableResidualCriterion_ = getParamFromGroup<bool>(group, "Newton.EnableResidualCriterion") || enableAbsoluteResidualCriterion_; + satisfyResidualAndShiftCriterion_ = getParamFromGroup<bool>(group, "Newton.SatisfyResidualAndShiftCriterion"); if (!enableShiftCriterion_ && !enableResidualCriterion_) { DUNE_THROW(Dune::NotImplemented, @@ -615,11 +616,11 @@ protected: << "NewtonEnableResidualCriterion has to be set to true"); } - setMaxRelativeShift(GET_PARAM_FROM_GROUP(TypeTag, Scalar, Newton, MaxRelativeShift)); - setMaxAbsoluteResidual(GET_PARAM_FROM_GROUP(TypeTag, Scalar, Newton, MaxAbsoluteResidual)); - setResidualReduction(GET_PARAM_FROM_GROUP(TypeTag, Scalar, Newton, ResidualReduction)); - setTargetSteps(GET_PARAM_FROM_GROUP(TypeTag, int, Newton, TargetSteps)); - setMaxSteps(GET_PARAM_FROM_GROUP(TypeTag, int, Newton, MaxSteps)); + setMaxRelativeShift(getParamFromGroup<Scalar>(group, "Newton.MaxRelativeShift")); + setMaxAbsoluteResidual(getParamFromGroup<Scalar>(group, "Newton.MaxAbsoluteResidual")); + setResidualReduction(getParamFromGroup<Scalar>(group, "Newton.ResidualReduction")); + setTargetSteps(getParamFromGroup<int>(group, "Newton.TargetSteps")); + setMaxSteps(getParamFromGroup<int>(group, "Newton.MaxSteps")); verbose_ = true; numSteps_ = 0; diff --git a/dumux/porousmediumflow/implicit/velocityoutput.hh b/dumux/porousmediumflow/implicit/velocityoutput.hh index 7f048db247..2068e3bf3a 100644 --- a/dumux/porousmediumflow/implicit/velocityoutput.hh +++ b/dumux/porousmediumflow/implicit/velocityoutput.hh @@ -91,7 +91,8 @@ public: , sol_(sol) { // check, if velocity output can be used (works only for cubes so far) - velocityOutput_ = GET_PARAM_FROM_GROUP(TypeTag, bool, Vtk, AddVelocity); + const std::string modelParamGroup = GET_PROP_VALUE(TypeTag, ModelParameterGroup); + velocityOutput_ = getParamFromGroup<bool>(modelParamGroup, "Vtk.AddVelocity"); if (velocityOutput_) { // set the number of scvs the vertices are connected to -- GitLab