8 #include "CellList.hpp" 
    9 #include "CellListM.hpp" 
   10 #include "Grid/grid_sm.hpp" 
   12 #ifndef CELLLIST_TEST_HPP_ 
   13 #define CELLLIST_TEST_HPP_ 
   21 template<
unsigned int dim, 
typename T, 
typename CellS> 
void Test_cell_s(
SpaceBox<dim,T> & box)
 
   28     size_t div[dim] = {16,16,16};
 
   41     for (
size_t i = 0 ; i < CELL_REALLOC * 3 ; i++)
 
   47     BOOST_REQUIRE_EQUAL(cl2.getNelements(cl2.getCell(org)),CELL_REALLOC * 3ul);
 
   48     for (
size_t i = 0 ; i < CELL_REALLOC * 3 ; i++)
 
   50         BOOST_REQUIRE_EQUAL(cl2.get(cl2.getCell(org),i),i);
 
   72     for (
size_t i = 0 ; i < dim ; i++)
 
   74         offset[i].
get(i) += (1.0 / div[i]) / 8.0;
 
   85         key = pmul(key,spacing) + offset[0] + box.
getP1();
 
   92         key = pmul(key,spacing) + offset[1] + box.
getP1();
 
  108     while (g_it.isNext())
 
  113         key = pmul(key,spacing) + offset[2] + box.
getP1();
 
  115         size_t cell = cl1.getCell(key);
 
  116         size_t n_ele = cl1.getNelements(cell);
 
  118         BOOST_REQUIRE_EQUAL(n_ele,2ul);
 
  119         BOOST_REQUIRE_EQUAL((
long int)(cl1.get(cell,1) - cl1.get(cell,0)),1);
 
  129     while (g_it.isNext())
 
  134         key = pmul(key,spacing) + offset[0] + box.
getP1();
 
  136         auto cell = cl1.getCell(key);
 
  148     while (g_it.isNext())
 
  153         key = pmul(key,spacing) + offset[0] + box.
getP1();
 
  155         auto cell = cl1.getCell(key);
 
  156         size_t n_ele = cl1.getNelements(cell);
 
  158         BOOST_REQUIRE_EQUAL(n_ele,1ul);
 
  171     while (g_it_s.isNext())
 
  176         key = pmul(key,spacing) + offset[0] + box.
getP1();
 
  178         auto NN = cl1.template getNNIterator<NO_CHECK>(cl1.getCell(key));
 
  192         BOOST_REQUIRE_EQUAL(total,(
size_t)openfpm::math::pow(3,dim));
 
  199         id = cl1.get(cl1.getCell(key),0);
 
  200         auto NNSym = cl1.template getNNIteratorSym<NO_CHECK>(cl1.getCell(key),id,pos);
 
  203         while(NNSym.isNext())
 
  212         BOOST_REQUIRE_EQUAL(total,(
size_t)openfpm::math::pow(3,dim) / 2 + 1);
 
  227 template<
unsigned int dim, 
typename T, 
typename CellS> 
void Test_cell_sM(
SpaceBox<dim,T> & box)
 
  233     size_t div[dim] = {16,16,16};
 
  260     for (
size_t i = 0 ; i < dim ; i++)
 
  262         offset[i].
get(i) += (1.0 / div[i]) / 8.0;
 
  274     while (g_it.isNext())
 
  279         key = pmul(key,spacing) + offset[0] + box.
getP1();
 
  286         key = pmul(key,spacing) + offset[1] + box.
getP1();
 
  300     while (g_it.isNext())
 
  305         key = pmul(key,spacing) + offset[2] + box.
getP1();
 
  307         size_t cell = cl1.getCell(key);
 
  308         size_t n_ele = cl1.getNelements(cell);
 
  310         size_t p1 = cl1.getP(cell,1);
 
  311         size_t p2 = cl1.getP(cell,0);
 
  313         size_t v1 = cl1.getV(cell,1);
 
  314         size_t v2 = cl1.getV(cell,0);
 
  316         BOOST_REQUIRE_EQUAL(n_ele,2ul);
 
  317         BOOST_REQUIRE_EQUAL((
long int)(p1 - p2),0);
 
  318         BOOST_REQUIRE_EQUAL((
long int)(v1 - v2),1);
 
  323 template<
