OpenFPM  5.2.0
Project that contain the implementation of distributed structures
vector_dist_key.hpp
1 /*
2  * vector_dist_key.hpp
3  *
4  * Created on: Mar 10, 2015
5  * Author: i-bird
6  */
7 
8 #ifndef VECTOR_DIST_KEY_HPP_
9 #define VECTOR_DIST_KEY_HPP_
10 
11 
12 
20 {
22 
23  size_t key;
24 
25 public:
26 
32  __device__ __host__ inline void setKey(size_t key)
33  {
34  this->key = key;
35  }
36 
42  __device__ __host__ inline size_t getKey() const
43  {
44  return key;
45  }
46 
52  __device__ __host__ inline operator unsigned int() const
53  {
54  return key;
55  }
56 
62  std::string to_string()
63  {
64  std::stringstream ts;
65 
66  ts << "x[0]=" << key;
67 
68  return ts.str();
69  }
70 
72  __device__ __host__ inline vect_dist_key_dx()
73  {
74  /* coverity[uninit_member] */
75  }
76 
77  __device__ __host__ inline vect_dist_key_dx(size_t key)
78  :key(key)
79  {
80  }
81 };
82 
83 
84 
85 #endif /* VECTOR_DIST_KEY_HPP_ */
Grid key for a distributed grid.
__device__ __host__ size_t getKey() const
Get the key.
__device__ __host__ vect_dist_key_dx()
Default constructor.
size_t key
Local grid iterator.
std::string to_string()
Convert the key into a string message.
__device__ __host__ void setKey(size_t key)
set the key
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data