OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
CellList< dim, T, Mem_type, transform, base > Class Template Reference

Class for FAST cell list implementation. More...

Detailed Description

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
class CellList< dim, T, Mem_type, 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
dimDimensionality of the space
Ttype of the space float, double ...
baseBase structure that store the information

Declaration of a cell list

//Space where is living the Cell list
//SpaceBox<dim,T> box({0.0f,0.0f,0.0f},{1.0f,1.0f,1.0f});
// Subdivisions
size_t div[dim] = {16,16,16};
// Origin
Point<dim,T> org({0.0,0.0,0.0});
// id Cell list
CellS cl2(box,div);

Usage of cell list [CellS == CellList<3,double,FAST>]

// id Cell list
CellS cl1(box,div);
// Create a grid iterator
// Iterate through each element
// Add 1 element for each cell
// Usefull definition of points
Point<dim,T> end = box.getP2() - box.getP1();
Point<dim,T> middle = end / div / 2.0;
Point<dim,T> spacing = end / div;
Point<dim,T> offset[dim] = {middle,middle,middle};
// Create offset shift vectors
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())
{
// Add 2 particles on each cell
Point<dim,T> key = Point<dim,T>(g_it.get().toPoint());
key = pmul(key,spacing) + offset[0] + box.getP1();
pos.add(key);
cl1.add(key,id);
++id;
key = Point<dim,T>(g_it.get().toPoint());
key = pmul(key,spacing) + offset[1] + box.getP1();
pos.add(key);
cl1.add(key,id);
++id;
++g_it;
}

Remove one particle from each cell

while (g_it.isNext())
{
// remove 1 particle on each cell
Point<dim,T> key = Point<dim,T>(g_it.get().toPoint());
key = pmul(key,spacing) + offset[0] + box.getP1();
auto cell = cl1.getCell(key);
// Remove the first particle in the cell
cl1.remove(cell,0);
++g_it;
}

Usage of the neighborhood iterator

Point<dim,T> key = Point<dim,T>(g_it_s.get().toPoint());
key = pmul(key,spacing) + offset[0] + box.getP1();
auto NN = cl1.template getNNIterator<NO_CHECK>(cl1.getCell(key));
size_t total = 0;
while(NN.isNext())
{
// total
total++;
++NN;
}

Definition at line 269 of file CellList.hpp.

#include <CellList.hpp>

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

Public Types

typedef Mem_type Mem_type_type
 Type of internal memory structure.
 
typedef CellNNIteratorSym< dim,
CellList< dim, T, Mem_type,
transform, base >, RUNTIME,
NO_CHECK > 
SymNNIterator
 
typedef base::value_type value_type
 Object type that the structure store.
 
typedef T stype
 Type of the coordinate space (double float)
 

Public Member Functions

