]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Undo free of static variable.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 4 Feb 2010 08:08:18 +0000 (08:08 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 4 Feb 2010 08:08:18 +0000 (08:08 +0000)
git-svn-id: https://svn.dealii.org/trunk@20490 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/polynomial.h
deal.II/base/source/polynomial.cc

index 9a840f0cad3fe82f69c98db1f7b3448bfc033093..8eda9827884d14780e4a5546dda5d5733b6fb7fd 100644 (file)
@@ -404,11 +404,6 @@ namespace Polynomials
                                         */
       Legendre (const unsigned int p);
 
-                                      /**
-                                       * Destructor.
-                                       */
-      ~Legendre();
-
                                        /**
                                         * Return a vector of Legendre
                                         * polynomial objects of degrees
index d4259788ca81dbc57a3937229fbd78082693a5d3..2d864be15086ca28223268e311154da5a30dad2c 100644 (file)
@@ -727,29 +727,6 @@ namespace Polynomials
 
 
 
-  Legendre::~Legendre ()
-  {
-                               // need to free the memory that was allocated
-                               // when recursive coefficients are calculated.
-    Threads::ThreadMutex::ScopedLock lock(coefficients_lock);
-    for (unsigned int i=0; i<recursive_coefficients.size(); ++i)
-      if (recursive_coefficients[i] != 0)
-       {
-         const std::vector<double> *c0 = 0;
-         std::swap (recursive_coefficients[i], c0);
-         delete c0;
-       }
-    for (unsigned int i=0; i<shifted_coefficients.size(); ++i)
-      if (shifted_coefficients[i] != 0)
-       {
-         const std::vector<double> *c0 = 0;
-         std::swap (shifted_coefficients[i], c0);
-         delete c0;
-       }
-  }
-
-
-
   void
   Legendre::compute_coefficients (const unsigned int k_)
   {
@@ -810,16 +787,16 @@ namespace Polynomials
 
                                              // Compute polynomials
                                              // orthogonal on [0,1]
-            std::vector<double> *d0 = new std::vector<double>(*c0);
-            std::vector<double> *d1 = new std::vector<double>(*c1);
-
-            Polynomial<double>::shift<SHIFT_TYPE> (*d0, -1.);
-            Polynomial<double>::scale(*d0, 2.);
-            Polynomial<double>::shift<SHIFT_TYPE> (*d1, -1.);
-            Polynomial<double>::scale(*d1, 2.);
-            Polynomial<double>::multiply(*d1, std::sqrt(3.));
-            shifted_coefficients[0]=d0;
-            shifted_coefficients[1]=d1;
+            c0 = new std::vector<double>(*c0);
+            c1 = new std::vector<double>(*c1);
+
+            Polynomial<double>::shift<SHIFT_TYPE> (*c0, -1.);
+            Polynomial<double>::scale(*c0, 2.);
+            Polynomial<double>::shift<SHIFT_TYPE> (*c1, -1.);
+            Polynomial<double>::scale(*c1, 2.);
+            Polynomial<double>::multiply(*c1, std::sqrt(3.));
+            shifted_coefficients[0]=c0;
+            shifted_coefficients[1]=c1;
           }
         else
           {

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.