From 28bead480513dc1b4f6c4a2c35616f98ea781801 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 6 Apr 2017 15:22:52 -0500 Subject: [PATCH] C++11 cleanup: Remove deprecated class InverseMatrixRichardson --- include/deal.II/lac/matrix_lib.h | 123 --------------------- include/deal.II/lac/matrix_lib.templates.h | 82 -------------- source/lac/matrix_lib.cc | 5 - 3 files changed, 210 deletions(-) diff --git a/include/deal.II/lac/matrix_lib.h b/include/deal.II/lac/matrix_lib.h index 0ae8ac96a3..63abba6f10 100644 --- a/include/deal.II/lac/matrix_lib.h +++ b/include/deal.II/lac/matrix_lib.h @@ -401,113 +401,6 @@ private: -/** - * Objects of this type represent the inverse of a matrix as computed - * approximately by using the SolverRichardson iterative solver. In other - * words, if you set up an object of the current type for a matrix $A$, then - * calling the vmult() function with arguments $v,w$ amounts to setting - * $w=A^{-1}v$ by solving the linear system $Aw=v$ using the Richardson solver - * with a preconditioner that can be chosen. Similarly, this class allows to - * also multiple with the transpose of the inverse (i.e., the inverse of the - * transpose) using the function SolverRichardson::Tsolve(). - * - * The functions vmult() and Tvmult() approximate the inverse iteratively - * starting with the vector dst. Functions vmult_add() and - * Tvmult_add() start the iteration with a zero vector. All of the matrix- - * vector multiplication functions expect that the Richardson solver with the - * given preconditioner actually converge. If the Richardson solver does not - * converge within the specified number of iterations, the exception that will - * result in the solver will simply be propagated to the caller of the member - * function of the current class. - * - * @note A more powerful version of this class is provided by the - * IterativeInverse class. - * - * @note Instantiations for this template are provided for @ and - * @; others can be generated in application programs (see the - * section on - * @ref Instantiations - * in the manual). - * - * @deprecated If deal.II was configured with C++11 support, use the - * LinearOperator class instead, see the module on - * @ref LAOperators "linear operators" - * for further details. - * - * @author Guido Kanschat, 2005 - */ -template -class InverseMatrixRichardson : public Subscriptor -{ -public: - /** - * Constructor, initializing the solver with a control and memory object. - * The inverted matrix and the preconditioner are added in initialize(). - */ - InverseMatrixRichardson (SolverControl &control, - VectorMemory &mem); - /** - * Since we use two pointers, we must implement a destructor. - */ - ~InverseMatrixRichardson(); - - /** - * Initialization function. Provide a solver object, a matrix, and another - * preconditioner for this. - */ - template - void initialize (const MatrixType &, - const PreconditionerType &); - - /** - * Access to the SolverControl object used by the solver. - */ - SolverControl &control() const; - /** - * Execute solver. - */ - void vmult (VectorType &, const VectorType &) const; - - /** - * Execute solver. - */ - void vmult_add (VectorType &, const VectorType &) const; - - /** - * Execute transpose solver. - */ - void Tvmult (VectorType &, const VectorType &) const; - - /** - * Execute transpose solver. - */ - void Tvmult_add (VectorType &, const VectorType &) const; - -private: - /** - * A reference to the provided VectorMemory object. - */ - VectorMemory &mem; - - /** - * The solver object. - */ - mutable SolverRichardson solver; - - /** - * The matrix in use. - */ - PointerMatrixBase *matrix; - - /** - * The preconditioner to use. - */ - PointerMatrixBase *precondition; -}; - - - - /*@}*/ //--------------------------------------------------------------------------- @@ -739,22 +632,6 @@ MeanValueFilter::Tvmult_add(VectorType &, const VectorType &) const Assert(false, ExcNotImplemented()); } -//-----------------------------------------------------------------------// - -template -template -inline void -InverseMatrixRichardson::initialize (const MatrixType &m, - const PreconditionerType &p) -{ - if (matrix != 0) - delete matrix; - matrix = new PointerMatrix(&m); - if (precondition != 0) - delete precondition; - precondition = new PointerMatrix(&p); -} - DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/lac/matrix_lib.templates.h b/include/deal.II/lac/matrix_lib.templates.h index 58f07a0c67..247d23234a 100644 --- a/include/deal.II/lac/matrix_lib.templates.h +++ b/include/deal.II/lac/matrix_lib.templates.h @@ -119,88 +119,6 @@ MeanValueFilter::vmult_add(BlockVector &dst, } -//----------------------------------------------------------------------// - - -template -InverseMatrixRichardson::InverseMatrixRichardson( - SolverControl &c, - VectorMemory &m) - : - mem(m), - solver(c,m), - matrix(0), - precondition(0) -{} - - -template -InverseMatrixRichardson::~InverseMatrixRichardson() -{ - if (matrix != 0) delete matrix; - if (precondition != 0) delete precondition; -} - - -template -void -InverseMatrixRichardson::vmult(VectorType &dst, const VectorType &src) const -{ - Assert (matrix != 0, ExcNotInitialized()); - Assert (precondition != 0, ExcNotInitialized()); - dst = 0.; - solver.solve(*matrix, dst, src, *precondition); -} - - - -template -void -InverseMatrixRichardson::vmult_add(VectorType &dst, const VectorType &src) const -{ - Assert (matrix != 0, ExcNotInitialized()); - Assert (precondition != 0, ExcNotInitialized()); - VectorType *aux = mem.alloc(); - aux->reinit(dst); - - solver.solve(*matrix, *aux, src, *precondition); - - dst += *aux; - mem.free(aux); -} - - - -template -void -InverseMatrixRichardson::Tvmult(VectorType &dst, const VectorType &src) const -{ - Assert (matrix != 0, ExcNotInitialized()); - Assert (precondition != 0, ExcNotInitialized()); - dst = 0.; - solver.Tsolve(*matrix, dst, src, *precondition); -} - - - -template -void -InverseMatrixRichardson::Tvmult_add(VectorType &dst, const VectorType &src) const -{ - Assert (matrix != 0, ExcNotInitialized()); - Assert (precondition != 0, ExcNotInitialized()); - VectorType *aux = mem.alloc(); - aux->reinit(dst); - - solver.Tsolve(*matrix, *aux, src, *precondition); - - dst += *aux; - mem.free(aux); -} - - - - DEAL_II_NAMESPACE_CLOSE #endif diff --git a/source/lac/matrix_lib.cc b/source/lac/matrix_lib.cc index b8ea151670..6c4ead13d9 100644 --- a/source/lac/matrix_lib.cc +++ b/source/lac/matrix_lib.cc @@ -161,9 +161,4 @@ template void MeanValueFilter::vmult_add(BlockVector &, template void MeanValueFilter::vmult_add(BlockVector &, const BlockVector &) const; -template class InverseMatrixRichardson >; -template class InverseMatrixRichardson >; -template class InverseMatrixRichardson >; -template class InverseMatrixRichardson >; - DEAL_II_NAMESPACE_CLOSE -- 2.39.5