OpenFPM  5.2.0
Project that contain the implementation of distributed structures
CellList< dim, T, Mem_type, transform, vector_pos_type > Class Template Reference

Class for FAST cell list implementation. More...

#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 > 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 Types inherited from Mem_fast< Memory, local_index >
typedef Mem_fast_ker< Memory, memory_traits_lin, local_index > toKernel_type
 
typedef local_index local_index_type
 
typedef local_index loc_index
 expose the type of the local index
 

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)
 
 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. 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 (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.
 
CellList< dim, T, Mem_type, transform > & operator= (CellList< dim, T, Mem_type, transform > &&cell)
 Constructor from a temporal object. More...
 
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. More...
 
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. More...
 
void setRadius (T radius)
 Set the radius for the getNNIteratorRadius. More...
 
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. More...
 
void add (const T(&pos)[dim], typename Mem_type::local_index_type ele)
 Add an element in the cell list. More...
 
void add (const Point< dim, T > &pos, typename Mem_type::local_index_type ele)
 Add an element in the cell list. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void addCellGhostMarkers ()
 add ghost marker in each cell
 
void remove (size_t cell, size_t ele)
 remove an element from the cell More...
 
size_t getNCells () const
 Get the number of cells this cell-list contain. 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, vector_pos_type > &cl)
 Swap the memory. More...
 
CellIterator< CellList< dim, T, Mem_type, transform > > getParticleInCellIterator (size_t cell)
 Get the Cell iterator. More...
 
CellNNIteratorRadius< dim, CellList< dim, T, Mem_type, transform > > getNNIteratorRadius (size_t cell)
 Get the Neighborhood iterator. More...
 
 __attribute__ ((always_inline)) inline CellNNIterator< dim
 Get the Neighborhood iterator. More...
 
int FULL getNNIteratorBox (size_t cell)
 
 __attribute__ ((always_inline)) inline CellNNIteratorRadius< dim
 Get the symmetric Neighborhood iterator. More...
 
CellList< dim, T, Mem_type, transform, vector_pos_type > getNNIteratorRadius (size_t cell, T r_cut)
 
 __attribute__ ((always_inline)) inline CellNNIteratorSym< dim
 Get the symmetric Neighborhood iterator. More...
 
unsigned int SYM getNNIteratorBoxSym (size_t cell, size_t p, const vector_pos_type &v)
 
 __attribute__ ((always_inline)) inline CellNNIteratorSymLocal< dim
 Get the symmetric local Neighborhood iterator. More...
 
int FULL getNNIteratorBoxSymLocal (size_t cell, size_t p, const vector_pos_type &v)
 
template<typename vector_pos_type2 >
 __attribute__ ((always_inline)) inline CellNNIteratorSymMP< dim
 Get the symmetric Neighborhood iterator. More...
 
