Class for FAST cell list implementation. More...
Class for FAST cell list implementation.
This class implement the FAST cell list, fast but memory expensive. The memory allocation is (M * N_cell_max)*sizeof(ele) + M*8
Example of a 2D Cell list 6x6 structure with padding 1 without shift, cell indicated with p are padding cell the origin of the cell or point (0,0) is marked with cell number 9
* +-----------------------+ * |p |p |p |p |p |p |p |p | * +-----------------------+ * |p | | | | | | |p | * +-----------------------+ * |p | | | | | | |p | * +-----------------------+ * |p | | | | | | |p | * +-----------------------+ * |p |9 | | | | | |p | * +-----------------------+ * |p |p |p |p |p |p |p |p | * +-----------------------+ *
dim | Dimensionality of the space |
T | type of the space float, double ... |
base | Base structure that store the information |
Definition at line 356 of file CellList.hpp.
#include <CellList.hpp>
Public Types | |
typedef Mem_type | Mem_type_type |
Type of internal memory structure. | |
typedef CellNNIteratorSym< dim, CellList< dim, T, Mem_type, transform, vector_pos_type >, vector_pos_type, RUNTIME, NO_CHECK > | SymNNIterator |
typedef Mem_type::local_index_type | value_type |
Object type that the structure store. | |
typedef T | stype |
Type of the coordinate space (double float) | |
typedef vector_pos_type | internal_vector_pos_type |
Public Member Functions | |
const grid_sm< dim, void > & | getGrid () |
Return the underlying grid information of the cell list. | |
void | Initialize (CellDecomposer_sm< dim, T, transform > &cd_sm, const Box< dim, T > &dom_box, const size_t pad=1, size_t slot=STARTING_NSLOT) |
void | Initialize (const Box< dim, T > &box, const size_t(&div)[dim], const size_t pad=1, size_t slot=STARTING_NSLOT) |
void | Initialize (const SpaceBox< dim, T > &box, const size_t(&div)[dim], const size_t pad=1, size_t slot=STARTING_NSLOT) |
CellList () | |
Default Constructor. | |
CellList (const CellList< dim, T, Mem_type, transform, vector_pos_type > &cell) | |
Copy constructor. | |
CellList (CellList< dim, T, Mem_type, transform, vector_pos_type > &&cell) | |
Copy constructor. | |
CellList (Box< dim, T > &box, const size_t(&div)[dim], Matrix< dim, T > mat, const size_t pad=1, size_t slot=STARTING_NSLOT) | |
Cell list constructor. | |
CellList (Box< dim, T > &box, const size_t(&div)[dim], const size_t pad=1, size_t slot=STARTING_NSLOT) | |
Cell list constructor. | |
CellList (SpaceBox< dim, T > &box, const size_t(&div)[dim], const size_t pad=1, size_t slot=STARTING_NSLOT) | |
Cell list constructor. | |
CellList (CellDecomposer_sm< dim, T, transform > &cd_sm, const Box< dim, T > &box, const size_t pad=1, size_t slot=STARTING_NSLOT) | |
Cell list constructor from a cell decomposer. | |
~CellList () | |
Destructor. | |
CellList< dim, T, Mem_type, transform > & | operator= (CellList< dim, T, Mem_type, transform > &&cell) |
Constructor from a temporal object. | |
CellList< dim, T, Mem_type, transform, vector_pos_type > & | operator= (const CellList< dim, T, Mem_type, transform, vector_pos_type > &cell) |
Constructor from a temporal object. | |
template<typename Mem_type2 > | |
CellList< dim, T, Mem_type, transform, vector_pos_type > & | operator= (const CellList< dim, T, Mem_type2, transform, vector_pos_type > &cell) |
Constructor from a temporal object. | |
void | setRadius (T radius) |
Set the radius for the getNNIteratorRadius. | |
ParticleIt_Cells< dim, CellList< dim, T, Mem_fast<>, transform > > | getDomainIterator (openfpm::vector< size_t > &dom_cells) |
Get an iterator over particles following the cell structure. | |
void | addCell (size_t cell_id, typename Mem_type::local_index_type ele) |
Add to the cell. | |
void | add (const T(&pos)[dim], typename Mem_type::local_index_type ele) |
Add an element in the cell list. | |
void | add (const Point< dim, T > &pos, typename Mem_type::local_index_type ele) |
Add an element in the cell list. | |
void | addDom (const T(&pos)[dim], typename Mem_type::local_index_type ele) |
Add an element in the cell list forcing to be in the domain cells. | |
void | addDom (const Point< dim, T > &pos, typename Mem_type::local_index_type ele) |
Add an element in the cell list forcing to be in the domain cells. | |
void | addPad (const T(&pos)[dim], typename Mem_type::local_index_type ele) |
Add an element in the cell list forcing to be in the padding cells. | |
void | addPad (const Point< dim, T > &pos, typename Mem_type::local_index_type ele) |
Add an element in the cell list forcing to be in the padding cells. | |
void | remove (size_t cell, size_t ele) |
remove an element from the cell | |
size_t | getNCells () const |
Get the number of cells this cell-list contain. | |
size_t | getNelements (const size_t cell_id) const |
Return the number of elements in the cell. | |
auto | get (size_t cell, size_t ele) -> decltype(this->Mem_type::get(cell, ele)) |
Get an element in the cell. | |
auto | get (size_t cell, size_t ele) const -> decltype(this->Mem_type::get(cell, ele)) |
Get an element in the cell. | |
void | swap (CellList< dim, T, Mem_type, transform, vector_pos_type > &cl) |
Swap the memory. | |
CellIterator< CellList< dim, T, Mem_type, transform > > | getCellIterator (size_t cell) |
Get the Cell iterator. | |
template<unsigned int impl = NO_CHECK> | |
CellNNIteratorRadius< dim, CellList< dim, T, Mem_type, transform >, impl > | getNNIteratorRadius (size_t cell) |
Get the Neighborhood iterator. | |
template<unsigned int impl = NO_CHECK> | |
__attribute__ ((always_inline)) inline CellNNIterator< dim | |
Get the Neighborhood iterator. | |
int impl | getNNIterator (size_t cell) |
template<unsigned int impl = NO_CHECK> | |
__attribute__ ((always_inline)) inline CellNNIteratorRadius< dim | |
Get the symmetric Neighborhood iterator. | |
impl | getNNIteratorRadius (size_t cell, T r_cut) |
template<unsigned int impl> | |
__attribute__ ((always_inline)) inline CellNNIteratorSym< dim | |
Get the symmetric Neighborhood iterator. | |
unsigned int impl | getNNIteratorSym (size_t cell, size_t p, const vector_pos_type &v) |
template<unsigned int impl, typename vector_pos_type2 > | |
__attribute__ ((always_inline)) inline CellNNIteratorSymMP< dim | |
Get the symmetric Neighborhood iterator. | |
unsigned int impl | getNNIteratorSymMP (size_t cell, size_t p, const vector_pos_type2 &v_p1, const vector_pos_type2 &v_p2) |
const NNc_array< dim,(unsigned int) openfpm::math::pow(3, dim)/2+1 > & | getNNc_sym () const |
Get the symmetric neighborhood. | |
size_t | getPadding (size_t i) const |
Return the number of padding cells of the Cell decomposer. | |
size_t(& | getPadding ())[dim] |
Return the number of padding cells of the Cell decomposer as an array. | |
void | clear () |
Clear the cell list. | |
void | destroy () |
Litterary destroy the memory of the cell list, including the retained one. | |
__attribute__((always_inline)) inline const typename Mem_type size_t | get_gm () |
Return the starting point of the cell p. | |
void | set_gm (size_t g_m) |
Set the ghost marker. | |
const NNc_array< dim,(unsigned int) openfpm::math::pow(3, dim)> & | private_get_NNc_full () const |
const NNc_array< dim,(unsigned int) openfpm::math::pow(3, dim)/2+1 > & | private_get_NNc_sym () const |
bool | private_get_from_cd () const |
void | re_setBoxNN () |
void | set_ndec (size_t n_dec) |
Set the n_dec number. | |
size_t | get_ndec () const |
Set the n_dec number. | |
Data Fields | |
CellList< dim, T, Mem_type, transform, vector_pos_type > | |
int | FULL |
vector_pos_type | |
unsigned int | SYM |
vector_pos_type2 | |
Protected Attributes | |
NNc_array< dim,(unsigned int) openfpm::math::pow(3, dim)> | NNc_full |
The array contain the neighborhood of the cell-id in case of asymmetric interaction. | |
NNc_array< dim,(unsigned int) openfpm::math::pow(3, dim)/2+1 > | NNc_sym |
The array contain the neighborhood of the cell-id in case of symmetric interaction. | |
Private Member Functions | |
void | InitializeStructures (const size_t(&div)[dim], size_t tot_n_cell, size_t slot=STARTING_NSLOT) |
Initialize the structures of the data structure. | |
void | setCellDecomposer (CellDecomposer_sm< dim, T, transform > &cd, const CellDecomposer_sm< dim, T, transform > &cd_sm, const Box< dim, T > &dom_box, size_t pad) const |
Private Attributes | |
wrap_unordered_map< T, openfpm::vector< long int > > | rcache |
Caching of r_cutoff radius. | |
bool | from_cd |
True if has been initialized from CellDecomposer. | |
size_t | n_dec |
openfpm::vector< long int > | nnc_rad |
Cells for the neighborhood radius. | |
typedef vector_pos_type CellList< dim, T, Mem_type, transform, vector_pos_type >::internal_vector_pos_type |
Definition at line 440 of file CellList.hpp.
typedef Mem_type CellList< dim, T, Mem_type, transform, vector_pos_type >::Mem_type_type |
Type of internal memory structure.
Definition at line 429 of file CellList.hpp.
typedef T CellList< dim, T, Mem_type, transform, vector_pos_type >::stype |
Type of the coordinate space (double float)
Definition at line 437 of file CellList.hpp.
typedef CellNNIteratorSym<dim,CellList<dim,T,Mem_type,transform,vector_pos_type>,vector_pos_type,RUNTIME,NO_CHECK> CellList< dim, T, Mem_type, transform, vector_pos_type >::SymNNIterator |
Definition at line 431 of file CellList.hpp.
typedef Mem_type::local_index_type CellList< dim, T, Mem_type, transform, vector_pos_type >::value_type |
Object type that the structure store.
Definition at line 434 of file CellList.hpp.
|
inline |
Default Constructor.
Definition at line 530 of file CellList.hpp.
|
inline |
Copy constructor.
Definition at line 536 of file CellList.hpp.
|
inline |
Copy constructor.
Definition at line 543 of file CellList.hpp.
|
inline |
Cell list constructor.
box | Domain where this cell list is living |
div | grid size on each dimension |
mat | Matrix transformation |
pad | Cell padding |
slot | maximum number of slot |
Definition at line 559 of file CellList.hpp.
|
inline |
Cell list constructor.
box | Domain where this cell list is living |
div | grid size on each dimension |
pad | Cell padding |
slot | maximum number of slot |
Definition at line 574 of file CellList.hpp.
|
inline |
Cell list constructor.
box | Domain where this cell list is living |
div | grid size on each dimension |
pad | Cell padding |
slot | maximum number of slot |
Definition at line 589 of file CellList.hpp.
|
inline |
Cell list constructor from a cell decomposer.
cd_sm | Cell-Decomposer |
box | domain box (carefully this is going to be adjusted) |
pad | Cell list padding |
slot | number of slot for each cell |
Definition at line 605 of file CellList.hpp.
|
inline |
Destructor.
Definition at line 615 of file CellList.hpp.
CellList< dim, T, Mem_type, transform, vector_pos_type >::__attribute__ | ( | (always_inline) | ) |
Get the Neighborhood iterator.
It iterate across all the element of the selected cell and the near cells
* * * * x * * * *
cell | cell id |
CellList< dim, T, Mem_type, transform, vector_pos_type >::__attribute__ | ( | (always_inline) | ) |
Get the symmetric Neighborhood iterator.
It iterate across all the element of the selected cell and the near cells up to some selected radius
cell | cell id |
r_cut | radius |
CellList< dim, T, Mem_type, transform, vector_pos_type >::__attribute__ | ( | (always_inline) | ) |
Get the symmetric Neighborhood iterator.
It iterate across all the element of the selected cell and the near cells
* * * x *
cell | cell id |
p | particle id |
CellList< dim, T, Mem_type, transform, vector_pos_type >::__attribute__ | ( | (always_inline) | ) |
Get the symmetric Neighborhood iterator.
It iterate across all the element of the selected cell and the near cells
* * * x *
cell | cell id |
p | particle id |
v_p1 | first phase for particle p |
v_p2 | second phase for particle q |
|
inline |
Add an element in the cell list.
pos | array that contain the coordinate |
ele | element to store |
Definition at line 740 of file CellList.hpp.
|
inline |
Add an element in the cell list.
pos | array that contain the coordinate |
ele | element to store |
Definition at line 726 of file CellList.hpp.
|
inline |
Add to the cell.
cell_id | Cell id where to add |
ele | element to add |
Definition at line 715 of file CellList.hpp.
|
inline |
Add an element in the cell list forcing to be in the domain cells.
pos | array that contain the coordinate |
ele | element to store |
Definition at line 776 of file CellList.hpp.
|
inline |
Add an element in the cell list forcing to be in the domain cells.
pos | array that contain the coordinate |
ele | element to store |
Definition at line 757 of file CellList.hpp.
|
inline |
Add an element in the cell list forcing to be in the padding cells.
pos | array that contain the coordinate |
ele | element to store |
Definition at line 814 of file CellList.hpp.
|
inline |
Add an element in the cell list forcing to be in the padding cells.
pos | array that contain the coordinate |
ele | element to store |
Definition at line 795 of file CellList.hpp.
|
inline |
Clear the cell list.
Definition at line 1100 of file CellList.hpp.
|
inline |
Litterary destroy the memory of the cell list, including the retained one.
Definition at line 1108 of file CellList.hpp.
|
inline |
Get an element in the cell.
i | property to get |
cell | cell id |
ele | element id |
Definition at line 867 of file CellList.hpp.
|
inline |
Get an element in the cell.
i | property to get |
cell | cell id |
ele | element id |
Definition at line 882 of file CellList.hpp.
|
inline |
Return the starting point of the cell p.
cell_id | cell id |
Return the end point of the cell p
cell_id | cell id |
Return the neighborhood id
part_id | particle id |
return the ghost marker
Definition at line 1159 of file CellList.hpp.
|
inline |
|
inline |
Get the Cell iterator.
cell |
Definition at line 912 of file CellList.hpp.
|
inline |
Get an iterator over particles following the cell structure.
dom_cells | cells in the domain |
Definition at line 702 of file CellList.hpp.
|
inline |
Return the underlying grid information of the cell list.
Definition at line 447 of file CellList.hpp.
|
inline |
Get the number of cells this cell-list contain.
Definition at line 840 of file CellList.hpp.
|
inline |
Return the number of elements in the cell.
cell_id | id of the cell |
Definition at line 852 of file CellList.hpp.
|
inline |
Get the symmetric neighborhood.
Definition at line 1069 of file CellList.hpp.
|
inline |
Definition at line 964 of file CellList.hpp.
|
inline |
Get the Neighborhood iterator.
It iterate across all the element of the selected cell and the near cells
* * * * x * * * *
cell | cell id |
Definition at line 937 of file CellList.hpp.
|
inline |
Definition at line 982 of file CellList.hpp.
|
inline |
Definition at line 1018 of file CellList.hpp.
|
inline |
Definition at line 1053 of file CellList.hpp.
|
inline |
Return the number of padding cells of the Cell decomposer as an array.
Definition at line 1092 of file CellList.hpp.
|
inline |
Return the number of padding cells of the Cell decomposer.
i | dimension |
Definition at line 1081 of file CellList.hpp.
|
inline |
Initialize the cell list from a well-define Cell-decomposer
In some cases is needed to have a Cell-list with Cells consistent with a well predefined CellDecomposer. In this case we use this function. Using this initialization the Cell-list maintain the Cells defined by this Cell-decomposer consistently
cd_sm | Cell-Decomposer |
dom_box | domain box (carefully this is going to be adjusted) |
pad | cell-list padding |
slot | slots for each cell |
Definition at line 465 of file CellList.hpp.
|
inline |
Initialize the cell list
box | Domain where this cell list is living |
div | grid size on each dimension |
pad | padding cell |
slot | maximum number of slot |
Definition at line 499 of file CellList.hpp.
|
inline |
Initialize the cell list constructor
box | Domain where this cell list is living |
div | grid size on each dimension |
pad | padding cell |
slot | maximum number of slot |
Definition at line 516 of file CellList.hpp.
|
inlineprivate |
Initialize the structures of the data structure.
Definition at line 394 of file CellList.hpp.
|
inline |
Constructor from a temporal object.
cell | Cell list structure |
Definition at line 625 of file CellList.hpp.
|
inline |
Constructor from a temporal object.
cell | Cell list structure |
Definition at line 647 of file CellList.hpp.
|
inline |
Constructor from a temporal object.
cell | Cell list structure |
Definition at line 670 of file CellList.hpp.
|
inline |
Definition at line 1222 of file CellList.hpp.
|
inline |
Definition at line 1212 of file CellList.hpp.
|
inline |
Definition at line 1217 of file CellList.hpp.
|
inline |
Definition at line 1229 of file CellList.hpp.
|
inline |
remove an element from the cell
cell | cell id |
ele | element id |
Definition at line 831 of file CellList.hpp.
|
inline |
|
inline |
|
inlineprivate |
Definition at line 405 of file CellList.hpp.
|
inline |
Set the radius for the getNNIteratorRadius.
radius |
Definition at line 690 of file CellList.hpp.
|
inline |
Swap the memory.
cl | Cell list with witch you swap the memory |
Definition at line 892 of file CellList.hpp.
CellList< dim, T, Mem_type, transform, vector_pos_type >::CellList< dim, T, Mem_type, transform, vector_pos_type > |
Definition at line 964 of file CellList.hpp.
|
private |
True if has been initialized from CellDecomposer.
Definition at line 382 of file CellList.hpp.
int CellList< dim, T, Mem_type, transform, vector_pos_type >::FULL |
Definition at line 964 of file CellList.hpp.
|
private |
Additional information in general (used to understand if the cell-list) has been constructed from an old decomposition
Definition at line 386 of file CellList.hpp.
|
protected |
The array contain the neighborhood of the cell-id in case of asymmetric interaction.
Definition at line 366 of file CellList.hpp.
|
private |
Cells for the neighborhood radius.
Definition at line 389 of file CellList.hpp.
|
protected |
The array contain the neighborhood of the cell-id in case of symmetric interaction.
Definition at line 374 of file CellList.hpp.
|
private |
Caching of r_cutoff radius.
Definition at line 379 of file CellList.hpp.
unsigned int CellList< dim, T, Mem_type, transform, vector_pos_type >::SYM |
Definition at line 1017 of file CellList.hpp.
CellList< dim, T, Mem_type, transform, vector_pos_type >::vector_pos_type |
Definition at line 1017 of file CellList.hpp.
CellList< dim, T, Mem_type, transform, vector_pos_type >::vector_pos_type2 |
Definition at line 1052 of file CellList.hpp.