OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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
76 {
78 v.setKey(v_it);
79 return v;
80 }
81
88 {
90 v.setKey(v_it);
91 return v;
92 }
93
98 void reset()
99 {
100 v_it = 0;
101 }
102};
103
104
107{
109 size_t v_it;
110
112 size_t stop;
113
115
116 public:
117
125 :v_it(start),stop(stop),pid(pid)
126 {
127 }
128
129 // Destructor
131 {
132 }
133
141 {
142 ++v_it;
143
144 return *this;
145 }
146
153 bool isNext()
154 {
155 // If there are no other grid stop
156
157 if (v_it >= stop)
158 return false;
159
160 return true;
161 }
162
169 {
171 v.setKey(v_it);
172 return v;
173 }
174
181 {
183 v.setKey(pid.template get<0>(v_it));
184 return v;
185 }
186
191 void reset()
192 {
193 v_it = 0;
194 }
195};
196
197#endif /* VECTOR_DIST_ITERATOR_HPP_ */
Implementation of 1-D std::vector like structure.
Grid key for a distributed grid.
Iterator that Iterate across particle indexes.
vector_dist_iterator_subset(size_t start, size_t stop, const openfpm::vector< aggregate< int > > &pid)
Constructor of the distributed grid.
vector_dist_iterator_subset & operator++()
Get the next element.
vect_dist_key_dx get()
Get the actual key.
bool isNext()
Check if there is the next element.
void reset()
Reset the iterator.
vect_dist_key_dx getOrig()
Get the actual key.
Iterator that Iterate across particle indexes.
vector_dist_iterator & operator++()
Get the next element.
bool isNext()
Check if there is the next element.
void reset()
Reset the iterator.
vect_dist_key_dx get()
Get the actual key.
vector_dist_iterator(size_t start, size_t stop)
Constructor of the distributed grid.
vect_dist_key_dx getOrig()
Get the actual key.
size_t v_it
Actual iterator.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...