OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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
24template<unsigned int dim,typename vector_dist>
25inline void count_local_n_local(vector_dist & vd,
27 size_t (& bc)[dim] ,
30 size_t & l_cnt,
31 size_t & nl_cnt,
32 size_t & n_out)
33{
34 auto & ct = vd.getDecomposition();
35
36 while (it.isNext())
37 {
38 auto key = it.get();
39 // Check if it is in the domain
40 if (box.isInsideNP(vd.getPos(key)) == true)
41 {
43
44 // Check if local
45 if (ct.isLocalBC(xp,bc) == true)
46 l_cnt++;
47 else
48 nl_cnt++;
49 }
50 else
51 {
52 nl_cnt++;
53 }
54
56
57 // Check that all particles are inside the Domain + Ghost part
58 if (dom_ext.isInside(xp) == false)
59 n_out++;
60
61 ++it;
62 }
63}
64
65
66
67#endif /* SRC_VECTOR_TESTS_VECTOR_DIST_UTIL_UNIT_TESTS_HPP_ */
This class represent an N-dimensional box.
Definition Box.hpp:61
__host__ __device__ bool isInside(const Point< dim, T > &p) const
Check if the point is inside the box.
Definition Box.hpp:1004
__device__ __host__ bool isInsideNP(const Point< dim, T > &p) const
Check if the point is inside the region excluding the positive part.
Definition Box.hpp:1034
This class implement the point shape in an N-dimensional space.
Definition Point.hpp:28
Iterator that Iterate across particle indexes.
bool isNext()
Check if there is the next element.
vect_dist_key_dx get()
Get the actual key.
Distributed vector.
auto getPos(vect_dist_key_dx vec_key) -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
Decomposition & getDecomposition()
Get the decomposition.