OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
CellList< dim, T, Mem_type, transform, vector_pos_type > 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 vector_pos_type = openfpm::vector<Point<dim,T>>>
class CellList< dim, T, Mem_type, transform, vector_pos_type >

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);
This class implement the point shape in an N-dimensional space.
Definition Point.hpp:28

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;
}
__device__ __host__ const T & get(unsigned int i) const
Get coordinate.
Definition Point.hpp:172
Implementation of 1-D std::vector like structure.

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 356 of file CellList.hpp.

#include <CellList.hpp>

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

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.
 

Member Typedef Documentation

◆ internal_vector_pos_type

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
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.

◆ Mem_type_type

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
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.

◆ stype

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
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.

◆ SymNNIterator

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
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.

◆ value_type

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
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.

Constructor & Destructor Documentation

◆ CellList() [1/7]

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

Default Constructor.

Definition at line 530 of file CellList.hpp.

◆ CellList() [2/7]

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

Copy constructor.

Definition at line 536 of file CellList.hpp.

◆ CellList() [3/7]

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

Copy constructor.

Definition at line 543 of file CellList.hpp.

◆ CellList() [4/7]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
CellList< dim, T, Mem_type, transform, vector_pos_type >::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 559 of file CellList.hpp.

◆ CellList() [5/7]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
CellList< dim, T, Mem_type, transform, vector_pos_type >::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 574 of file CellList.hpp.

◆ CellList() [6/7]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
CellList< dim, T, Mem_type, transform, vector_pos_type >::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 589 of file CellList.hpp.

◆ CellList() [7/7]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
CellList< dim, T, Mem_type, transform, vector_pos_type >::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 605 of file CellList.hpp.

◆ ~CellList()

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

Destructor.

Definition at line 615 of file CellList.hpp.

Member Function Documentation

◆ __attribute__() [1/4]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
template<unsigned int impl = NO_CHECK>
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 *
  * * *
  • x is the selected cell
  • * are the near cell
Parameters
cellcell id
Returns
An iterator across the neighhood particles

◆ __attribute__() [2/4]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
template<unsigned int impl = NO_CHECK>
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

Parameters
cellcell id
r_cutradius
Returns
An iterator across the neighborhood particles

◆ __attribute__() [3/4]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
template<unsigned int impl>
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 *
  • x is the selected cell
  • * are the near cell
Parameters
cellcell id
pparticle id
Returns
An aiterator across the neighborhood particles

◆ __attribute__() [4/4]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
template<unsigned int impl, typename vector_pos_type2 >
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 *
  • 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

◆ add() [1/2]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
void CellList< dim, T, Mem_type, transform, vector_pos_type >::add ( const Point< dim, T > &  pos,
typename Mem_type::local_index_type  ele 
)
inline

Add an element in the cell list.

Parameters
posarray that contain the coordinate
eleelement to store

Definition at line 740 of file CellList.hpp.

◆ add() [2/2]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
void CellList< dim, T, Mem_type, transform, vector_pos_type >::add ( const T(&)  pos[dim],
typename Mem_type::local_index_type  ele 
)
inline

Add an element in the cell list.

Parameters
posarray that contain the coordinate
eleelement to store

Definition at line 726 of file CellList.hpp.

◆ addCell()

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

Add to the cell.

Parameters
cell_idCell id where to add
eleelement to add

Definition at line 715 of file CellList.hpp.

