OpenFPM  5.2.0
Project that contain the implementation of distributed structures
VerletNNIterator.hpp
1 #ifndef OPENFPM_DATA_SRC_NN_VERLETLIST_VERLETNNITERATOR_HPP_
2 #define OPENFPM_DATA_SRC_NN_VERLETLIST_VERLETNNITERATOR_HPP_
3 
4 
16  template<unsigned int dim, typename Ver> class VerletNNIterator
17 {
19  const typename Ver::Mem_type_type::local_index_type * start;
20 
22  const typename Ver::Mem_type_type::local_index_type * stop;
23 
25  const typename Ver::Mem_type_type::local_index_type * ele_id;
26 
28  Ver & ver;
29 
30 public:
31 
40  inline VerletNNIterator(size_t part_id, Ver & ver)
41  :start(&ver.getStart(part_id)),stop(&ver.getStop(part_id)),ver(ver)
42  {ele_id = start;}
43 
51  inline bool isNext()
52  {
53  if (ele_id < stop)
54  return true;
55  return false;
56  }
57 
64  {
65  ele_id++;
66 
67  return *this;
68  }
69 
75  inline typename Ver::Mem_type_type::local_index_type get()
76  {
77  return ver.get_lin(ele_id);
78  }
79 
80 
85  inline void reset()
86  {
87  ele_id = start;
88  }
89 
90 
91 };
92 
93 
94 #endif /* OPENFPM_DATA_SRC_NN_VERLETLIST_VERLETNNITERATOR_HPP_ */
Iterator for the neighborhood of the cell structures.
Ver::Mem_type_type::local_index_type get()
Get the value of the cell.
Ver & ver
verlet list
const Ver::Mem_type_type::local_index_type * ele_id
actual neighborhood
void reset()
Resets the iterator to the starting position.
VerletNNIterator(size_t part_id, Ver &ver)
Cell NN iterator.
const Ver::Mem_type_type::local_index_type * start
start index for the neighborhood
bool isNext()
Check if there is the next element.
const Ver::Mem_type_type::local_index_type * stop
stop index for the neighborhood
VerletNNIterator & operator++()
take the next element