7#define BOOST_TEST_DYN_LINK
8#include <boost/test/unit_test.hpp>
10#include "Vector/vector_dist.hpp"
11#include "Vector/performance/vector_dist_performance_util.hpp"
12#include "vector_dist_util_unit_tests.hpp"
14extern void print_test_v(std::string test,
size_t sz);
15extern long int decrement(
long int k,
long int step);
17BOOST_AUTO_TEST_CASE( vector_dist_periodic_complex_prp_test_use_3d )
27 std::default_random_engine eg;
28 std::uniform_real_distribution<float> ud(0.0f, 1.0f);
30#ifdef TEST_COVERAGE_MODE
36 long int big_step = k / 4;
37 big_step = (big_step == 0)?1:big_step;
39 print_test_v(
"Testing 3D vector full complex prp vector k<=",k);
42 for ( ; k >= 2 ; k-= decrement(k,big_step) )
44 BOOST_TEST_CHECKPOINT(
"Testing 3D full complex prp vector k=" << k );
49 size_t bc[3]={NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
52 float factor = pow(create_vcluster().getProcessingUnits()/2.0f,1.0f/3.0f);
63 auto it = vd.getIterator();
69 vd.getPos(key)[0] = ud(eg);
70 vd.getPos(key)[1] = ud(eg);
71 vd.getPos(key)[2] = ud(eg);
75 vd.getProp<0>(key).add(vd.getPos(key)[0]);
76 vd.getProp<0>(key).add(vd.getPos(key)[1]);
77 vd.getProp<0>(key).add(vd.getPos(key)[2]);
79 vd.getProp<0>(key).add(vd.getPos(key)[0]+vd.getPos(key)[1]);
80 vd.getProp<0>(key).add(vd.getPos(key)[1]+vd.getPos(key)[2]);
81 vd.getProp<0>(key).add(vd.getPos(key)[0]+vd.getPos(key)[2]);
84 size_t sz[] = {3,3,3};
85 vd.getProp<1>(key).resize(sz);
87 vd.getProp<1>(key).get<0>({0,0,0}) = vd.getPos(key)[0];
88 vd.getProp<1>(key).get<0>({0,0,1}) = vd.getPos(key)[1];
89 vd.getProp<1>(key).get<0>({0,0,2}) = vd.getPos(key)[2];
91 vd.getProp<1>(key).get<0>({0,1,0}) = 2.0*vd.getPos(key)[0];
92 vd.getProp<1>(key).get<0>({0,1,1}) = 2.0*vd.getPos(key)[1];
93 vd.getProp<1>(key).get<0>({0,1,2}) = 2.0*vd.getPos(key)[2];
95 vd.getProp<1>(key).get<0>({0,2,0}) = 3.0*vd.getPos(key)[0];
96 vd.getProp<1>(key).get<0>({0,2,1}) = 3.0*vd.getPos(key)[1];
97 vd.getProp<1>(key).get<0>({0,2,2}) = 3.0*vd.getPos(key)[2];
99 vd.getProp<1>(key).get<0>({1,0,0}) = 4.0*vd.getPos(key)[0];
100 vd.getProp<1>(key).get<0>({1,0,1}) = 4.0*vd.getPos(key)[1];
101 vd.getProp<1>(key).get<0>({1,0,2}) = 4.0*vd.getPos(key)[2];
103 vd.getProp<1>(key).get<0>({1,1,0}) = 5.0*vd.getPos(key)[0];
104 vd.getProp<1>(key).get<0>({1,1,1}) = 5.0*vd.getPos(key)[1];
105 vd.getProp<1>(key).get<0>({1,1,2}) = 5.0*vd.getPos(key)[2];
107 vd.getProp<1>(key).get<0>({1,2,0}) = 6.0*vd.getPos(key)[0];
108 vd.getProp<1>(key).get<0>({1,2,1}) = 6.0*vd.getPos(key)[1];
109 vd.getProp<1>(key).get<0>({1,2,2}) = 6.0*vd.getPos(key)[2];
111 vd.getProp<1>(key).get<0>({2,0,0}) = 7.0*vd.getPos(key)[0];
112 vd.getProp<1>(key).get<0>({2,0,1}) = 7.0*vd.getPos(key)[1];
113 vd.getProp<1>(key).get<0>({2,0,2}) = 7.0*vd.getPos(key)[2];
115 vd.getProp<1>(key).get<0>({2,1,0}) = 8.0*vd.getPos(key)[0];
116 vd.getProp<1>(key).get<0>({2,1,1}) = 8.0*vd.getPos(key)[1];
117 vd.getProp<1>(key).get<0>({2,1,2}) = 8.0*vd.getPos(key)[2];
119 vd.getProp<1>(key).get<0>({2,2,0}) = 9.0*vd.getPos(key)[0];
120 vd.getProp<1>(key).get<0>({2,2,1}) = 9.0*vd.getPos(key)[1];
121 vd.getProp<1>(key).get<0>({2,2,2}) = 9.0*vd.getPos(key)[2];
140 auto it2 = vd.getIterator();
141 count_local_n_local<3,vector_dist<3,float, aggregate<openfpm::vector<float>,
grid_cpu<3,aggregate<double,double[3]>>>> >(vd,it2,bc,box,dom_ext,l_cnt,nl_cnt,n_out);
144 BOOST_REQUIRE_EQUAL(n_out,0ul);
149 BOOST_REQUIRE(nl_cnt != 0);
150 BOOST_REQUIRE(l_cnt > nl_cnt);
156 BOOST_REQUIRE_EQUAL(l_cnt,(
size_t)k);
162 auto itg = vd.getGhostIterator();
163 count_local_n_local<3, vector_dist<3,float, aggregate<openfpm::vector<float>,
grid_cpu<3,aggregate<double,double[3]>>>> >(vd,itg,bc,box,dom_ext,l_cnt,nl_cnt,n_out);
166 BOOST_REQUIRE_EQUAL(l_cnt,0ul);
171 BOOST_REQUIRE(nl_cnt != 0);
177 auto it3 = vd.getDomainAndGhostIterator();
181 auto key = it3.get();
183 ret &= vd.getProp<0>(key).size() == 6;
185 ret &= vd.getProp<0>(key).get(0) == vd.getPos(key)[0];
186 ret &= vd.getProp<0>(key).get(1) == vd.getPos(key)[1];
187 ret &= vd.getProp<0>(key).get(2) == vd.getPos(key)[2];
189 ret &= vd.getProp<0>(key).get(3) == vd.getPos(key)[0]+vd.getPos(key)[1];
190 ret &= vd.getProp<0>(key).get(4) == vd.getPos(key)[1]+vd.getPos(key)[2];
191 ret &= vd.getProp<0>(key).get(5) == vd.getPos(key)[0]+vd.getPos(key)[2];
195 ret &= vd.getProp<1>(key).size() == 3*3*3;
196 ret &= vd.getProp<1>(key).get<0>({0,0,0}) == vd.getPos(key)[0];
197 ret &= vd.getProp<1>(key).get<0>({0,0,1}) == vd.getPos(key)[1];
198 ret &= vd.getProp<1>(key).get<0>({0,0,2}) == vd.getPos(key)[2];
200 ret &= vd.getProp<1>(key).get<0>({0,1,0}) == 2.0*vd.getPos(key)[0];
201 ret &= vd.getProp<1>(key).get<0>({0,1,1}) == 2.0*vd.getPos(key)[1];
202 ret &= vd.getProp<1>(key).get<0>({0,1,2}) == 2.0*vd.getPos(key)[2];
204 ret &= vd.getProp<1>(key).get<0>({0,2,0}) == 3.0*vd.getPos(key)[0];
205 ret &= vd.getProp<1>(key).get<0>({0,2,1}) == 3.0*vd.getPos(key)[1];
206 ret &= vd.getProp<1>(key).get<0>({0,2,2}) == 3.0*vd.getPos(key)[2];
208 ret &= vd.getProp<1>(key).get<0>({1,0,0}) == 4.0*vd.getPos(key)[0];
209 ret &= vd.getProp<1>(key).get<0>({1,0,1}) == 4.0*vd.getPos(key)[1];
210 ret &= vd.getProp<1>(key).get<0>({1,0,2}) == 4.0*vd.getPos(key)[2];
212 ret &= vd.getProp<1>(key).get<0>({1,1,0}) == 5.0*vd.getPos(key)[0];
213 ret &= vd.getProp<1>(key).get<0>({1,1,1}) == 5.0*vd.getPos(key)[1];
214 ret &= vd.getProp<1>(key).get<0>({1,1,2}) == 5.0*vd.getPos(key)[2];
216 ret &= vd.getProp<1>(key).get<0>({1,2,0}) == 6.0*vd.getPos(key)[0];
217 ret &= vd.getProp<1>(key).get<0>({1,2,1}) == 6.0*vd.getPos(key)[1];
218 ret &= vd.getProp<1>(key).get<0>({1,2,2}) == 6.0*vd.getPos(key)[2];
220 ret &= vd.getProp<1>(key).get<0>({2,0,0}) == 7.0*vd.getPos(key)[0];
221 ret &= vd.getProp<1>(key).get<0>({2,0,1}) == 7.0*vd.getPos(key)[1];
222 ret &= vd.getProp<1>(key).get<0>({2,0,2}) == 7.0*vd.getPos(key)[2];
224 ret &= vd.getProp<1>(key).get<0>({2,1,0}) == 8.0*vd.getPos(key)[0];
225 ret &= vd.getProp<1>(key).get<0>({2,1,1}) == 8.0*vd.getPos(key)[1];
226 ret &= vd.getProp<1>(key).get<0>({2,1,2}) == 8.0*vd.getPos(key)[2];
228 ret &= vd.getProp<1>(key).get<0>({2,2,0}) == 9.0*vd.getPos(key)[0];
229 ret &= vd.getProp<1>(key).get<0>({2,2,1}) == 9.0*vd.getPos(key)[1];
230 ret &= vd.getProp<1>(key).get<0>({2,2,2}) == 9.0*vd.getPos(key)[2];
235 BOOST_REQUIRE_EQUAL(ret,
true);
This class represent an N-dimensional box.
void enlarge(const Box< dim, T > &gh)
Enlarge the box with ghost margin.
void execute()
Execute all the requests.
void sum(T &num)
Sum the numbers across all processors and get the result.
size_t getProcessUnitID()
Get the process unit id.
size_t getProcessingUnits()
Get the total number of processors.
Implementation of VCluster class.