From: Matthias Maier Date: Sun, 25 Oct 2015 18:01:57 +0000 (-0500) Subject: Partially revert pull request 1673 X-Git-Tag: v8.4.0-rc2~283^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b6a4bdc128e382e593621951244caf5e71d3606;p=dealii.git Partially revert pull request 1673 This reverts all changes to iterative_inverse.h and pointer_matrix.h introduced by pull request #1673. --- diff --git a/include/deal.II/lac/iterative_inverse.h b/include/deal.II/lac/iterative_inverse.h index 84375351cf..dbbf17ccfc 100644 --- a/include/deal.II/lac/iterative_inverse.h +++ b/include/deal.II/lac/iterative_inverse.h @@ -72,19 +72,13 @@ DEAL_II_NAMESPACE_OPEN * for further details. * * @ingroup Matrix2 - * @author Guido Kanschat; extension for full compatibility with - * LinearOperator class: Jean-Paul Pelteret - * @date 2010, 2015 + * @author Guido Kanschat + * @date 2010 */ template class IterativeInverse : public Subscriptor { public: - /** - * Declare type for container size. - */ - typedef typename PointerMatrixBase::size_type size_type; - /** * Initialization function. Provide a matrix and preconditioner for the * solve in vmult(). @@ -102,11 +96,6 @@ public: */ void vmult (VECTOR &dst, const VECTOR &src) const; - /** - * Same as before, but uses the transpose of the matrix. - */ - void Tvmult (VECTOR &dst, const VECTOR &src) const; - /** * Solve for right hand side src, but allow for the fact that the * vectors given to this function have different type from the vectors used @@ -115,24 +104,6 @@ public: template void vmult (VECTOR2 &dst, const VECTOR2 &src) const; - /** - * Same as before, but uses the transpose of the matrix. - */ - template - void Tvmult (VECTOR2 &dst, const VECTOR2 &src) const; - - /** - * Return the dimension of the codomain (or range) space. To remember: the - * matrix is of dimension $m \times n$. - */ - size_type m () const; - - /** - * Return the dimension of the domain space. To remember: the matrix is of - * dimension $m \times n$. - */ - size_type n () const; - /** * The solver, which allows selection of the actual solver as well as * adjustment of parameters. @@ -186,14 +157,6 @@ IterativeInverse::vmult (VECTOR &dst, const VECTOR &src) const } -template -inline void -IterativeInverse::Tvmult (VECTOR &dst, const VECTOR &src) const -{ - AssertThrow(false, ExcNotImplemented()); -} - - template template inline void @@ -211,32 +174,6 @@ IterativeInverse::vmult (VECTOR2 &dst, const VECTOR2 &src) const } -template -template -inline void -IterativeInverse::Tvmult (VECTOR2 &dst, const VECTOR2 &src) const -{ - AssertThrow(false, ExcNotImplemented()); -} - - -template -inline typename IterativeInverse::size_type -IterativeInverse::m () const -{ - Assert (matrix.get()!=0, ExcNotInitialized()); - return matrix->m(); -} - -template -inline typename IterativeInverse::size_type -IterativeInverse::n () const -{ - Assert (matrix.get()!=0, ExcNotInitialized()); - return matrix->n(); -} - - DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/lac/pointer_matrix.h b/include/deal.II/lac/pointer_matrix.h index aad96c0253..708f595e1c 100644 --- a/include/deal.II/lac/pointer_matrix.h +++ b/include/deal.II/lac/pointer_matrix.h @@ -51,11 +51,6 @@ template class PointerMatrixBase : public Subscriptor { public: - /** - * Declare type for container size. - */ - typedef types::global_dof_index size_type; - /** * Value type of this matrix. since the matrix itself is unknown, we take * the value type of the vector. Therefore, matrix entries must be @@ -101,18 +96,6 @@ public: */ virtual void Tvmult_add (VECTOR &dst, const VECTOR &src) const = 0; - - /** - * Return the dimension of the codomain (or range) space. To remember: the - * matrix is of dimension $m \times n$. - */ - virtual size_type m () const = 0; - - /** - * Return the dimension of the domain space. To remember: the matrix is of - * dimension $m \times n$. - */ - virtual size_type n () const = 0; }; @@ -124,18 +107,12 @@ public: * only has a vector as template argument. Therefore, this interface provides * an abstract base class for matrices. * - * @author Guido Kanschat 2000, 2001, 2002; extension for full compatibility - * with LinearOperator class: Jean-Paul Pelteret, 2015 + * @author Guido Kanschat 2000, 2001, 2002 */ template class PointerMatrix : public PointerMatrixBase { public: - /** - * Declare type for container size. - */ - typedef typename PointerMatrixBase::size_type size_type; - /** * Constructor. The pointer in the argument is stored in this class. As * usual, the lifetime of *M must be longer than the one of the @@ -171,12 +148,6 @@ public: PointerMatrix(const MATRIX *M, const char *name); - /** - * Destructor - */ - virtual ~PointerMatrix () - {} - // Use doc from base class virtual void clear(); @@ -216,23 +187,11 @@ public: virtual void Tvmult_add (VECTOR &dst, const VECTOR &src) const; - /** - * Return the dimension of the codomain (or range) space. To remember: the - * matrix is of dimension $m \times n$. - */ - virtual size_type m () const; - - /** - * Return the dimension of the domain space. To remember: the matrix is of - * dimension $m \times n$. - */ - virtual size_type n () const; - private: /** * The pointer to the actual matrix. */ - SmartPointer > matrix; + SmartPointer > m; }; @@ -248,18 +207,12 @@ private: * and by the fact that it implements the functions vmult_add() and * Tvmult_add() only using vmult() and Tvmult() of the MATRIX. * - * @author Guido Kanschat 2006; extension for full compatibility with - * LinearOperator class: Jean-Paul Pelteret, 2015 + * @author Guido Kanschat 2006 */ template class PointerMatrixAux : public PointerMatrixBase { public: - /** - * Declare type for container size. - */ - typedef typename PointerMatrixBase::size_type size_type; - /** * Constructor. The pointer in the argument is stored in this class. As * usual, the lifetime of *M must be longer than the one of the @@ -300,12 +253,6 @@ public: const MATRIX *M, const char *name); - /** - * Destructor - */ - virtual ~PointerMatrixAux () - {} - // Use doc from base class virtual void clear(); @@ -350,18 +297,6 @@ public: virtual void Tvmult_add (VECTOR &dst, const VECTOR &src) const; - /** - * Return the dimension of the codomain (or range) space. To remember: the - * matrix is of dimension $m \times n$. - */ - virtual size_type m () const; - - /** - * Return the dimension of the domain space. To remember: the matrix is of - * dimension $m \times n$. - */ - virtual size_type n () const; - private: /** * The backup memory if none was provided. @@ -376,7 +311,7 @@ private: /** * The pointer to the actual matrix. */ - SmartPointer > matrix; + SmartPointer > m; }; @@ -389,18 +324,12 @@ private: * (#vmult()) and scalar multiplication (#Tvmult()) functions of the Vector * class. * - * @author Guido Kanschat, 2006; extension for full compatibility with - * LinearOperator class: Jean-Paul Pelteret, 2015 + * @author Guido Kanschat, 2006 */ template class PointerMatrixVector : public PointerMatrixBase > { public: - /** - * Declare type for container size. - */ - typedef typename PointerMatrixBase< Vector >::size_type size_type; - /** * Constructor. The pointer in the argument is stored in this class. As * usual, the lifetime of *M must be longer than the one of the @@ -436,12 +365,6 @@ public: PointerMatrixVector (const Vector *M, const char *name); - /** - * Destructor - */ - virtual ~PointerMatrixVector () - {} - // Use doc from base class virtual void clear(); @@ -495,23 +418,11 @@ public: virtual void Tvmult_add (Vector &dst, const Vector &src) const; - /** - * Return the dimension of the codomain (or range) space. To remember: the - * matrix is of dimension $m \times n$. - */ - virtual size_type m () const; - - /** - * Return the dimension of the domain space. To remember: the matrix is of - * dimension $m \times n$. - */ - virtual size_type n () const; - private: /** * The pointer to the actual matrix. */ - SmartPointer,PointerMatrixVector > matrix; + SmartPointer,PointerMatrixVector > m; }; @@ -674,13 +585,13 @@ PointerMatrixBase::~PointerMatrixBase () template PointerMatrix::PointerMatrix (const MATRIX *M) - : matrix(M, typeid(*this).name()) + : m(M, typeid(*this).name()) {} template PointerMatrix::PointerMatrix (const char *name) - : matrix(0, name) + : m(0, name) {} @@ -688,7 +599,7 @@ template PointerMatrix::PointerMatrix ( const MATRIX *M, const char *name) - : matrix(M, name) + : m(M, name) {} @@ -696,7 +607,7 @@ template inline void PointerMatrix::clear () { - matrix = 0; + m = 0; } @@ -704,7 +615,7 @@ template inline const PointerMatrix & PointerMatrix::operator= (const MATRIX *M) { - matrix = M; + m = M; return *this; } @@ -713,9 +624,9 @@ template inline bool PointerMatrix::empty () const { - if (matrix == 0) + if (m == 0) return true; - return matrix->empty(); + return m->empty(); } template @@ -723,8 +634,8 @@ inline void PointerMatrix::vmult (VECTOR &dst, const VECTOR &src) const { - Assert (matrix != 0, ExcNotInitialized()); - matrix->vmult (dst, src); + Assert (m != 0, ExcNotInitialized()); + m->vmult (dst, src); } @@ -733,8 +644,8 @@ inline void PointerMatrix::Tvmult (VECTOR &dst, const VECTOR &src) const { - Assert (matrix != 0, ExcNotInitialized()); - matrix->Tvmult (dst, src); + Assert (m != 0, ExcNotInitialized()); + m->Tvmult (dst, src); } @@ -743,8 +654,8 @@ inline void PointerMatrix::vmult_add (VECTOR &dst, const VECTOR &src) const { - Assert (matrix != 0, ExcNotInitialized()); - matrix->vmult_add (dst, src); + Assert (m != 0, ExcNotInitialized()); + m->vmult_add (dst, src); } @@ -753,28 +664,11 @@ inline void PointerMatrix::Tvmult_add (VECTOR &dst, const VECTOR &src) const { - Assert (matrix != 0, ExcNotInitialized()); - matrix->Tvmult_add (dst, src); + Assert (m != 0, ExcNotInitialized()); + m->Tvmult_add (dst, src); } -template -inline typename PointerMatrix::size_type -PointerMatrix::m () const -{ - Assert (matrix != 0, ExcNotInitialized()); - return matrix->m(); -} - - -template -inline typename PointerMatrix::size_type -PointerMatrix::n () const -{ - Assert (matrix != 0, ExcNotInitialized()); - return matrix->n(); -} - //----------------------------------------------------------------------// @@ -784,7 +678,7 @@ PointerMatrixAux::PointerMatrixAux ( VectorMemory *mem, const MATRIX *M) : mem(mem, typeid(*this).name()), - matrix(M, typeid(*this).name()) + m(M, typeid(*this).name()) { if (mem == 0) mem = &my_memory; } @@ -795,7 +689,7 @@ PointerMatrixAux::PointerMatrixAux ( VectorMemory *mem, const char *name) : mem(mem, name), - matrix(0, name) + m(0, name) { if (mem == 0) mem = &my_memory; } @@ -807,7 +701,7 @@ PointerMatrixAux::PointerMatrixAux ( const MATRIX *M, const char *name) : mem(mem, name), - matrix(M, name) + m(M, name) { if (mem == 0) mem = &my_memory; } @@ -817,7 +711,7 @@ template inline void PointerMatrixAux::clear () { - matrix = 0; + m = 0; } @@ -825,7 +719,7 @@ template inline const PointerMatrixAux & PointerMatrixAux::operator= (const MATRIX *M) { - matrix = M; + m = M; return *this; } @@ -844,9 +738,9 @@ template inline bool PointerMatrixAux::empty () const { - if (matrix == 0) + if (m == 0) return true; - return matrix->empty(); + return m->empty(); } template @@ -857,8 +751,8 @@ PointerMatrixAux::vmult (VECTOR &dst, if (mem == 0) mem = &my_memory; Assert (mem != 0, ExcNotInitialized()); - Assert (matrix != 0, ExcNotInitialized()); - matrix->vmult (dst, src); + Assert (m != 0, ExcNotInitialized()); + m->vmult (dst, src); } @@ -870,8 +764,8 @@ PointerMatrixAux::Tvmult (VECTOR &dst, if (mem == 0) mem = &my_memory; Assert (mem != 0, ExcNotInitialized()); - Assert (matrix != 0, ExcNotInitialized()); - matrix->Tvmult (dst, src); + Assert (m != 0, ExcNotInitialized()); + m->Tvmult (dst, src); } @@ -883,10 +777,10 @@ PointerMatrixAux::vmult_add (VECTOR &dst, if (mem == 0) mem = &my_memory; Assert (mem != 0, ExcNotInitialized()); - Assert (matrix != 0, ExcNotInitialized()); + Assert (m != 0, ExcNotInitialized()); VECTOR *v = mem->alloc(); v->reinit(dst); - matrix->vmult (*v, src); + m->vmult (*v, src); dst += *v; mem->free(v); } @@ -900,45 +794,27 @@ PointerMatrixAux::Tvmult_add (VECTOR &dst, if (mem == 0) mem = &my_memory; Assert (mem != 0, ExcNotInitialized()); - Assert (matrix != 0, ExcNotInitialized()); + Assert (m != 0, ExcNotInitialized()); VECTOR *v = mem->alloc(); v->reinit(dst); - matrix->Tvmult (*v, src); + m->Tvmult (*v, src); dst += *v; mem->free(v); } -template -inline typename PointerMatrixAux::size_type -PointerMatrixAux::m () const -{ - Assert (matrix != 0, ExcNotInitialized()); - return matrix->m(); -} - - -template -inline typename PointerMatrixAux::size_type -PointerMatrixAux::n () const -{ - Assert (matrix != 0, ExcNotInitialized()); - return matrix->n(); -} - - //----------------------------------------------------------------------// template PointerMatrixVector::PointerMatrixVector (const Vector *M) - : matrix(M, typeid(*this).name()) + : m(M, typeid(*this).name()) {} template PointerMatrixVector::PointerMatrixVector (const char *name) - : matrix(0, name) + : m(0, name) {} @@ -946,7 +822,7 @@ template PointerMatrixVector::PointerMatrixVector ( const Vector *M, const char *name) - : matrix(M, name) + : m(M, name) {} @@ -954,7 +830,7 @@ template inline void PointerMatrixVector::clear () { - matrix = 0; + m = 0; } @@ -962,7 +838,7 @@ template inline const PointerMatrixVector & PointerMatrixVector::operator= (const Vector *M) { - matrix = M; + m = M; return *this; } @@ -971,9 +847,9 @@ template inline bool PointerMatrixVector::empty () const { - if (matrix == 0) + if (m == 0) return true; - return matrix->empty(); + return m->empty(); } template @@ -982,10 +858,10 @@ PointerMatrixVector::vmult ( Vector &dst, const Vector &src) const { - Assert (matrix != 0, ExcNotInitialized()); + Assert (m != 0, ExcNotInitialized()); Assert (dst.size() == 1, ExcDimensionMismatch(dst.size(), 1)); - dst(0) = *matrix * src; + dst(0) = *m * src; } @@ -995,10 +871,10 @@ PointerMatrixVector::Tvmult ( Vector &dst, const Vector &src) const { - Assert (matrix != 0, ExcNotInitialized()); + Assert (m != 0, ExcNotInitialized()); Assert(src.size() == 1, ExcDimensionMismatch(src.size(), 1)); - dst.equ (src(0), *matrix); + dst.equ (src(0), *m); } @@ -1008,10 +884,10 @@ PointerMatrixVector::vmult_add ( Vector &dst, const Vector &src) const { - Assert (matrix != 0, ExcNotInitialized()); + Assert (m != 0, ExcNotInitialized()); Assert (dst.size() == 1, ExcDimensionMismatch(dst.size(), 1)); - dst(0) += *matrix * src; + dst(0) += *m * src; } @@ -1021,28 +897,10 @@ PointerMatrixVector::Tvmult_add ( Vector &dst, const Vector &src) const { - Assert (matrix != 0, ExcNotInitialized()); + Assert (m != 0, ExcNotInitialized()); Assert(src.size() == 1, ExcDimensionMismatch(src.size(), 1)); - dst.add (src(0), *matrix); -} - - -template -inline typename PointerMatrixVector::size_type -PointerMatrixVector::m () const -{ - Assert (matrix != 0, ExcNotInitialized()); - return matrix->m(); -} - - -template -inline typename PointerMatrixVector::size_type -PointerMatrixVector::n () const -{ - Assert (matrix != 0, ExcNotInitialized()); - return matrix->n(); + dst.add (src(0), *m); }