OpenFPM_data  0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Namespaces Functions Variables Typedefs Friends
CellList< dim, T, MEMORY, transform, base > Class Template Reference

Class for MEMORY-WISE cell list implementation. More...

Detailed Description

template<unsigned int dim, typename T, typename transform, typename base>
class CellList< dim, T, MEMORY, transform, base >

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

Note
It is useful when M >> N
Template Parameters
dimDimensionality of the space
Ttype of the space float, double, complex

Definition at line 34 of file CellListMem.hpp.

#include <CellListMem.hpp>

+ Inheritance diagram for CellList< dim, T, MEMORY, transform, base >:

Public Types

typedef T value_type
 

Public Member Functions

grid_sm< dim, void > & getGrid ()
 Return the underlying grid information of the cell list. More...
 
void Initialize (Box< dim, T > &box, size_t(&div)[dim], Point< dim, T > &orig, const size_t pad=1)
 
void Initialize (SpaceBox< dim, T > &box, size_t(&div)[dim], Point< dim, T > &orig, const size_t pad=1)
 
 CellList ()
 Default constructor. More...
 
 CellList (Box< dim, T > &box, size_t(&div)[dim], Point< dim, T > &orig, const size_t pad=1)
 Cell list. More...
 
 CellList (SpaceBox< dim, T > &box, size_t(&div)[dim], Point< dim, T > &orig, const size_t pad=1)
 Cell list. 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 (size_t cell_id)
 Return the number of element in the cell. More...
 
auto get (size_t cell, size_t ele) -> decltype(cl_base[cell].get(ele))
 Get an element in the cell. More...
 
void swap (CellList< dim, T, MEMORY, base > &cl)
 Swap the memory. More...
 
CellIterator< CellList< dim, T,
MEMORY, base > > 
getIterator (size_t cell)
 Get the Cell iterator. More...
 
template<unsigned int impl>
CellNNIterator< dim, CellList
< dim, T, MEMORY, base >, FULL,
impl > 
getNNIterator (size_t cell)
 Get the Nearest Neighborhood iterator. More...
 
template<unsigned int impl>
CellNNIterator< dim, CellList
< dim, T, MEMORY, base >, SYM,
impl > 
getNNIteratorSym (size_t cell)
 
template<unsigned int impl>
CellNNIterator< dim, CellList
< dim, T, MEMORY, base >, CRS,
impl > 
getNNIteratorCross (size_t cell)
 

Private Attributes

long int NNc_full [openfpm::math::pow(3, dim)]
 
long int NNc_sym [openfpm::math::pow(3, dim)/2+1]
 
long int NNc_cr [openfpm::math::pow(2, dim)]
 
std::unordered_map< size_t, base > cl_base
 
Point< dim, T > orig
 

Constructor & Destructor Documentation

template<unsigned int dim, typename T , typename transform , typename base >
CellList< dim, T, MEMORY, transform, base >::CellList ( )
inline

Default constructor.

Definition at line 184 of file CellListMem.hpp.

template<unsigned int dim, typename T , typename transform , typename base >
CellList< dim, T, MEMORY, transform, base >::CellList ( Box< dim, T > &  box,
size_t(&)  div[dim],
Point< dim, T > &  orig,
const size_t  pad = 1 
)
inline

Cell list.

Parameters
boxDomain where this cell list is living
orgof the Cell list
divgrid size on each dimension

Definition at line 196 of file CellListMem.hpp.

template<unsigned int dim, typename T , typename transform , typename base >
CellList< dim, T, MEMORY, transform, base >::CellList ( SpaceBox< dim, T > &  box,
size_t(&)  div[dim],
Point< dim, T > &  orig,
const size_t  pad = 1 
)
inline

Cell list.

Parameters
boxDomain where this cell list is living
originof the Cell list
divgrid size on each dimension

Definition at line 209 of file CellListMem.hpp.

Member Function Documentation

