1/*
2 * VerletNNIteratorM.hpp
3 *
4 * Created on: Oct 15, 2016
5 * Author: i-bird
6 */
7
8#ifndef OPENFPM_DATA_SRC_NN_VERLETLIST_VERLETNNITERATORM_HPP_
9#define OPENFPM_DATA_SRC_NN_VERLETLIST_VERLETNNITERATORM_HPP_
10
11#include "VerletNNIterator.hpp"
12
13/*! \brief Iterator for the neighborhood of the cell structures
14 *
15 * In general you never create it directly but you get it from the CellList structures
16 *
17 * It iterate across all the element of the selected cell and the near cells
18 *
19 * \tparam dim dimensionality of the space where the cell live
20 * \tparam Ver Base verlet structure
21 * \tparam sh_byte number of bits for the phase number
22 *
23 */
24template<unsigned int dim, typename Ver, unsigned int sh_byte> class VerletNNIteratorM : public VerletNNIterator<dim,Ver>
25{
26 //! Mask to get the high bits of a number
27 typedef boost::high_bit_mask_t<sh_byte> mask_high;
28
29 //! Mask to get the low bits of a number
30 typedef boost::low_bits_mask_t<sizeof(size_t)*8-sh_byte> mask_low;
31
32
33public:
34
35 /*! \brief Constructor for the Verlet iterator Multi-phase
36 *
37 *
38 */
39 VerletNNIteratorM(size_t part_id, Ver & ver)
40 :VerletNNIterator<dim,Ver>(part_id,ver)
41 {
42 }
43
44 /*! \brief Get the value of the cell
45 *
46 * \return the next element object
47 *
48 */
49 inline size_t getP()
50 {
51 return VerletNNIterator<dim,Ver>::get() & mask_low::sig_bits_fast;
52 }
53
54 /*! \brief Get the value of the cell
55 *
56 * \return the next element object
57 *
58 */
59 inline size_t getV()
60 {
61 return (VerletNNIterator<dim,Ver>::get()) >> (sizeof(size_t)*8-sh_byte);
62 }
63
64
65};
66
67
68#endif /* OPENFPM_DATA_SRC_NN_VERLETLIST_VERLETNNITERATORM_HPP_ */
69