From a300c1d9aa064c517270194f38e1a740dd0babb0 Mon Sep 17 00:00:00 2001 From: guido Date: Fri, 6 May 2005 23:19:09 +0000 Subject: [PATCH] give an additional name to PointerMatrix for identifying the smart pointers git-svn-id: https://svn.dealii.org/trunk@10655 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/block_matrix_array.h | 2 +- deal.II/lac/include/lac/matrix_lib.h | 8 +-- deal.II/lac/include/lac/pointer_matrix.h | 52 +++++++++++++++++--- 3 files changed, 49 insertions(+), 13 deletions(-) diff --git a/deal.II/lac/include/lac/block_matrix_array.h b/deal.II/lac/include/lac/block_matrix_array.h index f9702a6899..0bb9a15857 100644 --- a/deal.II/lac/include/lac/block_matrix_array.h +++ b/deal.II/lac/include/lac/block_matrix_array.h @@ -571,7 +571,7 @@ BlockMatrixArray::Entry::Entry (const MATRIX& matrix, col (col), prefix (prefix), transpose (transpose), - matrix (new PointerMatrix >(&matrix)) + matrix (new PointerMatrix >(&matrix, typeid(*this).name())) {} diff --git a/deal.II/lac/include/lac/matrix_lib.h b/deal.II/lac/include/lac/matrix_lib.h index 501f6f243e..36a674c85f 100644 --- a/deal.II/lac/include/lac/matrix_lib.h +++ b/deal.II/lac/include/lac/matrix_lib.h @@ -303,8 +303,8 @@ ProductMatrix::ProductMatrix ( VectorMemory& m) : mem(&m, typeid(*this).name()) { - m1 = new PointerMatrix(&mat1); - m2 = new PointerMatrix(&mat2); + m1 = new PointerMatrix(&mat1, typeid(*this).name()); + m2 = new PointerMatrix(&mat2, typeid(*this).name()); } @@ -317,8 +317,8 @@ ProductMatrix::reinit ( { delete m1; delete m2; - m1 = new PointerMatrix(&mat1); - m2 = new PointerMatrix(&mat2); + m1 = new PointerMatrix(&mat1, typeid(*this).name()); + m2 = new PointerMatrix(&mat2, typeid(*this).name()); } diff --git a/deal.II/lac/include/lac/pointer_matrix.h b/deal.II/lac/include/lac/pointer_matrix.h index ea616cea75..922cc3e4f9 100644 --- a/deal.II/lac/include/lac/pointer_matrix.h +++ b/deal.II/lac/include/lac/pointer_matrix.h @@ -107,14 +107,14 @@ class PointerMatrixBase : public Subscriptor /** * Matrix-vector product, adding to - * @p dst. + * dst. */ virtual void vmult_add (VECTOR& dst, const VECTOR& src) const = 0; /** * Tranposed matrix-vector product, - * adding to @p dst. + * adding to dst. */ virtual void Tvmult_add (VECTOR& dst, const VECTOR& src) const = 0; @@ -144,11 +144,31 @@ class PointerMatrix : public PointerMatrixBase * argument is stored in this * class. As usual, the lifetime of * *M must be longer than the - * one of the @p PointerMatrix. + * one of the PointerMatrix. * - * If @p M is zero, no matrix is stored. + * If M is zero, no + * matrix is stored. */ PointerMatrix (const MATRIX* M=0); + + /** + * Constructor. The name argument + * is used to identify the + * SmartPointer for this object. + */ + PointerMatrix(const char* name); + + /** + * Constructor. M points + * to a matrix which must live + * longer than the + * PointerMatrix. The name + * argument is used to identify + * the SmartPointer for this + * object. + */ + PointerMatrix(const MATRIX* M, + const char* name); /** * Return whether the object is @@ -178,14 +198,14 @@ class PointerMatrix : public PointerMatrixBase /** * Matrix-vector product, adding to - * @p dst. + * dst. */ virtual void vmult_add (VECTOR& dst, const VECTOR& src) const; /** * Tranposed matrix-vector product, - * adding to @p dst. + * adding to dst. */ virtual void Tvmult_add (VECTOR& dst, const VECTOR& src) const; @@ -292,13 +312,29 @@ PointerMatrixBase::operator >= (const PointerMatrixBase& other) } +//----------------------------------------------------------------------// + template PointerMatrix::PointerMatrix (const MATRIX* M) - : - m(M, typeid(*this).name()) + : m(M, typeid(*this).name()) +{} + + +template +PointerMatrix::PointerMatrix (const char* name) + : m(0, name) +{} + + +template +PointerMatrix::PointerMatrix ( + const MATRIX* M, + const char* name) + : m(M, name) {} + template inline const PointerMatrix& PointerMatrix::operator= (const MATRIX* M) -- 2.39.5