template<unsigned int dim, typename T, typename transform, typename base>
class CellList< dim, T, FAST, transform, base >
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
- M = number of cells
- N_cell_max = maximum number of elements in a cell
- ele = element the structure is storing
- Note
- Because N_cell_max >= N/M then M * N_cell_max >= O(N)
- Warning
- Not not use for high asymmetric distribution
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 |
* +-----------------------+
*
- Template Parameters
-
dim | Dimansionality of the space |
T | type of the space float, double, complex |
base | Base structure that store the information |
Declaration of a cell list
size_t div[dim] = {16,16,16};
CellS cl2(box,div,org);
Usage of cell list [CellS == CellList<3,double,FAST>]
CellS cl1(box,div,org);
for (size_t i = 0 ; i < dim ; i++)
{
offset[i].
get(i) += (1.0 / div[i]) / 8.0;
}
size_t id = 0;
while (g_it.isNext())
{
key = key * spacing + offset[0];
cl1.add(key,id);
++id;
key = key * spacing + offset[1];
cl1.add(key,id);
++id;
++g_it;
}
Remove one particle from each cell
while (g_it.isNext())
{
key = key * spacing + offset[0];
auto cell = cl1.getCell(key);
cl1.remove(cell,0);
++g_it;
}
Usage of the neighborhood iterator
key = key * spacing + offset[0];
auto NN = cl1.template getNNIterator<NO_CHECK>(cl1.getCell(key));
size_t total = 0;
while(NN.isNext())
{
total++;
++NN;
}
Definition at line 67 of file CellListFast.hpp.
|
const grid_sm< dim, void > & | getGrid () |
| Return the underlying grid information of the cell list. More...
|
|
void | Initialize (const Box< dim, T > &box, const size_t(&div)[dim], const Point< dim, T > &orig, const size_t pad=1, size_t slot=16) |
|
void | Initialize (SpaceBox< dim, T > &box, const size_t(&div)[dim], const Point< dim, T > &orig, const size_t pad=1, size_t slot=16) |
|
| CellList () |
| Default Constructor.
|
|
| CellList (const CellList< dim, T, FAST, transform, base > &cell) |
| Copy constructor.
|
|
| CellList (CellList< dim, T, FAST, transform, base > &&cell) |
| Copy constructor.
|
|
CellList< dim, T, FAST,
transform, base > & | operator= (CellList< dim, T, FAST, transform, base > &&cell) |
| Constructor from a temporal object. More...
|
|
CellList< dim, T, FAST,
transform, base > & | operator= (const CellList< dim, T, FAST, transform, base > &cell) |
| Constructor from a temporal object. More...
|
|
| CellList (Box< dim, T > &box, const size_t(&div)[dim], Matrix< dim, T > mat, Point< dim, T > &orig, const size_t pad=1, size_t slot=16) |
| Cell list constructor. More...
|
|
| CellList (Box< dim, T > &box, const size_t(&div)[dim], Point< dim, T > &orig, const size_t pad=1, size_t slot=16) |
| Cell list constructor. More...
|
|
| CellList (SpaceBox< dim, T > &box, const size_t(&div)[dim], Point< dim, T > &orig, const size_t pad=1, size_t slot=16) |
| Cell list constructor. More...
|
|
void | addCell (size_t cell_id, typename base::value_type ele) |
| Add to the cell. More...
|
|
void | add (const T(&pos)[dim], typename base::value_type ele) |
| Add an element in the cell list. More...
|
|
void | add (const Point< dim, T > &pos, typename base::value_type ele) |
| Add an element in the cell list. More...
|
|
void | remove (size_t cell, size_t ele) |
| remove an element from the cell More...
|
|
size_t | getNelements (const size_t cell_id) const |
| Return the number of element in the cell. More...
|
|
auto | get (size_t cell, size_t ele) -> decltype(cl_base.get(cell *slot+ele)) |
| Get an element in the cell. More...
|
|
template<unsigned int i> |
auto | get (size_t cell, size_t ele) -> decltype(cl_base.get(cell *slot+ele)) |
| Get an element in the cell. More...
|
|
void | swap (CellList< dim, T, FAST, transform, base > &cl) |
| Swap the memory. More...
|
|
CellIterator< CellList< dim, T,
FAST, transform, base > > | getIterator (size_t cell) |
| Get the Cell iterator. More...
|
|
template<unsigned int impl> |
CellNNIterator< dim, CellList
< dim, T, FAST, transform,
base >, FULL, impl > | getNNIterator (size_t cell) |
| Get the Neighborhood iterator. More...
|
|
template<unsigned int impl> |
CellNNIterator< dim, CellList
< dim, T, FAST, transform,
base >, SYM, impl > | getNNIteratorSym (size_t cell) |
| Get the Neighborhood iterator. More...
|
|
template<unsigned int impl> |
CellNNIterator< dim, CellList
< dim, T, FAST, transform,
base >, CRS, impl > | getNNIteratorCross (size_t cell) |
| Get the Neighborhood iterator. More...
|
|