8void Test3D_unb_ghost(
const Box<3,float> & domain,
long int k)
10 long int big_step = k / 30;
11 big_step = (big_step == 0)?1:big_step;
12 long int small_step = 21;
14 if (create_vcluster().getProcessingUnits() > 48)
17 print_test_v(
"Testing 3D grid unbound ghost k<=",k);
20 for ( ; k >= 2 ; k-= (k > 2*big_step)?big_step:small_step )
22 BOOST_TEST_CHECKPOINT(
"Testing 3D grid k=" << k );
37 bool val = g_dist.getDecomposition().check_consistency();
38 BOOST_REQUIRE_EQUAL(val,
true);
46 auto dom = g_dist.getDomainIterator();
51 auto key_g = g_dist.getGKey(key);
53 g_dist.template get<0>(key) = info.LinId(key_g);
69 BOOST_REQUIRE_EQUAL(count,(
size_t)k*k*k);
73 auto dom2 = g_dist.getDomainIterator();
78 auto key = dom2.get();
79 auto key_g = g_dist.getGKey(key);
81 match &= (g_dist.template get<0>(key) == info.LinId(key_g))?
true:false;
86 BOOST_REQUIRE_EQUAL(match,
true);
90 g_dist.template ghost_get<0>();
94 auto domg = g_dist.getDomainGhostIterator();
99 auto key = domg.get();
100 auto key_g = g_dist.getGKey(key);
103 if (g_dist.isInside(key_g))
105 match &= (g_dist.template get<0>(key) == info.LinId(key_g))?
true:false;
111 BOOST_REQUIRE_EQUAL(match,
true);
119void Test3D_unb_ghost_periodic(
const Box<3,float> & domain,
long int k)
126 long int big_step = k / 30;
127 big_step = (big_step == 0)?1:big_step;
128 long int small_step = 21;
130 print_test_v(
"Testing grid periodic unbound ghost k<=",k);
133 for ( ; k >= 2 ; k-= (k > 2*big_step)?big_step:small_step )
135 BOOST_TEST_CHECKPOINT(
"Testing grid unbound ghost periodic k<=" << k );
153 bool val = g_dist.getDecomposition().check_consistency();
154 BOOST_REQUIRE_EQUAL(val,
true);
163 auto dom1 = g_dist.getDomainGhostIterator();
165 while (dom1.isNext())
167 auto key = dom1.get();
169 g_dist.template get<0>(key) = -1;
174 auto dom = g_dist.getDomainIterator();
178 auto key = dom.get();
179 auto key_g = g_dist.getGKey(key);
181 g_dist.template get<0>(key) = info.LinId(key_g);
197 BOOST_REQUIRE_EQUAL(count,(
size_t)k*k*k);
200 g_dist.ghost_get<0>();
205 auto dom_gi = g_dist.getDomainGhostIterator();
209 while (dom_gi.isNext())
213 auto key = dom_gi.get();
214 auto key_g = g_dist.getGKey(key);
217 auto & gb = dom_gi.getGBoxes();
220 for (
size_t i = 0 ; i < 3 ; i++)
222 if (key_g.get(i) < 0)
223 {key_g.set_d(i,key_g.get(i) + k);out_p =
true;}
224 else if (key_g.get(i) >= k)
225 {key_g.set_d(i,key_g.get(i) - k);out_p =
true;}
228 if (g_dist.template get<0>(key) != -1 && out_p ==
true)
232 bool can_invalid =
false;
233 if (key.getKey().get(0) == 0 || key.getKey().get(1) == 0 || key.getKey().get(2) == 0)
235 else if (key.getKey().get(0) == gb.get(key.getSub()).GDbox.getHigh(0) ||
236 key.getKey().get(1) == gb.get(key.getSub()).GDbox.getHigh(1) ||
237 key.getKey().get(2) == gb.get(key.getSub()).GDbox.getHigh(2))
240 if (can_invalid ==
true)
242 if ( g_dist.template get<0>(key) != -1 && info.LinId(key_g) != g_dist.template get<0>(key) )
247 if (info.LinId(key_g) != g_dist.template get<0>(key) )
254 BOOST_REQUIRE_EQUAL(match,
true);
259 BOOST_REQUIRE(out_cnt != 0ul);
This class represent an N-dimensional box.
This class decompose a space into sub-sub-domains and distribute them across processors.
void execute()
Execute all the requests.
void sum(T &num)
Sum the numbers across all processors and get the result.
size_t getProcessingUnits()
Get the total number of processors.
Implementation of VCluster class.
This is a distributed grid.