Commit 83e281ca authored by Pietro Incardona's avatar Pietro Incardona

Cell list test working with vector

parent 1214b212
......@@ -969,9 +969,9 @@ p1[0]<-----+ +----> p2[0]
return sp;
}
/*! \brief Return the structure that store the physical domain
/*! \brief Return the box of the physical domain
*
* \return The physical domain
* \return The physical domain box
*
*/
const Domain<dim,T> & getDomain()
......@@ -1068,6 +1068,15 @@ p1[0]<-----+ +----> p2[0]
}
/*! \brief Return the ghost
*
*
*/
const Ghost<dim,T> & getGhost() const
{
return ghost;
}
////////////// Functions to get decomposition information ///////////////
/*! \brief Write the decomposition as VTK file
......
......@@ -929,24 +929,33 @@ public:
* \tparam CellL CellList type to construct
*
*/
template<typename CellL=CellList<dim,St,FAST>> CellL getCellList(St r_cut)
template<typename CellL=CellList<dim,St,FAST,shift<dim,St> > > CellL getCellList(St r_cut)
{
CellL cell_list;
// calculate the parameters of the cell list
// get the processor bounding box
Box<dim,St> pbox = dec.getProcessorBounds();
Box<dim,St> pbox_dom = pbox;
pbox_dom -= pbox_dom.getP1();
// extend by the ghost
pbox.enlarge(dec.getGhost());
Box<dim,St> cell_box;
size_t div[dim];
// Calculate the division array
// Calculate the division array and the cell box
for (size_t i = 0 ; i < dim ; i++)
{
div[i] = (pbox.getP2().get(i) - pbox.getP1().get(i))/ r_cut;
div[i]++;
cell_box.setLow(i,0.0);
cell_box.setHigh(i,div[i]*r_cut);
}
cell_list.Initialize(pbox_dom,div,pbox.getP1());
cell_list.Initialize(cell_box,div,pbox.getP1());
// for each particle add the particle to the cell list
......
......@@ -977,6 +977,8 @@ BOOST_AUTO_TEST_CASE( vector_dist_periodic_test_interacting_particles )
// get the cell list with a cutoff radius
bool error = false;
auto NN = vd.getCellList(0.01 / factor);
// iterate across the domain particle
......@@ -1008,10 +1010,10 @@ BOOST_AUTO_TEST_CASE( vector_dist_periodic_test_interacting_particles )
float distance = f.norm();
// Particle should be in the r_cut and
// 2 * r_cut range
// Particle should be inside 2 * r_cut range
if (distance > 2*r_cut*sqrt(2))
error = true;
++Np;
}
......@@ -1019,6 +1021,10 @@ BOOST_AUTO_TEST_CASE( vector_dist_periodic_test_interacting_particles )
++it2;
}
// Error
BOOST_REQUIRE_EQUAL(error,false);
// Count the local particles and check that the total number is consistent
size_t cnt = total_n_part_lc(vd,bc);
......
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