Commit 5deb864a authored by incardon's avatar incardon

Symmetric compiling

parent 121d28a9
openfpm_data @ a7cce193
Subproject commit fdf6629cc30bb52c73b703e2f66146439aebb7bc
Subproject commit a7cce19305d224ab9195683295a42a509fac0787
......@@ -381,10 +381,12 @@ public:
cd_sm.setDimensions(getDecomposition().getDomain(),div,pad);
// get the processor bounding box
// Processor bounding box
Box<dim, St> pbox = getDecomposition().getProcessorBounds();
cell_list.setDimensions(cd_sm, pbox);
// Ghost padding extension
Ghost<dim,size_t> g_ext(0);
cell_list.Initialize(cd_sm,pbox,pad);
updateCellList(cell_list);
......@@ -1115,6 +1117,16 @@ public:
#endif
return v_cl;
}
/*! \brief return the position vector of all the particles
*
* \return the particle position vector
*
*/
const openfpm::vector<Point<dim,St>> & getPosVector() const
{
return v_pos;
}
};
......
......@@ -332,7 +332,7 @@ BOOST_AUTO_TEST_CASE( vector_dist_cl_random_vs_reorder_forces_test )
}
}
/*
BOOST_AUTO_TEST_CASE( vector_dist_sym_cell_list_test )
{
long int k = 4096*create_vcluster().getProcessingUnits();
......@@ -495,8 +495,141 @@ BOOST_AUTO_TEST_CASE( vector_dist_sym_cell_list_test )
++it;
}
}
}
}*/
BOOST_AUTO_TEST_CASE( vector_dist_symmetric_cell_list )
{
Vcluster & v_cl = create_vcluster();
if (v_cl.getProcessingUnits() > 24)
return;
// set the seed
// create the random generator engine
std::srand(v_cl.getProcessUnitID());
std::default_random_engine eg;
std::uniform_real_distribution<float> ud(0.0f, 1.0f);
long int k = 4096 * v_cl.getProcessingUnits();
long int big_step = k / 4;
big_step = (big_step == 0)?1:big_step;
print_test("Testing 3D periodic vector symmetric cell-list k=",k);
BOOST_TEST_CHECKPOINT( "Testing 3D periodic vector symmetric cell-list k=" << k );
Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
// Boundary conditions
size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
float r_cut = 0.1;
// ghost
Ghost<3,float> ghost(r_cut);
typedef aggregate<size_t,size_t> part_prop;
// Distributed vector
vector_dist<3,float, part_prop > vd(k,box,bc,ghost);
auto it = vd.getIterator();
while (it.isNext())
{
auto key = it.get();
vd.getPos(key)[0] = ud(eg);
vd.getPos(key)[1] = ud(eg);
vd.getPos(key)[2] = ud(eg);
// Fill some properties randomly
vd.getProp<0>(key) = 0.0;
++it;
}
vd.map();
// sync the ghost
vd.ghost_get<0>();
auto NN = vd.getCellList(0.1);
auto p_it = vd.getDomainIterator();
while (p_it.isNext())
{
auto p = p_it.get();
Point<3,float> xp = vd.getPos(p);
auto Np = NN.getNNIterator(NN.getCell(vd.getPos(p)));
while (Np.isNext())
{
auto q = Np.get();
// repulsive
Point<3,float> xq = vd.getPos(q);
Point<3,float> f = (xp - xq);
float distance = f.norm();
// Particle should be inside 2 * r_cut range
if (distance < r_cut )
vd.getProp<0>(p)++;
++Np;
}
++p_it;
}
// We now try symmetric Cell-list
auto NN2 = vd.getCellListSym(0.1);
auto p_it2 = vd.getDomainIterator();
while (p_it2.isNext())
{
auto p = p_it2.get();
Point<3,float> xp = vd.getPos(p);
auto Np = NN2.template getNNIteratorSym<NO_CHECK>(NN2.getCell(vd.getPos(p)),p.getKey(),vd.getPosVector());
while (Np.isNext())
{
auto q = Np.get();
// repulsive
Point<3,float> xq = vd.getPos(q);
Point<3,float> f = (xp - xq);
float distance = f.norm();
// Particle should be inside r_cut range
if (distance < r_cut )
{
vd.getProp<1>(p)++;
vd.getProp<1>(q)++;
}
++Np;
}
++p_it2;
}
vd.ghost_put<add_,1>();
}
BOOST_AUTO_TEST_CASE( vector_dist_sym_verlet_list_test )
{
......
......@@ -749,7 +749,7 @@ public:
*
*/
vector_dist_comm(const vector_dist_comm<dim,St,prop,Decomposition,Memory> & v)
:v_cl(create_vcluster()),dec(create_vcluster())
:v_cl(create_vcluster()),dec(create_vcluster()),lg_m(0)
{
this->operator=(v);
}
......@@ -761,7 +761,7 @@ public:
*
*/
vector_dist_comm(const Decomposition & dec)
:v_cl(create_vcluster()),dec(dec)
:v_cl(create_vcluster()),dec(dec),lg_m(0)
{
}
......@@ -781,7 +781,7 @@ public:
*
*/
vector_dist_comm()
:v_cl(create_vcluster()),dec(create_vcluster())
:v_cl(create_vcluster()),dec(create_vcluster()),lg_m(0)
{
}
......
......@@ -1817,139 +1817,6 @@ BOOST_AUTO_TEST_CASE( vector_of_vector_dist )
BOOST_REQUIRE_EQUAL(cnt,4*4096ul);
}
BOOST_AUTO_TEST_CASE( vector_dist_symmetric_cell_list )
{
Vcluster & v_cl = create_vcluster();
if (v_cl.getProcessingUnits() > 24)
return;
// set the seed
// create the random generator engine
std::srand(v_cl.getProcessUnitID());
std::default_random_engine eg;
std::uniform_real_distribution<float> ud(0.0f, 1.0f);
long int k = 524288 * v_cl.getProcessingUnits();
long int big_step = k / 4;
big_step = (big_step == 0)?1:big_step;
print_test("Testing 3D periodic vector symmetric cell-list k=",k);
BOOST_TEST_CHECKPOINT( "Testing 3D periodic vector symmetric cell-list k=" << k );
Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0});
// Boundary conditions
size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
float r_cut = 0.1;
// ghost
Ghost<3,float> ghost(r_cut);
typedef aggregate<size_t,size_t> part_prop;
// Distributed vector
vector_dist<3,float, part_prop > vd(k,box,bc,ghost);
auto it = vd.getIterator();
while (it.isNext())
{
auto key = it.get();
vd.getPos(key)[0] = ud(eg);
vd.getPos(key)[1] = ud(eg);
vd.getPos(key)[2] = ud(eg);
// Fill some properties randomly
vd.getProp<0>(key) = 0.0;
++it;
}
vd.map();
// sync the ghost
vd.ghost_get<0>();
auto NN = vd.getCellList(0.1);
auto p_it = vd.getDomainIterator();
while (p_it.isNext())
{
auto p = p_it.get();
Point<3,float> xp = vd.getPos(p);
auto Np = NN.getIterator(NN.getCell(vd.getPos(p)));
while (Np.isNext())
{
auto q = Np.get();
// repulsive
Point<3,float> xq = vd.getPos(q);
Point<3,float> f = (xp - xq);
float distance = f.norm();
// Particle should be inside 2 * r_cut range
if (distance < r_cut )
vd.getProp<0>(p)++;
++Np;
}
++p_it;
}
// We now try symmetric Cell-list
auto NN2 = vd.getCellListSym(0.1);
auto p_it2 = vd.getDomainIterator();
while (p_it2.isNext())
{
auto p = p_it2.get();
Point<3,float> xp = vd.getPos(p);
auto Np = NN2.getIterator(NN2.getCell(vd.getPos(p)));
while (Np.isNext())
{
auto q = Np.get();
// repulsive
Point<3,float> xq = vd.getPos(q);
Point<3,float> f = (xp - xq);
float distance = f.norm();
// Particle should be inside r_cut range
if (distance < r_cut )
{
vd.getProp<1>(p)++;
vd.getProp<1>(q)++;
}
++Np;
}
++p_it;
}
vd.ghost_put<add_,1>();
}
#include "vector_dist_cell_list_tests.hpp"
#include "vector_dist_NN_tests.hpp"
......
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