OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
vector_dist_util_unit_tests.hpp
1 /*
2  * vector_dist_util_unit_tests.hpp
3  *
4  * Created on: Feb 14, 2018
5  * Author: i-bird
6  */
7 
8 #ifndef SRC_VECTOR_TESTS_VECTOR_DIST_UTIL_UNIT_TESTS_HPP_
9 #define SRC_VECTOR_TESTS_VECTOR_DIST_UTIL_UNIT_TESTS_HPP_
10 
11 
24 template<unsigned int dim,typename vector_dist> inline void count_local_n_local(vector_dist & vd, vector_dist_iterator & it, size_t (& bc)[dim] , Box<dim,float> & box, Box<dim,float> & dom_ext, size_t & l_cnt, size_t & nl_cnt, size_t & n_out)
25 {
27 
28  while (it.isNext())
29  {
30  auto key = it.get();
31  // Check if it is in the domain
32  if (box.isInsideNP(vd.getPos(key)) == true)
33  {
34  // Check if local
35  if (ct.isLocalBC(vd.getPos(key),bc) == true)
36  l_cnt++;
37  else
38  nl_cnt++;
39  }
40  else
41  {
42  nl_cnt++;
43  }
44 
45  Point<dim,float> xp = vd.getPos(key);
46 
47  // Check that all particles are inside the Domain + Ghost part
48  if (dom_ext.isInside(xp) == false)
49  n_out++;
50 
51  ++it;
52  }
53 }
54 
55 
56 
57 #endif /* SRC_VECTOR_TESTS_VECTOR_DIST_UTIL_UNIT_TESTS_HPP_ */
bool isInsideNP(const Point< dim, T > &p) const
Check if the point is inside the region excluding the positive part.
Definition: Box.hpp:910
bool isInside(const Point< dim, T > &p) const
Check if the point is inside the box.
Definition: Box.hpp:880
auto getPos(vect_dist_key_dx vec_key) -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
Iterator that Iterate across particle indexes.
Decomposition & getDecomposition()
Get the decomposition.
This class implement the point shape in an N-dimensional space.
Definition: Point.hpp:22
bool isLocalBC(const encapc< 1, Point< dim, T >, Mem > p, const size_t(&bc)[dim]) const
Check if the particle is local considering boundary conditions.
bool isNext()
Check if there is the next element.
This class decompose a space into sub-sub-domains and distribute them across processors.
This class represent an N-dimensional box.
Definition: Box.hpp:56
This class is a trick to indicate the compiler a specific specialization pattern. ...
Definition: memory_c.hpp:201
Distributed vector.
vect_dist_key_dx get()
Get the actual key.