12#include "Space/SpaceBox.hpp"
13#include "util/mathutil.hpp"
14#include "Space/Shape/HyperCube.hpp"
15#include "NN/CellList/CellListIterator.hpp"
16#include <unordered_map>
17#include "util/common.hpp"
18#include "Vector/map_vector.hpp"
20template <
typename Memory,
template <
typename>
class layout_base,
typename local_index>
38 typedef local_index local_index_type;
44 inline __device__
int getNelements(
int id)
const
46 return (
int)
cl_n.template get<0>(
id);
57 inline __device__
unsigned int get(
unsigned int cell,
unsigned int ele)
71 inline unsigned int get(
unsigned int cell,
unsigned int ele)
const
87template <
typename Memory = HeapMemory,
typename local_index =
size_t>
114 for (
size_t i = 0 ; i <
cl_n.size() ; i++)
116 for (local_index j = 0 ; j <
cl_n.template get<0>(i) ; j++)
117 {cl_base_.template get<0>(2*i*
slot + j) =
cl_base.template get<0>(
slot * i + j);}
132 typedef local_index local_index_type;
165 cl_n.resize(tot_n_cell);
166 cl_n.template fill<0>(0);
201 template<
typename Memory2>
230 cl_n.template get<0>(cell_id)++;
239 inline void add(local_index cell_id, local_index
ele)
268 inline auto get(local_index cell, local_index
ele)
const ->
decltype(
cl_base.template get<0>(cell *
slot +
ele)) &
282 cl_n.template get<0>(cell)--;
294 return cl_n.template get<0>(cell_id);
308 size_t cl_slot_tmp = mem.
slot;
333 for (
size_t i = 0 ; i <
cl_n.size() ; i++)
334 {
cl_n.template get<0>(i) = 0;}
344 inline const local_index &
getStartId(local_index cell_id)
const
356 inline const local_index &
getStopId(local_index cell_id)
const
358 return cl_base.template get<0>(cell_id*
slot+
cl_n.template get<0>(cell_id));
368 inline const local_index &
get_lin(
const local_index * part_id)
const
413 cl_n.template hostToDevice<0>();
414 cl_base.template hostToDevice<0>();
unsigned int get(unsigned int cell, unsigned int ele) const
Get an element in the cell.
__device__ unsigned int get(unsigned int cell, unsigned int ele)
Get an element in the cell.
openfpm::vector_gpu_ker< aggregate< local_index >, layout_base > base
base that store the data
openfpm::vector_gpu_ker< aggregate< local_index >, layout_base > cl_n
number of particle in each cell list
local_index slot
Number of slot for each cell.
It is a class that work like a vector of vector.
openfpm::vector< aggregate< local_index >, Memory > base
base that store the data
const openfpm::vector< aggregate< local_index >, Memory > & private_get_cl_n() const
Return the private data-structure cl_n.
void add(local_index cell_id, local_index ele)
Add an element to the cell.
const int & private_get_slot() const
Return the private slot.
openfpm::vector< aggregate< local_index >, Memory > cl_n
number of particle in each cell list
const base & private_get_cl_base() const
Return the private data-structure cl_base.
void set_slot(local_index slot)
Set the number of slot for each cell.
local_index loc_index
expose the type of the local index
void operator=(Mem_fast< Memory, local_index > &&mem)
copy an object Mem_fast
const local_index & getStopId(local_index cell_id) const
Get the last element of a cell (as reference)
void init_to_zero(local_index slot, local_index tot_n_cell)
Initialize the data to zero.
void realloc()
realloc the data structures
auto get(local_index cell, local_index ele) const -> decltype(cl_base.template get< 0 >(cell *slot+ele)) &
Get an element in the cell.
void clear()
Delete all the elements in the Cell-list.
void addCell(local_index cell_id, local_index ele)
Add an element to the cell.
void destroy()
Destroy the internal memory including the retained one.
void remove(local_index cell, local_index ele)
Remove an element in the cell.
void swap(Mem_fast< Memory, local_index > &mem)
swap to Mem_fast object
void copy_general(const Mem_fast< Memory2, local_index > &mem)
copy an object Mem_fast
const local_index & getStartId(local_index cell_id) const
Get the first element of a cell (as reference)
const local_index & get_lin(const local_index *part_id) const
Just return the value pointed by part_id.
local_index slot
Number of slot for each cell.
void swap(Mem_fast< Memory, local_index > &&mem)
swap to Mem_fast object
size_t size() const
return the number of elements
auto get(local_index cell, local_index ele) -> decltype(cl_base.template get< 0 >(cell *slot+ele)) &
Get an element in the cell.
size_t getNelements(const local_index cell_id) const
Get the number of elements in the cell.
void operator=(const Mem_fast< Memory, local_index > &mem)
copy an object Mem_fast
Mem_fast(local_index slot)
Constructor.
Implementation of 1-D std::vector like structure.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
grid interface available when on gpu