template<unsigned int dim, typename T , typename transform , typename base >
void CellList< dim, T, MEMORY, transform, base >::add ( const T(&)  pos[dim],
typename base::value_type  ele 
)
inline

Add an element in the cell list.

Parameters
posarray that contain the coordinate
eleelement to store

Definition at line 221 of file CellListMem.hpp.

template<unsigned int dim, typename T , typename transform , typename base >
void CellList< dim, T, MEMORY, transform, base >::add ( const Point< dim, T > &  pos,
typename base::value_type  ele 
)
inline

Add an element in the cell list.

Parameters
posarray that contain the coordinate
eleelement to store

Definition at line 238 of file CellListMem.hpp.

template<unsigned int dim, typename T , typename transform , typename base >
auto CellList< dim, T, MEMORY, transform, base >::get ( size_t  cell,
size_t  ele 
) -> decltype(cl_base[cell].get(ele))
inline

Get an element in the cell.

Parameters
cellcell id
eleelement id

Definition at line 279 of file CellListMem.hpp.

template<unsigned int dim, typename T , typename transform , typename base >
grid_sm<dim,void>& CellList< dim, T, MEMORY, transform, base >::getGrid ( )
inline

Return the underlying grid information of the cell list.

Returns
the grid infos

Definition at line 75 of file CellListMem.hpp.

template<unsigned int dim, typename T , typename transform , typename base >
CellIterator<CellList<dim,T,MEMORY,base> > CellList< dim, T, MEMORY, transform, base >::getIterator ( size_t  cell)
inline

Get the Cell iterator.

Parameters
returnthe iterator to the cell

Definition at line 298 of file CellListMem.hpp.

template<unsigned int dim, typename T , typename transform , typename base >
size_t CellList< dim, T, MEMORY, transform, base >::getNelements ( size_t  cell_id)
inline

Return the number of element in the cell.

Parameters
cell_idid of the cell
Returns
number of elements in the cell

Definition at line 268 of file CellListMem.hpp.

template<unsigned int dim, typename T , typename transform , typename base >
template<unsigned int impl>
CellNNIterator<dim,CellList<dim,T,MEMORY,base>,FULL,impl> CellList< dim, T, MEMORY, transform, base >::getNNIterator ( size_t  cell)
inline

Get the Nearest Neighborhood iterator.

Parameters
cellcell id

Definition at line 308 of file CellListMem.hpp.

template<unsigned int dim, typename T , typename transform , typename base >
void CellList< dim, T, MEMORY, transform, base >::Initialize ( Box< dim, T > &  box,
size_t(&)  div[dim],
Point< dim, T > &  orig,
const size_t  pad = 1 
)
inline

Initialize the cell list

Parameters
boxDomain where this cell list is living
originof the Cell list
divgrid size on each dimension

Definition at line 88 of file CellListMem.hpp.

template<unsigned int dim, typename T , typename transform , typename base >
void CellList< dim, T, MEMORY, transform, base >::Initialize ( SpaceBox< dim, T > &  box,
size_t(&)  div[dim],
Point< dim, T > &  orig,
const size_t  pad = 1 
)
inline

Initialize the cell list

Parameters
boxDomain where this cell list is living
originof the Cell list
divgrid size on each dimension

Definition at line 102 of file CellListMem.hpp.

template<unsigned int dim, typename T , typename transform , typename base >
void CellList< dim, T, MEMORY, transform, base >::remove ( size_t  cell,
size_t  ele 
)
inline

remove an element from the cell

Parameters
cellcell id
eleelement id

Definition at line 256 of file CellListMem.hpp.

template<unsigned int dim, typename T , typename transform , typename base >
void CellList< dim, T, MEMORY, transform, base >::swap ( CellList< dim, T, MEMORY, base > &  cl)
inline

Swap the memory.

Parameters
clCell list with witch you swap the memory

Definition at line 288 of file CellListMem.hpp.


The documentation for this class was generated from the following file: