OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
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 
12 #define NO_CHECK 1
13 #define SAFE 2
14 
15 #define VL_NON_SYMMETRIC 0
16 #define VL_SYMMETRIC 1
17 #define VL_CRS_SYMMETRIC 2
18 
31 template<unsigned int dim, typename Ver> class VerletNNIterator
32 {
34  const typename Ver::Mem_type_type::loc_index * start;
35 
37  const typename Ver::Mem_type_type::loc_index * stop;
38 
40  const typename Ver::Mem_type_type::loc_index * ele_id;
41 
43  Ver & ver;
44 
45 public:
46 
55  inline VerletNNIterator(size_t part_id, Ver & ver)
56  :start(&ver.getStart(part_id)),stop(&ver.getStop(part_id)),ver(ver)
57  {ele_id = start;}
58 
66  inline bool isNext()
67  {
68  if (ele_id < stop)
69  return true;
70  return false;
71  }
72 
79  {
80  ele_id++;
81 
82  return *this;
83  }
84 
90  inline typename Ver::Mem_type_type::loc_index get()
91  {
92  return ver.get_lin(ele_id);
93  }
94 };
95 
96 
97 #endif /* OPENFPM_DATA_SRC_NN_VERLETLIST_VERLETNNITERATOR_HPP_ */
const Ver::Mem_type_type::loc_index * stop
stop index for the neighborhood
Iterator for the neighborhood of the cell structures.
const Ver::Mem_type_type::loc_index * start
start index for the neighborhood
Ver & ver
verlet list
bool isNext()
Check if there is the next element.
const Ver::Mem_type_type::loc_index * ele_id
actual neighborhood
VerletNNIterator(size_t part_id, Ver &ver)
Cell NN iterator.
VerletNNIterator & operator++()
take the next element