16 #ifndef dealii_precondition_selector_h 17 #define dealii_precondition_selector_h 20 #include <deal.II/base/config.h> 22 #include <deal.II/base/smartpointer.h> 23 #include <deal.II/base/subscriptor.h> 27 DEAL_II_NAMESPACE_OPEN
29 template <
class number>
31 template <
class number>
98 template <
typename MatrixType = SparseMatrix<
double>,
99 typename VectorType = ::Vector<
double>>
113 const typename VectorType::value_type &
omega = 1.);
146 vmult(VectorType &dst,
const VectorType &src)
const;
153 Tvmult(VectorType &dst,
const VectorType &src)
const;
197 const typename VectorType::value_type
omega;
204 template <
typename MatrixType,
typename VectorType>
206 const std::string & preconditioning,
207 const typename VectorType::value_type &omega)
208 : preconditioning(preconditioning)
213 template <
typename MatrixType,
typename VectorType>
221 template <
typename MatrixType,
typename VectorType>
229 template <
typename MatrixType,
typename VectorType>
233 Assert(A !=
nullptr, ExcNoMatrixGivenToUse());
238 template <
typename MatrixType,
typename VectorType>
242 Assert(A !=
nullptr, ExcNoMatrixGivenToUse());
248 template <
typename MatrixType,
typename VectorType>
251 const VectorType &src)
const 253 if (preconditioning ==
"none")
259 Assert(A !=
nullptr, ExcNoMatrixGivenToUse());
261 if (preconditioning ==
"jacobi")
263 A->precondition_Jacobi(dst, src, omega);
265 else if (preconditioning ==
"sor")
267 A->precondition_SOR(dst, src, omega);
269 else if (preconditioning ==
"ssor")
271 A->precondition_SSOR(dst, src, omega);
279 template <
typename MatrixType,
typename VectorType>
283 const VectorType &src)
const 285 if (preconditioning ==
"none")
291 Assert(A !=
nullptr, ExcNoMatrixGivenToUse());
293 if (preconditioning ==
"jacobi")
295 A->precondition_Jacobi(dst, src, omega);
297 else if (preconditioning ==
"sor")
299 A->precondition_TSOR(dst, src, omega);
301 else if (preconditioning ==
"ssor")
303 A->precondition_SSOR(dst, src, omega);
311 template <
typename MatrixType,
typename VectorType>
315 return "none|jacobi|sor|ssor";
319 DEAL_II_NAMESPACE_CLOSE
SmartPointer< const MatrixType, PreconditionSelector< MatrixType, VectorType > > A
void use_matrix(const MatrixType &M)
const VectorType::value_type omega
static ::ExceptionBase & ExcNoMatrixGivenToUse()
LinearAlgebra::distributed::Vector< Number > Vector
#define Assert(cond, exc)
#define DeclException0(Exception0)
PreconditionSelector(const std::string &preconditioning, const typename VectorType::value_type &omega=1.)
virtual ~PreconditionSelector() override
static std::string get_precondition_names()
virtual void Tvmult(VectorType &dst, const VectorType &src) const
typename MatrixType::size_type size_type
virtual void vmult(VectorType &dst, const VectorType &src) const
static ::ExceptionBase & ExcNotImplemented()
std::string preconditioning