8 #ifndef OPENFPM_DATA_SRC_NN_VERLETLIST_VERLETLISTM_HPP_
9 #define OPENFPM_DATA_SRC_NN_VERLETLIST_VERLETLISTM_HPP_
11 #include "NN/VerletList/VerletNNIteratorM.hpp"
12 #include "VerletList.hpp"
24 template<
unsigned int dim,
typename T,
typename CellListImpl,
typename PartIt,
int type>
38 static inline auto get(
const PartIt & it,
45 T r_cut) -> decltype(cl.template getNNIterator<NO_CHECK>(0))
47 return cl.template getNNIterator<NO_CHECK>(cl.getCell(xp));
61 template<
unsigned int dim,
typename T,
typename CellListImpl,
typename PartIt>
62 struct NNTypeM<dim,T,CellListImpl,PartIt,VL_CRS_SYMMETRIC>
76 static inline auto get(
const PartIt & it,
83 T r_cut) -> decltype(it.getNNIteratorCSRM(pos,v))
85 return it.getNNIteratorCSRM(pos,v);
99 template<
unsigned int dim,
typename T,
typename CellListImpl,
typename PartIt>
100 struct NNTypeM<dim,T,CellListImpl,PartIt,VL_SYMMETRIC>
113 static inline auto get(
const PartIt & it,
122 return cl.template getNNIteratorSym<NO_CHECK>(cl.getCell(xp),pp,p,pos,v);
135 template<
unsigned int dim,
137 unsigned int sh_byte ,
148 typedef boost::low_bits_mask_t<
sizeof(size_t)*8-sh_byte>
mask_low;
172 if (opt == VL_CRS_SYMMETRIC)
174 create_<CellNNIteratorSymM<dim,CellListImpl,sh_byte,RUNTIME,NO_CHECK>,VL_CRS_SYMMETRIC>(pos,pos2,dom,anom,pp,r_cut,g_m,cl,opt);
176 else if (opt == VL_SYMMETRIC)
178 create_<decltype(cl.template getNNIteratorSym<NO_CHECK>(0,0,0,pos,pos2)),VL_SYMMETRIC>(pos,pos2,dom,anom,pp,r_cut,g_m,cl,opt);
182 create_<decltype(cl.template getNNIterator<NO_CHECK>(0)),VL_NON_SYMMETRIC>(pos,pos2,dom,anom,pp,r_cut,g_m,cl,opt);
218 this->init_to_zero(this->slot,end);
221 T r_cut2 = r_cut * r_cut;
230 NN_type NN =
NNTypeM<dim,T,CellListImpl,decltype(it),type>::get(it,pos,pos2,xp,pp,i,cli,r_cut);
234 size_t nnp = NN.getP();
235 size_t v = NN.getV();
236 size_t nnp_a = NN.get();
240 if (xp.distance2(xq) < r_cut2)
241 this->addPart(i,nnp_a);
276 for (
size_t i = 0 ; i < dim ; i++)
277 {wr &= r_cut <= spacing.
get(i);}
279 if (wr ==
true || opt == VL_SYMMETRIC)
284 create(pos,pos2,dom_c,anom_c,pp,r_cut,g_m,cli,opt);
288 std::cerr << __FILE__ <<
":" << __LINE__ <<
" error iterator with radius is not implemented yet " << std::endl;
302 inline size_t getP(
size_t part,
size_t ele)
const
304 return VerletBase::get(part,ele) & mask_low::sig_bits_fast;
317 inline size_t getV(
size_t part,
size_t ele)
const
319 return (VerletBase::get(part,ele)) >> (
sizeof(size_t)*8-sh_byte);
Get the neighborhood iterator based on type.
Iterator for the neighborhood of the cell structures.
size_t getP(size_t part, size_t ele) const
Get the element-id in the cell.
Class for Verlet list implementation.
void create(const openfpm::vector< Point< dim, T >> &pos, const openfpm::vector< pos_v< dim, T >> &pos2, const openfpm::vector< size_t > &dom, const openfpm::vector< subsub_lin< dim >> &anom, size_t pp, T r_cut, size_t g_m, CellListImpl &cl, size_t opt)
Create the Verlet list from a given cell-list.
This class implement the point shape in an N-dimensional space.
Structure that contain a reference to a vector of particles.
static auto get(const PartIt &it, const openfpm::vector< Point< dim, T >> &pos, const openfpm::vector< pos_v< dim, T >> &v, Point< dim, T > &xp, size_t pp, size_t p, CellListImpl &cl, T r_cut) -> decltype(cl.template getNNIterator< NO_CHECK >(0))
Get the neighborhood.
size_t getV(size_t part, size_t ele) const
Get the element vector in the cell.
Class for Verlet list implementation with Multiphase.
Class for Multi-Phase cell-list.
const T & get(size_t i) const
Get coordinate.
In general different NN scheme like full symmetric or CRS require different iterators over particles ...
boost::low_bits_mask_t< sizeof(size_t)*8-sh_byte > mask_low
Mask to get the low bits of a number.
void Initialize(CellListImpl &cli, size_t pp, T r_cut, const openfpm::vector< Point< dim, T >> &pos, const openfpm::vector< struct pos_v< dim, T >> &pos2, size_t g_m, size_t opt=VL_NON_SYMMETRIC)
void create_(const openfpm::vector< Point< dim, T >> &pos, const openfpm::vector< pos_v< dim, T >> &pos2, const openfpm::vector< size_t > &dom, const openfpm::vector< subsub_lin< dim >> &anom, size_t pp, T r_cut, size_t g_m, CellListImpl &cli, size_t opt)
Create the Verlet list from a given cell-list.
Implementation of 1-D std::vector like structure.
Linearized version of subsub.
VerletNNIteratorM< dim, VerletListM< dim, T, sh_byte, CellListImpl, transform, VerletBase >, sh_byte > getNNIterator(size_t part_id)
Get the Neighborhood iterator.
boost::high_bit_mask_t< sh_byte > mask_high
Mask to get the high bits of a number.