OpenFPM_data  0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Namespaces Functions Variables Typedefs Friends
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 
27 template<unsigned int dim>
29 {
32 
33 public:
34 
80  template<typename T> grid_key_dx_iterator_sp(grid_sm<dim,T> & g, mem_id from, mem_id to)
81  :grid_key_dx_iterator<dim>(g)
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 is the key to access any element in the grid
Definition: grid_key.hpp:18
grid_key_dx_iterator_sp(grid_sm< dim, T > &g, mem_id from, mem_id to)
Constructor require a grid grid<dim,T>
grid_key_dx< N > InvLinId(mem_id id) const
Construct.
Definition: grid_sm.hpp:483
bool isNext()
Check if there is the next element.
grid_key_dx< dim > gk_stop
stop point