PFASST++
uniform_impl.hpp
Go to the documentation of this file.
2 
3 #include <stdexcept>
4 #include <vector>
5 using namespace std;
6 
7 
8 namespace pfasst
9 {
10  namespace quadrature
11  {
12  template<typename precision>
13  Uniform<precision>::Uniform(const size_t num_nodes)
14  : IQuadrature<precision>(num_nodes)
15  {
16  if (this->num_nodes < 2) {
17  throw invalid_argument("Uniform quadrature requires at least two quadrature nodes.");
18  }
19  this->compute_nodes();
20  this->compute_weights();
21  }
22 
23  template<typename precision>
25  {
26  return LEFT_IS_NODE;
27  }
28 
29  template<typename precision>
31  {
32  return RIGHT_IS_NODE;
33  }
34 
35  template<typename precision>
37  {
38  this->nodes = vector<precision>(this->num_nodes, precision(0.0));
39  for (size_t j = 0; j < this->num_nodes; j++) {
40  this->nodes[j] = precision(j) / (this->num_nodes - 1);
41  }
42  }
43  } // ::pfasst::quadrature
44 } // ::pfasst
Interface for quadrature handlers.
Definition: interface.hpp:232
Quadrature handler for uniform distributed nodes.
Definition: uniform.hpp:23
STL namespace.
virtual bool left_is_node() const override
virtual void compute_nodes() override
virtual bool right_is_node() const override