| 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 | |
| 13 | /*! \brief Grid key for a distributed grid |
| 14 | * |
| 15 | * Grid key for a distributed grid |
| 16 | * |
| 17 | */ |
| 18 | |
| 19 | class vect_dist_key_dx |
| 20 | { |
| 21 | //! Local grid iterator |
| 22 | |
| 23 | size_t key; |
| 24 | |
| 25 | public: |
| 26 | |
| 27 | /*! \brief set the key |
| 28 | * |
| 29 | * \param key the local key |
| 30 | * |
| 31 | */ |
| 32 | __device__ __host__ inline void setKey(size_t key) |
| 33 | { |
| 34 | this->key = key; |
| 35 | } |
| 36 | |
| 37 | /*! \brief Get the key |
| 38 | * |
| 39 | * \return the local key |
| 40 | * |
| 41 | */ |
| 42 | __device__ __host__ inline size_t getKey() const |
| 43 | { |
| 44 | return key; |
| 45 | } |
| 46 | |
| 47 | /*! \brief Convert the key into a string message |
| 48 | * |
| 49 | * \return a string message |
| 50 | * |
| 51 | */ |
| 52 | std::string to_string() |
| 53 | { |
| 54 | std::stringstream ts; |
| 55 | |
| 56 | ts << "x[0]=" << key; |
| 57 | |
| 58 | return ts.str(); |
| 59 | } |
| 60 | |
| 61 | //! constructor from a key |
| 62 | /* inline vect_dist_key_dx(size_t key) |
| 63 | :key(key) |
| 64 | { |
| 65 | }*/ |
| 66 | |
| 67 | //! Default constructor |
| 68 | __device__ __host__ inline vect_dist_key_dx() |
| 69 | { |
| 70 | /* coverity[uninit_member] */ |
| 71 | } |
| 72 | |
| 73 | //! Default constructor |
| 74 | __device__ __host__ inline vect_dist_key_dx(size_t key) |
| 75 | :key(key) |
| 76 | { |
| 77 | } |
| 78 | }; |
| 79 | |
| 80 | |
| 81 | |
| 82 | #endif /* VECTOR_DIST_KEY_HPP_ */ |
| 83 | |