OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
vector_dist_iterator.hpp
1 /*
2  * vector_dist_iterator.hpp
3  *
4  * Created on: Mar 10, 2015
5  * Author: Pietro Incardona
6  */
7 
8 #ifndef VECTOR_DIST_ITERATOR_HPP_
9 #define VECTOR_DIST_ITERATOR_HPP_
10 
11 #include "Vector/vector_dist_key.hpp"
12 #include "VCluster/VCluster.hpp"
13 
16 {
18  size_t v_it;
19 
21  size_t stop;
22 
23  public:
24 
31  vector_dist_iterator(size_t start, size_t stop)
32  :v_it(start),stop(stop)
33  {
34  }
35 
36  // Destructor
38  {
39  }
40 
48  {
49  ++v_it;
50 
51  return *this;
52  }
53 
60  bool isNext()
61  {
62  // If there are no other grid stop
63 
64  if (v_it >= stop)
65  return false;
66 
67  return true;
68  }
69 
75  inline vect_dist_key_dx get()
76  {
78  v.setKey(v_it);
79  return v;
80  }
81 
86  void reset()
87  {
88  v_it = 0;
89  }
90 };
91 
92 
93 #endif /* VECTOR_DIST_ITERATOR_HPP_ */
vector_dist_iterator & operator++()
Get the next element.
void reset()
Reset the iterator.
Iterator that Iterate across particle indexes.
Grid key for a distributed grid.
vector_dist_iterator(size_t start, size_t stop)
Constructor of the distributed grid.
bool isNext()
Check if there is the next element.
void setKey(size_t key)
set the key
size_t v_it
Actual iterator.