]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use clear() to release memory, rather than doing it by hand in each of the derived...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 6 Nov 2008 03:20:07 +0000 (03:20 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 6 Nov 2008 03:20:07 +0000 (03:20 +0000)
git-svn-id: https://svn.dealii.org/trunk@17482 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/block_sparse_matrix.templates.h
deal.II/lac/include/lac/block_sparse_matrix_ez.templates.h
deal.II/lac/source/petsc_block_sparse_matrix.cc
deal.II/lac/source/petsc_parallel_block_sparse_matrix.cc
deal.II/lac/source/trilinos_block_sparse_matrix.cc

index 9c0e277add400d372f316b4e5d908633f13effef..a22eeec2c02208d1f2971f4c24065365badd7f62 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -45,14 +45,7 @@ BlockSparseMatrix<number>::~BlockSparseMatrix ()
 {
                                   // delete previous content of
                                   // the subobjects array
-  for (unsigned int r=0; r<this->n_block_rows(); ++r)
-    for (unsigned int c=0; c<this->n_block_cols(); ++c)
-      {
-       BlockType *p = this->sub_objects[r][c];
-       this->sub_objects[r][c] = 0;
-       delete p;
-      }
-
+  clear ();
   sparsity_pattern = 0;
 }
 
@@ -114,14 +107,7 @@ reinit (const BlockSparsityPattern &sparsity)
                                   // first delete previous content of
                                   // the subobjects array and delete
                                   // the table completely
-  for (unsigned int r=0; r<this->n_block_rows(); ++r)
-    for (unsigned int c=0; c<this->n_block_cols(); ++c)
-      {
-       BlockType *p = this->sub_objects[r][c];
-       this->sub_objects[r][c] = 0;
-       delete p;
-      }
-  this->sub_objects.reinit (0,0);
+  clear ();
 
                                   // then associate new sparsity
                                   // pattern and resize
index 79cfcc043deda68bbeeac37cc076450929f295c8..56eb25c3256dd4218fa02f743b79208c6a3f990b 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -46,13 +46,7 @@ BlockSparseMatrixEZ (const unsigned int rows,
 //  {
 //                                // delete previous content of
 //                                // the subobjects array
-//    for (unsigned int r=0; r<rows; ++r)
-//      for (unsigned int c=0; c<columns; ++c)
-//        {
-//     SparseMatrixEZ<number> *p = sub_objects[r][c];
-//     sub_objects[r][c] = 0;
-//     delete p;
-//        };
+//    clear ();
 //  };
 
 
index a4c3a8fc4d0dc8c4da6b4edbe89897a67fbb30b1..4759d172e4a14cb461d3cf43324b5d0067df463d 100644 (file)
@@ -58,15 +58,7 @@ namespace PETScWrappers
   {
                                      // first delete previous content of
                                      // the subobjects array
-    for (unsigned int r=0; r<this->n_block_rows(); ++r)
-      for (unsigned int c=0; c<this->n_block_cols(); ++c)
-        {
-          BlockType *p = this->sub_objects[r][c];
-          this->sub_objects[r][c] = 0;
-          delete p;
-        }
-  
-    this->sub_objects.reinit (0,0);
+    clear ();
 
                                      // then resize. set sizes of blocks to
                                      // zero. user will later have to call
index ec7cb38eaeadc06e7b8668abd329db0d7fbcb4d7..ca98f33066f708becef596a2e6155ff5696c5908 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2004, 2005, 2006, 2008 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -61,15 +61,7 @@ namespace PETScWrappers
     {
                                        // first delete previous content of
                                        // the subobjects array
-      for (unsigned int r=0; r<this->n_block_rows(); ++r)
-        for (unsigned int c=0; c<this->n_block_cols(); ++c)
-          {
-            BlockType *p = this->sub_objects[r][c];
-            this->sub_objects[r][c] = 0;
-            delete p;
-          }
-  
-      this->sub_objects.reinit (0,0);
+      clear ();
 
                                        // then resize. set sizes of blocks to
                                        // zero. user will later have to call
index 4fbee6fd4f5d3df4e718df63206ffed54aff0802..8fc610188087486b351473788b92b61557495b23 100644 (file)
@@ -30,13 +30,7 @@ namespace TrilinosWrappers
   {
                                   // delete previous content of
                                   // the subobjects array
-    for (unsigned int r=0; r<this->n_block_rows(); ++r)
-      for (unsigned int c=0; c<this->n_block_cols(); ++c)
-       {
-         BlockType *p = this->sub_objects[r][c];
-         this->sub_objects[r][c] = 0;
-         delete p;
-       }
+    clear ();
   }
 
 
@@ -70,15 +64,7 @@ namespace TrilinosWrappers
   {
                                      // first delete previous content of
                                      // the subobjects array
-    for (unsigned int r=0; r<this->n_block_rows(); ++r)
-      for (unsigned int c=0; c<this->n_block_cols(); ++c)
-        {
-          BlockType *p = this->sub_objects[r][c];
-          this->sub_objects[r][c] = 0;
-          delete p;
-        }
-  
-    this->sub_objects.reinit (0,0);
+    clear ();
 
                                      // then resize. set sizes of blocks to
                                      // zero. user will later have to call

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.