const grid_sm< dim, void > & getGrid ()
 Return the underlying grid information of the cell list. More...
 
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, base > &cell)
 Copy constructor.
 
 CellList (CellList< dim, T, Mem_type, transform, base > &&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. More...
 
 CellList (Box< dim, T > &box, const size_t(&div)[dim], const size_t pad=1, size_t slot=STARTING_NSLOT)
 Cell list constructor. More...
 
 CellList (SpaceBox< dim, T > &box, const size_t(&div)[dim], const size_t pad=1, size_t slot=STARTING_NSLOT)
 Cell list constructor. More...
 
 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. More...
 
 ~CellList ()
 Destructor. More...
 
CellList< dim, T, Mem_type,
transform, base > & 
operator= (CellList< dim, T, Mem_type, transform, base > &&cell)
 Constructor from a temporal object. More...
 
CellList< dim, T, Mem_type,
transform, base > & 
operator= (const CellList< dim, T, Mem_type, transform, base > &cell)
 Constructor from a temporal object. More...
 
ParticleIt_Cells< dim,
CellList< dim, T, Mem_fast
<>, transform, base > > 
getDomainIterator (openfpm::vector< size_t > &dom_cells)
 Get an iterator over particles following the cell structure. 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 addDom (const T(&pos)[dim], typename base::value_type ele)
 Add an element in the cell list forcing to be in the domain cells. More...
 
void addDom (const Point< dim, T > &pos, typename base::value_type ele)
 Add an element in the cell list forcing to be in the domain cells. More...
 
void addPad (const T(&pos)[dim], typename base::value_type ele)
 Add an element in the cell list forcing to be in the padding cells. More...
 
void addPad (const Point< dim, T > &pos, typename base::value_type ele)
 Add an element in the cell list forcing to be in the padding cells. 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 elements in the cell. More...
 
auto get (size_t cell, size_t ele) -> decltype(this->Mem_type::get(cell, ele))
 Get an element in the cell. More...
 
auto get (size_t cell, size_t ele) const -> decltype(this->Mem_type::get(cell, ele))
 Get an element in the cell. More...
 
void swap (CellList< dim, T, Mem_type, transform, base > &cl)
 Swap the memory. More...
 
CellIterator< CellList< dim, T,
Mem_type, transform, base > > 
getCellIterator (size_t cell)
 Get the Cell iterator. More...
 
template<unsigned int impl = NO_CHECK>
CellNNIterator< dim, CellList
< dim, T, Mem_type, transform,
base >,(int) FULL, impl > 
getNNIterator (size_t cell)
 Get the Neighborhood iterator. More...
 
template<unsigned int impl = NO_CHECK>
CellNNIteratorRadius< dim,
CellList< dim, T, Mem_type,
transform, base >, impl > 
getNNIteratorRadius (size_t cell, T r_cut)
 Get the symmetric Neighborhood iterator. More...
 
template<unsigned int impl>
CellNNIteratorSym< dim,
CellList< dim, T, Mem_type,
transform, base >,(unsigned
int) SYM, impl > 
getNNIteratorSym (size_t cell, size_t p, const openfpm::vector< Point< dim, T >> &v)
 Get the symmetric Neighborhood iterator. More...
 
template<unsigned int impl>
CellNNIteratorSymMP< dim,
CellList< dim, T, Mem_type,
transform, base >,(unsigned
int) SYM, impl > 
getNNIteratorSymMP (size_t cell, size_t p, const openfpm::vector< Point< dim, T >> &v_p1, const openfpm::vector< Point< dim, T >> &v_p2)
 Get the symmetric Neighborhood iterator. More...
 
const NNc_array< dim,(unsigned
int) openfpm::math::pow(3, dim)/2+1 > & 
getNNc_sym () const
 Get the symmetric neighborhood. More...
 
size_t getPadding (size_t i) const
 Return the number of padding cells of the Cell decomposer. More...
 
size_t(& getPadding ())[dim]
 Return the number of padding cells of the Cell decomposer as an array. More...
 
void clear ()
 Clear the cell list. More...
 
const Mem_type::loc_index & getStartId (typename Mem_type::loc_index cell_id) const
 Return the starting point of the cell p. More...
 
const Mem_type::loc_index & getStopId (typename Mem_type::loc_index cell_id) const
 Return the end point of the cell p. More...
 
const Mem_type::loc_index & get_lin (const typename Mem_type::loc_index *part_id) const
 Return the neighborhood id. More...
 
size_t get_gm ()
 return the ghost marker More...
 
void set_gm (size_t g_m)
 Set the ghost marker. More...
 
void set_ndec (size_t n_dec)
 Set the n_dec number. More...
 
size_t get_ndec () const
 Set the n_dec number. More...
 

Data Fields

size_t g_m = 0
 Ghost marker.
 

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 NNcalc (T r_cut, openfpm::vector< long int > &NNcell)
 
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
 

Constructor & Destructor Documentation

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
CellList< dim, T, Mem_type, transform, base >::CellList ( Box< dim, T > &  box,
const size_t(&)  div[dim],
Matrix< dim, T >  mat,
const size_t  pad = 1,
size_t  slot = STARTING_NSLOT 
)
inline

Cell list constructor.

Parameters
boxDomain where this cell list is living
divgrid size on each dimension
matMatrix transformation
padCell padding
slotmaximum number of slot

Definition at line 528 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
CellList< dim, T, Mem_type, transform, base >::CellList ( Box< dim, T > &  box,
const size_t(&)  div[dim],
const size_t  pad = 1,
size_t  slot = STARTING_NSLOT 
)
inline

Cell list constructor.

Parameters
boxDomain where this cell list is living
divgrid size on each dimension
padCell padding
slotmaximum number of slot

Definition at line 543 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
CellList< dim, T, Mem_type, transform, base >::CellList ( SpaceBox< dim, T > &  box,
const size_t(&)  div[dim],
const size_t  pad = 1,
size_t  slot = STARTING_NSLOT 
)
inline

Cell list constructor.

Parameters
boxDomain where this cell list is living
divgrid size on each dimension
padCell padding
slotmaximum number of slot

Definition at line 558 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
CellList< dim, T, Mem_type, transform, base >::CellList ( CellDecomposer_sm< dim, T, transform > &  cd_sm,
const Box< dim, T > &  box,
const size_t  pad = 1,
size_t  slot = STARTING_NSLOT 
)
inline

Cell list constructor from a cell decomposer.

See Also
Initialize
Parameters
cd_smCell-Decomposer
boxdomain box (carefully this is going to be adjusted)
padCell list padding
slotnumber of slot for each cell

Definition at line 574 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
CellList< dim, T, Mem_type, transform, base >::~CellList ( )
inline

Destructor.

Definition at line 584 of file CellList.hpp.

Member Function Documentation

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, 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 662 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, 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 676 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::addCell ( size_t  cell_id,
typename base::value_type  ele 
)
inline

Add to the cell.

Parameters
cell_idCell id where to add
eleelement to add

Definition at line 651 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::addDom ( const T(&)  pos[dim],
typename base::value_type  ele 
)
inline

Add an element in the cell list forcing to be in the domain cells.

Warning
careful is intended to be used ONLY to avoid round-off problems
Parameters
posarray that contain the coordinate
eleelement to store

Definition at line 693 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::addDom ( const Point< dim, T > &  pos,
typename base::value_type  ele 
)
inline

Add an element in the cell list forcing to be in the domain cells.

Warning
careful is intended to be used ONLY to avoid round-off problems
Parameters
posarray that contain the coordinate
eleelement to store

Definition at line 712 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::addPad ( const T(&)  pos[dim],
typename base::value_type  ele 
)
inline

Add an element in the cell list forcing to be in the padding cells.

Warning
careful is intended to be used ONLY to avoid round-off problems
Parameters
posarray that contain the coordinate
eleelement to store

Definition at line 731 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::addPad ( const Point< dim, T > &  pos,
typename base::value_type  ele 
)
inline

Add an element in the cell list forcing to be in the padding cells.

Warning
careful is intended to be used ONLY to avoid round-off problems
Parameters
posarray that contain the coordinate
eleelement to store

Definition at line 750 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::clear ( )
inline

Clear the cell list.

Definition at line 996 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
auto CellList< dim, T, Mem_type, transform, base >::get ( size_t  cell,
size_t  ele 
) -> decltype(this->Mem_type::get(cell,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 794 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
auto CellList< dim, T, Mem_type, transform, base >::get ( size_t  cell,
size_t  ele 
) const -> decltype(this->Mem_type::get(cell,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 809 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
size_t CellList< dim, T, Mem_type, transform, base >::get_gm ( )
inline

return the ghost marker

Returns
ghost marker

Definition at line 1047 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
const Mem_type::loc_index& CellList< dim, T, Mem_type, transform, base >::get_lin ( const typename Mem_type::loc_index *  part_id) const
inline

Return the neighborhood id.

Parameters
part_idparticle id
Returns
the neighborhood id

Definition at line 1032 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
size_t CellList< dim, T, Mem_type, transform, base >::get_ndec ( ) const
inline

Set the n_dec number.

Returns
n_dec

Definition at line 1081 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
CellIterator<CellList<dim,T,Mem_type,transform,base> > CellList< dim, T, Mem_type, transform, base >::getCellIterator ( size_t  cell)
inline

Get the Cell iterator.

Parameters
cell
Returns
the iterator to the elements inside cell

Definition at line 836 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
ParticleIt_Cells<dim,CellList<dim,T,Mem_fast<>,transform,base> > CellList< dim, T, Mem_type, transform, base >::getDomainIterator ( openfpm::vector< size_t > &  dom_cells)
inline

Get an iterator over particles following the cell structure.

Parameters
dom_cellscells in the domain
Returns
a particle iterator

Definition at line 638 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
const grid_sm<dim,void>& CellList< dim, T, Mem_type, transform, base >::getGrid ( )
inline

Return the underlying grid information of the cell list.

Returns
the grid infos

Definition at line 416 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
size_t CellList< dim, T, Mem_type, transform, base >::getNelements ( const size_t  cell_id) const
inline

Return the number of elements in the cell.

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

Definition at line 779 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
const NNc_array<dim,(unsigned int)openfpm::math::pow(3,dim)/2+1>& CellList< dim, T, Mem_type, transform, base >::getNNc_sym ( ) const
inline

Get the symmetric neighborhood.

Returns
the symmetric neighborhood

Definition at line 965 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
template<unsigned int impl = NO_CHECK>
CellNNIterator<dim,CellList<dim,T,Mem_type,transform,base>,(int)FULL,impl> CellList< dim, T, Mem_type, transform, base >::getNNIterator ( size_t  cell)
inline

Get the Neighborhood iterator.

It iterate across all the element of the selected cell and the near cells

  * * *
  * x *
  * * *
  • x is the selected cell
  • * are the near cell
Parameters
cellcell id
Returns
An iterator across the neighhood particles

Definition at line 861 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
template<unsigned int impl = NO_CHECK>
CellNNIteratorRadius<dim,CellList<dim,T,Mem_type,transform,base>,impl> CellList< dim, T, Mem_type, transform, base >::getNNIteratorRadius ( size_t  cell,
r_cut 
)
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

Parameters
cellcell id
r_cutradius
Returns
An iterator across the neighborhood particles

Definition at line 878 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
template<unsigned int impl>
CellNNIteratorSym<dim,CellList<dim,T,Mem_type,transform,base>,(unsigned int)SYM,impl> CellList< dim, T, Mem_type, transform, base >::getNNIteratorSym ( size_t  cell,
size_t  p,
const openfpm::vector< Point< dim, T >> &  v 
)
inline

Get the symmetric Neighborhood iterator.

It iterate across all the element of the selected cell and the near cells

* * *
  x *
  • x is the selected cell
  • * are the near cell
Parameters
cellcell id
pparticle id
Returns
An aiterator across the neighborhood particles

Definition at line 914 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
template<unsigned int impl>
CellNNIteratorSymMP<dim,CellList<dim,T,Mem_type,transform,base>,(unsigned int)SYM,impl> CellList< dim, T, Mem_type, transform, base >::getNNIteratorSymMP ( size_t  cell,
size_t  p,
const openfpm::vector< Point< dim, T >> &  v_p1,
const openfpm::vector< Point< dim, T >> &  v_p2 
)
inline

Get the symmetric Neighborhood iterator.

It iterate across all the element of the selected cell and the near cells

* * *
  x *
  • x is the selected cell
  • * are the near cell
Parameters
cellcell id
pparticle id
v_p1first phase for particle p
v_p2second phase for particle q
Returns
An aiterator across the neighborhood particles

Definition at line 949 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
size_t CellList< dim, T, Mem_type, transform, base >::getPadding ( size_t  i) const
inline

Return the number of padding cells of the Cell decomposer.

Parameters
idimension
Returns
the number of padding cells

Definition at line 977 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
size_t(& CellList< dim, T, Mem_type, transform, base >::getPadding ( ) )[dim]
inline

Return the number of padding cells of the Cell decomposer as an array.

Returns
the number of padding cells

Definition at line 988 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
const Mem_type::loc_index& CellList< dim, T, Mem_type, transform, base >::getStartId ( typename Mem_type::loc_index  cell_id) const
inline

Return the starting point of the cell p.

Parameters
cell_idcell id
Returns
the index

Definition at line 1008 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
const Mem_type::loc_index& CellList< dim, T, Mem_type, transform, base >::getStopId ( typename Mem_type::loc_index  cell_id) const
inline

Return the end point of the cell p.

Parameters
cell_idcell id
Returns
the stop index

Definition at line 1020 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::Initialize ( CellDecomposer_sm< dim, T, transform > &  cd_sm,
const Box< dim, T > &  dom_box,
const size_t  pad = 1,
size_t  slot = STARTING_NSLOT 
)
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

Parameters
cd_smCell-Decomposer
dom_boxdomain box (carefully this is going to be adjusted)
padcell-list padding
slotslots for each cell

Definition at line 434 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::Initialize ( const Box< dim, T > &  box,
const size_t(&)  div[dim],
const size_t  pad = 1,
size_t  slot = STARTING_NSLOT 
)
inline

Initialize the cell list

Parameters
boxDomain where this cell list is living
divgrid size on each dimension
padpadding cell
slotmaximum number of slot

Definition at line 468 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::Initialize ( const SpaceBox< dim, T > &  box,
const size_t(&)  div[dim],
const size_t  pad = 1,
size_t  slot = STARTING_NSLOT 
)
inline

Initialize the cell list constructor

Parameters
boxDomain where this cell list is living
divgrid size on each dimension
padpadding cell
slotmaximum number of slot

Definition at line 485 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::NNcalc ( r_cut,
openfpm::vector< long int > &  NNcell 
)
inlineprivate

Calculate the neighborhood cells based on the radius

Note
To the calculated neighborhood cell you have to add the id of the central cell
+-----------------------+
|p |p |p |p |p |p |p |p |
+-----------------------+
|p |  |  |  |  |  |  |p |
+-----------------------+
|p |  |  |7 |8 |9 |  |p |
+-----------------------+
|p |  |  |-1|0 |1 |  |p |
+-----------------------+
|p |9 |  |-9|-8|-7|  |p |
+-----------------------+
|p |p |p |p |p |p |p |p |
+-----------------------+

The number indicate the cell id calculated

-9,-8,-7,-1,0,1,7,8,9

The cell 0 has id = 22 in the big cell matrix, so to calculate the neighborhood cells you have to sum the id of the center cell

13,14,15,21,22,23,29,30,31

Parameters
r_cutCutoff-radius
NNcellvector containing the neighborhood cells ids

Definition at line 335 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
CellList<dim,T,Mem_type,transform,base>& CellList< dim, T, Mem_type, transform, base >::operator= ( CellList< dim, T, Mem_type, transform, base > &&  cell)
inline

Constructor from a temporal object.

Parameters
cellCell list structure
Returns
itself

Definition at line 594 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
CellList<dim,T,Mem_type,transform,base>& CellList< dim, T, Mem_type, transform, base >::operator= ( const CellList< dim, T, Mem_type, transform, base > &  cell)
inline

Constructor from a temporal object.

Parameters
cellCell list structure
Returns
itself

Definition at line 616 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::remove ( size_t  cell,
size_t  ele 
)
inline

remove an element from the cell

Parameters
cellcell id
eleelement id

Definition at line 767 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::set_gm ( size_t  g_m)
inline

Set the ghost marker.

Parameters
g_mmarker

Definition at line 1057 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::set_ndec ( size_t  n_dec)
inline

Set the n_dec number.

Parameters
n_dec

Definition at line 1071 of file CellList.hpp.

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
void CellList< dim, T, Mem_type, transform, base >::swap ( CellList< dim, T, Mem_type, transform, base > &  cl)
inline

Swap the memory.

Parameters
clCell list with witch you swap the memory

Definition at line 819 of file CellList.hpp.

Field Documentation

template<unsigned int dim, typename T, typename Mem_type, typename transform = no_transform<dim,T>, typename base = openfpm::vector<size_t>>
size_t CellList< dim, T, Mem_type, transform, base >::n_dec
private

Additional information in general (used to understand if the cell-list) has been constructed from an old decomposition

Definition at line 300 of file CellList.hpp.


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