8 #ifndef OPENFPM_DATA_SRC_NN_CELLLIST_CELLNNITERATORRUNTIME_HPP_
9 #define OPENFPM_DATA_SRC_NN_CELLLIST_CELLNNITERATORRUNTIME_HPP_
11 #include "util/mathutil.hpp"
13 #define FULL openfpm::math::pow(3,dim)
14 #define SYM openfpm::math::pow(3,dim)/2 + 1
15 #define CRS openfpm::math::pow(2,dim)
31 template<
unsigned int dim,
typename Cell>
37 const typename Cell::Mem_type_type::loc_index *
start_id;
40 const typename Cell::Mem_type_type::loc_index *
stop_id;
70 if (
NNc_id >= NNc_size)
return;
133 __attribute__((always_inline))
inline const typename Cell::Mem_type_type::loc_index & get()
155 template<
unsigned int dim,
typename Cell,
typename vector_pos_type>
162 const vector_pos_type &
v;
169 if (this->NNc[this->NNc_id] == 0)
171 while (this->start_id < this->
stop_id)
173 size_t q = this->cl.get_lin(this->start_id);
174 for (
long int i = dim-1 ; i >= 0 ; i--)
176 if (
v.template get<0>(
p)[i] <
v.template get<0>(q)[i])
178 else if (
v.template get<0>(
p)[i] >
v.template get<0>(q)[i])
208 const long int * NNc,
211 const vector_pos_type &
v)
214 if (this->NNc_id >= this->NNc_size)
Symmetric iterator for the neighborhood of the cell structures.
const vector_pos_type & v
Position of the particle p.
__attribute__((always_inline)) inline CellNNIteratorSym(size_t cell
Cell NN iterator.
__attribute__((always_inline)) inline void selectValid()
__attribute__((always_inline)) inline CellNNIteratorSym< dim
take the next element
size_t p
index of the particle p
Symmetric iterator for the neighborhood of the cell structures.
size_t p
index of the particle p
const vector_pos_type & v
Position of the particle p.
const Cell::Mem_type_type::loc_index * stop_id
stop id to read the end of the cell
const long int cell
Center cell, or cell for witch we are searching the NN-cell.
__attribute__((always_inline)) inline const typename Cell
Get the value of the cell.
const Cell::Mem_type_type::loc_index * start_id
actual element id
__attribute__((always_inline)) inline void selectValid()
Select non-empty cell.
const long int * NNc
NN cell id.
__attribute__((always_inline)) inline bool isNext()
Check if there is the next element.
size_t cell_id
actual cell id = NNc[NNc_id]+cell stored for performance reason
size_t NNc_size
Size of the neighboring cells.
__attribute__((always_inline)) inline CellNNIterator &operator++()
take the next element
size_t NNc_id
Actual NNc_id;.
__attribute__((always_inline)) inline CellNNIterator(size_t cell
Cell NN iterator.
Iterator for the neighborhood of the cell structures.
const NNc_array< dim, NNc_size > & NNc
NN cell id.
const Cell::Mem_type_type::local_index_type * stop_id
stop id to read the end of the cell
size_t NNc_id
Actual NNc_id;.
const Cell::Mem_type_type::local_index_type * start_id
actual element id
size_t cell_id
actual cell id = NNc[NNc_id]+cell stored for performance reason
const long int cell
Center cell, or cell for witch we are searching the NN-cell.