]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move computation of QGaussLobattoChebyshev support points into helper namespace 5957/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 25 Feb 2018 16:27:53 +0000 (17:27 +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 2ff37bb6510ce91123c3f58696f247d23c1123ed..ea545fa23c3616afcd2b1a953fd6e392a05a7d58 100644 (file)
@@ -575,16 +575,6 @@ class QGaussLobattoChebyshev : public Quadrature<dim>
 public:
   /// Generate a formula with <tt>n</tt> quadrature points
   QGaussLobattoChebyshev(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 1dec63ee94ac18d5b83871841e0b49c5460398da..bf7d86d59cd5cdcdd79616104672dc10e590dea9 100644 (file)
@@ -1322,43 +1322,49 @@ QGaussRadauChebyshev<dim>::QGaussRadauChebyshev (const unsigned int n,
 {}
 
 
-template <>
-std::vector<double>
-QGaussLobattoChebyshev<1>::get_quadrature_points(const unsigned int n)
+
+namespace internal
 {
+  namespace QGaussLobattoChebyshev
+  {
+    // 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(i Pi/N)
-    // 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(i)/double(n-1))));
+      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(i Pi/N)
+        // 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(i)/double(n-1))));
 
-  return points;
-}
+      return points;
+    }
 
+    // Computes the weights of the quadrature formula.
+    std::vector<double>
+    get_quadrature_weights(const unsigned int n)
+    {
 
-template <>
-std::vector<double>
-QGaussLobattoChebyshev<1>::get_quadrature_weights(const unsigned int n)
-{
+      std::vector<double> weights(n);
 
-  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-1));
+          if (i==0 || i==(n-1))
+            weights[i] /= 2.;
+        }
 
-  for (unsigned short i=0; i<n; ++i)
-    {
-      // same weights as on [-1,1]
-      weights[i] = numbers::PI/double((n-1));
-      if (i==0 || i==(n-1))
-        weights[i] /= 2.;
+      return weights;
     }
-
-  return weights;
-
+  }
 }
 
 
+
 template <>
 QGaussLobattoChebyshev<1>::QGaussLobattoChebyshev(const unsigned int n)
   :
@@ -1366,8 +1372,8 @@ QGaussLobattoChebyshev<1>::QGaussLobattoChebyshev(const unsigned int n)
 {
 
   Assert(n>1,ExcMessage("Need at least two points for Gauss-Lobatto quadrature rule"));
-  std::vector<double> p=get_quadrature_points(n);
-  std::vector<double> w=get_quadrature_weights(n);
+  std::vector<double> p=internal::QGaussLobattoChebyshev::get_quadrature_points(n);
+  std::vector<double> w=internal::QGaussLobattoChebyshev::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.