OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
encap_num.hpp
1 /*
2  * encap_num.hpp
3  *
4  * Created on: Apr 25, 2020
5  * Author: i-bird
6  */
7 
8 #ifndef ENCAP_NUM_HPP_
9 #define ENCAP_NUM_HPP_
10 
11 template<typename encap>
12 struct enc_num
13 {
14  encap ec;
15  unsigned int offset;
16 
17  __device__ enc_num(const encap & ec, unsigned int offset)
18  :ec(ec),offset(offset)
19  {}
20 
21  template<unsigned int p>
22  __device__ auto get() -> decltype(ec.template get<p>()[offset])
23  {
24  return ec.template get<p>()[offset];
25  }
26 
27  __device__ unsigned int getOffset()
28  {
29  return offset;
30  }
31 };
32 
33 
34 #endif /* ENCAP_NUM_HPP_ */