8 #ifndef OPENFPM_DATA_SRC_NN_CELLLIST_NNC_ARRAY_HPP_
9 #define OPENFPM_DATA_SRC_NN_CELLLIST_NNC_ARRAY_HPP_
11 #include "Grid/grid_sm.hpp"
12 #include <boost/mpl/bool.hpp>
19 template<
unsigned int dim>
23 typedef boost::mpl::bool_< dim < 10 > type;
31 template<unsigned int dim, unsigned int size, bool thr = as_array_nnc<dim>::type::value>
78 typedef typename generate_array<size_t,dim, Fill_zero>::result NNzero;
79 typedef typename generate_array<size_t,dim, Fill_two>::result NNtwo;
80 typedef typename generate_array<size_t,dim, Fill_one>::result NNone;
88 size_t middle =
gs.
LinId(NNone::data);
108 typedef typename generate_array<size_t,dim, Fill_zero>::result NNzero;
109 typedef typename generate_array<size_t,dim, Fill_two>::result NNtwo;
110 typedef typename generate_array<size_t,dim, Fill_one>::result NNone;
112 size_t middle =
gs.
LinId(NNone::data);
173 long int NNc_full_tmp[openfpm::math::pow(3,dim)];
177 std::copy(&NNc_full_tmp[0],&NNc_full_tmp[size],&
NNc_arr[0]);
189 template<
unsigned int dim,
unsigned int size>
214 typedef typename generate_array<size_t,dim, Fill_three>::result NNthree;
217 gs_base.setDimensions(NNthree::data);
219 typedef typename generate_array<size_t,dim, Fill_one>::result NNone;
220 sub_off =
gs.
LinId(NNone::data);
221 sym_mid = gs_base.LinId(NNone::data);
231 if (full_or_sym ==
true)
234 return gs.
LinId(key) - sub_off;
238 return gs.
LinId(key) - sub_off;
258 std::cerr << __FILE__ <<
":" << __LINE__ <<
" error dimension is too high to use this type of neighborhood" << std::endl;
271 sub_off = nnc.sub_off;
272 sym_mid = nnc.sym_mid;
287 size_t sub_off_tmp = sub_off;
288 sub_off = nnc.sub_off;
289 nnc.sub_off = sub_off_tmp;
291 size_t sym_mid_tmp = sym_mid;
292 sym_mid = nnc.sym_mid;
293 nnc.sym_mid = sym_mid_tmp;
295 bool full_or_sym_tmp = full_or_sym;
296 full_or_sym = nnc.full_or_sym;
297 nnc.full_or_sym = full_or_sym_tmp;
grid_sm< dim, void > gs
size of the cell array on each dimension
mem_id LinId(const grid_key_dx< N > &gk, const char sum_id[N]) const
Linearization of the grid_key_dx with a specified shift.
grid_key_dx is the key to access any element in the grid
const long int * getPointer() const
return the pointer to the array
long int NNc_arr[size]
NNc_array.
long int operator[](size_t i) const
return the element i
const long int * getPointer() const
return the pointer to the array
void swap(NNc_array< dim, size, false > &nnc)
swap the NNc_array
void set_size(const size_t(&sz)[dim])
Set the size in each.
const long int & operator[](size_t i) const
return the element i
Set a dimension threshold.
void swap(grid_sm< N, T > &g)
swap the grid_sm informations
void init_sym()
Initialize the NNc array with symmetric neighborhood cells indexes.
grid_key_dx< dim > get() const
Return the actual grid key iterator.
This class is a trick to indicate the compiler a specific specialization pattern. ...
NNc_array< dim, size, thr > & operator=(const NNc_array< dim, size, thr > &nnc)
Copy the NNc_array.
long int & operator[](size_t i)
return the element i
NNc_array< dim, size, false > & operator=(const NNc_array< dim, size, false > &nnc)
Copy the NNc_array.
void swap(NNc_array< dim, size, thr > &nnc)
swap NNc_array
void set_size(const size_t(&sz)[dim])
set the size of the cell grid
grid_sm< dim, void > gs_base
Information about the grid in the reduced space.
void init_full()
Initialize the NNc array with full neighborhood cells indexes.
bool isNext()
Check if there is the next element.
void setDimensions(const size_t(&dims)[N])
Reset the dimension of the grid.