8 #ifndef OPENFPM_DATA_SRC_NN_CELLLIST_CELLLISTM_HPP_
9 #define OPENFPM_DATA_SRC_NN_CELLLIST_CELLLISTM_HPP_
11 #include "CellNNIteratorM.hpp"
12 #include "CellList.hpp"
52 template<
unsigned int dim,
typename T,
unsigned int sh_byte,
typename CellBase=CellList<dim,T,Mem_fast<>,shift<dim, T>> >
59 typedef boost::low_bits_mask_t<
sizeof(size_t)*8-sh_byte>
mask_low;
101 :CellBase(box,div,mat,pad,slot)
113 :CellBase(box,div,pad,slot)
131 inline void addCell(
size_t cell_id,
size_t ele,
size_t v_id)
133 size_t ele_k = ele | (v_id << (
sizeof(size_t)*8-sh_byte));
135 CellBase::addCell(cell_id,ele_k);
145 inline void add(
const T (& pos)[dim],
size_t ele,
size_t v_id)
149 size_t cell_id = this->getCell(pos);
150 size_t ele_k = ele | (v_id << (
sizeof(size_t)*8-sh_byte));
154 CellBase::addCell(cell_id,ele_k);
168 size_t cell_id = this->getCell(pos);
169 size_t ele_k = ele | (v_id << (
sizeof(size_t)*8-sh_byte));
173 CellBase::addCell(cell_id,ele_k);
183 static inline size_t getP(
size_t ele)
185 return ele & mask_low::sig_bits_fast;
195 static inline size_t getV(
size_t ele)
197 return ele >> (
sizeof(size_t)*8-sh_byte);
210 inline size_t getP(
size_t cell,
size_t ele)
212 return CellBase::get(cell,ele) & mask_low::sig_bits_fast;
225 inline size_t getV(
size_t cell,
size_t ele)
227 return (CellBase::get(cell,ele)) >> (
sizeof(size_t)*8-sh_byte);
237 CellBase::swap(*
this);
249 return CellBase::getIterator(cell);
274 CellNNIteratorM<dim,CellListM<dim,T,sh_byte,CellBase>,sh_byte,FULL,impl> cln(cell,
CellListM<dim,T,sh_byte,CellBase>::NNc_full,*
this);
306 CellNNIteratorSymM<dim,CellListM<dim,T,sh_byte,CellBase>,sh_byte,SYM,impl> cln(cell,pp,p,
CellListM<dim,T,sh_byte,CellBase>::NNc_sym,*
this,pos,v);
335 static_cast<CellBase *
>(
this)->
operator=(*static_cast<const CellBase *>(&clm));
CellListM(CellListM< dim, T, sh_byte, CellBase > &&cell)
Copy constructor.
boost::high_bit_mask_t< sh_byte > mask_high
Mask to get the high bits of a number.
CellListM(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.
Iterator for the neighborhood of the cell structures.
CellListM(const CellListM< dim, T, sh_byte, CellBase > &cell)
Copy constructor.
CellIterator< CellListM< dim, T, sh_byte, CellBase > > getIterator(size_t cell)
Get the Cell iterator.
CellListM(Box< dim, T > &box, const size_t(&div)[dim], const size_t pad=1, size_t slot=STARTING_NSLOT)
Cell list constructor.
size_t getP(size_t cell, size_t ele)
Get the element-id in the cell.
CellListM< dim, T, sh_byte, CellBase > & operator=(const CellListM< dim, T, sh_byte, CellBase > &clm)
operator=
Iterator for the neighborhood of the cell structures.
static size_t getP(size_t ele)
Convert an element in particle id.
boost::low_bits_mask_t< sizeof(size_t)*8-sh_byte > mask_low
Mask to get the low bits of a number.
This class implement the point shape in an N-dimensional space.
Structure that contain a reference to a vector of particles.
CellNNIteratorM< dim, CellListM< dim, T, sh_byte, CellBase >, sh_byte, FULL, impl > getNNIterator(size_t cell)
Get the Neighborhood iterator.
void add(const Point< dim, T > &pos, size_t ele, size_t v_id)
Add an element in the cell list.
CellNNIteratorSymM< dim, CellListM< dim, T, sh_byte, CellBase >, sh_byte, RUNTIME, NO_CHECK > SymNNIterator
Type of the iterator for the neighborhood.
void swap(CellListM< dim, T, sh_byte, CellBase > &cl)
Swap the memory.
CellNNIteratorSymM< dim, CellListM< dim, T, sh_byte, CellBase >, sh_byte, SYM, impl > getNNIteratorSym(size_t cell, size_t pp, size_t p, const openfpm::vector< Point< dim, typename CellBase::stype >> &pos, const openfpm::vector< pos_v< dim, typename CellBase::stype >> &v)
Get the Neighborhood iterator.
Class for Multi-Phase cell-list.
This class implement an NxN (dense) matrix.
CellListM< dim, T, sh_byte, CellBase > & operator=(CellListM< dim, T, sh_byte, CellBase > &&clm)
operator=
it iterate through the elements of a cell
This class represent an N-dimensional box.
CellListM()
Default Constructor.
void add(const T(&pos)[dim], size_t ele, size_t v_id)
Add an element in the cell list.
void addCell(size_t cell_id, size_t ele, size_t v_id)
Add to the cell.
static size_t getV(size_t ele)
Convert an element in phase id.
Implementation of 1-D std::vector like structure.
size_t getV(size_t cell, size_t ele)
Get the element vector in the cell.