22 #ifndef OPM_FLEXIBLE_SOLVER_HEADER_INCLUDED
23 #define OPM_FLEXIBLE_SOLVER_HEADER_INCLUDED
25 #include <opm/simulators/linalg/PreconditionerWithUpdate.hpp>
26 #include <opm/simulators/linalg/PropertyTree.hpp>
28 #include <dune/istl/solver.hh>
29 #include <dune/istl/paamg/pinfo.hh>
38 template <
class MatrixTypeT,
class VectorTypeT>
39 class FlexibleSolver :
public Dune::InverseOperator<VectorTypeT, VectorTypeT>
42 using MatrixType = MatrixTypeT;
43 using VectorType = VectorTypeT;
53 const std::function<VectorType()>& weightsCalculator,
54 std::size_t pressureIndex);
61 const std::function<VectorType()>& weightsCalculator,
62 std::size_t pressureIndex);
64 virtual void apply(VectorType& x, VectorType& rhs, Dune::InverseOperatorResult& res)
override;
66 virtual void apply(VectorType& x, VectorType& rhs,
double reduction, Dune::InverseOperatorResult& res)
override;
71 virtual Dune::SolverCategory::Category category()
const override;
74 using AbstractScalarProductType = Dune::ScalarProduct<VectorType>;
75 using AbstractSolverType = Dune::InverseOperator<VectorType, VectorType>;
80 const std::function<VectorType()> weightsCalculator,
const Comm& comm,
81 std::size_t pressureIndex);
84 const std::function<VectorType()> weightsCalculator,
const Dune::Amg::SequentialInformation&,
85 std::size_t pressureIndex);
95 const std::function<VectorType()> weightsCalculator,
96 std::size_t pressureIndex);
99 std::shared_ptr<AbstractOperatorType> linearoperator_for_precond_;
100 std::shared_ptr<AbstractPrecondType> preconditioner_;
101 std::shared_ptr<AbstractScalarProductType> scalarproduct_;
102 std::shared_ptr<AbstractSolverType> linsolver_;
A solver class that encapsulates all needed objects for a linear solver (operator,...
Definition: FlexibleSolver.hpp:40
Dune::AssembledLinearOperator< MatrixType, VectorType, VectorType > AbstractOperatorType
Base class type of the operator passed to the solver.
Definition: FlexibleSolver.hpp:46
FlexibleSolver(AbstractOperatorType &op, const Opm::PropertyTree &prm, const std::function< VectorType()> &weightsCalculator, std::size_t pressureIndex)
Create a sequential solver.
Definition: FlexibleSolver_impl.hpp:41
AbstractPrecondType & preconditioner()
Access the contained preconditioner.
Definition: FlexibleSolver_impl.hpp:83
Definition: PropertyTree.hpp:37