unsigned int SYM getNNIteratorBoxSymMP (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. More...
 
size_t getOpt () const
 Returns the option flags that control the cell list. More...
 
void setOpt (size_t opt)
 Sets the option flags that control the cell list. 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.
 
void clear (typename Mem_type::local_index_type cell_id)
 Clear one cell of 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 getGhostMarker () const
 Return the starting point of the cell p. More...
 
void setGhostMarker (size_t ghostMarker)
 Set the ghost marker. More...
 
CellParticleIterator getCellParticleIterator ()
 return the celllist iterator (across cells) More...
 
const openfpm::vector< size_t > & getCellSFCKeys ()
 Get the space filling curve object. More...
 
bool isSFCInit () const
 Returns a bool flag of SFC keys vector being filled. More...
 
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
 
const NNc_array< dim,(unsigned int) openfpm::math::pow(3, dim)> & private_get_NNc_sym_local () const
 
bool private_get_from_cd () const
 
void resetBoxNN ()
 
void set_ndec (size_t n_dec)
 Set the n_dec number. More...
 
size_t get_ndec () const
 Set the n_dec number. More...
 
template<typename vector_pos_type2 , typename vector_prp_type >
void fill (vector_pos_type2 &vPos, vector_prp_type &vPrp, size_t ghostMarker)
 Fill cell list with particles at positions vPos. More...
 
- Public Member Functions inherited from Mem_fast< Memory, local_index >
size_t size () const
 return the number of elements More...
 
void destroy ()
 Destroy the internal memory including the retained one.
 
void init_to_zero (local_index slot, local_index tot_n_cell)
 Initialize the data to zero. More...
 
void operator= (const Mem_fast< Memory, local_index > &mem)
 copy an object Mem_fast More...
 
void operator= (Mem_fast< Memory, local_index > &&mem)
 copy an object Mem_fast More...
 
template<typename Memory2 >
void copy_general (const Mem_fast< Memory2, local_index > &mem)
 copy an object Mem_fast More...
 
void addCellGhostMarkers ()
 Add ghost marker to the cell. More...
 
size_t getGhostMarker (local_index cell_id) const
 Get ghost marker of the cell.
 
void addCell (local_index cell_id, local_index ele)
 Add an element to the cell. More...
 
auto get (local_index cell, local_index ele) -> decltype(cl_base.template get< 0 >(cell *slot+ele)) &
 Get an element in the cell. More...
 
auto get (local_index cell, local_index ele) const -> decltype(cl_base.template get< 0 >(cell *slot+ele)) &
 Get an element in the cell. More...
 
void remove (local_index cell_id, local_index ele)
 Remove an element in the cell. More...
 
size_t getNelements (const local_index cell_id) const
 Get the number of elements in the cell. More...
 
void swap (Mem_fast< Memory, local_index > &mem)
 swap to Mem_fast object More...
 
void swap (Mem_fast< Memory, local_index > &&mem)
 swap to Mem_fast object More...
 
void clear ()
 Delete all the elements in every cell.
 
void clear (local_index cell_id)
 Delete cell elements in Cell p.
 
const local_index & getStartId (local_index cell_id) const
 Get the first element of a cell (as reference) More...
 
const local_index & getGhostId (local_index cell_id) const
 Get the index of the first ghost element. More...
 
const local_index & getStopId (local_index cell_id) const
 Get the last element of a cell (as reference) More...
 
const local_index & get_lin (const local_index *part_id) const
 Just return the value pointed by part_id. More...
 
 Mem_fast (local_index slot)
 Constructor. More...
 
void set_slot (local_index slot)
 Set the number of slot for each cell. More...
 
const openfpm::vector< aggregate< local_index >, Memory > & private_get_cl_n () const
 Return the private data-structure cl_n. More...
 
const openfpm::vector< size_t > & getGhostMarkers () const
 Return the private data-structure ghostMarkers. More...
 
const int & private_get_slot () const
 Return the private slot. More...
 
const baseprivate_get_cl_base () const
 Return the private data-structure cl_base. More...
 
template<int ... prp>
void packRequest (size_t &req) const
 It calculate the number of byte required to serialize the object. More...
 
template<int ... prp>
void pack (ExtPreAlloc< HeapMemory > &mem, Pack_stat &sts) const
 pack a vector selecting the properties to pack More...
 
template<int ... prp, typename MemType >
void unpack (ExtPreAlloc< MemType > &mem, Unpack_stat &ps)
 unpack a vector More...
 

Data Fields

 CellList< dim, T, Mem_type, transform, vector_pos_type >
 
 vector_pos_type
 
 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.
 
NNc_array< dim,(unsigned int) openfpm::math::pow(3, dim)> NNc_sym_local
 

Private Types

typedef ParticleIt_CellP< CellList< dim, T, Mem_type, transform, vector_pos_type > > CellParticleIterator
 Cell particle iterator that follows space filling curve.
 

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
 
template<typename SFC_type >
void initSFC (SFC_type &SFC)
 Initialize Space-filling-curve (SFC)
 

Private Attributes

size_t opt
 Option flags.
 
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.
 
bool isInitSFC
 Space filling curve cells keys have to be filled once.
 
openfpm::vector< size_t > SFCKeys
 Cell keys that follow space filling curve.
 

Additional Inherited Members

- Static Public Member Functions inherited from Mem_fast< Memory, local_index >
static bool pack ()
 
static bool packRequest ()
 

Detailed Description

template<unsigned int dim, typename T, typename Mem_type = Mem_fast<>, 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
//Box<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.
Definition: map_vector.hpp:204

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.getNNIteratorBox(cl1.getCell(key));
size_t total = 0;
while(NN.isNext())
{
// total
total++;
++NN;
}

Definition at line 557 of file CellList.hpp.

Constructor & Destructor Documentation

◆ CellList() [1/3]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 805 of file CellList.hpp.

◆ CellList() [2/3]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 823 of file CellList.hpp.

◆ CellList() [3/3]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 841 of file CellList.hpp.

Member Function Documentation

◆ __attribute__() [1/5]

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

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

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

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

Get the symmetric local 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__() [5/5]

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

◆ add() [2/2]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 971 of file CellList.hpp.

◆ addDom() [1/2]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1021 of file CellList.hpp.

◆ addDom() [2/2]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1002 of file CellList.hpp.

◆ addPad() [1/2]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1059 of file CellList.hpp.

◆ addPad() [2/2]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1040 of file CellList.hpp.

◆ fill()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, typename transform = no_transform<dim,T>, typename vector_pos_type = openfpm::vector<Point<dim,T>>>
template<typename vector_pos_type2 , typename vector_prp_type >
void CellList< dim, T, Mem_type, transform, vector_pos_type >::fill ( vector_pos_type2 &  vPos,
vector_prp_type &  vPrp,
size_t  ghostMarker 
)
inline

Fill cell list with particles at positions vPos.

Template Parameters
vPoslist of particle positions
vPrplist of particle properties
ghostMarkerghost marker denoting domain and ghost particles in vPos

Definition at line 1639 of file CellList.hpp.

◆ get() [1/2]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1121 of file CellList.hpp.

◆ get() [2/2]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1136 of file CellList.hpp.

◆ get_ndec()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1625 of file CellList.hpp.

◆ getCellParticleIterator()

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

return the celllist iterator (across cells)

Returns
an iterator

Definition at line 1499 of file CellList.hpp.

◆ getCellSFCKeys()

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

Get the space filling curve object.

Returns
the SFC keys

Definition at line 1520 of file CellList.hpp.

◆ getDomainIterator()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 958 of file CellList.hpp.

◆ getGhostMarker()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 >::getGhostMarker ( ) const
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 1478 of file CellList.hpp.

◆ getGrid()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 713 of file CellList.hpp.

◆ getNCells()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1094 of file CellList.hpp.

◆ getNelements()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1106 of file CellList.hpp.

◆ getNNc_sym()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1357 of file CellList.hpp.

◆ getNNIteratorRadius()

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

◆ getOpt()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 >::getOpt ( ) const
inline

Returns the option flags that control the cell list.

Returns
option flags

Definition at line 1368 of file CellList.hpp.

◆ getPadding() [1/2]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1402 of file CellList.hpp.

◆ getPadding() [2/2]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1391 of file CellList.hpp.

◆ getParticleInCellIterator()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 >::getParticleInCellIterator ( size_t  cell)
inline

Get the Cell iterator.

Parameters
cell
Returns
the iterator to the elements inside cell

Definition at line 1171 of file CellList.hpp.

◆ Initialize() [1/2]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 731 of file CellList.hpp.

◆ Initialize() [2/2]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 constructor

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

Definition at line 765 of file CellList.hpp.

◆ isSFCInit()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 >::isSFCInit ( ) const
inline

Returns a bool flag of SFC keys vector being filled.

Returns
SFC keys init status

Definition at line 1541 of file CellList.hpp.

◆ operator=() [1/3]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 864 of file CellList.hpp.

◆ operator=() [2/3]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 892 of file CellList.hpp.

◆ operator=() [3/3]

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 921 of file CellList.hpp.

◆ remove()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1085 of file CellList.hpp.

◆ set_ndec()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1615 of file CellList.hpp.

◆ setGhostMarker()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 >::setGhostMarker ( size_t  ghostMarker)
inline

Set the ghost marker.

Parameters
ghostMarkermarker

Definition at line 1488 of file CellList.hpp.

◆ setOpt()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 >::setOpt ( size_t  opt)
inline

Sets the option flags that control the cell list.

Parameters
optoption flags

Definition at line 1378 of file CellList.hpp.

◆ setRadius()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 946 of file CellList.hpp.

◆ swap()

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 1146 of file CellList.hpp.

Field Documentation

◆ n_dec

template<unsigned int dim, typename T , typename Mem_type = Mem_fast<>, 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 592 of file CellList.hpp.


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