Commit 0680f113 authored by incardon's avatar incardon

NN iterator detection

parent d04ec9d1
......@@ -260,6 +260,12 @@ void Test3D_amr_child_parent_get_no_periodic(grid & amr_g, Box<3,float> & domain
match &= amr_g.template get<2>(key_mz) == gkey.get(2) - 1;
}
if (match == false)
{
int debug = 0;
debug++;
}
// Test to go to all the levels down
size_t lvl = it2.getLvl();
......@@ -295,6 +301,12 @@ void Test3D_amr_child_parent_get_no_periodic(grid & amr_g, Box<3,float> & domain
}
}
if (match == false)
{
int debug = 0;
debug++;
}
++it2;
}
......@@ -365,11 +377,7 @@ void Test3D_amr_child_parent_get_periodic(grid & amr_g, Box<3,float> & domain, s
++it;
}
amr_g.write("amr_gg_before_");
amr_g.template ghost_get<0,1,2>();
amr_g.write("amr_gg_after_");
amr_g.getDistGrid(0).getDecomposition().write("DEC_OUT");
// now we check that move space work
......@@ -863,4 +871,126 @@ BOOST_AUTO_TEST_CASE( grid_dist_amr_get_domain_ghost_check )
BOOST_REQUIRE_EQUAL(cnt,1);
}
template<typename grid_amr>
void Test3D_ghost_put(grid_amr & g_dist_amr, long int k)
{
// check the consistency of the decomposition
bool val = g_dist_amr.getDecomposition().check_consistency();
BOOST_REQUIRE_EQUAL(val,true);
size_t sz[3] = {k,k,k};
// Grid sm
grid_sm<3,void> info(sz);
size_t count = 0;
{
auto dom = g_dist_amr.getDomainIterator();
while (dom.isNext())
{
auto key = dom.get();
g_dist_amr.template get<0>(key) = -6.0;
// Count the points
count++;
++dom;
}
}
// Set to zero the full grid
{
auto dom = g_dist_amr.getDomainIterator();
while (dom.isNext())
{
auto key = dom.get();
g_dist_amr.template get<0>(key.move(0,1)) += 1.0;
g_dist_amr.template get<0>(key.move(0,-1)) += 1.0;
g_dist_amr.template get<0>(key.move(1,1)) += 1.0;
g_dist_amr.template get<0>(key.move(1,-1)) += 1.0;
g_dist_amr.template get<0>(key.move(2,1)) += 1.0;
g_dist_amr.template get<0>(key.move(2,-1)) += 1.0;
++dom;
}
}
bool correct = true;
// Domain + Ghost iterator
auto dom_gi = g_dist_amr.getDomainIterator();
while (dom_gi.isNext())
{
auto key = dom_gi.get();
correct &= (g_dist_amr.template get<0>(key) == 0);
++dom_gi;
}
g_dist_amr.template ghost_put<add_,0>();
if (count != 0)
BOOST_REQUIRE_EQUAL(correct, false);
// sync the ghosts
g_dist_amr.template ghost_get<0>();
correct = true;
// Domain + Ghost iterator
auto dom_gi2 = g_dist_amr.getDomainIterator();
while (dom_gi2.isNext())
{
auto key = dom_gi2.get();
correct &= (g_dist_amr.template get<0>(key) == 0);
++dom_gi2;
}
BOOST_REQUIRE_EQUAL(correct, true);
}
BOOST_AUTO_TEST_CASE( grid_dist_amr_get_domain_ghost_put_check )
{
// Test grid periodic
Box<3,float> domain({0.0,0.0,0.0},{1.0,1.0,1.0});
Vcluster & v_cl = create_vcluster();
if ( v_cl.getProcessingUnits() > 32 )
{return;}
long int k = 13;
BOOST_TEST_CHECKPOINT( "Testing grid periodic k<=" << k );
// grid size
size_t sz[3];
sz[0] = k;
sz[1] = k;
sz[2] = k;
// Ghost
Ghost<3,long int> g(1);
// periodicity
periodicity<3> pr = {{PERIODIC,PERIODIC,PERIODIC}};
// Distributed grid with id decomposition
grid_dist_id<3, float, aggregate<long int>> g_dist(sz,domain,g,pr);
Test3D_ghost_put(g_dist,k);
}
BOOST_AUTO_TEST_SUITE_END()
......@@ -403,7 +403,7 @@ class grid_dist_id : public grid_dist_id_comm<dim,St,T,Decomposition,Memory,devi
eg_box.resize(dec.getNNProcessors());
for (size_t i = 0 ; i < eg_box.size() ; i++)
eg_box.get(i).prc = dec.IDtoProc(i);
{eg_box.get(i).prc = dec.IDtoProc(i);}
for (size_t i = 0 ; i < box_int_recv.size() ; i++)
{
......@@ -551,6 +551,7 @@ class grid_dist_id : public grid_dist_id_comm<dim,St,T,Decomposition,Memory,devi
pib.bid.add(bid_t);
eb_gid_list.add();
eb_gid_list.last().eb_list.add(pib.bid.size()-1);
eb_gid_list.last().e_id = p_id;
g_id_to_external_ghost_box[bid_t.g_id] = eb_gid_list.size()-1;
}
......
This diff is collapsed.
......@@ -494,6 +494,10 @@ struct e_box_multi
//! This is the id in eb_list that contain an external ghost box
//! able to store the full received box
size_t full_match;
//! It store the id of linked eg_box (eg_box.get(e_id) is valid, this mean that e_id store processor id information)
//! \see ProctoID function
size_t e_id;
};
......
......@@ -1284,7 +1284,7 @@ void Test3D_periodic_put(const Box<3,float> & domain, long int k)
Vcluster & v_cl = create_vcluster();
if ( v_cl.getProcessingUnits() > 32 )
return;
{return;}
long int big_step = k / 30;
big_step = (big_step == 0)?1:big_step;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment