NiHu  2.0
m2l_indices.hpp
Go to the documentation of this file.
1 
7 #ifndef NIHU_M2L_INDICES_HPP_INCLUDED
8 #define NIHU_M2L_INDICES_HPP_INCLUDED
9 
10 #include "bounding_box.hpp"
11 
12 #include <type_traits>
13 
14 namespace NiHu
15 {
16 namespace fmm
17 {
20 template <unsigned Dim>
22 {
23 public:
24  static size_t const dimension = Dim;
26  typedef typename bounding_box_t::location_t location_t;
27 
28 private:
29  static size_t drel2idx(location_t const &drel, std::integral_constant<size_t, 1U>)
30  {
31  return size_t(round(drel(0)) + 3);
32  }
33 
34  static size_t drel2idx(location_t const &drel, std::integral_constant<size_t, 2U>)
35  {
36  return size_t(round(drel(0)) + 3 + 7 * (round(drel(1)) + 3));
37  }
38 
39  static size_t drel2idx(location_t const &drel, std::integral_constant<size_t, 3U>)
40  {
41  return size_t(round(drel(0)) + 3 + 7 * (round(drel(1)) + 3) + 7 * 7 * (round(drel(2)) + 3));
42  }
43 public:
44 
45  static size_t eval(bounding_box_t const &to, bounding_box_t const &from)
46  {
47  location_t drel = (to.get_center() - from.get_center()) / to.get_diameter();
48  return drel2idx(drel, std::integral_constant<size_t, dimension>());
49  }
50 };
51 } // end of namespace fmm
52 } // namespace NiHu
53 
54 #endif /* NIHU_M2L_INDICES_HPP_INCLUDED */
NiHu::fmm::bounding_box::location_t
Eigen::Matrix< scalar_t, dimension, 1 > location_t
the location type in the bounding box
Definition: bounding_box.hpp:38
bounding_box.hpp
Implementation of class NiHu::fmm::bounding_box.
NiHu::fmm::bounding_box::get_center
const location_t & get_center(void) const
return center
Definition: bounding_box.hpp:75
NiHu::fmm::bounding_box
multidimensional square bounding box
Definition: bounding_box.hpp:30
NiHu::fmm::bounding_box::get_diameter
scalar_t get_diameter(void) const
return diameter
Definition: bounding_box.hpp:91
NiHu::fmm::m2l_indices
Class assigning indices to M2L distances.
Definition: m2l_indices.hpp:21