8 #define BOOST_TEST_DYN_LINK 
    9 #include <boost/test/unit_test.hpp> 
   14 #include "Vector/vector_dist.hpp" 
   15 #include "data_type/aggregate.hpp" 
   16 #include "vector_dist_util_unit_tests.hpp" 
   17 #include "Point_test.hpp" 
   18 #include "Vector/performance/vector_dist_performance_common.hpp" 
   26 void print_test_v(std::string test, 
size_t sz)
 
   28     if (create_vcluster().getProcessUnitID() == 0)
 
   29         std::cout << test << 
" " << sz << 
"\n";
 
   40 long int decrement(
long int k, 
long int step)
 
   46     else if (k - 2*step+1 <= 0)
 
   63     auto it2 = vd.getDomainIterator();
 
   80     BOOST_REQUIRE_EQUAL(noOut,
true);
 
   90 BOOST_AUTO_TEST_SUITE( vector_dist_test )
 
   92 void print_test(std::
string test, 
size_t sz)
 
   94     if (create_vcluster().getProcessUnitID() == 0)
 
   95         std::cout << test << 
" " << sz << 
"\n";
 
   98 template<
typename vector>
 
  102     Vcluster & v_cl = create_vcluster();
 
  113     size_t g_div[]= {sz,sz};
 
  136     spacing = spacing / g_div;
 
  145     size_t bc[2]={NON_PERIODIC,NON_PERIODIC};
 
  148     vector vd(g_info.size(),box,bc,g);
 
  154     auto v_it = vd.getIterator();
 
  156     while (v_it.isNext() && it.isNext())
 
  159         auto key_v = v_it.get();
 
  163         vd.getPos(key_v)[0] = 
key.get(0) * spacing[0] + m_spacing[0] + box.
getLow(0);
 
  164         vd.getPos(key_v)[1] = 