◆ addDom() [1/2]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
void CellList< dim, T, Mem_type, transform, vector_pos_type >::addDom ( const Point< dim, T > &  pos,
typename Mem_type::local_index_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 776 of file CellList.hpp.

◆ addDom() [2/2]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
void CellList< dim, T, Mem_type, transform, vector_pos_type >::addDom ( const T(&)  pos[dim],
typename Mem_type::local_index_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 757 of file CellList.hpp.

◆ addPad() [1/2]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
void CellList< dim, T, Mem_type, transform, vector_pos_type >::addPad ( const Point< dim, T > &  pos,
typename Mem_type::local_index_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 814 of file CellList.hpp.

◆ addPad() [2/2]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
void CellList< dim, T, Mem_type, transform, vector_pos_type >::addPad ( const T(&)  pos[dim],
typename Mem_type::local_index_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 795 of file CellList.hpp.

◆ clear()

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

Clear the cell list.

Definition at line 1100 of file CellList.hpp.

◆ destroy()

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
void CellList< dim, T, Mem_type, transform, vector_pos_type >::destroy ( )
inline

Litterary destroy the memory of the cell list, including the retained one.

Definition at line 1108 of file CellList.hpp.

◆ get() [1/2]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
auto CellList< dim, T, Mem_type, transform, vector_pos_type >::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 867 of file CellList.hpp.

◆ get() [2/2]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
auto CellList< dim, T, Mem_type, transform, vector_pos_type >::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 882 of file CellList.hpp.

◆ get_gm()

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
__attribute__((always_inline)) inline const typename Mem_type size_t CellList< dim, T, Mem_type, transform, vector_pos_type >::get_gm ( )
inline

Return the starting point of the cell p.

Parameters
cell_idcell id
Returns
the index

Return the end point of the cell p

Parameters
cell_idcell id
Returns
the stop index

Return the neighborhood id

Parameters
part_idparticle id
Returns
the neighborhood id

return the ghost marker

Returns
ghost marker

Definition at line 1159 of file CellList.hpp.

◆ get_ndec()

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

Set the n_dec number.

Returns
n_dec

Definition at line 1249 of file CellList.hpp.

◆ getCellIterator()

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

Get the Cell iterator.

Parameters
cell
Returns
the iterator to the elements inside cell

Definition at line 912 of file CellList.hpp.

◆ getDomainIterator()

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
ParticleIt_Cells< dim, CellList< dim, T, Mem_fast<>, transform > > CellList< dim, T, Mem_type, transform, vector_pos_type >::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 702 of file CellList.hpp.

◆ getGrid()

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

Return the underlying grid information of the cell list.

Returns
the grid infos

Definition at line 447 of file CellList.hpp.

◆ getNCells()

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

Get the number of cells this cell-list contain.

Returns
number of cells

Definition at line 840 of file CellList.hpp.

◆ getNelements()

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

◆ getNNc_sym()

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

Get the symmetric neighborhood.

Returns
the symmetric neighborhood

Definition at line 1069 of file CellList.hpp.

◆ getNNIterator()

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

Definition at line 964 of file CellList.hpp.

◆ getNNIteratorRadius() [1/2]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
template<unsigned int impl = NO_CHECK>
CellNNIteratorRadius< dim, CellList< dim, T, Mem_type, transform >, impl > CellList< dim, T, Mem_type, transform, vector_pos_type >::getNNIteratorRadius ( 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 937 of file CellList.hpp.

◆ getNNIteratorRadius() [2/2]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
impl CellList< dim, T, Mem_type, transform, vector_pos_type >::getNNIteratorRadius ( size_t  cell,
r_cut 
)
inline

Definition at line 982 of file CellList.hpp.

◆ getNNIteratorSym()

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

Definition at line 1018 of file CellList.hpp.

◆ getNNIteratorSymMP()

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

Definition at line 1053 of file CellList.hpp.

◆ getPadding() [1/2]

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
size_t(& CellList< dim, T, Mem_type, transform, vector_pos_type >::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 1092 of file CellList.hpp.

◆ getPadding() [2/2]

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

◆ Initialize() [1/3]

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

◆ Initialize() [2/3]

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

◆ Initialize() [3/3]

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

◆ InitializeStructures()

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
void CellList< dim, T, Mem_type, transform, vector_pos_type >::InitializeStructures ( const size_t(&)  div[dim],
size_t  tot_n_cell,
size_t  slot = STARTING_NSLOT 
)
inlineprivate

Initialize the structures of the data structure.

Definition at line 394 of file CellList.hpp.

◆ operator=() [1/3]

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

Constructor from a temporal object.

Parameters
cellCell list structure
Returns
itself

Definition at line 625 of file CellList.hpp.

◆ operator=() [2/3]

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

Constructor from a temporal object.

Parameters
cellCell list structure
Returns
itself

Definition at line 647 of file CellList.hpp.

◆ operator=() [3/3]

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

Constructor from a temporal object.

Parameters
cellCell list structure
Returns
itself

Definition at line 670 of file CellList.hpp.

◆ private_get_from_cd()

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
bool CellList< dim, T, Mem_type, transform, vector_pos_type >::private_get_from_cd ( ) const
inline

Definition at line 1222 of file CellList.hpp.

◆ private_get_NNc_full()

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
const NNc_array< dim,(unsigned int) openfpm::math::pow(3, dim)> & CellList< dim, T, Mem_type, transform, vector_pos_type >::private_get_NNc_full ( ) const
inline

Definition at line 1212 of file CellList.hpp.

◆ private_get_NNc_sym()

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

Definition at line 1217 of file CellList.hpp.

◆ re_setBoxNN()

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
void CellList< dim, T, Mem_type, transform, vector_pos_type >::re_setBoxNN ( )
inline

Definition at line 1229 of file CellList.hpp.

◆ remove()

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

remove an element from the cell

Parameters
cellcell id
eleelement id

Definition at line 831 of file CellList.hpp.

◆ set_gm()

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

Set the ghost marker.

Parameters
g_mmarker

Definition at line 1169 of file CellList.hpp.

◆ set_ndec()

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

Set the n_dec number.

Parameters
n_dec

Definition at line 1239 of file CellList.hpp.

◆ setCellDecomposer()

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
void CellList< dim, T, Mem_type, transform, vector_pos_type >::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
inlineprivate

Definition at line 405 of file CellList.hpp.

◆ setRadius()

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
void CellList< dim, T, Mem_type, transform, vector_pos_type >::setRadius ( radius)
inline

Set the radius for the getNNIteratorRadius.

Parameters
radius

Definition at line 690 of file CellList.hpp.

◆ swap()

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

Swap the memory.

Parameters
clCell list with witch you swap the memory

Definition at line 892 of file CellList.hpp.

Field Documentation

◆ CellList< dim, T, Mem_type, transform, vector_pos_type >

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
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.

◆ from_cd

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
bool CellList< dim, T, Mem_type, transform, vector_pos_type >::from_cd
private

True if has been initialized from CellDecomposer.

Definition at line 382 of file CellList.hpp.

◆ FULL

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
int CellList< dim, T, Mem_type, transform, vector_pos_type >::FULL

Definition at line 964 of file CellList.hpp.

◆ n_dec

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
size_t CellList< dim, T, Mem_type, transform, vector_pos_type >::n_dec
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.

◆ NNc_full

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
NNc_array<dim,(unsigned int)openfpm::math::pow(3,dim)> CellList< dim, T, Mem_type, transform, vector_pos_type >::NNc_full
protected

The array contain the neighborhood of the cell-id in case of asymmetric interaction.

Definition at line 366 of file CellList.hpp.

◆ nnc_rad

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
openfpm::vector<long int> CellList< dim, T, Mem_type, transform, vector_pos_type >::nnc_rad
private

Cells for the neighborhood radius.

Definition at line 389 of file CellList.hpp.

◆ NNc_sym

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
NNc_array<dim,(unsigned int)openfpm::math::pow(3,dim)/2+1> CellList< dim, T, Mem_type, transform, vector_pos_type >::NNc_sym
protected

The array contain the neighborhood of the cell-id in case of symmetric interaction.

Definition at line 374 of file CellList.hpp.

◆ rcache

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
wrap_unordered_map<T,openfpm::vector<long int> > CellList< dim, T, Mem_type, transform, vector_pos_type >::rcache
private

Caching of r_cutoff radius.

Definition at line 379 of file CellList.hpp.

◆ SYM

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
unsigned int CellList< dim, T, Mem_type, transform, vector_pos_type >::SYM

Definition at line 1017 of file CellList.hpp.

◆ vector_pos_type

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
CellList< dim, T, Mem_type, transform, vector_pos_type >::vector_pos_type

Definition at line 1017 of file CellList.hpp.

◆ vector_pos_type2

template<unsigned int dim, typename T , typename Mem_type , typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
CellList< dim, T, Mem_type, transform, vector_pos_type >::vector_pos_type2

Definition at line 1052 of file CellList.hpp.


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