OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
grid_key_dx_iterator_sp.hpp
1/*
2 * grid_key_dx_iterator_sp.hpp
3 *
4 * Created on: Dec 15, 2015
5 * Author: i-bird
6 */
7
8#ifndef OPENFPM_DATA_SRC_GRID_ITERATORS_GRID_KEY_DX_ITERATOR_SP_HPP_
9#define OPENFPM_DATA_SRC_GRID_ITERATORS_GRID_KEY_DX_ITERATOR_SP_HPP_
10
11
12
27template<unsigned int dim>
29{
32
33public:
34
80 template<typename T> grid_key_dx_iterator_sp(grid_sm<dim,T> & g, mem_id from, mem_id to)
82 {
84 this->gk = g.InvLinId(from);
85
87 gk_stop = g.InvLinId(to);
88 }
89
98 bool isNext()
99 {
101 for (int i = dim-1 ; i >= 0 ; i-- )
102 {
104 if (this->gk.get(i) < gk_stop.get(i))
105 return true;
106 else if (this->gk.get(i) > gk_stop.get(i))
107 return false;
108 }
109
111 return true;
112 }
113};
114
115
116#endif /* OPENFPM_DATA_SRC_GRID_ITERATORS_GRID_KEY_DX_ITERATOR_SP_HPP_ */
grid_key_dx< dim > gk_stop
stop point
grid_key_dx_iterator_sp(grid_sm< dim, T > &g, mem_id from, mem_id to)
Constructor require a grid grid<dim,T>
bool isNext()
Check if there is the next element.
grid_key_dx< dim > gk
Actual key.
grid_key_dx is the key to access any element in the grid
Definition grid_key.hpp:19
__device__ __host__ index_type get(index_type i) const
Get the i index.
Definition grid_key.hpp:503
Declaration grid_sm.
Definition grid_sm.hpp:167
__device__ __host__ grid_key_dx< N > InvLinId(mem_id id) const
Construct.
Definition grid_sm.hpp:609