OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
CellList_util.hpp
1 /*
2  * CellList_util.hpp
3  *
4  * Created on: Oct 20, 2016
5  * Author: i-bird
6  */
7 
8 #ifndef OPENFPM_DATA_SRC_NN_CELLLIST_CELLLIST_UTIL_HPP_
9 #define OPENFPM_DATA_SRC_NN_CELLLIST_CELLLIST_UTIL_HPP_
10 
11 #define CL_SYMMETRIC 1
12 #define CL_NON_SYMMETRIC 2
13 
14 #include "Vector/map_vector.hpp"
15 
27 template<unsigned int dim, typename T, typename CellList> void populate_cell_list_no_sym(openfpm::vector<Point<dim,T>> & pos, CellList & cli, size_t g_m)
28 {
29  cli.clear();
30 
31  for (size_t i = 0; i < pos.size() ; i++)
32  {
33  cli.add(pos.get(i), i);
34  }
35 }
36 
48 template<unsigned int dim, typename T, typename CellList> void populate_cell_list_sym(openfpm::vector<Point<dim,T>> & pos, CellList & cli, size_t g_m)
49 {
50  cli.clear();
51 
52  for (size_t i = 0; i < g_m ; i++)
53  {
54  cli.addDom(pos.get(i), i);
55  }
56 
57  for (size_t i = g_m; i < pos.size() ; i++)
58  {
59  cli.addPad(pos.get(i), i);
60  }
61 }
62 
75 template<unsigned int dim, typename T, typename CellList> void populate_cell_list(openfpm::vector<Point<dim,T>> & pos, CellList & cli, size_t g_m, size_t opt)
76 {
77  if (opt == CL_NON_SYMMETRIC)
78  populate_cell_list_no_sym(pos,cli,g_m);
79  else
80  populate_cell_list_sym(pos,cli,g_m);
81 }
82 
87 template<unsigned int dim, typename T>
88 struct pos_v
89 {
91 
93  :pos(pos)
94  {}
95 };
96 
97 #endif /* OPENFPM_DATA_SRC_NN_CELLLIST_CELLLIST_UTIL_HPP_ */
void add(const T(&pos)[dim], typename base::value_type ele)
Add an element in the cell list.
Definition: CellList.hpp:662
This class implement the point shape in an N-dimensional space.
Definition: Point.hpp:22
Structure that contain a reference to a vector of particles.
void addPad(const T(&pos)[dim], typename base::value_type ele)
Add an element in the cell list forcing to be in the padding cells.
Definition: CellList.hpp:731
void clear()
Clear the cell list.
Definition: CellList.hpp:996
void addDom(const T(&pos)[dim], typename base::value_type ele)
Add an element in the cell list forcing to be in the domain cells.
Definition: CellList.hpp:693
Implementation of 1-D std::vector like structure.
Definition: map_vector.hpp:61
Class for FAST cell list implementation.
Definition: CellList.hpp:269