Class for BALANCED cell list implementation. More...
Class for BALANCED cell list implementation.
local_index | type of local index |
This class implement the BALANCED cell list is fast (not best) The memory allocation is small (not best). The memory allocation is (in byte) Size = M*16 + N*sizeof(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 41 of file MemBalanced.hpp.
#include <MemBalanced.hpp>
Public Types | |
typedef void | toKernel_type |
typedef local_index | local_index_type |
expose the type of the local index | |
Public Member Functions | |
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 | 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 | remove (local_index cell, local_index ele) |
Remove an element from the cell. | |
local_index | getNelements (const local_index cell_id) const |
Get the number of elements in the cell. | |
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 | swap (Mem_bal &cl) |
Swap two Mem_bal. | |
void | swap (Mem_bal &&cell) |
Swap two Mem_bal. | |
void | clear () |
Reset the object. | |
const local_index & | getStartId (local_index part_id) const |
Get the start index of the selected element. | |
const local_index & | getStopId (local_index part_id) const |
Get the stop index of the selected element. | |
const local_index & | get_lin (const local_index *part_id) const |
get_lin | |
Mem_bal (size_t slot) | |
void | set_slot (size_t slot) |
Private Types | |
typedef openfpm::vector< local_index > | base |
vector that store the information | |
Private Attributes | |
openfpm::vector< base > | cl_base |
each cell has a pointer to a dynamic structure | |
local_index | invalid |
Invalid element. | |
|
private |
vector that store the information
Definition at line 44 of file MemBalanced.hpp.
typedef local_index Mem_bal< local_index >::local_index_type |
expose the type of the local index
Definition at line 58 of file MemBalanced.hpp.
typedef void Mem_bal< local_index >::toKernel_type |
Definition at line 55 of file MemBalanced.hpp.
Definition at line 233 of file MemBalanced.hpp.
|
inline |
Add an element to the cell.
cell_id | id of the cell |
ele | element to add |
Definition at line 107 of file MemBalanced.hpp.
|
inline |
Add an element to the cell.
cell_id | id of the cell |
ele | element to add |
Definition at line 94 of file MemBalanced.hpp.
|
inline |
Reset the object.
Definition at line 185 of file MemBalanced.hpp.
|
inline |
Return an element from the cell.
cell | id of the cell |
ele | element id |
Definition at line 143 of file MemBalanced.hpp.
|
inline |
Return an element from the cell.
cell | id of the cell |
ele | element id |
Definition at line 156 of file MemBalanced.hpp.
|
inline |
get_lin
It just return the element pointed by part_id
part_id | element |
Definition at line 226 of file MemBalanced.hpp.
|
inline |
Get the number of elements in the cell.
cell_id | id of the cell |
Definition at line 130 of file MemBalanced.hpp.
|
inline |
Get the start index of the selected element.
part_id | element |
Definition at line 196 of file MemBalanced.hpp.
|
inline |
Get the stop index of the selected element.
part_id | element |
Definition at line 209 of file MemBalanced.hpp.
|
inline |
Initialize all to zero.
slot | number of slot (unused) |
tot_n_cell | total number of cells |
Definition at line 66 of file MemBalanced.hpp.
|
inline |
Copy mem balanced.
cell | memory to copy |
Definition at line 81 of file MemBalanced.hpp.
|
inline |
Remove an element from the cell.
cell | id of the cell |
ele | element to remove |
Definition at line 118 of file MemBalanced.hpp.
|
inline |
Definition at line 237 of file MemBalanced.hpp.
|
inline |
Swap two Mem_bal.
cell | element to swap with |
Definition at line 176 of file MemBalanced.hpp.
|
private |
each cell has a pointer to a dynamic structure
Definition at line 48 of file MemBalanced.hpp.
|
private |
Invalid element.
Definition at line 51 of file MemBalanced.hpp.