44#ifndef EWOMS_ISTL_PRECONDITIONER_WRAPPERS_HH
45#define EWOMS_ISTL_PRECONDITIONER_WRAPPERS_HH
47#include <dune/common/version.hh>
56#include <dune/istl/preconditioners.hh>
60#define EWOMS_WRAP_ISTL_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE) \
61 template <class TypeTag> \
62 class PreconditionerWrapper##PREC_NAME \
64 using Scalar = GetPropType<TypeTag, Properties::Scalar>; \
65 using SparseMatrixAdapter = GetPropType<TypeTag, Properties::SparseMatrixAdapter>; \
66 using IstlMatrix = typename SparseMatrixAdapter::IstlMatrix; \
67 using OverlappingVector = GetPropType<TypeTag, Properties::OverlappingVector>; \
70 using SequentialPreconditioner = ISTL_PREC_TYPE<IstlMatrix, \
73 PreconditionerWrapper##PREC_NAME() \
76 static void registerParameters() \
78 Parameters::Register<Parameters::PreconditionerOrder> \
79 ("The order of the preconditioner"); \
80 Parameters::Register<Parameters::PreconditionerRelaxation<Scalar>> \
81 ("The relaxation factor of the preconditioner"); \
84 void prepare(IstlMatrix& matrix) \
86 int order = Parameters::Get<Parameters::PreconditionerOrder>(); \
87 Scalar relaxationFactor = Parameters::Get<Parameters::PreconditionerRelaxation<Scalar>>(); \
88 seqPreCond_ = new SequentialPreconditioner(matrix, order, \
92 SequentialPreconditioner& get() \
93 { return *seqPreCond_; } \
96 { delete seqPreCond_; } \
99 SequentialPreconditioner *seqPreCond_; \
104#define EWOMS_WRAP_ISTL_SIMPLE_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE) \
105 template <class TypeTag> \
106 class PreconditionerWrapper##PREC_NAME \
108 using Scalar = GetPropType<TypeTag, Properties::Scalar>; \
109 using OverlappingMatrix = GetPropType<TypeTag, Properties::OverlappingMatrix>; \
110 using OverlappingVector = GetPropType<TypeTag, Properties::OverlappingVector>; \
113 using SequentialPreconditioner = ISTL_PREC_TYPE<OverlappingMatrix, \
115 OverlappingVector>; \
116 PreconditionerWrapper##PREC_NAME() \
119 static void registerParameters() \
121 Parameters::Register<Parameters::PreconditionerRelaxation<Scalar>> \
122 ("The relaxation factor of the preconditioner"); \
125 void prepare(OverlappingMatrix& matrix) \
127 Scalar relaxationFactor = \
128 Parameters::Get<Parameters::PreconditionerRelaxation<Scalar>>();\
129 seqPreCond_ = new SequentialPreconditioner(matrix, \
133 SequentialPreconditioner& get() \
134 { return *seqPreCond_; } \
137 { delete seqPreCond_; } \
140 SequentialPreconditioner *seqPreCond_; \
151template <
class TypeTag>
158 static constexpr int order = 0;
168 Parameters::Register<Parameters::PreconditionerRelaxation<Scalar>>
169 (
"The relaxation factor of the preconditioner");
170 Parameters::Register<Parameters::PreconditionerOrder>
171 (
"The order of the preconditioner");
176 Scalar relaxationFactor = Parameters::Get<Parameters::PreconditionerRelaxation<Scalar>>();
183 {
return *seqPreCond_; }
186 {
delete seqPreCond_; }
192#undef EWOMS_WRAP_ISTL_PRECONDITIONER
Definition: istlpreconditionerwrappers.hh:153
SequentialPreconditioner & get()
Definition: istlpreconditionerwrappers.hh:182
void cleanup()
Definition: istlpreconditionerwrappers.hh:185
static void registerParameters()
Definition: istlpreconditionerwrappers.hh:166
void prepare(OverlappingMatrix &matrix)
Definition: istlpreconditionerwrappers.hh:174
PreconditionerWrapperILU()
Definition: istlpreconditionerwrappers.hh:163
Dune::SeqILU< OverlappingMatrix, OverlappingVector, OverlappingVector, order > SequentialPreconditioner
Definition: istlpreconditionerwrappers.hh:161
#define EWOMS_WRAP_ISTL_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE)
Definition: istlpreconditionerwrappers.hh:60
Declares the parameters for the black oil model.
Declares the properties required by the black oil model.
Definition: blackoilboundaryratevector.hh:37
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:235
This file provides the infrastructure to retrieve run-time parameters.
The Opm property system, traits with inheritance.