22 #ifndef OPM_PRECONDITIONERFACTORY_HEADER
23 #define OPM_PRECONDITIONERFACTORY_HEADER
25 #include <opm/simulators/linalg/PreconditionerWithUpdate.hpp>
27 #include <dune/common/version.hh>
28 #include <dune/istl/paamg/aggregates.hh>
29 #if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
30 #include <dune/istl/paamg/matrixhierarchy.hh>
32 #include <dune/istl/paamg/hierarchy.hh>
46 template <
class Operator,
class Comm,
class Matrix,
class Vector>
49 using PrecPtr = std::shared_ptr<Dune::PreconditionerWithUpdate<Vector, Vector>>;
51 = Dune::Amg::AggregationCriterion<Dune::Amg::SymmetricDependency<Matrix, Dune::Amg::FirstDiagonal>>;
52 using Criterion = Dune::Amg::CoarsenCriterion<CriterionBase>;
56 template <
class Smoother>
57 static PrecPtr makeAmgPreconditioner(
const Operator& op,
59 bool useKamg =
false);
67 template <
class Operator,
class Comm>
72 using Matrix =
typename Operator::matrix_type;
73 using Vector =
typename Operator::domain_type;
76 using PrecPtr = std::shared_ptr<Dune::PreconditionerWithUpdate<Vector, Vector>>;
80 const std::function<Vector()>&, std::size_t)>;
82 const std::function<Vector()>&, std::size_t,
const Comm&)>;
90 const std::function<Vector()>& weightsCalculator = {},
91 std::size_t pressureIndex = std::numeric_limits<std::size_t>::max());
100 const std::function<Vector()>& weightsCalculator,
const Comm& comm,
101 std::size_t pressureIndex = std::numeric_limits<std::size_t>::max());
109 std::size_t pressureIndex = std::numeric_limits<std::size_t>::max());
127 static void addCreator(
const std::string& type, ParCreator creator);
130 = Dune::Amg::AggregationCriterion<Dune::Amg::SymmetricDependency<Matrix, Dune::Amg::FirstDiagonal>>;
131 using Criterion = Dune::Amg::CoarsenCriterion<CriterionBase>;
144 const std::function<Vector()> weightsCalculator,
145 std::size_t pressureIndex);
148 const std::function<Vector()> weightsCalculator,
149 std::size_t pressureIndex,
const Comm& comm);
152 void doAddCreator(
const std::string& type,
Creator c);
155 void doAddCreator(
const std::string& type, ParCreator c);
158 std::map<std::string, Creator> creators_;
159 std::map<std::string, ParCreator> parallel_creators_;
160 bool defAdded_=
false;
This is an object factory for creating preconditioners.
Definition: PreconditionerFactory.hpp:69
static PrecPtr create(const Operator &op, const PropertyTree &prm, const std::function< Vector()> &weightsCalculator={}, std::size_t pressureIndex=std::numeric_limits< std::size_t >::max())
Create a new serial preconditioner and return a pointer to it.
Definition: PreconditionerFactory_impl.hpp:500
std::function< PrecPtr(const Operator &, const PropertyTree &, const std::function< Vector()> &, std::size_t)> Creator
The type of creator functions passed to addCreator().
Definition: PreconditionerFactory.hpp:80
static void addCreator(const std::string &type, Creator creator)
Add a creator for a serial preconditioner to the PreconditionerFactory.
Definition: PreconditionerFactory_impl.hpp:529
std::shared_ptr< Dune::PreconditionerWithUpdate< Vector, Vector > > PrecPtr
The type of pointer returned by create().
Definition: PreconditionerFactory.hpp:76
typename Operator::matrix_type Matrix
Linear algebra types.
Definition: PreconditionerFactory.hpp:72
Definition: PropertyTree.hpp:37
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27
Definition: PreconditionerFactory.hpp:48