10 #ifndef CELLLISTBAL_HPP_
11 #define CELLLISTBAL_HPP_
13 #include "NN/CellList/CellList.hpp"
14 #include "Space/SpaceBox.hpp"
15 #include "util/mathutil.hpp"
16 #include "NN/CellList/CellNNIterator.hpp"
17 #include "Space/Shape/HyperCube.hpp"
40 template<
typename local_index =
size_t>
92 inline void addCell(
size_t cell_id,
typename base::value_type ele)
105 inline void add(
size_t cell_id,
typename base::value_type ele)
116 inline void remove(local_index cell, local_index ele)
130 return cl_base.get(cell_id).size();
141 inline auto get(local_index cell, local_index ele) -> decltype(
cl_base.get(0).get(0)) &
143 return cl_base.get(cell).get(ele);
154 inline auto get(local_index cell, local_index ele)
const -> decltype(
cl_base.get(0).get(0)) &
156 return cl_base.get(cell).get(ele);
185 for (
size_t i = 0 ; i <
cl_base.size() ; i++)
194 inline const local_index &
getStartId(local_index part_id)
const
196 if (
cl_base.get(part_id).size() == 0)
199 return cl_base.get(part_id).get(0);
207 inline const local_index &
getStopId(local_index part_id)
const
209 if (
cl_base.get(part_id).size() == 0)
212 return *(&
cl_base.get(part_id).last() + 1);
224 inline const local_index &
get_lin(
const local_index * part_id)
const
235 inline void set_slot(
size_t slot)
local_index getNelements(const local_index cell_id) const
Get the number of elements in the cell.
void swap(Mem_bal &&cell)
Swap two Mem_bal.
void addCell(size_t cell_id, typename base::value_type ele)
Add an element to the cell.
void add(size_t cell_id, typename base::value_type ele)
Add an element to the cell.
void init_to_zero(size_t slot, size_t tot_n_cell)
Initialize all to zero.
Mem_bal & operator=(const Mem_bal &cell)
Copy mem balanced.
openfpm::vector< local_index > base
vector that store the information
const local_index & get_lin(const local_index *part_id) const
get_lin
void clear()
Reset the object.
const local_index & getStartId(local_index part_id) const
Get the start index of the selected element.
local_index invalid
Invalid element.
local_index loc_index
expose the type of the local index
openfpm::vector< base > cl_base
each cell has a pointer to a dynamic structure
const local_index & getStopId(local_index part_id) const
Get the stop index of the selected element.
void swap(Mem_bal &cl)
Swap two Mem_bal.
Class for BALANCED cell list implementation.