NiHu  2.0
chebyshev_cluster.hpp
Go to the documentation of this file.
1 
7 #ifndef NIHU_CHEBYSHEV_CLUSTER_HPP_INCLUDED
8 #define NIHU_CHEBYSHEV_CLUSTER_HPP_INCLUDED
9 
10 #include "cluster.hpp"
11 #include "util/misc.hpp"
12 #include "nd_cheb.hpp"
13 
14 #include <cstddef>
15 
16 namespace NiHu
17 {
18 namespace fmm
19 {
20 
27 template <size_t Dim, class Scalar, size_t FieldDim>
29 
36 template <size_t Dim, class Scalar, size_t FieldDim>
37 struct cluster_traits<chebyshev_cluster<Dim, Scalar, FieldDim> >
38 {
40  static size_t const dimension = Dim;
42  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> multipole_t;
44  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> local_t;
45 };
46 
47 template <size_t Dim, class Scalar, size_t FieldDim = 1>
49  : public cluster_base<chebyshev_cluster<Dim, Scalar, FieldDim> >
50 {
51 public:
55  static size_t const dimension = base_t::dimension;
57  static size_t const field_dimension = FieldDim;
59  typedef typename base_t::multipole_t multipole_t;
61  typedef typename base_t::local_t local_t;
62 
64  typedef Eigen::Matrix<double, dimension, Eigen::Dynamic> cheb_nodes_t;
65 
68  void set_chebyshev_order(size_t order)
69  {
70  m_chebyshev_order = order;
71  m_cheb_nodes = chebnodes<dimension>(m_chebyshev_order, this->get_bounding_box());
72  }
73 
76  size_t get_data_size() const
77  {
78  return Ipow(m_chebyshev_order, dimension) * field_dimension;
79  }
80 
84  {
85  return multipole_t::Zero(get_data_size(), 1);
86  }
87 
91  {
92  return local_t::Zero(get_data_size(), 1);
93  }
94 
98  {
99  return m_cheb_nodes;
100  }
101 
104  size_t get_chebyshev_order() const
105  {
106  return m_chebyshev_order;
107  }
108 
109 private:
110  size_t m_chebyshev_order;
111  cheb_nodes_t m_cheb_nodes;
112 };
113 
114 } // end of namespace fmm
115 } // end of namespace NiHu
116 
117 #endif /* NIHU_CHEBYSHEV_CLUSTER_HPP_INCLUDED */
NiHu::fmm::chebyshev_cluster::get_chebyshev_order
size_t get_chebyshev_order() const
return the Chebyshev order
Definition: chebyshev_cluster.hpp:104
NiHu::fmm::cluster_base::dimension
static const size_t dimension
Space dimension.
Definition: cluster.hpp:47
NiHu::fmm::cluster_base::local_t
traits_t::local_t local_t
Local type.
Definition: cluster.hpp:60
NiHu::fmm::cluster_traits< chebyshev_cluster< Dim, Scalar, FieldDim > >::multipole_t
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > multipole_t
the multipole contribution's type
Definition: chebyshev_cluster.hpp:42
NiHu::fmm::chebyshev_cluster
Cluster class of the Black Box FMM.
Definition: chebyshev_cluster.hpp:28
NiHu::fmm::chebyshev_cluster::dimension
static const size_t dimension
the space's dimension
Definition: chebyshev_cluster.hpp:55
NiHu::fmm::chebyshev_cluster::zero_multipole
multipole_t zero_multipole() const
return zero multipole contribution
Definition: chebyshev_cluster.hpp:83
NiHu::fmm::chebyshev_cluster::cheb_nodes_t
Eigen::Matrix< double, dimension, Eigen::Dynamic > cheb_nodes_t
type to store Chebyshev nodes
Definition: chebyshev_cluster.hpp:64
NiHu::fmm::chebyshev_cluster::zero_local
local_t zero_local() const
return zero local contribution
Definition: chebyshev_cluster.hpp:90
NiHu::fmm::chebyshev_cluster::set_chebyshev_order
void set_chebyshev_order(size_t order)
set the Chebyshev order
Definition: chebyshev_cluster.hpp:68
nd_cheb.hpp
n-dimensional Chebyshev polynomial
NiHu::fmm::cluster_traits
CRTP traits structure of a cluster.
Definition: cluster.hpp:33
NiHu::Ipow
I Ipow(I base, I exp)
compute integer power
Definition: math_functions.hpp:409
NiHu::fmm::chebyshev_cluster::multipole_t
base_t::multipole_t multipole_t
the multipole type
Definition: chebyshev_cluster.hpp:59
NiHu::fmm::cluster_base
CRTP base class of clusters.
Definition: cluster.hpp:40
NiHu::fmm::chebyshev_cluster::local_t
base_t::local_t local_t
the local type
Definition: chebyshev_cluster.hpp:61
NiHu::fmm::cluster_base::multipole_t
traits_t::multipole_t multipole_t
Multipole type.
Definition: cluster.hpp:58
NiHu::fmm::chebyshev_cluster::get_chebyshev_nodes
const cheb_nodes_t & get_chebyshev_nodes() const
return the Chebyshev nodes
Definition: chebyshev_cluster.hpp:97
NiHu::fmm::chebyshev_cluster::base_t
cluster_base< chebyshev_cluster< Dim, Scalar, FieldDim > > base_t
the CRTP base class
Definition: chebyshev_cluster.hpp:53
NiHu::fmm::chebyshev_cluster::field_dimension
static const size_t field_dimension
the field dimension
Definition: chebyshev_cluster.hpp:57
NiHu::fmm::chebyshev_cluster::get_data_size
size_t get_data_size() const
return the number of elements in the multipole coefficients
Definition: chebyshev_cluster.hpp:76
cluster.hpp
implementation of class NiHu::fmm::cluster_base
NiHu::fmm::cluster_traits< chebyshev_cluster< Dim, Scalar, FieldDim > >::local_t
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > local_t
the local contribution's type
Definition: chebyshev_cluster.hpp:44
misc.hpp
miscellaneous functions and metafunctions