From c6d7b35f547ce119f2f23157ab99bc8e23ee1a90 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 6 Apr 2017 15:30:49 -0500 Subject: [PATCH] C++ cleanup: Remove deprecated class ProductMatrix --- include/deal.II/lac/matrix_lib.h | 247 ------------------------------- 1 file changed, 247 deletions(-) diff --git a/include/deal.II/lac/matrix_lib.h b/include/deal.II/lac/matrix_lib.h index 0ae8ac96a3..dbbbfbc5a6 100644 --- a/include/deal.II/lac/matrix_lib.h +++ b/include/deal.II/lac/matrix_lib.h @@ -32,116 +32,6 @@ template class SparseMatrix; */ -/** - * Poor man's matrix product of two quadratic matrices. Stores two quadratic - * matrices #m1 and #m2 of arbitrary types and implements matrix-vector - * multiplications for the product M1M2 by - * performing multiplication with both factors consecutively. Because the - * types of the matrices are opaque (i.e., they can be arbitrary), you can - * stack products of three or more matrices by making one of the two matrices - * an object of the current type handles be a ProductMatrix itself. - * - * Here is an example multiplying two different FullMatrix objects: - * @include product_matrix.cc - * - * @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, 2000, 2001, 2002, 2005 - */ -template -class ProductMatrix : public PointerMatrixBase -{ -public: - /** - * Standard constructor. Matrices and the memory pool must be added later - * using initialize(). - */ - ProductMatrix(); - - /** - * Constructor only assigning the memory pool. Matrices must be added by - * reinit() later. - */ - ProductMatrix(VectorMemory &mem); - - /** - * Constructor. Additionally to the two constituting matrices, a memory - * pool for the auxiliary vector must be provided. - */ - template - ProductMatrix (const MatrixType1 &m1, - const MatrixType2 &m2, - VectorMemory &mem); - - /** - * Destructor. - */ - ~ProductMatrix(); - - /** - * Change the matrices. - */ - template - void reinit (const MatrixType1 &m1, const MatrixType2 &m2); - - /** - * Change the matrices and memory pool. - */ - template - void initialize (const MatrixType1 &m1, - const MatrixType2 &m2, - VectorMemory &mem); - - // Doc in PointerMatrixBase - void clear(); - - /** - * Matrix-vector product w = m1 * m2 * v. - */ - virtual void vmult (VectorType &w, - const VectorType &v) const; - - /** - * Transposed matrix-vector product w = m2T * m1T * - * v. - */ - virtual void Tvmult (VectorType &w, - const VectorType &v) const; - - /** - * Adding matrix-vector product w += m1 * m2 * v - */ - virtual void vmult_add (VectorType &w, - const VectorType &v) const; - - /** - * Adding, transposed matrix-vector product w += m2T * - * m1T * v. - */ - virtual void Tvmult_add (VectorType &w, - const VectorType &v) const; - -private: - /** - * The left matrix of the product. - */ - PointerMatrixBase *m1; - - /** - * The right matrix of the product. - */ - PointerMatrixBase *m2; - - /** - * Memory for auxiliary vector. - */ - SmartPointer,ProductMatrix > mem; -}; - - /** * A matrix that is the multiple of another matrix. * @@ -585,143 +475,6 @@ ScaledMatrix::Tvmult (VectorType &w, const VectorType &v) const } -//--------------------------------------------------------------------------- - -template -ProductMatrix::ProductMatrix () - : m1(0), m2(0), mem(0) -{} - - -template -ProductMatrix::ProductMatrix (VectorMemory &m) - : m1(0), m2(0), mem(&m) -{} - - -template -template -ProductMatrix::ProductMatrix (const MatrixType1 &mat1, - const MatrixType2 &mat2, - VectorMemory &m) - : mem(&m) -{ - m1 = new PointerMatrix(&mat1, typeid(*this).name()); - m2 = new PointerMatrix(&mat2, typeid(*this).name()); -} - - -template -template -void -ProductMatrix::reinit (const MatrixType1 &mat1, const MatrixType2 &mat2) -{ - if (m1) delete m1; - if (m2) delete m2; - m1 = new PointerMatrix(&mat1, typeid(*this).name()); - m2 = new PointerMatrix(&mat2, typeid(*this).name()); -} - - -template -template -void -ProductMatrix::initialize (const MatrixType1 &mat1, - const MatrixType2 &mat2, - VectorMemory &memory) -{ - mem = &memory; - if (m1) delete m1; - if (m2) delete m2; - m1 = new PointerMatrix(&mat1, typeid(*this).name()); - m2 = new PointerMatrix(&mat2, typeid(*this).name()); -} - - -template -ProductMatrix::~ProductMatrix () -{ - if (m1) delete m1; - if (m2) delete m2; -} - - -template -void -ProductMatrix::clear () -{ - if (m1) delete m1; - m1 = 0; - if (m2) delete m2; - m2 = 0; -} - - -template -void -ProductMatrix::vmult (VectorType &dst, const VectorType &src) const -{ - Assert (mem != 0, ExcNotInitialized()); - Assert (m1 != 0, ExcNotInitialized()); - Assert (m2 != 0, ExcNotInitialized()); - - VectorType *v = mem->alloc(); - v->reinit(dst); - m2->vmult (*v, src); - m1->vmult (dst, *v); - mem->free(v); -} - - -template -void -ProductMatrix::vmult_add (VectorType &dst, const VectorType &src) const -{ - Assert (mem != 0, ExcNotInitialized()); - Assert (m1 != 0, ExcNotInitialized()); - Assert (m2 != 0, ExcNotInitialized()); - - VectorType *v = mem->alloc(); - v->reinit(dst); - m2->vmult (*v, src); - m1->vmult_add (dst, *v); - mem->free(v); -} - - -template -void -ProductMatrix::Tvmult (VectorType &dst, const VectorType &src) const -{ - Assert (mem != 0, ExcNotInitialized()); - Assert (m1 != 0, ExcNotInitialized()); - Assert (m2 != 0, ExcNotInitialized()); - - VectorType *v = mem->alloc(); - v->reinit(dst); - m1->Tvmult (*v, src); - m2->Tvmult (dst, *v); - mem->free(v); -} - - -template -void -ProductMatrix::Tvmult_add (VectorType &dst, const VectorType &src) const -{ - Assert (mem != 0, ExcNotInitialized()); - Assert (m1 != 0, ExcNotInitialized()); - Assert (m2 != 0, ExcNotInitialized()); - - VectorType *v = mem->alloc(); - v->reinit(dst); - m1->Tvmult (*v, src); - m2->Tvmult_add (dst, *v); - mem->free(v); -} - - - //--------------------------------------------------------------------------- template -- 2.39.5