]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add clear functions to release matrices
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 25 Nov 2005 08:58:37 +0000 (08:58 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 25 Nov 2005 08:58:37 +0000 (08:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@11787 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/pointer_matrix.h
deal.II/lac/include/lac/precondition.h

index 922cc3e4f9fa8fda1e71f2704462aaccd48c902d..690da5a9c56fcc892a2057461c518eabf3b07d59 100644 (file)
@@ -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<VECTOR>
                                      */
     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<MATRIX, VECTOR>::PointerMatrix (
 {}
 
 
+template<class MATRIX, class VECTOR>
+inline void
+PointerMatrix<MATRIX, VECTOR>::clear ()
+{
+  m = 0;
+}
+
+
 template<class MATRIX, class VECTOR>
 inline const PointerMatrix<MATRIX, VECTOR>&
 PointerMatrix<MATRIX, VECTOR>::operator= (const MATRIX* M)
index f15e059e329a8fda9a4a4666abccdda34cd4dfce..2615c4fd58c90705b585f0494d82700f267daf89 100644 (file)
@@ -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<MATRIX>::initialize (const MATRIX &rA,
   relaxation = parameters.relaxation;
 }
 
+
+template <class MATRIX>
+inline void
+PreconditionRelaxation<MATRIX>::clear ()
+{
+  A = 0;
+}
+
+
 //---------------------------------------------------------------------------
 
 template <class MATRIX>

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.