Class for MEMORY-WISE cell list implementation. More...
Class for MEMORY-WISE cell list implementation.
This class implement the MEMORY-WISE cell list The memory allocation is small. The memory allocation is (in byte) Size = O(N*size_of(ele))
Where
N = total number of elements M = number of cells sizeof(ele) = the size of the element the cell list is storing, example if the cell list store the particle id (64bit) is 8 byte
dim | Dimensionality of the space |
T | type of the space float, double, complex |
Definition at line 34 of file MemMemoryWise.hpp.
#include <MemMemoryWise.hpp>
Public Types | |
typedef local_index | loc_index |
expose the type of the local index | |
Public Member Functions | |
void | init_to_zero (local_index slot, local_index tot_n_cell) |
Initialize the data structure to zeros. More... | |
Mem_mw & | operator= (const Mem_mw &cell) |
Copy two data-structure. More... | |
void | addCell (local_index cell_id, typename base::value_type ele) |
Add an element to the cell. More... | |
void | add (local_index cell_id, typename base::value_type ele) |
Add an element to the cell. More... | |
void | remove (local_index cell, local_index ele) |
Remove an element from the cell. More... | |
size_t | getNelements (const local_index cell_id) const |
Get the number of elements in the cell. More... | |
auto | get (local_index cell, local_index ele) -> decltype(cl_base[0].get(0))& |
auto | get (local_index cell, local_index ele) const -> decltype(cl_base.find(cell) ->second.get(0))& |
void | swap (Mem_mw &cl) |
void | swap (Mem_mw &&cell) |
void | clear () |
const local_index & | getStartId (size_t part_id) const |
const local_index & | getStopId (size_t part_id) const |
const local_index & | get_lin (const local_index *part_id) const |
Mem_mw (size_t slot) | |
constructor More... | |
void | set_slot (size_t slot) |
Set the number of slots. More... | |
Private Types | |
typedef openfpm::vector < local_index > | base |
Base type storing information. | |
Private Attributes | |
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. | |
constructor
slot | number of slots (unused) |
Definition at line 192 of file MemMemoryWise.hpp.
|
inline |
Add an element to the cell.
cell_id | cell-id |
ele | element to add |
Definition at line 96 of file MemMemoryWise.hpp.
|
inline |
Add an element to the cell.
cell_id | cell-id |
ele | element to add |
Definition at line 83 of file MemMemoryWise.hpp.
|
inline |
Get the number of elements in the cell.
cell_id |
Definition at line 119 of file MemMemoryWise.hpp.
|
inline |
Initialize the data structure to zeros.
In this case it does nothing
slots | |
tot_n_cell | total number of cells |
Definition at line 59 of file MemMemoryWise.hpp.
|
inline |
Copy two data-structure.
cell | data-structure to copy |
Definition at line 71 of file MemMemoryWise.hpp.
|
inline |
Remove an element from the cell.
cell | cell-id |
ele | element to remove |
Definition at line 107 of file MemMemoryWise.hpp.
|
inline |
|
private |
each cell has a dynamic structure that store the elements in the cell
Definition at line 41 of file MemMemoryWise.hpp.