]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move computation of QGaussChebyshev support points into helper namespace
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 25 Feb 2018 16:26:21 +0000 (17:26 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 25 Feb 2018 17:43:35 +0000 (18:43 +0100)
include/deal.II/base/quadrature_lib.h
source/base/quadrature_lib.cc

index fb373961e1f52f65a5997f6ff7c0bbce9aedb2a3..6576104b63a013f907e99d3de48c183e3c6ced1c 100644 (file)
@@ -503,16 +503,6 @@ class QGaussChebyshev : public Quadrature<dim>
 public:
   /// Generate a formula with <tt>n</tt> quadrature points
   QGaussChebyshev(const unsigned int n);
-
-private:
-  /// Computes the points of the quadrature formula.
-  static std::vector<double>
-  get_quadrature_points(const unsigned int n);
-
-  /// Computes the weights of the quadrature formula.
-  static std::vector<double>
-  get_quadrature_weights(const unsigned int n);
-
 };
 
 
index 45351f54b379a6676d81b4112f39473e26205f67..d766912061a201fd8778cd8f9438466d47bfd153 100644 (file)
@@ -1157,40 +1157,49 @@ QTelles<1>::QTelles (
     }
 }
 
-
-
-template <>
-std::vector<double>
-QGaussChebyshev<1>::get_quadrature_points(const unsigned int n)
+namespace internal
 {
+  namespace QGaussChebyshev
+  {
+    /**
+     * Computes the points of the quadrature formula.
+     */
+    std::vector<double>
+    get_quadrature_points(const unsigned int n)
+    {
 
-  std::vector<double> points(n);
-  // n point quadrature: index from 0 to n-1
-  for (unsigned short i=0; i<n; ++i)
-    // would be cos((2i+1)Pi/(2N+2))
-    // put + Pi so we start from the smallest point
-    // then map from [-1,1] to [0,1]
-    points[i] = 1./2.*(1.+std::cos(numbers::PI*(1.+double(2*i+1)/double(2*(n-1)+2))));
+      std::vector<double> points(n);
+      // n point quadrature: index from 0 to n-1
+      for (unsigned short i=0; i<n; ++i)
+        // would be cos((2i+1)Pi/(2N+2))
+        // put + Pi so we start from the smallest point
+        // then map from [-1,1] to [0,1]
+        points[i] = 1./2.*(1.+std::cos(numbers::PI*(1.+double(2*i+1)/double(2*(n-1)+2))));
 
-  return points;
-}
+      return points;
+    }
 
 
-template <>
-std::vector<double>
-QGaussChebyshev<1>::get_quadrature_weights(const unsigned int n)
-{
 
-  std::vector<double> weights(n);
-
-  for (unsigned short i=0; i<n; ++i)
+    /**
+    * Computes the weights of the quadrature formula.
+    */
+    std::vector<double>
+    get_quadrature_weights(const unsigned int n)
     {
-      // same weights as on [-1,1]
-      weights[i] = numbers::PI/double(n);
-    }
 
-  return weights;
+      std::vector<double> weights(n);
 
+      for (unsigned short i=0; i<n; ++i)
+        {
+          // same weights as on [-1,1]
+          weights[i] = numbers::PI/double(n);
+        }
+
+      return weights;
+
+    }
+  }
 }
 
 
@@ -1201,8 +1210,8 @@ QGaussChebyshev<1>::QGaussChebyshev(const unsigned int n)
 {
 
   Assert(n>0,ExcMessage("Need at least one point for the quadrature rule"));
-  std::vector<double> p=get_quadrature_points(n);
-  std::vector<double> w=get_quadrature_weights(n);
+  std::vector<double> p=internal::QGaussChebyshev::get_quadrature_points(n);
+  std::vector<double> w=internal::QGaussChebyshev::get_quadrature_weights(n);
 
   for (unsigned int i=0; i<this->size(); ++i)
     {

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.