From 4ee0287b169e50b3866be5e4f04e6cb7d8f3013f Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Sun, 11 Jun 2017 22:53:48 +0200 Subject: [PATCH] Implement vmult() method in RelaxationBlock{Jacobi,SOR,SSOR} --- include/deal.II/lac/relaxation_block.h | 40 ++++++++++- .../deal.II/lac/relaxation_block.templates.h | 68 +++++++++++++++++++ 2 files changed, 106 insertions(+), 2 deletions(-) diff --git a/include/deal.II/lac/relaxation_block.h b/include/deal.II/lac/relaxation_block.h index ad6b0dc641..2292f67b5a 100644 --- a/include/deal.II/lac/relaxation_block.h +++ b/include/deal.II/lac/relaxation_block.h @@ -227,9 +227,9 @@ protected: * Perform one block relaxation step. * * Depending on the arguments @p dst and @p pref, this performs an SOR step - * (both reference the same vector) of a Jacobi step (both are different + * (both reference the same vector) or a Jacobi step (both are different * vectors). For the Jacobi step, the calling function must copy @p dst to - * @p pref after this. + * @p prev after this. */ void do_step ( VectorType &dst, @@ -339,6 +339,18 @@ public: */ void Tstep (VectorType &dst, const VectorType &rhs) const; + /** + * Implements a vmult() operation, which for this class first sets the dst() + * vector to zero before calling the step() method. + */ + void vmult (VectorType &dst, const VectorType &rhs) const; + + /** + * Implements a transpose vmult operation, which for this class first sets + * the dst() vector to zero before calling the Tstep() method. + */ + void Tvmult (VectorType &dst, const VectorType &rhs) const; + /** * Return the memory allocated in this object. */ @@ -426,6 +438,18 @@ public: * Perform one step of the transposed SOR iteration. */ void Tstep (VectorType &dst, const VectorType &rhs) const; + + /** + * Implements a vmult() operation, which for this class first sets the dst() + * vector to zero before calling the step() method. + */ + void vmult (VectorType &dst, const VectorType &rhs) const; + + /** + * Implements a transpose vmult operation, which for this class first sets + * the dst() vector to zero before calling the Tstep() method. + */ + void Tvmult (VectorType &dst, const VectorType &rhs) const; }; @@ -505,6 +529,18 @@ public: * Perform one step of the transposed SSOR iteration. */ void Tstep (VectorType &dst, const VectorType &rhs) const; + + /** + * Implements a vmult() operation, which for this class first sets the dst() + * vector to zero before calling the step() method. + */ + void vmult (VectorType &dst, const VectorType &rhs) const; + + /** + * Implements a transpose vmult operation, which for this class first sets + * the dst() vector to zero before calling the Tstep() method. + */ + void Tvmult (VectorType &dst, const VectorType &rhs) const; }; diff --git a/include/deal.II/lac/relaxation_block.templates.h b/include/deal.II/lac/relaxation_block.templates.h index 1af48da02b..c0b7d03ab6 100644 --- a/include/deal.II/lac/relaxation_block.templates.h +++ b/include/deal.II/lac/relaxation_block.templates.h @@ -299,6 +299,32 @@ void RelaxationBlockJacobi::Tstep } +template +void RelaxationBlockJacobi::vmult +(VectorType &dst, + const VectorType &src) const +{ + GrowingVectorMemory mem; + typename VectorMemory::Pointer aux = mem; + dst = 0; + aux->reinit(dst); + this->do_step(dst, *aux, src, false); +} + + +template +void RelaxationBlockJacobi::Tvmult +(VectorType &dst, + const VectorType &src) const +{ + GrowingVectorMemory mem; + typename VectorMemory::Pointer aux = mem; + dst = 0; + aux->reinit(dst); + this->do_step(dst, *aux, src, true); +} + + //----------------------------------------------------------------------// template @@ -319,6 +345,26 @@ void RelaxationBlockSOR::Tstep } +template +void RelaxationBlockSOR::vmult +(VectorType &dst, + const VectorType &src) const +{ + dst = 0; + this->do_step(dst, dst, src, false); +} + + +template +void RelaxationBlockSOR::Tvmult +(VectorType &dst, + const VectorType &src) const +{ + dst = 0; + this->do_step(dst, dst, src, true); +} + + //----------------------------------------------------------------------// template @@ -341,6 +387,28 @@ void RelaxationBlockSSOR::Tstep } +template +void RelaxationBlockSSOR::vmult +(VectorType &dst, + const VectorType &src) const +{ + dst = 0; + this->do_step(dst, dst, src, false); + this->do_step(dst, dst, src, true); +} + + +template +void RelaxationBlockSSOR::Tvmult +(VectorType &dst, + const VectorType &src) const +{ + dst = 0; + this->do_step(dst, dst, src, true); + this->do_step(dst, dst, src, false); +} + + DEAL_II_NAMESPACE_CLOSE -- 2.39.5