9 #ifndef CELLISTMEM_HPP_
10 #define CELLISTMEM_HPP_
12 #include <unordered_map>
33 template<
unsigned int dim,
typename T,
typename transform,
typename base>
34 class CellList<dim,T,MEMORY,transform,base> :
public CellDecomposer_sm<dim,T,transform>
42 long int NNc_full[openfpm::math::pow(3,dim)];
49 long int NNc_sym[openfpm::math::pow(3,dim)/2+1];
56 long int NNc_cr[openfpm::math::pow(2,dim)];
60 std::unordered_map<size_t,base> cl_base;
77 CellDecomposer_sm<dim,T>::getGrid();
91 Initialize(sbox,div,orig);
106 for (
size_t i = 0 ; i < dim ; i++)
107 div_pad[i] = div[i] + 2;
109 CellDecomposer_sm<dim,T>::setDimensions(box,div_pad, pad);
114 for (
int i = 0; i < this->tot_n_cell; i++)
122 typedef typename generate_array<size_t,dim, Fill_zero>::result NNzero;
123 typedef typename generate_array<size_t,dim, Fill_two>::result NNtwo;
124 typedef typename generate_array<size_t,dim, Fill_one>::result NNone;
132 size_t middle = this->gr_cell.LinId(NNone::data);
136 NNc_full[i] = (
long int)this->gr_cell.LinId(gr_sub3.
get()) - middle;
150 size_t lin = this->gr_cell.LinId(
key);
159 NNc_sym[i] = lin - middle;
174 NNc_cr[i] = (
long int)this->gr_cell.LinId(
key);
199 Initialize(sbox,div,orig,pad);
211 Initialize(box,div,orig,pad);
221 void add(
const T (& pos)[dim],
typename base::value_type ele)
225 size_t cell_id = this->getCell(pos);
229 cl_base[cell_id].add(ele);
242 size_t cell_id = this->getCell(pos);
246 cl_base[cell_id].add(ele);
256 void remove(
size_t cell,
size_t ele)
258 cl_base[cell].remove(ele);
270 return cl_base[cell_id].size();
279 auto get(
size_t cell,
size_t ele) -> decltype(cl_base[cell].
get(ele))
281 return cl_base[cell].get(ele);
290 cl_base.swap(cl.cl_base);
This class represent an N-dimensional box.
bool isNext()
Check if there is the next element.
This class implement the point shape in an N-dimensional space.
grid_key_dx< dim > get()
Return the actual grid key iterator.
it iterate through the elements of a cell
void reset()
Reset the iterator (it restart from the beginning)
This class represent an N-dimensional box.
This class is a trick to indicate the compiler a specific specialization pattern. ...
Iterator for the neighborhood of the cell structures.