6#include <dune/common/shared_ptr.hh>
7#include <dune/istl/operators.hh>
8#include <dune/istl/preconditioner.hh>
9#include <dune/istl/scalarproducts.hh>
10#include <dune/istl/solver.hh>
11#include <dune/istl/solvercategory.hh>
13#include <amdis/common/TypeTraits.hpp>
21 :
public Dune::InverseOperator<typename S::domain_type, typename S::range_type>
26 using domain_type =
typename S::domain_type;
27 using range_type =
typename S::range_type;
29 using LinOp = Dune::LinearOperator<domain_type,range_type>;
30 using Prec = Dune::Preconditioner<domain_type,range_type>;
31 using ScalProd = Dune::ScalarProduct<domain_type>;
34 template <
class... Args>
36 : linOp_(Dune::stackobject_to_shared_ptr(linOp))
37 , prec_(Dune::stackobject_to_shared_ptr(prec))
38 , solver_(*linOp_, *prec_, FWD(args)...)
41 template <
class... Args>
43 : linOp_(std::move(linOp))
44 , prec_(std::move(prec))
45 , solver_(*linOp_, *prec_, FWD(args)...)
48 template <
class... Args>
50 : linOp_(Dune::stackobject_to_shared_ptr(linOp))
51 , sp_(Dune::stackobject_to_shared_ptr(sp))
52 , prec_(Dune::stackobject_to_shared_ptr(prec))
53 , solver_(*linOp_, *sp_, *prec_, FWD(args)...)
56 template <
class... Args>
57 IterativeSolverWrapper(std::shared_ptr<LinOp> linOp, std::shared_ptr<ScalProd> sp, std::shared_ptr<Prec> prec, Args&&... args)
58 : linOp_(std::move(linOp))
60 , prec_(std::move(prec))
61 , solver_(*linOp_, *sp_, *prec_, FWD(args)...)
65 void apply(domain_type& x, range_type& b, Dune::InverseOperatorResult& res)
override
67 solver_.apply(x, b, res);
71 void apply(domain_type& x, range_type& b,
double reduction, Dune::InverseOperatorResult& res)
override
73 solver_.apply(x, b, reduction, res);
77 Dune::SolverCategory::Category
category()
const override
79 return solver_.category();
83 std::shared_ptr<LinOp> linOp_;
84 std::shared_ptr<ScalProd> sp_;
85 std::shared_ptr<Prec> prec_;
Definition: SolverWrapper.hpp:22
void apply(domain_type &x, range_type &b, double reduction, Dune::InverseOperatorResult &res) override
Apply inverse operator with given reduction factor.
Definition: SolverWrapper.hpp:71
Dune::SolverCategory::Category category() const override
Category of the solver.
Definition: SolverWrapper.hpp:77
void apply(domain_type &x, range_type &b, Dune::InverseOperatorResult &res) override
Apply inverse operator.
Definition: SolverWrapper.hpp:65