]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add support to release memory in dSMatrix.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 2 Apr 1998 15:17:21 +0000 (15:17 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 2 Apr 1998 15:17:21 +0000 (15:17 +0000)
git-svn-id: https://svn.dealii.org/trunk@123 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/numerics/base.cc
deal.II/lac/include/lac/dsmatrix.h
deal.II/lac/source/dsmatrix.cc

index 46ea191420145e2d378f0994c4244610d7d90d45..c3c3edbb9412db4f785dba08205c37c64b5b9d4e 100644 (file)
@@ -53,7 +53,7 @@ void ProblemBase<dim>::clear () {
   tria        = 0;
   dof_handler = 0;
   system_sparsity.reinit (1,1,1);
-  system_matrix.reinit (system_sparsity);
+  system_matrix.clear ();
   right_hand_side.reinit (1);
   solution.reinit (1);
   constraints.clear ();
index 81690dce27489b06d0a9d5f5d85101dfdad0b0ed..658980efda6dd3803ed5a5394d5efd9d0fee4287 100644 (file)
@@ -172,6 +172,13 @@ class dSMatrix
                                     //
     void reinit (dSMatrixStruct &);
 
+                                    /**
+                                     * Release all memory and return to a state
+                                     * just like after having called the
+                                     * default constructor.
+                                     */
+    void clear ();
+    
                                     //
     int m() const;
                                     //
index c038df127cd48e3e4da6812cd85a3aa3297d11c8..c3a580ef8f25affe84cca46178a4162eb0fde9ea 100644 (file)
@@ -391,6 +391,15 @@ dSMatrix::reinit (dSMatrixStruct &sparsity) {
 
 
 
+void
+dSMatrix::clear () {
+  cols = 0;
+  if (val) delete[] val;
+  val = 0;
+  max_len = 0;
+};
+
+
 
 void
 dSMatrix::vmult(dVector& dst,const dVector& src) const

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.