PFASST++
interface_impl.hpp
Go to the documentation of this file.
1 
2 
4 
5 namespace pfasst
6 {
7  namespace quadrature
8  {
9  template<typename precision>
10  IQuadrature<precision>::IQuadrature(const size_t num_nodes)
11  : num_nodes(num_nodes)
12  {
13  if (this->num_nodes == 0) {
14  throw invalid_argument("Any quadrature requires at least one quadrature nodes.");
15  }
16  }
17 
18  template<typename precision>
20  : num_nodes(0)
21  {}
22 
23  template<typename precision>
25  {
26  return this->q_mat;
27  }
28 
29  template<typename precision>
31  {
32  return this->s_mat;
33  }
34 
35  template<typename precision>
37  {
38  return this->b_mat;
39  }
40 
41  template<typename precision>
42  const vector<precision>& IQuadrature<precision>::get_q_vec() const
43  {
44  return this->q_vec;
45  }
46 
47  template<typename precision>
48  const vector<precision>& IQuadrature<precision>::get_nodes() const
49  {
50  return this->nodes;
51  }
52 
53  template<typename precision>
55  {
56  return this->num_nodes;
57  }
58 
59  template<typename precision>
61  {
62  throw NotImplementedYet("Quadrature");
63  return LEFT_IS_NODE;
64  }
65 
66  template<typename precision>
68  {
69  throw NotImplementedYet("Quadrature");
70  return RIGHT_IS_NODE;
71  }
72 
73  template<typename precision>
75  {
76  throw NotImplementedYet("Quadrature");
77  }
78 
79  template<typename precision>
81  {
82  using cvec = Eigen::Array<precision, Eigen::Dynamic, 1>;
83  const cvec row_sums = this->get_q_mat().rowwise().sum();
84  Eigen::Map<const cvec> nodes(this->get_nodes().data(), this->get_nodes().size());
85  return (row_sums - nodes).maxCoeff();
86  }
87 
98  template<typename precision>
100  {
101  this->q_mat = compute_q_matrix(this->nodes);
102  this->s_mat = compute_s_matrix(this->q_mat);
103  this->q_vec = compute_q_vec(this->nodes);
104  this->b_mat = Matrix<precision>::Zero(1, this->num_nodes);
105  for (size_t i = 0; i < this->num_nodes; i++){
106  this->b_mat(0,i) = this->q_vec[i];
107  }
108  }
109  } // ::pfasst::quadrature
110 } // ::pfasst
virtual size_t get_num_nodes() const
virtual const vector< precision > & get_nodes() const
tuple data
Definition: plot.py:7
static Matrix< scalar > compute_s_matrix(const Matrix< scalar > &q_mat)
Compute node-to-node quadrature matrix \( S \) from a given quadrature matrix \( Q \)...
Definition: interface.hpp:158
virtual const Matrix< precision > & get_s_mat() const
Not implemented yet exception.
Definition: interfaces.hpp:29
virtual bool right_is_node() const
virtual bool left_is_node() const
static Matrix< scalar > compute_q_matrix(const vector< scalar > &from, const vector< scalar > &to)
Compute quadrature matrix \( Q \) between two sets of nodes.
Definition: interface.hpp:80
virtual const vector< precision > & get_q_vec() const
static vector< scalar > compute_q_vec(const vector< scalar > &nodes)
Compute vector \( q \) for integration from \( 0 \) to \( 1 \) for given set of nodes.
Definition: interface.hpp:200
Eigen::Matrix< scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
virtual const Matrix< precision > & get_b_mat() const
precision expected_error() const
Compute a rough estimate of the numerical error...
virtual const Matrix< precision > & get_q_mat() const