PFASST++
gauss_legendre_impl.hpp
Go to the documentation of this file.
2 
3 #include <vector>
4 using namespace std;
5 
7 
8 
9 namespace pfasst
10 {
11  namespace quadrature
12  {
13  template<typename precision>
15  : IQuadrature<precision>(num_nodes)
16  {
17  this->compute_nodes();
18  this->compute_weights();
19  }
20 
21  template<typename precision>
23  {
24  return LEFT_IS_NODE;
25  }
26 
27  template<typename precision>
29  {
30  return RIGHT_IS_NODE;
31  }
32 
33  template<typename precision>
35  {
36  this->nodes = vector<precision>(this->num_nodes, precision(0.0));
37  auto roots = Polynomial<precision>::legendre(this->num_nodes).roots();
38 
39  for (size_t j = 0; j < this->num_nodes; j++) {
40  this->nodes[j] = 0.5 * (1.0 + roots[j]);
41  }
42  }
43  } // ::pfasst::quadrature
44 } // ::pfasst
Interface for quadrature handlers.
Definition: interface.hpp:232
STL namespace.
virtual bool left_is_node() const override
Quadrature handler for Gauss-Legendre quadrature.
static Polynomial< CoeffT > legendre(const size_t order)
Computes the Legendre polynomial of given order.
virtual bool right_is_node() const override