10 #ifndef CELLLISTBAL_HPP_
11 #define CELLLISTBAL_HPP_
13 #include "Space/Shape/Box.hpp"
14 #include "util/mathutil.hpp"
15 #include "Space/Shape/HyperCube.hpp"
38 template<
typename local_index =
size_t>
56 typedef void toKernel_type;
97 inline void addCell(
size_t cell_id,
typename base::value_type
ele)
124 return cl_base.get(cell_id).size();
135 inline auto get(local_index cell, local_index
ele) -> decltype(
cl_base.get(0).get(0)) &
148 inline auto get(local_index cell, local_index
ele)
const -> decltype(
cl_base.get(0).get(0)) &
163 for (
int i = 0; i <
cl_base.size(); ++i)
205 for (
size_t i = 0 ; i <
cl_base.size() ; i++) {
216 inline const local_index &
getStartId(local_index cell_id)
const
218 if (
cl_base.get(cell_id).size() == 0)
221 return cl_base.get(cell_id).get(0);
229 inline const local_index &
getGhostId(local_index cell_id)
const
231 if (
cl_base.get(cell_id).size() == 0)
242 inline const local_index &
getStopId(local_index cell_id)
const
244 if (
cl_base.get(cell_id).size() == 0)
247 return *(&
cl_base.get(cell_id).last() + 1);
259 inline const local_index &
get_lin(
const local_index * cell_id)
const
270 inline void set_slot(
size_t slot)
Class for BALANCED cell list implementation.
local_index local_index_type
expose the type of the local index
openfpm::vector< base > cl_base
each cell has a pointer to a dynamic structure
const local_index & getStartId(local_index cell_id) const
Get the start index of the selected element.
void addCell(size_t cell_id, typename base::value_type ele)
Add an element to the cell.
local_index getNelements(const local_index cell_id) const
Get the number of elements in the cell.
const local_index & getGhostId(local_index cell_id) const
Get the index of the first ghost element.
void swap(Mem_bal &&cell)
Swap two Mem_bal.
auto get(local_index cell, local_index ele) -> decltype(cl_base.get(0).get(0)) &
Return an element from the cell.
auto get(local_index cell, local_index ele) const -> decltype(cl_base.get(0).get(0)) &
Return an element from the cell.
void addCellGhostMarkers()
Add ghost marker to the cell.
local_index invalid
Invalid element.
const local_index & getStopId(local_index cell_id) const
Get the stop index of the selected element.
void remove(local_index cell, local_index ele)
Remove an element from the cell.
size_t getGhostMarker(local_index cell_id) const
Get ghost marker of the cell.
openfpm::vector< local_index > base
vector that store the information
const local_index & get_lin(const local_index *cell_id) const
get_lin
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.
void swap(Mem_bal &cl)
Swap two Mem_bal.
openfpm::vector< size_t > ghostMarkers
ghost marker for every cell (non-ghost particles < gm (ghost marker))
void clear()
Reset the object.
Implementation of 1-D std::vector like structure.