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);
123 auto key = gr_sub3.
get();
185 long int NNc_full_tmp[openfpm::math::pow(3,dim)];
189 std::copy(&NNc_full_tmp[0],&NNc_full_tmp[size],&
NNc_arr[0]);
201 template<
unsigned int dim,
unsigned int size>
226 typedef typename generate_array<size_t,dim, Fill_three>::result NNthree;
231 typedef typename generate_array<size_t,dim, Fill_one>::result NNone;
232 sub_off =
gs.
LinId(NNone::data);
233 sym_mid = gs_base.
LinId(NNone::data);
243 if (full_or_sym ==
true)
246 return gs.
LinId(key) - sub_off;
250 return gs.
LinId(key) - sub_off;
275 std::cerr << __FILE__ <<
":" << __LINE__ <<
" error dimension is too high to use this type of neighborhood" << std::endl;
288 sub_off = nnc.sub_off;
289 sym_mid = nnc.sym_mid;
291 full_or_sym = nnc.full_or_sym;
306 size_t sub_off_tmp = sub_off;
307 sub_off = nnc.sub_off;
308 nnc.sub_off = sub_off_tmp;
310 size_t sym_mid_tmp = sym_mid;
311 sym_mid = nnc.sym_mid;
312 nnc.sym_mid = sym_mid_tmp;
314 bool full_or_sym_tmp = full_or_sym;
315 full_or_sym = nnc.full_or_sym;
316 nnc.full_or_sym = full_or_sym_tmp;
NNc_array< dim, size, false > & operator=(const NNc_array< dim, size, false > &nnc)
Copy the NNc_array.
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 of the cell grid
long int operator[](size_t i) const
return the element i
grid_sm< dim, void > gs_base
Information about the grid in the reduced space.
const long int * getPointer() const
return the pointer to the array
grid_sm< dim, void > gs
size of the cell array on each dimension
void swap(NNc_array< dim, size, thr > &nnc)
swap NNc_array
NNc_array< dim, size, thr > & operator=(const NNc_array< dim, size, thr > &nnc)
Copy the NNc_array.
const long int & operator[](size_t i) const
return the element i
void init_sym()
Initialize the NNc array with symmetric neighborhood cells indexes.
long int & operator[](size_t i)
return the element i
void init_full()
Initialize the NNc array with full neighborhood cells indexes.
long int NNc_arr[size]
NNc_array.
void init_sym_local()
Initialize the NNc array with symmetric local neighborhood cells indexes.
void set_size(const size_t(&sz)[dim])
Set the size in each.
bool isNext()
Check if there is the next element.
grid_key_dx< dim > get() const
Return the actual grid key iterator.
void setDimensions(const size_t(&dims)[N])
Reset the dimension of the grid.
mem_id LinId(const grid_key_dx< N, ids_type > &gk, const signed char sum_id[N]) const
Linearization of the grid_key_dx with a specified shift.
void swap(grid_sm< N, T > &g)
swap the grid_sm informations
__device__ __host__ grid_key_dx< N > InvLinId(mem_id id) const
Construct.
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data
Set a dimension threshold.