11 #include "Space/SpaceBox.hpp"
12 #include "util/mathutil.hpp"
13 #include "Space/Shape/HyperCube.hpp"
14 #include "NN/CellList/CellListIterator.hpp"
15 #include <unordered_map>
16 #include "util/common.hpp"
17 #include "Vector/map_vector.hpp"
29 template <
typename local_index =
size_t>
56 for (
size_t i = 0 ; i <
cl_n.
size() ; i++)
58 for (
size_t j = 0 ; j <
cl_n.get(i) ; j++)
94 cl_n.resize(tot_n_cell);
99 cl_base.resize(tot_n_cell * slot);
131 inline void addCell(local_index cell_id,
typename base::value_type ele)
154 inline void add(local_index cell_id,
typename base::value_type ele)
169 inline auto get(local_index cell, local_index ele) -> decltype(
cl_base.get(cell *
slot + ele)) &
183 inline auto get(local_index cell, local_index ele)
const -> decltype(
cl_base.get(cell *
slot + ele)) &
195 inline void remove(local_index cell, local_index ele)
209 return cl_n.get(cell_id);
223 size_t cl_slot_tmp = mem.
slot;
248 for (
size_t i = 0 ; i <
cl_n.
size() ; i++)
259 inline const local_index &
getStartId(local_index cell_id)
const
271 inline const local_index &
getStopId(local_index cell_id)
const
283 inline const local_index &
get_lin(
const local_index * part_id)
const
local_index slot
Number of slot for each cell.
const local_index & getStartId(local_index cell_id) const
Get the first element of a cell (as reference)
openfpm::vector< local_index > base
base that store the data
void operator=(Mem_fast< local_index > &&mem)
copy an object Mem_fast
It is a class that work like a vector of vector.
void clear()
Delete all the elements in the Cell-list.
void set_slot(local_index slot)
Set the number of slot for each cell.
void swap(Mem_fast< local_index > &&mem)
swap to Mem_fast object
void operator=(const Mem_fast< local_index > &mem)
copy an object Mem_fast
void init_to_zero(local_index slot, local_index tot_n_cell)
Initialize the data to zero.
local_index loc_index
expose the type of the local index
size_t size()
return the number of elements
void addCell(local_index cell_id, typename base::value_type ele)
Add an element to the cell.
void realloc()
realloc the data structures
const local_index & get_lin(const local_index *part_id) const
Just return the value pointed by part_id.
openfpm::vector< local_index > cl_n
number of particle in each cell list
void swap(Mem_fast< local_index > &mem)
swap to Mem_fast object
const local_index & getStopId(local_index cell_id) const
Get the last element of a cell (as reference)
size_t getNelements(const local_index cell_id) const
Get the number of elements in the cell.
void add(local_index cell_id, typename base::value_type ele)
Add an element to the cell.
Mem_fast(local_index slot)
Constructor.