Commit 406f3750 authored by incardon's avatar incardon

Adding additional test for more consistent check on map anf ghost_get

parent 72d7780b
......@@ -1116,7 +1116,7 @@ public:
applyPointBC(pt);
return processorID_impl(p);
return processorID_impl(pt);
}
/*! \brief Given a point return in which processor the particle should go
......@@ -1135,7 +1135,7 @@ public:
// Get the number of elements in the cell
return processorID_impl(p);
return processorID_impl(pt);
}
/*! \brief Given a point return in which processor the particle should go
......@@ -1152,7 +1152,7 @@ public:
Point<dim,T> pt = p;
applyPointBC(pt);
return processorID_impl(p);
return processorID_impl(pt);
}
/*! \brief Get the periodicity on i dimension
......
......@@ -389,6 +389,101 @@ BOOST_AUTO_TEST_CASE( CartDecomposition_check_cross_consistency_between_proc_idb
}
}
BOOST_AUTO_TEST_CASE( CartDecomposition_check_cross_consistency_between_proc_idbc_and_ghost2 )
{
// Vcluster
Vcluster & vcl = create_vcluster();
CartDecomposition<3, double> dec(vcl);
size_t bc[3] = {PERIODIC,PERIODIC,PERIODIC};
// Physical domain
Box<3, double> box( { -0.01, -0.01, 0.0 }, { 0.01, 0.01, 0.003 });
Ghost<3,double> g(0.0015);
dec.setGoodParameters(box, bc, g, 512);
dec.decompose();
// Now we check the point
for (size_t j = 0 ; j < 3 ; j++ )
{
for (size_t i = 0 ; i < dec.getNSubDomain() ; i++)
{
Point<3,double> p1;
Point<3,double> p2;
p1.get(0) = SpaceBox<3,double>(dec.getSubDomains().get(i)).getLow(0);
p1.get(1) = SpaceBox<3,double>(dec.getSubDomains().get(i)).getLow(1);
p1.get(2) = SpaceBox<3,double>(dec.getSubDomains().get(i)).getLow(2);
p2 = p1;
p2.get(j) = std::nextafter(SpaceBox<3,double>(dec.getSubDomains().get(i)).getLow(j),-1.0);
size_t proc1 = dec.processorIDBC(p1);
size_t proc2 = dec.processorIDBC(p2);
BOOST_REQUIRE(proc1 < vcl.size());
BOOST_REQUIRE(proc2 < vcl.size());
const openfpm::vector<std::pair<size_t, size_t>> & vp_id1 = dec.template ghost_processorID_pair<typename CartDecomposition<3, double>::lc_processor_id, typename CartDecomposition<3, double>::shift_id>(p1, UNIQUE);
const openfpm::vector<std::pair<size_t, size_t>> & vp_id2 = dec.template ghost_processorID_pair<typename CartDecomposition<3, double>::lc_processor_id, typename CartDecomposition<3, double>::shift_id>(p2, UNIQUE);
if (proc1 != proc2)
{
if (vcl.rank() == proc2)
{
BOOST_REQUIRE(vp_id2.size() != 0);
BOOST_REQUIRE(vp_id1.size() == 0);
}
if (vcl.rank() == proc1)
{
BOOST_REQUIRE(vp_id2.size() == 0 );
BOOST_REQUIRE(vp_id1.size() != 0 );
}
}
p1.get(0) = std::nextafter(SpaceBox<3,double>(dec.getSubDomains().get(i)).getHigh(0),SpaceBox<3,double>(dec.getSubDomains().get(i)).getLow(0));
p1.get(1) = std::nextafter(SpaceBox<3,double>(dec.getSubDomains().get(i)).getHigh(1),SpaceBox<3,double>(dec.getSubDomains().get(i)).getLow(1));
p1.get(2) = std::nextafter(SpaceBox<3,double>(dec.getSubDomains().get(i)).getHigh(2),SpaceBox<3,double>(dec.getSubDomains().get(i)).getLow(2));
p2 = p1;
p2.get(j) = std::nextafter(SpaceBox<3,double>(dec.getSubDomains().get(i)).getHigh(j),1.0);
proc1 = dec.processorIDBC(p1);
proc2 = dec.processorIDBC(p2);
BOOST_REQUIRE(proc1 < vcl.size());
BOOST_REQUIRE(proc2 < vcl.size());
const openfpm::vector<std::pair<size_t, size_t>> & vp_id3 = dec.template ghost_processorID_pair<typename CartDecomposition<3, double>::lc_processor_id, typename CartDecomposition<3, double>::shift_id>(p1, UNIQUE);
const openfpm::vector<std::pair<size_t, size_t>> & vp_id4 = dec.template ghost_processorID_pair<typename CartDecomposition<3, double>::lc_processor_id, typename CartDecomposition<3, double>::shift_id>(p2, UNIQUE);
if (proc1 != proc2)
{
if (vcl.rank() == proc2)
{
BOOST_REQUIRE(vp_id4.size() != 0);
BOOST_REQUIRE(vp_id3.size() == 0);
}
if (vcl.rank() == proc1)
{
BOOST_REQUIRE(vp_id4.size() == 0 );
BOOST_REQUIRE(vp_id3.size() != 0 );
}
}
}
}
}
BOOST_AUTO_TEST_CASE( CartDecomposition_non_periodic_test_dist_grid)
{
......
......@@ -725,7 +725,7 @@ class vector_dist_comm
// Check if the particle is inside the domain
if (dec.getDomain().isInside(v_pos.get(key)) == true)
{p_id = dec.processorIDBC(v_pos.get(key));}
{p_id = dec.processorID(v_pos.get(key));}
else
{p_id = obp::out(key, v_cl.getProcessUnitID());}
......
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