9 #ifndef CELLISTMEM_HPP_
10 #define CELLISTMEM_HPP_
32 template<
typename local_index =
size_t>
40 std::unordered_map<local_index,base>
cl_base;
50 typedef void toKernel_type;
88 inline void addCell(local_index cell_id,
typename base::value_type
ele)
115 auto it =
cl_base.find(cell_id);
119 return it->second.size();
122 inline auto get(local_index cell, local_index
ele) -> decltype(
cl_base[0].get(0)) &
128 return it->second.get(
ele);
131 inline auto get(local_index cell, local_index
ele)
const -> decltype(
cl_base.find(cell)->second.get(0)) &
137 return it->second.get(
ele);
165 inline void swap(
Mem_mw & cl)
171 inline void swap(
Mem_mw && cell)
183 inline const local_index & getStartId(
size_t cell_id)
const
185 auto it =
cl_base.find(cell_id);
189 return it->second.get(0);
192 inline const local_index & getGhostId(
size_t cell_id)
const
198 auto cell_it =
cl_base.find(cell_id);
202 return cell_it->second.get(gm_it->second);
205 inline const local_index & getStopId(
size_t cell_id)
const
207 auto it =
cl_base.find(cell_id);
211 return *(&it->second.last() + 1);
214 inline const local_index & get_lin(
const local_index * cell_id)
const
Class for MEMORY-WISE cell list implementation.
std::unordered_map< local_index, size_t > ghostMarkers
ghost marker for every cell (non-ghost particles < gm (ghost marker))
void init_to_zero(local_index slot, local_index tot_n_cell)
Initialize the data structure to zeros.
Mem_mw(size_t slot)
constructor
void addCell(local_index cell_id, typename base::value_type ele)
Add an element to the cell.
void set_slot(size_t slot)
Set the number of slots.
Mem_mw & operator=(const Mem_mw &cell)
Copy two data-structure.
openfpm::vector< local_index > base
Base type storing information.
void addCellGhostMarkers()
Add ghost marker to the cell.
void remove(local_index cell, local_index ele)
Remove an element from the cell.
std::unordered_map< local_index, base > cl_base
std::remove_reference< decltype(std::declval< openfpm::vector< local_index >>().get(0))>::type invalid
In case of invalid element return this.
size_t getNelements(const local_index cell_id) const
Get the number of elements in the cell.
local_index local_index_type
expose the type of the local index
size_t getGhostMarker(local_index cell_id) const
Get ghost marker of the cell.
Implementation of 1-D std::vector like structure.