]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fixed comments and static member functions
authorGiuseppe Pitton <gpitton@sissa.it>
Mon, 11 May 2015 19:34:07 +0000 (21:34 +0200)
committerGiuseppe Pitton <gpitton@sissa.it>
Thu, 14 May 2015 19:37:03 +0000 (21:37 +0200)
fixed indentation

removed static qualifier from EndPoint ep

removed useless comments

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

index 33a633563a1331a1085a1421ae190d253093d8f0..ad7d5b23e6747cf63c350b80d8b1b87214e8a4bc 100644 (file)
@@ -517,9 +517,9 @@ public:
 * $w(x) = 1/\sqrt{1-x^2}$. The nodes and weights are known analytically,
 * and are exact for monomials up to the order $2n-1$, where $n$ is the number
 * of quadrature points.
-* Here we rescale the quadrature formula so that it is defined on t
-* he interval [0,1] instead of [-1,1]. So the quadrature formulas inte
-* grate exactly the integral $\int_0^1 f(x) w(x) dx$ with the weight:
+* Here we rescale the quadrature formula so that it is defined on
+* the interval $[0,1]$ instead of $[-1,1]$. So the quadrature formulas
+* integrate exactly the integral $\int_0^1 f(x) w(x) dx$ with the weight:
 * $w(x) = 1/sqrt{x(1-x)}$.
 * For details see:
 * M. Abramowitz & I.A. Stegun: Handbook of Mathematical Functions, par. 25.4.38
@@ -530,17 +530,17 @@ template <int dim>
 class QGaussChebyshev : public Quadrature<dim>
 {
 public:
-  //Generate a formula with <tt>n</tt> quadrature points
+  //Generate a formula with <tt>n</tt> quadrature points
   QGaussChebyshev(const unsigned int n);
 
-protected:
-  // Sets the points of the quadrature formula.
-  std::vector<double>
-  set_quadrature_points(const unsigned int n) const;
+private:
+  /// Sets the points of the quadrature formula.
+  static std::vector<double>
+  get_quadrature_points(const unsigned int n);
 
-  // Sets the weights of the quadrature formula.
-  std::vector<double>
-  set_quadrature_weights(const unsigned int n) const;
+  /// Sets the weights of the quadrature formula.
+  static std::vector<double>
+  get_quadrature_weights(const unsigned int n);
 
 };
 
@@ -552,10 +552,9 @@ protected:
 * lies at one of the two extrema of the interval.
 * The nodes and weights are known analytically,
 * and are exact for monomials up to the order $2n-2$, where $n$ is the number
-* of quadrature points.
-* Here we rescale the quadrature formula so that it is defined on t
-* he interval [0,1] instead of [-1,1]. So the quadrature formulas inte
-* grate exactly the integral $\int_0^1 f(x) w(x) dx$ with the weight:
+* of quadrature points. Here we rescale the quadrature formula so that it is defined on
+* the interval $[0,1]$ instead of $[-1,1]$. So the quadrature formulas
+* integrate exactly the integral $\int_0^1 f(x) w(x) dx$ with the weight:
 * $w(x) = 1/sqrt{x(1-x)}$. By default the quadrature is constructed with the
 * left endpoint as quadrature node, but the quadrature node can be imposed at the
 * right endpoint through the variable ep that can assume the values left or right.
