43 #ifndef EWOMS_ISTL_SOLVER_WRAPPERS_HH 44 #define EWOMS_ISTL_SOLVER_WRAPPERS_HH 49 #include <dune/istl/solvers.hh> 52 namespace Properties {
68 #define EWOMS_WRAP_ISTL_SOLVER(SOLVER_NAME, ISTL_SOLVER_NAME) \ 69 template <class TypeTag> \ 70 class SolverWrapper##SOLVER_NAME \ 72 typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; \ 73 typedef typename GET_PROP_TYPE(TypeTag, \ 74 OverlappingMatrix) OverlappingMatrix; \ 75 typedef typename GET_PROP_TYPE(TypeTag, \ 76 OverlappingVector) OverlappingVector; \ 79 typedef ISTL_SOLVER_NAME<OverlappingVector> RawSolver; \ 81 SolverWrapper##SOLVER_NAME() \ 84 static void registerParameters() \ 87 template <class LinearOperator, class ScalarProduct, class Preconditioner> \ 88 std::shared_ptr<RawSolver> get(LinearOperator& parOperator, \ 89 ScalarProduct& parScalarProduct, \ 90 Preconditioner& parPreCond) \ 92 Scalar tolerance = EWOMS_GET_PARAM(TypeTag, Scalar, \ 93 LinearSolverTolerance); \ 94 int maxIter = EWOMS_GET_PARAM(TypeTag, int, LinearSolverMaxIterations);\ 97 if (parOperator.overlap().myRank() == 0) \ 98 verbosity = EWOMS_GET_PARAM(TypeTag, int, LinearSolverVerbosity); \ 99 solver_ = std::make_shared<RawSolver>(parOperator, parScalarProduct, \ 100 parPreCond, tolerance, maxIter, \ 107 { solver_.reset(); } \ 110 std::shared_ptr<RawSolver> solver_; \ 124 template <
class TypeTag>
127 typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
128 typedef typename GET_PROP_TYPE(TypeTag, OverlappingMatrix) OverlappingMatrix;
129 typedef typename GET_PROP_TYPE(TypeTag, OverlappingVector) OverlappingVector;
132 typedef Dune::RestartedGMResSolver<OverlappingVector> RawSolver;
137 static void registerParameters()
140 "Number of iterations after which the GMRES linear solver is restarted");
143 template <
class LinearOperator,
class ScalarProduct,
class Preconditioner>
144 std::shared_ptr<RawSolver>
get(LinearOperator& parOperator,
145 ScalarProduct& parScalarProduct,
146 Preconditioner& parPreCond)
148 Scalar tolerance =
EWOMS_GET_PARAM(TypeTag, Scalar, LinearSolverTolerance);
149 int maxIter =
EWOMS_GET_PARAM(TypeTag,
int, LinearSolverMaxIterations);
152 if (parOperator.overlap().myRank() == 0)
155 solver_ = std::make_shared<RawSolver>(parOperator,
170 std::shared_ptr<RawSolver> solver_;
173 #undef EWOMS_WRAP_ISTL_SOLVER #define EWOMS_WRAP_ISTL_SOLVER(SOLVER_NAME, ISTL_SOLVER_NAME)
Macro to create a wrapper around an ISTL solver.
Definition: istlsolverwrappers.hh:68
Solver wrapper for the restarted GMRES solver of dune-istl.
Definition: istlsolverwrappers.hh:125
Definition: baseauxiliarymodule.hh:37
#define EWOMS_REGISTER_PARAM(TypeTag, ParamType, ParamName, Description)
Register a run-time parameter.
Definition: parametersystem.hh:68
This file provides the infrastructure to retrieve run-time parameters.
#define EWOMS_GET_PARAM(TypeTag, ParamType, ParamName)
Retrieve a runtime parameter.
Definition: parametersystem.hh:99
Provides the magic behind the eWoms property system.
#define NEW_PROP_TAG(PTagName)
Define a property tag.
Definition: propertysystem.hh:247