44#ifndef EWOMS_ISTL_PRECONDITIONER_WRAPPERS_HH
45#define EWOMS_ISTL_PRECONDITIONER_WRAPPERS_HH
51#include <dune/istl/preconditioners.hh>
53#include <dune/common/version.hh>
57#define EWOMS_WRAP_ISTL_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE) \
58 template <class TypeTag> \
59 class PreconditionerWrapper##PREC_NAME \
61 using Scalar = GetPropType<TypeTag, Properties::Scalar>; \
62 using SparseMatrixAdapter = GetPropType<TypeTag, Properties::SparseMatrixAdapter>; \
63 using IstlMatrix = typename SparseMatrixAdapter::IstlMatrix; \
64 using OverlappingVector = GetPropType<TypeTag, Properties::OverlappingVector>; \
67 using SequentialPreconditioner = ISTL_PREC_TYPE<IstlMatrix, \
70 PreconditionerWrapper##PREC_NAME() \
73 static void registerParameters() \
75 Parameters::registerParam<TypeTag, Properties::PreconditionerOrder> \
76 ("The order of the preconditioner"); \
77 Parameters::registerParam<TypeTag, Properties::PreconditionerRelaxation> \
78 ("The relaxation factor of the preconditioner"); \
81 void prepare(IstlMatrix& matrix) \
83 int order = Parameters::get<TypeTag, Properties::PreconditionerOrder>(); \
84 Scalar relaxationFactor = Parameters::get<TypeTag, Properties::PreconditionerRelaxation>(); \
85 seqPreCond_ = new SequentialPreconditioner(matrix, order, \
89 SequentialPreconditioner& get() \
90 { return *seqPreCond_; } \
93 { delete seqPreCond_; } \
96 SequentialPreconditioner *seqPreCond_; \
101#define EWOMS_WRAP_ISTL_SIMPLE_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE) \
102 template <class TypeTag> \
103 class PreconditionerWrapper##PREC_NAME \
105 using Scalar = GetPropType<TypeTag, Properties::Scalar>; \
106 using OverlappingMatrix = GetPropType<TypeTag, Properties::OverlappingMatrix>; \
107 using OverlappingVector = GetPropType<TypeTag, Properties::OverlappingVector>; \
110 using SequentialPreconditioner = ISTL_PREC_TYPE<OverlappingMatrix, \
112 OverlappingVector>; \
113 PreconditionerWrapper##PREC_NAME() \
116 static void registerParameters() \
118 Parameters::registerParam<TypeTag, Properties::PreconditionerRelaxation> \
119 ("The relaxation factor of the preconditioner"); \
122 void prepare(OverlappingMatrix& matrix) \
124 Scalar relaxationFactor = \
125 Parameters::get<TypeTag, Properties::PreconditionerRelaxation>(); \
126 seqPreCond_ = new SequentialPreconditioner(matrix, \
130 SequentialPreconditioner& get() \
131 { return *seqPreCond_; } \
134 { delete seqPreCond_; } \
137 SequentialPreconditioner *seqPreCond_; \
148template <
class TypeTag>
155 static constexpr int order = getPropValue<TypeTag, Properties::PreconditionerOrder>();
165 Parameters::registerParam<TypeTag, Properties::PreconditionerRelaxation>
166 (
"The relaxation factor of the preconditioner");
171 Scalar relaxationFactor = Parameters::get<TypeTag, Properties::PreconditionerRelaxation>();
178 {
return *seqPreCond_; }
181 {
delete seqPreCond_; }
187#undef EWOMS_WRAP_ISTL_PRECONDITIONER
Definition: istlpreconditionerwrappers.hh:150
SequentialPreconditioner & get()
Definition: istlpreconditionerwrappers.hh:177
void cleanup()
Definition: istlpreconditionerwrappers.hh:180
static void registerParameters()
Definition: istlpreconditionerwrappers.hh:163
void prepare(OverlappingMatrix &matrix)
Definition: istlpreconditionerwrappers.hh:169
PreconditionerWrapperILU()
Definition: istlpreconditionerwrappers.hh:160
Dune::SeqILU< OverlappingMatrix, OverlappingVector, OverlappingVector, order > SequentialPreconditioner
Definition: istlpreconditionerwrappers.hh:158
#define EWOMS_WRAP_ISTL_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE)
Definition: istlpreconditionerwrappers.hh:57
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:242
This file provides the infrastructure to retrieve run-time parameters.
The Opm property system, traits with inheritance.