OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
map_vector_std_cuda_ker.cuh
1 /*
2  * map_vector_std_cuda_ker.cuh
3  *
4  * Created on: Mar 9, 2019
5  * Author: i-bird
6  */
7 
8 #ifndef MAP_VECTOR_STD_CUDA_KER_CUH_
9 #define MAP_VECTOR_STD_CUDA_KER_CUH_
10 
11 
18 template<typename T, template <typename> class layout_base>
20 {
22 
23  typedef typename apply_transform<layout_base,T>::type T_;
24 
28  unsigned int v_size;
29 
31  vector_gpu_ker<T_,layout_base> base;
32 
33 public:
34 
36  typedef int yes_i_am_vector;
37 
40 
42  // you can access all the properties of T
44 
46  typedef T_ value_type;
47 
53  __device__ unsigned int size() const
54  {
55  return v_size;
56  }
57 
64  __device__ unsigned int capacity() const
65  {
66  return base.size();
67  }
68 
79  __device__ inline auto at(size_t id) const -> decltype(base.template get<0>(0))
80  {
81  return base.template get<0>(id);
82  }
83 
94  __device__ inline auto at(size_t id) -> decltype(base.template get<0>(0))
95  {
96  return base.template get<0>(id);
97  }
98 
109  __device__ inline auto get(size_t id) const -> decltype(base.template get<0>(0))
110  {
111  return base.template get<0>(id);
112  }
113 
124  __device__ inline auto get(size_t id) -> decltype(base.template get<0>(0))
125  {
126  return base.template get<0>(id);
127  }
128 
130  {}
131 
132  vector_custd_ker(int v_size, const vector_gpu_ker<T_,layout_base> & cpy)
133  :v_size(v_size),base(cpy)
134  {}
135 };
136 
137 
138 
139 
140 #endif /* MAP_VECTOR_STD_CUDA_KER_CUH_ */
__device__ auto at(size_t id) -> decltype(base.template get< 0 >(0))
Get an element of the vector.
__device__ auto get(size_t id) const -> decltype(base.template get< 0 >(0))
Get an element of the vector.
grid interface available when on gpu
__device__ unsigned int capacity() const
return the maximum capacity of the vector before reallocation
Transform the boost::fusion::vector into memory specification (memory_traits)
Definition: memory_conf.hpp:83
T_ value_type
Type of the value the vector is storing.
grid_base< 1, T_, CudaMemory, typename memory_traits_inte< T_ >::type >::container container
Object container for T, it is the return type of get_o it return a object type trough.
memory_traits_inte< aggregate< T_ > >::type layout_type
Type of the encapsulation memory parameter.
__device__ unsigned int size() const
Return the size of the vector.
int yes_i_am_vector
it define that it is a vector
__device__ auto get(size_t id) -> decltype(base.template get< 0 >(0))
Get an element of the vector.
__device__ auto at(size_t id) const -> decltype(base.template get< 0 >(0))
Get an element of the vector.
vector_gpu_ker< T_, layout_base > base
1-D static grid