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>
19template<
unsigned int dim>
23 typedef boost::mpl::bool_< dim < 10 > type;
31template<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();
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]);
189template<
unsigned int dim,
unsigned int size>
214 typedef typename generate_array<size_t,dim, Fill_three>::result NNthree;
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;
270 gs_base = nnc.gs_base;
271 sub_off = nnc.sub_off;
272 sym_mid = nnc.sym_mid;
274 full_or_sym = nnc.full_or_sym;
287 gs_base.
swap(nnc.gs_base);
289 size_t sub_off_tmp = sub_off;
290 sub_off = nnc.sub_off;
291 nnc.sub_off = sub_off_tmp;
293 size_t sym_mid_tmp = sym_mid;
294 sym_mid = nnc.sym_mid;
295 nnc.sym_mid = sym_mid_tmp;
297 bool full_or_sym_tmp = full_or_sym;
298 full_or_sym = nnc.full_or_sym;
299 nnc.full_or_sym = full_or_sym_tmp;
const long int * getPointer() const
return the pointer to the array
void swap(NNc_array< dim, size, false > &nnc)
swap the NNc_array
NNc_array< dim, size, false > & operator=(const NNc_array< dim, size, false > &nnc)
Copy 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.
grid_sm< dim, void > gs
size of the cell array on each dimension
void swap(NNc_array< dim, size, thr > &nnc)
swap NNc_array
long int & operator[](size_t i)
return the element i
const long int & operator[](size_t i) const
return the element i
void init_sym()
Initialize the NNc array with symmetric neighborhood cells indexes.
void init_full()
Initialize the NNc array with full neighborhood cells indexes.
const long int * getPointer() const
return the pointer to the array
long int NNc_arr[size]
NNc_array.
NNc_array< dim, size, thr > & operator=(const NNc_array< dim, size, thr > &nnc)
Copy the NNc_array.
void set_size(const size_t(&sz)[dim])
Set the size in each.
Declaration grid_key_dx_iterator_sub.
grid_key_dx< dim > get() const
Return the actual grid key iterator.
bool isNext()
Check if there is the next element.
grid_key_dx is the key to access any element in the grid
__device__ __host__ grid_key_dx< N > InvLinId(mem_id id) const
Construct.
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
Set a dimension threshold.