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, BALANCED, base > Class Template Reference

Class for BALANCED cell list implementation. More...

Detailed Description

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

Class for BALANCED cell list implementation.

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

Warning
Do not use for extremely fine cell list (M big)
Template Parameters
dimDimensionality of the space
Ttype of the space float, double, complex

Definition at line 39 of file CellListBal.hpp.

#include <CellListBal.hpp>

+ Inheritance diagram for CellList< dim, T, BALANCED, 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.get(cell).get(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).get(ele))
 Get an element in the cell. More...
 
void swap (CellList< dim, T, BALANCED, base > &cl)
 Swap the memory. More...
 
CellIterator< CellList< dim, T,
BALANCED, base > > 
getIterator (size_t cell)
 Get the Cell iterator. More...
 
template<unsigned int impl>
CellNNIterator< dim, CellList
< dim, T, BALANCED, base >
, FULL, impl > 
getNNIterator (size_t cell)
 Get the Nearest Neighborhood iterator. More...
 
template<unsigned int impl>
CellNNIterator< dim, CellList
< dim, T, BALANCED, base >
, SYM, impl > 
getNNIteratorSym (size_t cell)
 
template<unsigned int impl>
CellNNIterator< dim, CellList
< dim, T, BALANCED, 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)]
 
openfpm::vector< base > cl_base
 
Point< dim, T > orig
 

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 195 of file CellListBal.hpp.

template<unsigned int dim, typename T , typename base >
CellList< dim, T, BALANCED, 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
originof the Cell list
divgrid size on each dimension

Definition at line 207 of file CellListBal.hpp.

template<unsigned int dim, typename T , typename base >
CellList< dim, T, BALANCED, 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 220 of file CellListBal.hpp.

Member Function Documentation

template<unsigned int dim, typename T , typename base >
void CellList< dim, T, BALANCED, 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 231 of file CellListBal.hpp.

template<unsigned int dim, typename T , typename base >
void CellList< dim, T, BALANCED, 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 248 of file CellListBal.hpp.

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

Get an element in the cell.

Parameters
cellcell id
eleelement id

Definition at line 288 of file CellListBal.hpp.

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

Get an element in the cell.

Template Parameters
iproperty to get
Parameters
cellcell id
eleelement id
Returns
The element value

Definition at line 305 of file CellListBal.hpp.

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

Return the underlying grid information of the cell list.

Returns
the grid infos

Definition at line 81 of file CellListBal.hpp.

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

Get the Cell iterator.

Parameters
returnthe iterator to the cell

Definition at line 326 of file CellListBal.hpp.

template<unsigned int dim, typename T , typename base >
size_t CellList< dim, T, BALANCED, 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 277 of file CellListBal.hpp.

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

Get the Nearest Neighborhood iterator.

Parameters
cellcell id

Definition at line 336 of file CellListBal.hpp.

template<unsigned int dim, typename T , typename base >
void CellList< dim, T, BALANCED, 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 94 of file CellListBal.hpp.

template<unsigned int dim, typename T , typename base >
void CellList< dim, T, BALANCED, 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 108 of file CellListBal.hpp.

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

remove an element from the cell

Parameters
cellcell id
eleelement id

Definition at line 265 of file CellListBal.hpp.

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

Swap the memory.

Parameters
clCell list with witch you swap the memory

Definition at line 315 of file CellListBal.hpp.


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