key.get(1) * spacing[1] + m_spacing[1] + box.
getLow(1);
 
  176     BOOST_REQUIRE_EQUAL(v_it.isNext(),
false);
 
  177     BOOST_REQUIRE_EQUAL(it.isNext(),
false);
 
  178     BOOST_REQUIRE_EQUAL(cobj,p_np);
 
  185     auto v_it2 = vd.getIterator();
 
  187     while (v_it2.isNext())
 
  189         auto key = v_it2.get();
 
  192         vd.template getProp<p::s>(
key) = vd.getPos(
key)[0] + vd.getPos(
key)[1] * 16.0f;
 
  201     vd.template ghost_get<p::s,p::v>();
 
  206     const auto & dec = vd.getDecomposition();
 
  212     auto g_it = vd.getGhostIterator();
 
  217     while (g_it.isNext())
 
  219         auto key = g_it.get();
 
  222         BOOST_REQUIRE_EQUAL(vd.getPos(
key)[0] + vd.getPos(
key)[1] * 16.0f,vd.template getProp<p::s>(
key));
 
  229         for ( ; b < dec.getNEGhostBox() ; b++)
 
  233             if (dec.getEGhostBox(b).isInside(xp) == true )
 
  242         BOOST_REQUIRE_EQUAL(is_in,
true);
 
  245         BOOST_REQUIRE_EQUAL(vd.template getProp<p::v>(
key)[0],dec.getEGhostBoxProcessor(lb));
 
  253         BOOST_REQUIRE(n_part != 0);
 
  258     for (
size_t i = 0 ; i < vb.size() ; i++)
 
  261         size_t n_point = cd.getGridPoints(dec.getEGhostBox(i)).getVolumeKey();
 
  263         BOOST_REQUIRE_EQUAL(n_point,vb.get(i));
 
  267 BOOST_AUTO_TEST_CASE( vector_dist_ghost )
 
  272     Test2D_ghost<vector>(box);
 
  275     Test2D_ghost<vector>(box2);
 
  278 BOOST_AUTO_TEST_CASE( vector_dist_ghost_inte )
 
  283     Test2D_ghost<vector>(box);
 
  286     Test2D_ghost<vector>(box2);
 
  291 BOOST_AUTO_TEST_CASE( vector_dist_iterator_test_use_2d )
 
  293     Vcluster & v_cl = create_vcluster();
 
  298     std::default_random_engine eg;
 
  299     std::uniform_real_distribution<float> ud(0.0f, 1.0f);
 
  301 #ifdef TEST_COVERAGE_MODE 
  307     long int big_step = k / 4;
 
  308     big_step = (big_step == 0)?1:big_step;
 
  310     print_test_v( 
"Testing 2D vector k<=",k);
 
  313     for ( ; k >= 2 ; k-= decrement(k,big_step) )
 
  315         BOOST_TEST_CHECKPOINT( 
"Testing 2D vector k=" << k );
 
  322         size_t bc[2]={NON_PERIODIC,NON_PERIODIC};
 
  324         vector_dist<2,float, Point_test<float> > vd(k,box,bc,
Ghost<2,float>(0.0));
 
  326         auto it = vd.getIterator();
 
  332             vd.getPos(
key)[0] = ud(eg);
 
  333             vd.getPos(
key)[1] = ud(eg);
 
  345         auto it2 = vd.getIterator();
 
  349             auto key = it2.get();
 
  352             BOOST_REQUIRE_EQUAL(ct.
isLocal(vd.getPos(
key)),
true);
 
  362         BOOST_REQUIRE_EQUAL((
long int)cnt,k);
 
  366 BOOST_AUTO_TEST_CASE( vector_dist_iterator_test_use_3d )
 
  368     Vcluster & v_cl = create_vcluster();
 
  373     std::default_random_engine eg;
 
  374     std::uniform_real_distribution<float> ud(0.0f, 1.0f);
 
  376 #ifdef TEST_COVERAGE_MODE 
  382     long int big_step = k / 4;
 
  383     big_step = (big_step == 0)?1:big_step;
 
  385     print_test_v( 
"Testing 3D vector k<=",k);
 
  388     for ( ; k >= 2 ; k-= decrement(k,big_step) )
 
  390         BOOST_TEST_CHECKPOINT( 
"Testing 3D vector k=" << k );
 
  397         size_t bc[3]={NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
 
  401         auto it = vd.getIterator();
 
  407             vd.getPos(
key)[0] = ud(eg);
 
  408             vd.getPos(
key)[1] = ud(eg);
 
  409             vd.getPos(
key)[2] = ud(eg);
 
  421         auto it2 = vd.getIterator();
 
  425             auto key = it2.get();
 
  428             BOOST_REQUIRE_EQUAL(ct.
isLocal(vd.getPos(
key)),
true);
 
  438         BOOST_REQUIRE_EQUAL(cnt,(
size_t)k);
 
  443 BOOST_AUTO_TEST_CASE( vector_dist_iterator_fixed_dec_3d )
 
  445     Vcluster & v_cl = create_vcluster();
 
  450     std::default_random_engine eg;
 
  451     std::uniform_real_distribution<float> ud(0.0f, 1.0f);
 
  453 #ifdef TEST_COVERAGE_MODE 
  459     long int big_step = k / 4;
 
  460     big_step = (big_step == 0)?1:big_step;
 
  462     print_test_v( 
"Testing 3D vector copy decomposition k<=",k);
 
  465     for ( ; k >= 2 ; k-= decrement(k,big_step) )
 
  467         BOOST_TEST_CHECKPOINT( 
"Testing 3D vector copy decomposition k=" << k );
 
  472         size_t bc[3]={NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
 
  484             vd.getPos(
key)[1] = ud(eg);
 
  485             vd.getPos(
key)[2] = ud(eg);
 
  487             vd2.getPos(
key)[0] = vd.getPos(
key)[0];
 
  488             vd2.getPos(
key)[1] = vd.getPos(
key)[1];
 
  489             vd2.getPos(
key)[2] = vd.getPos(
key)[2];
 
  500         auto NN = vd.getCellList(0.05);
 
  501         auto NN2 = vd2.getCellList(0.05);
 
  503         cross_calc<3,0>(NN,NN2,vd,vd2);
 
  504         cross_calc<3,1>(NN,NN,vd,vd);
 
  507         auto it3 = vd.getIterator();
 
  511             auto key = it3.get();
 
  513             BOOST_REQUIRE_EQUAL(vd.getProp<0>(
key),vd.getProp<1>(
key));
 
  520 BOOST_AUTO_TEST_CASE( vector_dist_periodic_test_use_2d )
 
  522     Vcluster & v_cl = create_vcluster();
 
  527     std::default_random_engine eg;
 
  528     std::uniform_real_distribution<float> ud(0.0f, 1.0f);
 
  530 #ifdef TEST_COVERAGE_MODE 
  536     long int big_step = k / 4;
 
  537     big_step = (big_step == 0)?1:big_step;
 
  539     print_test_v( 
"Testing 2D periodic vector k<=",k);
 
  542     for ( ; k >= 2 ; k-= decrement(k,big_step) )
 
  544         BOOST_TEST_CHECKPOINT( 
"Testing 2D periodic vector k=" << k );
 
  549         size_t bc[2]={PERIODIC,PERIODIC};
 
  552         float factor = pow(create_vcluster().getProcessingUnits()/2.0f,1.0f/3.0f);
 
  561         vector_dist<2,float, Point_test<float> > vd(k,box,bc,ghost);
 
  570             vd.getPos(
key)[1] = ud(eg);
 
  590         auto it2 = vd.getIterator();
 
  591         count_local_n_local<2,vector_dist<2,float, Point_test<float> >>(vd,it2,bc,box,dom_ext,l_cnt,nl_cnt,n_out);
 
  594         BOOST_REQUIRE_EQUAL(n_out,0ul);
 
  599             BOOST_REQUIRE(nl_cnt != 0);
 
  600             BOOST_REQUIRE(l_cnt > nl_cnt);
 
  608         BOOST_REQUIRE_EQUAL((
long int)l_cnt,k);
 
  614         auto itg = vd.getGhostIterator();
 
  615         count_local_n_local<2,vector_dist<2,float, Point_test<float> > >(vd,itg,bc,box,dom_ext,l_cnt,nl_cnt,n_out);
 
  618         BOOST_REQUIRE_EQUAL(l_cnt,0ul);
 
  623             BOOST_REQUIRE(nl_cnt != 0);
 
  628 BOOST_AUTO_TEST_CASE( vector_dist_periodic_test_use_3d )
 
  630     Vcluster & v_cl = create_vcluster();
 
  635     std::default_random_engine eg;
 
  636     std::uniform_real_distribution<float> ud(0.0f, 1.0f);
 
  638 #ifdef TEST_COVERAGE_MODE 
  644     long int big_step = k / 4;
 
  645     big_step = (big_step == 0)?1:big_step;
 
  647     print_test_v( 
"Testing 3D periodic vector k<=",k);
 
  650     for ( ; k >= 2 ; k-= decrement(k,big_step) )
 
  652         BOOST_TEST_CHECKPOINT( 
"Testing 3D periodic vector k=" << k );
 
  657         size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
 
  660         float factor = pow(create_vcluster().getProcessingUnits()/2.0f,1.0f/3.0f);
 
  678             vd.getPos(
key)[1] = ud(eg);
 
  679             vd.getPos(
key)[2] = ud(eg);
 
  698         auto it2 = vd.getIterator();
 
  699         count_local_n_local<3,vector_dist<3,float, Point_test<float> >>(vd,it2,bc,box,dom_ext,l_cnt,nl_cnt,n_out);
 
  702         BOOST_REQUIRE_EQUAL(n_out,0ul);
 
  707             BOOST_REQUIRE(nl_cnt != 0);
 
  708             BOOST_REQUIRE(l_cnt > nl_cnt);
 
  714         BOOST_REQUIRE_EQUAL(l_cnt,(
size_t)k);
 
  720         auto itg = vd.getGhostIterator();
 
  721         count_local_n_local<3,vector_dist<3,float, Point_test<float> > >(vd,itg,bc,box,dom_ext,l_cnt,nl_cnt,n_out);
 
  724         BOOST_REQUIRE_EQUAL(l_cnt,0ul);
 
  729             BOOST_REQUIRE(nl_cnt != 0);
 
  734 void test_random_walk(
size_t opt)
 
  736     Vcluster & v_cl = create_vcluster();
 
  741     std::default_random_engine eg;
 
  742     std::uniform_real_distribution<float> ud(0.0f, 1.0f);
 
  744     size_t nsz[] = {0,32,4};
 
  747     print_test_v( 
"Testing 3D random walk vector k<=",nsz[0]);
 
  750     for (
size_t i = 0 ; i < 3 ; i++ )
 
  754         BOOST_TEST_CHECKPOINT( 
"Testing 3D random walk vector k=" << k );
 
  759         size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
 
  762         float factor = pow(create_vcluster().getProcessingUnits()/2.0f,1.0f/3.0f);
 
  777             vd.getPos(
key)[1] = ud(eg);
 
  778             vd.getPos(
key)[2] = ud(eg);
 
  787         for (
size_t j = 0 ; j < 4 ; j++)
 
  796                 vd.getPos(
key)[1] += 0.02 * ud(eg);
 
  797                 vd.getPos(
key)[2] += 0.02 * ud(eg);
 
  807             size_t cnt = total_n_part_lc(vd,bc);
 
  809             BOOST_REQUIRE_EQUAL((
size_t)k,cnt);
 
  814 BOOST_AUTO_TEST_CASE( vector_dist_periodic_test_random_walk )
 
  816     test_random_walk(NONE);
 
  819 BOOST_AUTO_TEST_CASE( vector_dist_periodic_test_random_walk_local_map )
 
  821     test_random_walk(MAP_LOCAL);
 
  824 BOOST_AUTO_TEST_CASE( vector_dist_periodic_map )
 
  829     size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
 
  832     float factor = pow(create_vcluster().getProcessingUnits()/2.0f,1.0f/3.0f);
 
  849         vd.getPos(
key)[1] = 1.0;
 
  850         vd.getPos(
key)[2] = 1.0;
 
  857     auto it2 = vd.getIterator();
 
  861         auto key = it2.get();
 
  863         float f = vd.getPos(
key)[0];
 
  864         BOOST_REQUIRE_EQUAL(f, 0.0);
 
  865         f = vd.getPos(
key)[1];
 
  866         BOOST_REQUIRE_EQUAL(f, 0.0);
 
  867         f = vd.getPos(
key)[2];
 
  868         BOOST_REQUIRE_EQUAL(f, 0.0);
 
  875 BOOST_AUTO_TEST_CASE( vector_dist_not_periodic_map )
 
  880     size_t bc[3]={NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
 
  883     float factor = pow(create_vcluster().getProcessingUnits()/2.0f,1.0f/3.0f);
 
  900         vd.getPos(
key)[1] = 1.0;
 
  901         vd.getPos(
key)[2] = 1.0;
 
  908     auto it2 = vd.getIterator();
 
  912         auto key = it2.get();
 
  914         float f = vd.getPos(
key)[0];
 
  915         BOOST_REQUIRE_EQUAL(f, 1.0);
 
  916         f = vd.getPos(
key)[1];
 
  917         BOOST_REQUIRE_EQUAL(f, 1.0);
 
  918         f = vd.getPos(
key)[2];
 
  919         BOOST_REQUIRE_EQUAL(f, 1.0);
 
  925 BOOST_AUTO_TEST_CASE( vector_dist_out_of_bound_policy )
 
  927     Vcluster & v_cl = create_vcluster();
 
  935     size_t bc[3]={NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
 
  938     float factor = pow(create_vcluster().getProcessingUnits()/2.0f,1.0f/3.0f);
 
  959             vd.getPos(
key)[1] = -0.06;
 
  960             vd.getPos(
key)[2] = -0.06;
 
  964             vd.getPos(
key)[0] = 0.06;
 
  965             vd.getPos(
key)[1] = 0.06;
 
  966             vd.getPos(
key)[2] = 0.06;
 
  977     size_t cnt_l = vd.size_local();
 
  987     Vcluster & v_cl = create_vcluster();
 
  995     std::default_random_engine eg;
 
  996     std::uniform_real_distribution<float> ud(-0.5f, 0.5f);
 
  998     size_t nsz[] = {0,32,4};
 
 1000 #ifdef TEST_COVERAGE_MODE 
 1006     print_test_v(
"Testing 3D random walk interacting particles vector k=", nsz[0]);
 
 1009     for (
size_t i = 0 ; i < 3 ; i++ )
 
 1013         BOOST_TEST_CHECKPOINT( 
"Testing 3D random walk interacting particles vector k=" << k );
 
 1016         size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
 
 1019         float factor = pow(create_vcluster().getProcessingUnits()/2.0f,1.0f/3.0f);
 
 1022         float r_cut = 0.01 / factor;
 
 1034             auto key = it.get();
 
 1037             vd.getPos(
key)[1] = ud(eg);
 
 1038             vd.getPos(
key)[2] = ud(eg);
 
 1047         for (
size_t j = 0 ; j < 4 ; j++)
 
 1055                 auto key = it.get();
 
 1058                 vd.getPos(
key)[1] += 0.02 * ud(eg);
 
 1059                 vd.getPos(
key)[2] += 0.02 * ud(eg);
 
 1066             vd.write(
"Without_ghost");
 
 1070             vd.write(
"With_ghost");
 
 1071             vd.getDecomposition().write(
"With_dec_ghost");
 
 1077             auto NN = vd.getCellList(0.01 / factor);
 
 1081             auto it2 = vd.getDomainIterator();
 
 1083             while (it2.isNext())
 
 1089                 auto Np = NN.getCellIterator(NN.getCell(xp));
 
 1100                     float distance = f.
norm();
 
 1104                     if (distance > 2*r_cut*sqrt(2))
 
 1115             BOOST_REQUIRE_EQUAL(error,
false);
 
 1118             size_t cnt = total_n_part_lc(vd,bc);
 
 1120             BOOST_REQUIRE_EQUAL((
size_t)k,cnt);
 
 1125 BOOST_AUTO_TEST_CASE( vector_dist_periodic_test_interacting_particles )
 
 1128     Test_interacting(box);
 
 1131     Test_interacting(box2);
 
 1134 BOOST_AUTO_TEST_CASE( vector_dist_grid_iterator )
 
 1136 #ifdef TEST_COVERAGE_MODE 
 1137     long int k = 32*32*32*create_vcluster().getProcessingUnits();
 
 1139     long int k = 64*64*64*create_vcluster().getProcessingUnits();
 
 1141     k = std::pow(k, 1/3.);
 
 1143     long int big_step = k / 30;
 
 1144     big_step = (big_step == 0)?1:big_step;
 
 1145     long int small_step = 21;
 
 1147     print_test( 
"Testing vector grid iterator list k<=",k);
 
 1150     for ( ; k > 8*big_step ; k-= (k > 2*big_step)?big_step:small_step )
 
 1152         Vcluster & v_cl = create_vcluster();
 
 1154         const size_t Ng = k;
 
 1157         size_t sz[3] = {Ng,Ng,Ng};
 
 1162         size_t bc[3]={NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
 
 1177             auto key = it.get();
 
 1186         BOOST_REQUIRE_EQUAL(it.getSpacing(0),1.0f/(Ng-1));
 
 1187         BOOST_REQUIRE_EQUAL(it.getSpacing(1),1.0f/(Ng-1));
 
 1188         BOOST_REQUIRE_EQUAL(it.getSpacing(2),1.0f/(Ng-1));
 
 1195         size_t total = vd.size_local();
 
 1199         BOOST_REQUIRE_EQUAL(total,(Ng) * (Ng) * (Ng));
 
 1203 BOOST_AUTO_TEST_CASE( vector_dist_cell_verlet_test )
 
 1205 #ifdef TEST_COVERAGE_MODE 
 1206     long int k = 16*16*16*create_vcluster().getProcessingUnits();
 
 1208     long int k = 64*64*64*create_vcluster().getProcessingUnits();
 
 1210     k = std::pow(k, 1/3.);
 
 1212     long int big_step = k / 30;
 
 1213     big_step = (big_step == 0)?1:big_step;
 
 1214     long int small_step = 21;
 
 1216     print_test( 
"Testing cell and verlet list k<=",k);
 
 1219     for ( ; k > 8*big_step ; k-= (k > 2*big_step)?big_step:small_step )
 
 1221         Vcluster & v_cl = create_vcluster();
 
 1223         const size_t Ng = k;
 
 1226         size_t sz[3] = {Ng,Ng,Ng};
 
 1231         size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
 
 1233         float spacing = 1.0/Ng;
 
 1234         float first_dist = spacing;
 
 1235         float second_dist = sqrt(2.0*spacing*spacing);
 
 1236         float third_dist = sqrt(3.0 * spacing*spacing);
 
 1251             auto key = it.get();
 
 1260         BOOST_REQUIRE_EQUAL(it.getSpacing(0),1.0f/Ng);
 
 1261         BOOST_REQUIRE_EQUAL(it.getSpacing(1),1.0f/Ng);
 
 1262         BOOST_REQUIRE_EQUAL(it.getSpacing(2),1.0f/Ng);
 
 1268         size_t total = vd.size_local();
 
 1272         BOOST_REQUIRE_EQUAL(total,(Ng) * (Ng) * (Ng));
 
 1281         first_dist += first_dist * 0.05;
 
 1282         second_dist += second_dist * 0.05;
 
 1283         third_dist += third_dist * 0.05;
 
 1289         bool correct = 
true;
 
 1291         BOOST_REQUIRE_EQUAL(vd.size_local(),verlet.
size());
 
 1294         for (
size_t i = 0 ; i < verlet.
size() ; i++)
 
 1297             size_t first_NN = 0;
 
 1298             size_t second_NN = 0;
 
 1299             size_t third_NN = 0;
 
 1304             for (
size_t j = 0 ; j < verlet.
getNNPart(i) ; j++)
 
 1310                 if (dist <= first_dist)
 
 1312                 else if (dist <= second_dist)
 
 1318             correct &= (first_NN == 7);
 
 1319             correct &= (second_NN == 12);
 
 1320             correct &= (third_NN == 8);
 
 1323         BOOST_REQUIRE_EQUAL(correct,
true);
 
 1328 BOOST_AUTO_TEST_CASE( vector_dist_periodic_map_list )
 
 1330     Vcluster & v_cl = create_vcluster();
 
 1338     std::default_random_engine eg;
 
 1339     std::uniform_real_distribution<float> ud(0.0f, 1.0f);
 
 1341 #ifdef TEST_COVERAGE_MODE 
 1347     long int big_step = k / 4;
 
 1348     big_step = (big_step == 0)?1:big_step;
 
 1350     print_test(
"Testing 3D periodic vector with map_list k=",k);
 
 1351     BOOST_TEST_CHECKPOINT( 
"Testing 3D periodic vector with map_list k=" << k );
 
 1356     size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
 
 1359     float factor = pow(create_vcluster().getProcessingUnits()/2.0f,1.0f/3.0f);
 
 1376         auto key = it.get();
 
 1379         vd.getPos(
key)[1] = ud(eg);
 
 1380         vd.getPos(
key)[2] = ud(eg);
 
 1384         vd.getProp<2>(
key).push_back(1);
 
 1385         vd.getProp<2>(
key).push_back(2);
 
 1386         vd.getProp<2>(
key).push_back(3);
 
 1387         vd.getProp<2>(
key).push_back(4);
 
 1389         vd.getProp<3>(
key).add(1);
 
 1390         vd.getProp<3>(
key).add(2);
 
 1391         vd.getProp<3>(
key).add(3);
 
 1392         vd.getProp<3>(
key).add(4);
 
 1394         vd.getProp<4>(
key).add();
 
 1395         vd.getProp<4>(
key).add();
 
 1396         vd.getProp<4>(
key).add();
 
 1397         vd.getProp<4>(
key).add();
 
 1416     auto it2 = vd.getIterator();
 
 1417     count_local_n_local<3,vector_dist<3,float, part_prop>>(vd,it2,bc,box,dom_ext,l_cnt,nl_cnt,n_out);
 
 1420     BOOST_REQUIRE_EQUAL(n_out,0ul);
 
 1425         BOOST_REQUIRE(nl_cnt != 0);
 
 1426         BOOST_REQUIRE(l_cnt > nl_cnt);
 
 1432     BOOST_REQUIRE_EQUAL(l_cnt,(
size_t)k);
 
 1438     auto itg = vd.getGhostIterator();
 
 1439     count_local_n_local<3, vector_dist<3,float,part_prop> >(vd,itg,bc,box,dom_ext,l_cnt,nl_cnt,n_out);
 
 1442     BOOST_REQUIRE_EQUAL(l_cnt,0ul);
 
 1447         BOOST_REQUIRE(nl_cnt != 0);
 
 1452 BOOST_AUTO_TEST_CASE( vector_dist_ghost_with_ghost_buffering )
 
 1454     Vcluster & v_cl = create_vcluster();
 
 1462     std::default_random_engine eg;
 
 1463     std::uniform_real_distribution<float> ud(0.0f, 1.0f);
 
 1465 #ifdef TEST_COVERAGE_MODE 
 1471     long int big_step = k / 4;
 
 1472     big_step = (big_step == 0)?1:big_step;
 
 1474     print_test(
"Testing 3D periodic vector with ghost buffering k=",k);
 
 1475     BOOST_TEST_CHECKPOINT( 
"Testing 3D periodic with ghost buffering k=" << k );
 
 1480     size_t bc[3]={NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
 
 1494         auto key = it.get();
 
 1497         vd.getPos(
key)[1] = ud(eg);
 
 1498         vd.getPos(
key)[2] = ud(eg);
 
 1502         vd.getProp<0>(
key) = 0.0;
 
 1503         vd.getProp<1>(
key) = vd.getPos(
key)[0];
 
 1504         vd.getProp<2>(
key) = vd.getPos(
key)[0]*vd.getPos(
key)[0];
 
 1512     vd.ghost_get<0,1,2>();
 
 1515     auto it2 = vd.getGhostIterator();
 
 1516     while (it2.isNext())
 
 1518         auto key = it2.get();
 
 1520         ret &= vd.getProp<1>(
key) == vd.getPos(
key)[0];
 
 1521         ret &= vd.getProp<2>(
key) == vd.getPos(
key)[0] * vd.getPos(
key)[0];
 
 1526     BOOST_REQUIRE_EQUAL(ret,
true);
 
 1528     for (
size_t i = 0 ; i < 10 ; i++)
 
 1534             auto key = it.get();
 
 1537             vd.getPos(
key)[2] = ud(eg);
 
 1541             vd.getProp<0>(
key) = i;
 
 1549             vd.ghost_get<0>(SKIP_LABELLING | NO_CHANGE_ELEMENTS );
 
 1551         auto it2 = vd.getGhostIterator();
 
 1554         while (it2.isNext())
 
 1556             auto key = it2.get();
 
 1558             ret &= vd.getProp<0>(
key) == i;
 
 1559             ret &= vd.getProp<1>(
key) == vd.getPos(
key)[0];
 
 1560             ret &= vd.getProp<2>(
key) == vd.getPos(
key)[0] * vd.getPos(
key)[0];
 
 1565         BOOST_REQUIRE_EQUAL(ret,
true);
 
 1569     vd.ghost_get<0,1,2>();
 
 1583         vd.getPos(p)[1] = 17.0;
 
 1589     for (
size_t i = 0 ; i < 10 ; i++)
 
 1595             auto key = it.get();
 
 1598             vd.getPos(
key)[2] = ud(eg);
 
 1602             vd.getProp<0>(
key) = i;
 
 1603             vd.getProp<1>(
key) = vd.getPos(
key)[0];
 
 1604             vd.getProp<2>(
key) = vd.getPos(
key)[0]*vd.getPos(
key)[0];
 
 1609         vd.
ghost_get<0>(SKIP_LABELLING | NO_POSITION);
 
 1611         auto it2 = vd.getGhostIterator();
 
 1614         while (it2.isNext())
 
 1619             ret &= vd.
getPos(p)[0] == 10.0;
 
 1622             ret &= vd.getPos(p)[1] == 17.0;
 
 1628         BOOST_REQUIRE_EQUAL(ret,
true);
 
 1634 BOOST_AUTO_TEST_CASE( vector_dist_ghost_put )
 
 1636     Vcluster & v_cl = create_vcluster();
 
 1638     long int k = 25*25*25*create_vcluster().getProcessingUnits();
 
 1639     k = std::pow(k, 1/3.);
 
 1644     print_test(
"Testing 3D periodic ghost put k=",k);
 
 1645     BOOST_TEST_CHECKPOINT( 
"Testing 3D periodic ghost put k=" << k );
 
 1647     long int big_step = k / 30;
 
 1648     big_step = (big_step == 0)?1:big_step;
 
 1649     long int small_step = 21;
 
 1652     for ( ; k >= 2 ; k-= (k > 2*big_step)?big_step:small_step )
 
 1654         float r_cut = 1.3 / k;
 
 1655         float r_g = 1.5 / k;
 
 1660         size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
 
 1674             auto key = it.get();
 
 1678             vd.getLastPosWrite()[0] = 
key.get(0)*it.getSpacing(0);
 
 1695             auto NN = vd.getCellList(r_cut);
 
 1700             auto it2 = vd.getDomainIterator();
 
 1702             while (it2.isNext())
 
 1709                 auto Np = NN.getNNIterator<NO_CHECK>(NN.getCell(xp));
 
 1720                         vd.getPropWrite<0>(q) += a*(-dist*dist+r_cut*r_cut);
 
 1728             vd.ghost_put<
add_,0>();
 
 1731             auto it3 = vd.getDomainIterator();
 
 1733             float constant = vd.getProp<0>(it3.get());
 
 1736             while (it3.isNext())
 
 1738                 float constant2 = vd.getProp<0>(it3.get());
 
 1739                 if (fabs(constant - constant2)/constant > eps)
 
 1750             BOOST_REQUIRE_EQUAL(ret,
true);
 
 1753         auto itp = vd.getDomainAndGhostIterator();
 
 1754         while (itp.isNext())
 
 1756             auto key = itp.get();
 
 1758             vd.getPropWrite<0>(
key) = 0.0;
 
 1764             auto NN = vd.getCellList(r_cut);
 
 1769             auto it2 = vd.getDomainIterator();
 
 1771             while (it2.isNext())
 
 1778                 auto Np = NN.getNNIterator<NO_CHECK>(NN.getCell(xp));
 
 1789                         vd.getPropWrite<0>(q) += a*(-dist*dist+r_cut*r_cut);
 
 1797             vd.ghost_put<
add_,0>();
 
 1800             auto it3 = vd.getDomainIterator();
 
 1802             float constant = vd.getPropRead<0>(it3.get());
 
 1805             while (it3.isNext())
 
 1807                 float constant2 = vd.getPropRead<0>(it3.get());
 
 1808                 if (fabs(constant - constant2)/constant > eps)
 
 1819             BOOST_REQUIRE_EQUAL(ret,
true);
 
 1824 BOOST_AUTO_TEST_CASE( vector_fixing_noposition_and_keep_prop )
 
 1826     Vcluster & v_cl = create_vcluster();
 
 1832     size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
 
 1846         auto key = it.get();
 
 1848         vd.
getPos(
key)[0] = ((double)rand())/RAND_MAX;
 
 1849         vd.getPos(
key)[1] = ((double)rand())/RAND_MAX;
 
 1850         vd.getPos(
key)[2] = ((double)rand())/RAND_MAX;
 
 1858     size_t local = vd.getPosVector().size();
 
 1860     vd.ghost_get<>(KEEP_PROPERTIES | NO_POSITION);
 
 1862     size_t local2 = vd.getPosVector().size();
 
 1864     BOOST_REQUIRE_EQUAL(local,local2);
 
 1870     local = vd.getPosVector().size();
 
 1871     BOOST_REQUIRE_EQUAL(local,vd.size_local());
 
 1872     vd.ghost_get<>(KEEP_PROPERTIES  | NO_POSITION);
 
 1874     local2 = vd.getPosVector().size();
 
 1876     BOOST_REQUIRE_EQUAL(local,local2);
 
 1878     vd.ghost_get<>(KEEP_PROPERTIES);
 
 1879     BOOST_REQUIRE_EQUAL(local,vd.getPosVector().size());
 
 1880     BOOST_REQUIRE_EQUAL(vd.getPropVector().size(),local);
 
 1882     vd.ghost_get<0>(KEEP_PROPERTIES);
 
 1883     BOOST_REQUIRE_EQUAL(local,vd.getPosVector().size());
 
 1884     BOOST_REQUIRE_EQUAL(vd.getPropVector().size(),local);
 
 1888 BOOST_AUTO_TEST_CASE( vector_of_vector_dist )
 
 1890     Vcluster & v_cl = create_vcluster();
 
 1896     size_t bc[3]={PERIODIC,PERIODIC,PERIODIC};
 
 1914     phases.get(0).map();
 
 1915     phases.get(0).ghost_get<>();
 
 1916     phases.get(1).map();
 
 1917     phases.get(1).ghost_get<>();
 
 1918     phases.get(2).map();
 
 1919     phases.get(2).ghost_get<>();
 
 1920     phases.get(3).map();
 
 1921     phases.get(3).ghost_get<>();
 
 1925     for (
size_t i = 0 ; i < phases.
size() ; i++)
 
 1926         cnt += phases.get(i).size_local();
 
 1931     BOOST_REQUIRE_EQUAL(cnt,4*4096ul);
 
 1935 BOOST_AUTO_TEST_SUITE_END()
 
void sum(T &num)
Sum the numbers across all processors and get the result. 
 
This class represent an N-dimensional box. 
 
size_t get(size_t i, size_t j) const 
Get the neighborhood element j for the particle i. 
 
T getLow(int i) const 
get the i-coordinate of the low bound interval of the box 
 
size_t getProcessUnitID()
Get the process unit id. 
 
static size_t getDefaultGrid(size_t n_sub)
The default grid size. 
 
void execute()
Execute all the requests. 
 
std::string toString() const 
Return the string with the point coordinate. 
 
Class for Verlet list implementation. 
 
auto getPos(vect_dist_key_dx vec_key) -> decltype(v_pos.template get< 0 >(vec_key.getKey()))
Get the position of an element. 
 
This structure define the operation add to use with copy general. 
 
This class implement the point shape in an N-dimensional space. 
 
vector_dist_iterator getGhostIterator() const 
Get the iterator across the position of the ghost particles. 
 
Point< dim, T > getP1() const 
Get the point p1. 
 
grid_dist_id_iterator_dec< Decomposition > getGridIterator(const size_t(&sz)[dim])
 
bool isLocal(const encapc< 1, Point< dim, T >, Mem > p) const 
Check if the particle is local. 
 
Transform the boost::fusion::vector into memory specification (memory_traits) 
 
Implementation of VCluster class. 
 
auto getLastPosWrite() -> decltype(v_pos.template get< 0 >(0))
Get the position of the last element. 
 
This class decompose a space into sub-sub-domains and distribute them across processors. 
 
void enlarge(const Box< dim, T > &gh)
Enlarge the box with ghost margin. 
 
size_t getNNPart(size_t part_id) const 
Return the number of neighborhood particles for the particle id. 
 
const T & get(size_t i) const 
Get coordinate. 
 
void map(size_t opt=NONE)
It move all the particles that does not belong to the local processor to the respective processor...
 
void ghost_get(size_t opt=WITH_POSITION)
It synchronize the properties and position of the ghost particles. 
 
void add()
Add local particle. 
 
This class represent an N-dimensional box. 
 
T norm()
norm of the vector 
 
This class is a trick to indicate the compiler a specific specialization pattern. ...
 
auto getLastPropWrite() -> decltype(v_prp.template get< id >(0))
Get the property of the last element. 
 
void map_list(size_t opt=NONE)
It move all the particles that does not belong to the local processor to the respective processor...
 
vector_dist_iterator getIterator()
Get an iterator that traverse domain and ghost particles. 
 
vector_dist_iterator getDomainIterator() const 
Get an iterator that traverse the particles in the domain. 
 
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
 
auto getLastPos() -> decltype(v_pos.template get< 0 >(0))
Get the position of the last element. 
 
T distance(const Point< dim, T > &q)
It calculate the distance between 2 points. 
 
Test structure used for several test. 
 
size_t getProcessingUnits()
Get the total number of processors. 
 
size_t size()
Return for how many particles has been constructed this verlet list. 
 
Point< dim, T > getP2() const 
Get the point p2.