WaveBlocksND
gauss_hermite_qr.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <tuple>
4 #include <vector>
5 
6 #include "../types.hpp"
7 
9 
10 
11 namespace waveblocks {
12  namespace innerproducts {
18  template <dim_t ORDER>
20  {
21  static const dim_t D = 1;
22  static const dim_t order = ORDER;
23 
24  using NodeMatrix = Eigen::Matrix<real_t,1,Eigen::Dynamic>;
25  using WeightVector = Eigen::Matrix<real_t,1,Eigen::Dynamic>;
26 
33  {
34  return order;
35  }
36 
40  static NodeMatrix nodes()
41  {
42  const auto& nodes = gauss_hermite_rules[ORDER-1].nodes;
43  return NodeMatrix::Map(nodes.data(), nodes.size());
44  }
45 
50  {
51  const auto& weights = gauss_hermite_rules[ORDER-1].weights;
52  return WeightVector::Map(weights.data(), weights.size());
53  }
54 
58  static std::tuple<NodeMatrix,WeightVector> nodes_and_weights()
59  {
60  return std::make_tuple(nodes(), weights());
61  }
62 
68  static void clear_cache() {}
69  };
70  }
71 }
static dim_t number_nodes()
Return the number of nodes for the given order.
Definition: gauss_hermite_qr.hpp:32
Definition: coefficients_file_parser.cpp:10
static NodeMatrix nodes()
Return the quadrature nodes.
Definition: gauss_hermite_qr.hpp:40
Eigen::Matrix< real_t, 1, Eigen::Dynamic > WeightVector
Definition: gauss_hermite_qr.hpp:25
Eigen::Matrix< real_t, 1, Eigen::Dynamic > NodeMatrix
Definition: gauss_hermite_qr.hpp:24
static const dim_t D
Definition: gauss_hermite_qr.hpp:21
static const dim_t order
Definition: gauss_hermite_qr.hpp:22
const std::vector< QuadratureRule > gauss_hermite_rules
Definition: tables_gausshermite.hpp:14
static void clear_cache()
Free the precalculated nodes and weights.
Definition: gauss_hermite_qr.hpp:68
static WeightVector weights()
Return the quadrature weights.
Definition: gauss_hermite_qr.hpp:49
Structure providing weighted nodes for Gauss Hermite quadrature.
Definition: gauss_hermite_qr.hpp:19
int dim_t
Definition: types.hpp:16
static std::tuple< NodeMatrix, WeightVector > nodes_and_weights()
Return the quadrature nodes and weights.
Definition: gauss_hermite_qr.hpp:58