OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
VerletNNIterator.hpp
1 /*
2  * VerletNNIterator.hpp
3  *
4  * Created on: Aug 16, 2016
5  * Author: i-bird
6  */
7 
8 #ifndef OPENFPM_DATA_SRC_NN_VERLETLIST_VERLETNNITERATOR_HPP_
9 #define OPENFPM_DATA_SRC_NN_VERLETLIST_VERLETNNITERATOR_HPP_
10 
11 #define VL_NON_SYMMETRIC 0
12 #define VL_SYMMETRIC 1
13 #define VL_CRS_SYMMETRIC 2
14 
27 template<unsigned int dim, typename Ver> class VerletNNIterator
28 {
30  const typename Ver::Mem_type_type::local_index_type * start;
31 
33  const typename Ver::Mem_type_type::local_index_type * stop;
34 
36  const typename Ver::Mem_type_type::local_index_type * ele_id;
37 
39  Ver & ver;
40 
41 public:
42 
51  inline VerletNNIterator(size_t part_id, Ver & ver)
52  :start(&ver.getStart(part_id)),stop(&ver.getStop(part_id)),ver(ver)
53  {ele_id = start;}
54 
62  inline bool isNext()
63  {
64  if (ele_id < stop)
65  return true;
66  return false;
67  }
68 
75  {
76  ele_id++;
77 
78  return *this;
79  }
80 
86  inline typename Ver::Mem_type_type::local_index_type get()
87  {
88  return ver.get_lin(ele_id);
89  }
90 };
91 
92 
93 #endif /* OPENFPM_DATA_SRC_NN_VERLETLIST_VERLETNNITERATOR_HPP_ */
const Ver::Mem_type_type::local_index_type * ele_id
actual neighborhood
Iterator for the neighborhood of the cell structures.
Ver::Mem_type_type::local_index_type get()
Get the value of the cell.
const Ver::Mem_type_type::local_index_type * stop
stop index for the neighborhood
Ver & ver
verlet list
bool isNext()
Check if there is the next element.
const Ver::Mem_type_type::local_index_type * start
start index for the neighborhood
VerletNNIterator(size_t part_id, Ver &ver)
Cell NN iterator.
VerletNNIterator & operator++()
take the next element