NiHu  2.0
p2x_indexed.hpp
Go to the documentation of this file.
1 
7 #ifndef NIHU_P2X_INDEXED_HPP_INCLUDED
8 #define NIHU_P2X_INDEXED_HPP_INCLUDED
9 
10 #include "fmm_operator.hpp"
11 #include <type_traits>
12 
13 namespace NiHu
14 {
15 namespace fmm
16 {
17 
21 template <class Operator, class It>
23  : public fmm_operator<typename std::decay<Operator>::type::fmm_tag>
24 
25 {
26 public:
27  typedef typename std::decay<Operator>::type operator_t;
28  typedef It iterator_t;
29 
30  typedef typename operator_t::test_input_t test_input_t;
31  typedef size_t trial_input_t;
32  typedef typename operator_t::result_t result_t;
33 
34  p2x_indexed(Operator &&op, It begin, It end)
35  : m_op(std::forward<Operator>(op))
36  , m_begin(begin)
37  , m_end(end)
38  {
39  }
40 
41  result_t operator()(test_input_t const &ti, size_t idx) const
42  {
43  return m_op(ti, m_begin[idx]);
44  }
45 
46  size_t num_src() const
47  {
48  return m_end - m_begin;
49  }
50 
51 private:
52  Operator m_op;
53  iterator_t m_begin;
54  iterator_t m_end;
55 };
56 
57 template <class Operator, class It>
58 auto create_p2x_indexed(Operator &&op, It begin, It end)
59 {
60  return p2x_indexed<Operator, It>(std::forward<Operator>(op), begin, end);
61 }
62 
63 } // end of namespace fmm
64 } // namespace NiHu
65 
66 #endif /* NIHU_P2X_INDEXED_HPP_INCLUDED */
NiHu::fmm::p2x_indexed
class performing indexing of a P2P operator
Definition: p2x_indexed.hpp:22
fmm_operator.hpp
FMM operator types and tags.
NiHu::fmm::fmm_operator
Operator defining its tag type.
Definition: fmm_operator.hpp:85