43 #ifndef EWOMS_ISTL_PRECONDITIONER_WRAPPERS_HH
44 #define EWOMS_ISTL_PRECONDITIONER_WRAPPERS_HH
49 #include <dune/istl/preconditioners.hh>
52 namespace Properties {
62 #define EWOMS_WRAP_ISTL_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE) \
63 template <class TypeTag> \
64 class PreconditionerWrapper##PREC_NAME \
66 typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; \
67 typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix; \
68 typedef typename GET_PROP_TYPE(TypeTag, OverlappingVector) OverlappingVector; \
71 typedef ISTL_PREC_TYPE<JacobianMatrix, OverlappingVector, \
72 OverlappingVector> SequentialPreconditioner; \
73 PreconditionerWrapper##PREC_NAME() \
76 static void registerParameters() \
78 EWOMS_REGISTER_PARAM(TypeTag, int, PreconditionerOrder, \
79 "The order of the preconditioner"); \
80 EWOMS_REGISTER_PARAM(TypeTag, Scalar, PreconditionerRelaxation, \
81 "The relaxation factor of the " \
85 void prepare(JacobianMatrix& matrix) \
87 int order = EWOMS_GET_PARAM(TypeTag, int, PreconditionerOrder); \
88 Scalar relaxationFactor = EWOMS_GET_PARAM(TypeTag, Scalar, PreconditionerRelaxation); \
89 seqPreCond_ = new SequentialPreconditioner(matrix, order, \
93 SequentialPreconditioner& get() \
94 { return *seqPreCond_; } \
97 { delete seqPreCond_; } \
100 SequentialPreconditioner *seqPreCond_; \
105 #define EWOMS_WRAP_ISTL_SIMPLE_PRECONDITIONER(PREC_NAME, ISTL_PREC_TYPE) \
106 template <class TypeTag> \
107 class PreconditionerWrapper##PREC_NAME \
109 typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; \
110 typedef typename GET_PROP_TYPE(TypeTag, OverlappingMatrix) OverlappingMatrix; \
111 typedef typename GET_PROP_TYPE(TypeTag, OverlappingVector) OverlappingVector; \
114 typedef ISTL_PREC_TYPE<OverlappingMatrix, OverlappingVector, \
115 OverlappingVector> SequentialPreconditioner; \
116 PreconditionerWrapper##PREC_NAME() \
119 static void registerParameters() \
121 EWOMS_REGISTER_PARAM(TypeTag, Scalar, PreconditionerRelaxation, \
122 "The relaxation factor of the " \
126 void prepare(OverlappingMatrix& matrix) \
128 Scalar relaxationFactor = \
129 EWOMS_GET_PARAM(TypeTag, Scalar, PreconditionerRelaxation); \
130 seqPreCond_ = new SequentialPreconditioner(matrix, \
134 SequentialPreconditioner& get() \
135 { return *seqPreCond_; } \
138 { delete seqPreCond_; } \
141 SequentialPreconditioner *seqPreCond_; \
144 EWOMS_WRAP_ISTL_PRECONDITIONER(Jacobi, Dune::SeqJac)
146 EWOMS_WRAP_ISTL_PRECONDITIONER(GaussSeidel, Dune::SeqGS)
147 EWOMS_WRAP_ISTL_PRECONDITIONER(SOR, Dune::SeqSOR)
148 EWOMS_WRAP_ISTL_PRECONDITIONER(SSOR, Dune::SeqSSOR)
149 EWOMS_WRAP_ISTL_SIMPLE_PRECONDITIONER(ILU0, Dune::SeqILU0)
150 EWOMS_WRAP_ISTL_PRECONDITIONER(ILUn, Dune::SeqILUn)
152 #undef EWOMS_WRAP_ISTL_PRECONDITIONER
This file provides the infrastructure to retrieve run-time parameters.
Provides the magic behind the eWoms property system.
#define NEW_PROP_TAG(PTagName)
Define a property tag.
Definition: propertysystem.hh:247