From 98da2e9483cd721ea3e6bad95045e2ee3314594b Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Fri, 25 Nov 2005 08:58:37 +0000 Subject: [PATCH] add clear functions to release matrices git-svn-id: https://svn.dealii.org/trunk@11787 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/pointer_matrix.h | 17 +++++++++++++++++ deal.II/lac/include/lac/precondition.h | 15 +++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/deal.II/lac/include/lac/pointer_matrix.h b/deal.II/lac/include/lac/pointer_matrix.h index 922cc3e4f9..690da5a9c5 100644 --- a/deal.II/lac/include/lac/pointer_matrix.h +++ b/deal.II/lac/include/lac/pointer_matrix.h @@ -56,6 +56,12 @@ class PointerMatrixBase : public Subscriptor */ virtual ~PointerMatrixBase (); + /** + * Reset pointer and release the + * matrix pointed to. + */ + virtual void clear () = 0; + /** * Find out if two matrices point * to the same object. @@ -169,6 +175,9 @@ class PointerMatrix : public PointerMatrixBase */ PointerMatrix(const MATRIX* M, const char* name); + + // Use doc from base class + virtual void clear(); /** * Return whether the object is @@ -335,6 +344,14 @@ PointerMatrix::PointerMatrix ( {} +template +inline void +PointerMatrix::clear () +{ + m = 0; +} + + template inline const PointerMatrix& PointerMatrix::operator= (const MATRIX* M) diff --git a/deal.II/lac/include/lac/precondition.h b/deal.II/lac/include/lac/precondition.h index f15e059e32..2615c4fd58 100644 --- a/deal.II/lac/include/lac/precondition.h +++ b/deal.II/lac/include/lac/precondition.h @@ -301,6 +301,12 @@ class PreconditionRelaxation : public Subscriptor void initialize (const MATRIX &A, AdditionalData parameters = AdditionalData()); + /** + * Release the matrix and reset + * its pointer. + */ + void clear(); + protected: /** * Pointer to the matrix object. @@ -814,6 +820,15 @@ PreconditionRelaxation::initialize (const MATRIX &rA, relaxation = parameters.relaxation; } + +template +inline void +PreconditionRelaxation::clear () +{ + A = 0; +} + + //--------------------------------------------------------------------------- template -- 2.39.5