@@ -566,32 +565,37 @@ template <int dim>
 class QGaussRadauChebyshev : public Quadrature<dim>
 {
 public:
+  /* EndPoint is used to specify which of the two endpoints of the unit interval
+   * is used also as quadrature point
+   */
   enum EndPoint { left,right };
-  EndPoint ep;
-  //Generate a formula with <tt>n</tt> quadrature points
+  /// Generate a formula with <tt>n</tt> quadrature points
   QGaussRadauChebyshev(const unsigned int n,
                        QGaussRadauChebyshev::EndPoint ep=QGaussRadauChebyshev::left);
 
-protected:
-  // Sets the points of the quadrature formula.
-  std::vector<double>
-  set_quadrature_points(const unsigned int n) const;
+private:
+  const EndPoint ep;
+  /// Sets the points of the quadrature formula.
+  static std::vector<double>
+  get_quadrature_points(const unsigned int n, EndPoint ep);
 
-  // Sets the weights of the quadrature formula.
-  std::vector<double>
-  set_quadrature_weights(const unsigned int n) const;
+  /// Sets the weights of the quadrature formula.
+  static std::vector<double>
+  get_quadrature_weights(const unsigned int n, EndPoint ep);
 
 };
 
 /**
 * Gauss-Lobatto-Chebyshev quadrature rules integrate the weighted product
 * $\int_{-1}^1 f(x) w(x) dx$ with weight given by:
-* $w(x) = 1/\sqrt{1-x^2}$. The nodes and weights are known analytically,
-* and are exact for monomials up to the order $2n-1$, where $n$ is the number
+* $w(x) = 1/\sqrt{1-x^2}$, with the additional constraint that two of the quadrature
+* points are located at the endpoints of the quadrature interval.
+* The nodes and weights are known analytically,
+* and are exact for monomials up to the order $2n-3$, where $n$ is the number
 * of quadrature points.
-* Here we rescale the quadrature formula so that it is defined on t
-* he interval [0,1] instead of [-1,1]. So the quadrature formulas inte
-* grate exactly the integral $\int_0^1 f(x) w(x) dx$ with the weight:
+* Here we rescale the quadrature formula so that it is defined on
+* the interval $[0,1]$ instead of $[-1,1]$. So the quadrature formulas
+* integrate exactly the integral $\int_0^1 f(x) w(x) dx$ with the weight:
 * $w(x) = 1/sqrt{x(1-x)}$.
 * For details see:
 * M. Abramowitz & I.A. Stegun: Handbook of Mathematical Functions, par. 25.4.40
@@ -602,17 +606,17 @@ template <int dim>
 class QGaussLobattoChebyshev : public Quadrature<dim>
 {
 public:
-  //Generate a formula with <tt>n</tt> quadrature points
+  //Generate a formula with <tt>n</tt> quadrature points
   QGaussLobattoChebyshev(const unsigned int n);
 
-protected:
-  // Sets the points of the quadrature formula.
-  std::vector<double>
-  set_quadrature_points(const unsigned int n) const;
+private:
+  /// Sets the points of the quadrature formula.
+  static std::vector<double>
+  get_quadrature_points(const unsigned int n);
 
-  // Sets the weights of the quadrature formula.
-  std::vector<double>
-  set_quadrature_weights(const unsigned int n) const;
+  /// Sets the weights of the quadrature formula.
+  static std::vector<double>
+  get_quadrature_weights(const unsigned int n);
 
 };
 
index 0abe19989efb2162e50f4b0f3fce029e68d00a2b..d9724b465f34daee4cb568e068dec93996dece0b 100644 (file)
@@ -1132,7 +1132,7 @@ QTelles<1>::QTelles (
 
 template <>
 std::vector<double>
-QGaussChebyshev<1>::set_quadrature_points(const unsigned int n) const
+QGaussChebyshev<1>::get_quadrature_points(const unsigned int n)
 {
 
   std::vector<double> points(n);
@@ -1149,7 +1149,7 @@ QGaussChebyshev<1>::set_quadrature_points(const unsigned int n) const
 
 template <>
 std::vector<double>
-QGaussChebyshev<1>::set_quadrature_weights(const unsigned int n) const
+QGaussChebyshev<1>::get_quadrature_weights(const unsigned int n)
 {
 
   std::vector<double> weights(n);
@@ -1172,8 +1172,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=set_quadrature_points(n);
-  std::vector<double> w=set_quadrature_weights(n);
+  std::vector<double> p=get_quadrature_points(n);
+  std::vector<double> w=get_quadrature_weights(n);
 
   for (unsigned int i=0; i<this->size(); ++i)
     {
@@ -1196,7 +1196,8 @@ QGaussChebyshev<dim>::QGaussChebyshev (const unsigned int n)
 
 template <>
 std::vector<double>
-QGaussRadauChebyshev<1>::set_quadrature_points(const unsigned int n) const
+QGaussRadauChebyshev<1>::get_quadrature_points(const unsigned int n,
+                                               QGaussRadauChebyshev::EndPoint ep)
 {
 
   std::vector<double> points(n);
@@ -1219,7 +1220,8 @@ QGaussRadauChebyshev<1>::set_quadrature_points(const unsigned int n) const
 
 template <>
 std::vector<double>
-QGaussRadauChebyshev<1>::set_quadrature_weights(const unsigned int n) const
+QGaussRadauChebyshev<1>::get_quadrature_weights(const unsigned int n,
+                                                QGaussRadauChebyshev::EndPoint ep)
 {
 
   std::vector<double> weights(n);
@@ -1248,8 +1250,8 @@ QGaussRadauChebyshev<1>::QGaussRadauChebyshev(const unsigned int n,
 {
 
   Assert(n>0,ExcMessage("Need at least one point for quadrature rules"));
-  std::vector<double> p=set_quadrature_points(n);
-  std::vector<double> w=set_quadrature_weights(n);
+  std::vector<double> p=get_quadrature_points(n,ep);
+  std::vector<double> w=get_quadrature_weights(n,ep);
 
   for (unsigned int i=0; i<this->size(); ++i)
     {
@@ -1264,7 +1266,8 @@ QGaussRadauChebyshev<2>::QGaussRadauChebyshev (const unsigned int n,
                                                QGaussRadauChebyshev::EndPoint ep)
   :
   Quadrature<2> (QGaussRadauChebyshev<1>(n, static_cast<QGaussRadauChebyshev<1>::EndPoint>(ep)),
-                 QGaussRadauChebyshev<1>(n, static_cast<QGaussRadauChebyshev<1>::EndPoint>(ep)))
+                 QGaussRadauChebyshev<1>(n, static_cast<QGaussRadauChebyshev<1>::EndPoint>(ep))),
+  ep (ep)
 {}
 
 
@@ -1273,13 +1276,14 @@ QGaussRadauChebyshev<dim>::QGaussRadauChebyshev (const unsigned int n,
                                                  QGaussRadauChebyshev::EndPoint ep)
   :
   Quadrature<dim> (QGaussRadauChebyshev<dim-1>(n,static_cast<typename QGaussRadauChebyshev<dim-1>::EndPoint>(ep)),
-                   QGaussRadauChebyshev<1>(n,static_cast<QGaussRadauChebyshev<1>::EndPoint>(ep)))
+                   QGaussRadauChebyshev<1>(n,static_cast<QGaussRadauChebyshev<1>::EndPoint>(ep))),
+  ep (ep)
 {}
 
 
 template <>
 std::vector<double>
-QGaussLobattoChebyshev<1>::set_quadrature_points(const unsigned int n) const
+QGaussLobattoChebyshev<1>::get_quadrature_points(const unsigned int n)
 {
 
   std::vector<double> points(n);
@@ -1296,7 +1300,7 @@ QGaussLobattoChebyshev<1>::set_quadrature_points(const unsigned int n) const
 
 template <>
 std::vector<double>
-QGaussLobattoChebyshev<1>::set_quadrature_weights(const unsigned int n) const
+QGaussLobattoChebyshev<1>::get_quadrature_weights(const unsigned int n)
 {
 
   std::vector<double> weights(n);
@@ -1321,8 +1325,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=set_quadrature_points(n);
-  std::vector<double> w=set_quadrature_weights(n);
+  std::vector<double> p=get_quadrature_points(n);
+  std::vector<double> w=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.