7#include "Decomposition/CartDecomposition_ext.hpp"
8#include "Grid/grid_dist_id.hpp"
10extern void print_test_v(std::string test,
size_t sz);
14void Test3D_extended_grid(
const Box<3,float> & domain,
long int k)
16 long int big_step = k / 30;
17 big_step = (big_step == 0)?1:big_step;
18 long int small_step = 21;
25 print_test_v(
"Testing 3D extended grid k<=",k);
28 float factor = pow(create_vcluster().getProcessingUnits()/2.0f,1.0f/3.0f);
31 for ( ; (0.01 / factor) > ((domain.getHigh(0) - domain.getLow(0)) / k) ; k-= (k > 2*big_step)?big_step:small_step )
33 BOOST_TEST_CHECKPOINT(
"Testing 3D extended grid k=" << k );
59 auto dom_g1 = g_dist1.getDomainIterator();
61 auto dom_g2 = g_dist2.getSubDomainIterator({0,0,0},{k-1,k-1,k-1});
67 while (dom_g2.isNext())
69 auto key1 = dom_g1.get();
70 auto key2 = dom_g2.get();
75 check &= (g1_k == g2_k)?
true:false;
81 BOOST_REQUIRE_EQUAL(check,
true);
85 bool ret = g_dist2.getDecomposition().check_consistency();
86 BOOST_REQUIRE_EQUAL(ret,
true);
91 auto dom_g3 = g_dist2.getDomainIterator();
95 while (dom_g3.isNext())
97 auto key1 = dom_g3.get();
99 auto keyg = g_dist2.getGKey(key1);
101 g_dist2.template get<0>(key1)[0] = keyg.get(0);
102 g_dist2.template get<0>(key1)[1] = keyg.get(1);
103 g_dist2.template get<0>(key1)[2] = keyg.get(2);
105 g_dist2.template get<1>(key1) = info.
LinId(keyg);
110 g_dist2.ghost_get<0,1>();
112 auto dom_g4 = g_dist2.getSubDomainIterator({-1,-1,-1},{(
long int) sz[0]+2-2, (
long int) sz[1]+2-2, (
long int) sz[2]+2-2});
116 while (dom_g4.isNext())
118 auto key1 = dom_g4.get();
120 key1 = key1.move(0,1);
121 key1 = key1.move(1,1);
122 key1 = key1.move(2,1);
124 auto key2 = g_dist2.getGKey(key1);
126 check &= g_dist2.template get<0>(key1)[0] == (size_t)key2.get(0);
127 check &= g_dist2.template get<0>(key1)[1] == (size_t)key2.get(1);
128 check &= g_dist2.template get<0>(key1)[2] == (size_t)key2.get(2);
130 auto key3 = dom_g4.get();
132 key3 = key3.move(0,-1);
133 key3 = key3.move(1,-1);
134 key3 = key3.move(2,-1);
136 auto key4 = g_dist2.getGKey(key3);
138 check &= g_dist2.template get<0>(key3)[0] == (size_t)key4.get(0);
139 check &= g_dist2.template get<0>(key3)[1] == (size_t)key4.get(1);
140 check &= g_dist2.template get<0>(key3)[2] == (size_t)key4.get(2);
145 BOOST_REQUIRE_EQUAL(check,
true);
This class represent an N-dimensional box.
This class decompose a space into sub-sub-domains and distribute them across processors.
This class decompose a space into sub-sub-domains and distribute them across processors.
size_t getProcessingUnits()
Get the total number of processors.
Implementation of VCluster class.
This is a distributed grid.
grid_key_dx is the key to access any element in the grid
mem_id LinId(const grid_key_dx< N, ids_type > &gk, const signed char sum_id[N]) const
Linearization of the grid_key_dx with a specified shift.
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data