typename CellList> 
void Test_CellDecomposer_consistent()
 
  327     size_t div[2] = {36,36};
 
  329     CellDecomposer_sm<2,float,shift<2,float>> cd(bx,div,1);
 
  331     Box<2,float> bx_sub({-1.0/5.0,-1.0/5.0},{1.0/5.0,1.0/5.0});
 
  333     size_t bc[2] = {NON_PERIODIC,NON_PERIODIC};
 
  335     Box<2,long int> bx_int = cd.convertDomainSpaceIntoGridUnits(bx_sub,bc);
 
  337     BOOST_REQUIRE_EQUAL(bx_int.
getLow(0),8);
 
  338     BOOST_REQUIRE_EQUAL(bx_int.
getLow(1),8);
 
  340     BOOST_REQUIRE_EQUAL(bx_int.
getHigh(0),28);
 
  341     BOOST_REQUIRE_EQUAL(bx_int.
getHigh(1),28);
 
  343     cd.convertCellUnitsIntoDomainSpace(bx_sub);
 
  345     BOOST_REQUIRE_EQUAL(bx_sub.getLow(0),-1.0f/5.0f);
 
  346     BOOST_REQUIRE_EQUAL(bx_sub.getLow(1),-1.0f/5.0f);
 
  348     BOOST_REQUIRE_EQUAL(bx_sub.getHigh(0),1.0f/5.0f);
 
  349     BOOST_REQUIRE_EQUAL(bx_sub.getHigh(1),1.0f/5.0f);
 
  352 BOOST_AUTO_TEST_SUITE( CellList_test )
 
  354 BOOST_AUTO_TEST_CASE( CellList_use)
 
  356     std::cout << 
"Test cell list" << 
"\n";
 
  360     Test_cell_s<3,double,CellList<3,double,Mem_fast<>>>(box);
 
  361     Test_cell_s<3,double,CellList<3,double,Mem_fast<>,
shift<3,double>> >(box2);
 
  362     Test_cell_sM<3,double,CellListM<3,double,8>>(box);
 
  363     Test_cell_sM<3,double,CellListM<3,double,8>>(box2);
 
  366     Test_cell_s<3,double,CellList<3,double,Mem_bal<>>>(box);
 
  367     Test_cell_s<3,double,CellList<3,double,Mem_mw<>>>(box);
 
  369     std::cout << 
"End cell list" << 
"\n";
 
  374 BOOST_AUTO_TEST_CASE( CellList_consistent )
 
  376     Test_CellDecomposer_consistent<CellList<2,float,Mem_fast<>,
shift<2,float>>>();
 
  379 BOOST_AUTO_TEST_CASE( CellList_NNc_csr_calc )
 
  385     BOOST_REQUIRE_EQUAL(cNN.
size(),14ul);
 
  431 BOOST_AUTO_TEST_SUITE_END()
 
This class represent an N-dimensional box. 
 
T getLow(int i) const 
get the i-coordinate of the low bound interval of the box 
 
grid_key_dx is the key to access any element in the grid 
 
T getHigh(int i) const 
get the high interval of the box 
 
This class implement the point shape in an N-dimensional space. 
 
Structure that contain a reference to a vector of particles. 
 
Point< dim, T > getP1() const 
Get the point p1. 
 
const T & get(size_t i) const 
Get coordinate. 
 
This class represent an N-dimensional box. 
 
This class is a trick to indicate the compiler a specific specialization pattern. ...
 
Implementation of 1-D std::vector like structure. 
 
Class for FAST cell list implementation. 
 
Point< dim, T > getP2() const 
Get the point p2.