From: Peter Munch Date: Mon, 24 Jan 2022 15:52:53 +0000 (+0100) Subject: PreconditionRelaxation: vmult/step w. relaxation X-Git-Tag: v9.4.0-rc1~572^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13285%2Fhead;p=dealii.git PreconditionRelaxation: vmult/step w. relaxation --- diff --git a/include/deal.II/lac/precondition.h b/include/deal.II/lac/precondition.h index e8c45bd90f..7e292ccf91 100644 --- a/include/deal.II/lac/precondition.h +++ b/include/deal.II/lac/precondition.h @@ -569,6 +569,28 @@ namespace internal template const bool has_step::value; + template + struct has_step_omega + { + private: + static bool + detect(...); + + template + static decltype( + std::declval().step(std::declval(), + std::declval(), + std::declval())) + detect(const U &); + + public: + static const bool value = + !std::is_same()))>::value; + }; + + template + const bool has_step_omega::value; + template struct has_Tstep { @@ -590,6 +612,28 @@ namespace internal template const bool has_Tstep::value; + template + struct has_Tstep_omega + { + private: + static bool + detect(...); + + template + static decltype( + std::declval().Tstep(std::declval(), + std::declval(), + std::declval())) + detect(const U &); + + public: + static const bool value = + !std::is_same()))>::value; + }; + + template + const bool has_Tstep_omega::value; + template struct has_jacobi_step { @@ -923,12 +967,31 @@ namespace internal const std::vector &inverse_permutation; }; - template < - typename MatrixType, - typename PreconditionerType, - typename VectorType, - typename std::enable_if::value, - PreconditionerType>::type * = nullptr> + template ::value, + PreconditionerType>::type * = nullptr> + void + step(const MatrixType &, + const PreconditionerType &preconditioner, + VectorType & dst, + const VectorType & src, + const double relaxation, + VectorType &, + VectorType &) + { + preconditioner.step(dst, src, relaxation); + } + + template ::value && + has_step::value, + PreconditionerType>::type * = nullptr> void step(const MatrixType &, const PreconditionerType &preconditioner, @@ -945,12 +1008,13 @@ namespace internal preconditioner.step(dst, src); } - template < - typename MatrixType, - typename PreconditionerType, - typename VectorType, - typename std::enable_if::value, - PreconditionerType>::type * = nullptr> + template ::value && + !has_step::value, + PreconditionerType>::type * = nullptr> void step(const MatrixType & A, const PreconditionerType &preconditioner, @@ -970,12 +1034,31 @@ namespace internal dst.add(relaxation, tmp); } - template < - typename MatrixType, - typename PreconditionerType, - typename VectorType, - typename std::enable_if::value, - PreconditionerType>::type * = nullptr> + template ::value, + PreconditionerType>::type * = nullptr> + void + Tstep(const MatrixType &, + const PreconditionerType &preconditioner, + VectorType & dst, + const VectorType & src, + const double relaxation, + VectorType &, + VectorType &) + { + preconditioner.Tstep(dst, src, relaxation); + } + + template ::value && + has_Tstep::value, + PreconditionerType>::type * = nullptr> void Tstep(const MatrixType &, const PreconditionerType &preconditioner, @@ -1014,12 +1097,13 @@ namespace internal ExcMessage("Matrix A does not provide a Tvmult() function!")); } - template < - typename MatrixType, - typename PreconditionerType, - typename VectorType, - typename std::enable_if::value, - PreconditionerType>::type * = nullptr> + template ::value && + !has_Tstep::value, + PreconditionerType>::type * = nullptr> void Tstep(const MatrixType & A, const PreconditionerType &preconditioner,