9#define BOOST_TEST_DYN_LINK
11#include <boost/test/unit_test.hpp>
12#include "grid_dist_amr.hpp"
14BOOST_AUTO_TEST_SUITE( grid_dist_amr_test )
23template<
typename gr
id_amr>
24void Test3D_amr_create_levels(grid_amr & amr_g,
Box<3,float> & domain,
size_t coars_g,
size_t n_lvl)
26 size_t g_sz[3] = {coars_g,coars_g,coars_g};
28 size_t tot_c = (coars_g - 1)*(coars_g - 1)*(coars_g - 1);
29 size_t correct_result = 0;
30 size_t correct_result_cell = 0;
33 for (
size_t i = 0 ; i < n_lvl ; i++)
35 correct_result += coars_g*coars_g*coars_g;
36 correct_result_cell += tot_c*fact;
37 coars_g = 2*(coars_g - 1) + 1;
41 amr_g.initLevels(n_lvl,g_sz);
44 for (
size_t i = 0 ; i < amr_g.getNLvl() ; i++)
50 auto it = amr_g.getGridIterator(i);
54 auto key = it.get_dist();
55 auto akey = amr_g.getAMRKey(i,key);
57 amr_g.template insert<0>(akey) = 3.0;
59 amr_g.template insert<1>(akey)[0] = 3.0;
60 amr_g.template insert<1>(akey)[1] = 3.0;
61 amr_g.template insert<1>(akey)[2] = 3.0;
63 amr_g.template insert<2>(akey)[0] = 3;
64 amr_g.template insert<2>(akey)[1] = 3;
65 amr_g.template insert<2>(akey)[2] = 3;
74 auto it = amr_g.getDomainIterator();
90 BOOST_REQUIRE_EQUAL(count,correct_result);
92 auto itc = amr_g.getDomainIteratorCells();
106 auto it_level = amr_g.getDomainIteratorCells(3);
108 while (it_level.isNext())
110 auto key = it_level.get();
112 amr_g.template get<0>(3,key);
117 BOOST_REQUIRE_EQUAL(count_c,correct_result_cell);
122template<
unsigned int dim>
123inline bool gr_is_inside(
const grid_key_dx<dim> & key,
const size_t (& sz)[dim])
125 for (
size_t i = 0 ; i < dim ; i++)
127 if (key.
get(i) >= (
long int)sz[i] || key.
get(i) < 0)
136template <
typename gr
id>
137void Test3D_amr_child_parent_get_no_periodic(
grid & amr_g,
Box<3,float> & domain,
size_t coars_g,
size_t n_lvl)
143 size_t g_sz[3] = {coars_g,coars_g,coars_g};
145 size_t tot = coars_g*coars_g*coars_g;
146 size_t correct_result = 0;
149 for (
size_t i = 0 ; i < n_lvl ; i++)
151 correct_result += tot*fact;
155 amr_g.initLevels(n_lvl,g_sz);
159 for (
size_t i = 0 ; i < amr_g.getNLvl() ; i++)
165 auto it = amr_g.getGridIterator(i);
169 auto key = it.get_dist();
170 auto akey = amr_g.getAMRKey(i,key);
172 amr_g.template insert<0>(akey) = 3.0;
182 std::string test = amr_g.getSpacing(0).toString();
185 auto it = amr_g.getDomainIterator();
190 auto gkey = it.getGKey();
192 amr_g.template insert<0>(key) = gkey.get(0);
193 amr_g.template insert<1>(key) = gkey.get(1);
194 amr_g.template insert<2>(key) = gkey.get(2);
195 amr_g.template insert<3>(key)[0] = gkey.get(0);
196 amr_g.template insert<3>(key)[1] = gkey.get(1);
197 amr_g.template insert<3>(key)[2] = gkey.get(2);
198 amr_g.template insert<3>(key)[3] = gkey.get(0);
203 amr_g.template ghost_get<0,1,2,3>();
207 auto it2 = amr_g.getDomainIterator();
212 auto key = it2.
get();
213 auto gkey = it2.getGKey();
215 auto key_px = key.moveSpace(x,1);
216 auto key_gpx = amr_g.getGKey(key_px);
218 auto key_mx = key.moveSpace(x,-1);
219 auto key_gmx = amr_g.getGKey(key_mx);
221 auto key_py = key.moveSpace(y,1);
222 auto key_gpy = amr_g.getGKey(key_py);
224 auto key_my = key.moveSpace(y,-1);
225 auto key_gmy = amr_g.getGKey(key_my);
227 auto key_pz = key.moveSpace(z,1);
228 auto key_gpz = amr_g.getGKey(key_pz);
230 auto key_mz = key.moveSpace(z,-1);
231 auto key_gmz = amr_g.getGKey(key_mz);
233 if (gr_is_inside(key_gpx,amr_g.getGridInfoVoid(it2.getLvl()).getSize()) ==
true)
235 match &= amr_g.template get<0>(key_px) == gkey.get(0) + 1;
236 match &= amr_g.template get<1>(key_px) == gkey.get(1);
237 match &= amr_g.template get<2>(key_px) == gkey.get(2);
239 match &= amr_g.template get<3>(key_px)[0] == gkey.get(0) + 1;
240 match &= amr_g.template get<3>(key_px)[1] == gkey.get(1);
241 match &= amr_g.template get<3>(key_px)[2] == gkey.get(2);
242 match &= amr_g.template get<3>(key_px)[3] == gkey.get(0) + 1;
245 if (gr_is_inside(key_gmx,amr_g.getGridInfoVoid(it2.getLvl()).getSize()) ==
true)
247 match &= amr_g.template get<0>(key_mx) == gkey.get(0) - 1;
248 match &= amr_g.template get<1>(key_mx) == gkey.get(1);
249 match &= amr_g.template get<2>(key_mx) == gkey.get(2);
251 match &= amr_g.template get<3>(key_mx)[0] == gkey.get(0) - 1;
252 match &= amr_g.template get<3>(key_mx)[1] == gkey.get(1);
253 match &= amr_g.template get<3>(key_mx)[2] == gkey.get(2);
254 match &= amr_g.template get<3>(key_mx)[3] == gkey.get(0) - 1;
257 if (gr_is_inside(key_gpy,amr_g.getGridInfoVoid(it2.getLvl()).getSize()) ==
true)
259 match &= amr_g.template get<0>(key_py) == gkey.get(0);
260 match &= amr_g.template get<1>(key_py) == gkey.get(1) + 1;
261 match &= amr_g.template get<2>(key_py) == gkey.get(2);
263 match &= amr_g.template get<3>(key_py)[0] == gkey.get(0);
264 match &= amr_g.template get<3>(key_py)[1] == gkey.get(1) + 1;
265 match &= amr_g.template get<3>(key_py)[2] == gkey.get(2);
266 match &= amr_g.template get<3>(key_py)[3] == gkey.get(0);
269 if (gr_is_inside(key_gmy,amr_g.getGridInfoVoid(it2.getLvl()).getSize()) ==
true)
271 match &= amr_g.template get<0>(key_my) == gkey.get(0);
272 match &= amr_g.template get<1>(key_my) == gkey.get(1) - 1;
273 match &= amr_g.template get<2>(key_my) == gkey.get(2);
275 match &= amr_g.template get<3>(key_my)[0] == gkey.get(0);
276 match &= amr_g.template get<3>(key_my)[1] == gkey.get(1) - 1;
277 match &= amr_g.template get<3>(key_my)[2] == gkey.get(2);
278 match &= amr_g.template get<3>(key_my)[3] == gkey.get(0);
281 if (gr_is_inside(key_gpz,amr_g.getGridInfoVoid(it2.getLvl()).getSize()) ==
true)
283 match &= amr_g.template get<0>(key_pz) == gkey.get(0);
284 match &= amr_g.template get<1>(key_pz) == gkey.get(1);
285 match &= amr_g.template get<2>(key_pz) == gkey.get(2) + 1;
287 match &= amr_g.template get<3>(key_pz)[0] == gkey.get(0);
288 match &= amr_g.template get<3>(key_pz)[1] == gkey.get(1);
289 match &= amr_g.template get<3>(key_pz)[2] == gkey.get(2) + 1;
290 match &= amr_g.template get<3>(key_pz)[3] == gkey.get(0);
293 if (gr_is_inside(key_gmz,amr_g.getGridInfoVoid(it2.getLvl()).getSize()) ==
true)
295 match &= amr_g.template get<0>(key_mz) == gkey.get(0);
296 match &= amr_g.template get<1>(key_mz) == gkey.get(1);
297 match &= amr_g.template get<2>(key_mz) == gkey.get(2) - 1;
299 match &= amr_g.template get<3>(key_mz)[0] == gkey.get(0);
300 match &= amr_g.template get<3>(key_mz)[1] == gkey.get(1);
301 match &= amr_g.template get<3>(key_mz)[2] == gkey.get(2) - 1;
302 match &= amr_g.template get<3>(key_mz)[3] == gkey.get(0);
308 size_t lvl = it2.getLvl();
310 if (lvl < amr_g.getNLvl() - 1)
313 amr_g.moveLvlDw(key_l1);
314 auto key_gl1 = amr_g.getGKey(key_l1);
316 for (
size_t s = 0 ; s < 3 ; s++)
318 match &= key_gl1.get(s) >> 1 == gkey.get(s);
319 match &= amr_g.template get<0>(key_l1) == key_gl1.get(0);
320 match &= amr_g.template get<1>(key_l1) == key_gl1.get(1);
321 match &= amr_g.template get<2>(key_l1) == key_gl1.get(2);
328 amr_g.moveLvlUp(key_l1);
329 auto key_gl1 = amr_g.getGKey(key_l1);
331 for (
size_t s = 0 ; s < 3 ; s++)
333 match &= gkey.get(s) >> 1 == key_gl1.get(s);
335 match &= amr_g.template get<0>(key_l1) == key_gl1.get(0);
336 match &= amr_g.template get<1>(key_l1) == key_gl1.get(1);
337 match &= amr_g.template get<2>(key_l1) == key_gl1.get(2);
344 BOOST_REQUIRE_EQUAL(match,
true);
348template <
typename gr
id>
349void Test3D_amr_child_parent_get_periodic(
grid & amr_g,
Box<3,float> & domain,
size_t coars_g,
size_t n_lvl)
355 size_t g_sz[3] = {coars_g,coars_g,coars_g};
357 size_t tot = coars_g*coars_g*coars_g;
358 size_t correct_result = 0;
361 for (
size_t i = 0 ; i < n_lvl ; i++)
363 correct_result += tot*fact;
367 amr_g.initLevels(n_lvl,g_sz);
371 for (
size_t i = 0 ; i < amr_g.getNLvl() ; i++)
377 auto it = amr_g.getGridIterator(i);
381 auto key = it.get_dist();
382 auto akey = amr_g.getAMRKey(i,key);
384 amr_g.template insert<0>(akey) = 3.0;
394 std::string test = amr_g.getSpacing(0).toString();
397 auto it = amr_g.getDomainIterator();
402 auto gkey = it.getGKey();
404 amr_g.template insert<0>(key) = gkey.get(0);
405 amr_g.template insert<1>(key) = gkey.get(1);
406 amr_g.template insert<2>(key) = gkey.get(2);
411 amr_g.template ghost_get<0,1,2>();
415 auto it2 = amr_g.getDomainIterator();
420 auto key = it2.
get();
421 auto gkey = it2.getGKey();
423 auto key_px = key.moveSpace(x,1);
424 auto key_mx = key.moveSpace(x,-1);
425 auto key_py = key.moveSpace(y,1);
426 auto key_my = key.moveSpace(y,-1);
427 auto key_pz = key.moveSpace(z,1);
428 auto key_mz = key.moveSpace(z,-1);
430 match &= amr_g.template get<0>(key_px) == openfpm::math::positive_modulo(gkey.get(0) + 1,amr_g.getGridInfoVoid(it2.getLvl()).size(0));
431 match &= amr_g.template get<1>(key_px) == gkey.get(1);
432 match &= amr_g.template get<2>(key_px) == gkey.get(2);
434 match &= amr_g.template get<0>(key_mx) == openfpm::math::positive_modulo(gkey.get(0) - 1,amr_g.getGridInfoVoid(it2.getLvl()).size(0));
435 match &= amr_g.template get<1>(key_mx) == gkey.get(1);
436 match &= amr_g.template get<2>(key_mx) == gkey.get(2);
438 match &= amr_g.template get<0>(key_py) == gkey.get(0);
439 match &= amr_g.template get<1>(key_py) == openfpm::math::positive_modulo(gkey.get(1) + 1,amr_g.getGridInfoVoid(it2.getLvl()).size(1));
440 match &= amr_g.template get<2>(key_py) == gkey.get(2);
442 match &= amr_g.template get<0>(key_my) == gkey.get(0);
443 match &= amr_g.template get<1>(key_my) == openfpm::math::positive_modulo(gkey.get(1) - 1,amr_g.getGridInfoVoid(it2.getLvl()).size(1));
444 match &= amr_g.template get<2>(key_my) == gkey.get(2);
446 match &= amr_g.template get<0>(key_pz) == gkey.get(0);
447 match &= amr_g.template get<1>(key_pz) == gkey.get(1);
448 match &= amr_g.template get<2>(key_pz) == openfpm::math::positive_modulo(gkey.get(2) + 1,amr_g.getGridInfoVoid(it2.getLvl()).size(2));
450 match &= amr_g.template get<0>(key_mz) == gkey.get(0);
451 match &= amr_g.template get<1>(key_mz) == gkey.get(1);
452 match &= amr_g.template get<2>(key_mz) == openfpm::math::positive_modulo(gkey.get(2) - 1,amr_g.getGridInfoVoid(it2.getLvl()).size(2));
456 size_t lvl = it2.getLvl();
458 if (lvl < amr_g.getNLvl() - 1)
461 amr_g.moveLvlDw(key_l1);
462 auto key_gl1 = amr_g.getGKey(key_l1);
464 for (
size_t s = 0 ; s < 3 ; s++)
466 match &= key_gl1.get(s) >> 1 == gkey.get(s);
467 match &= amr_g.template get<0>(key_l1) == key_gl1.get(0);
468 match &= amr_g.template get<1>(key_l1) == key_gl1.get(1);
469 match &= amr_g.template get<2>(key_l1) == key_gl1.get(2);
476 amr_g.moveLvlUp(key_l1);
477 auto key_gl1 = amr_g.getGKey(key_l1);
479 for (
size_t s = 0 ; s < 3 ; s++)
481 match &= gkey.get(s) >> 1 == key_gl1.get(s);
483 match &= amr_g.template get<0>(key_l1) == key_gl1.get(0);
484 match &= amr_g.template get<1>(key_l1) == key_gl1.get(1);
485 match &= amr_g.template get<2>(key_l1) == key_gl1.get(2);
492 BOOST_REQUIRE_EQUAL(match,
true);
495template <
typename gr
id>
496void Test3D_amr_ghost_it(
grid & amr_g,
Box<3,float> & domain,
size_t coars_g,
size_t n_lvl)
498 size_t g_sz[3] = {coars_g,coars_g,coars_g};
500 size_t tot = coars_g*coars_g*coars_g;
501 size_t correct_result = 0;
504 for (
size_t i = 0 ; i < n_lvl ; i++)
506 correct_result += tot*fact;
510 amr_g.initLevels(n_lvl,g_sz);
514 for (
size_t i = 0 ; i < amr_g.getNLvl() ; i++)
520 auto it = amr_g.getGridGhostIterator(i);
524 auto key = it.get_dist();
525 auto gkey = it.
get();
526 auto akey = amr_g.getAMRKey(i,key);
528 amr_g.template insert<0>(akey) = gkey.get(0);
529 amr_g.template insert<1>(akey) = gkey.get(1);
530 amr_g.template insert<2>(akey) = gkey.get(2);
532 if (gkey.get(0) == -1 || gkey.get(0) == (
long int)amr_g.getGridInfoVoid(i).size(0) ||
533 gkey.get(1) == -1 || gkey.get(1) == (
long int)amr_g.getGridInfoVoid(i).size(1) ||
534 gkey.get(2) == -1 || gkey.get(2) == (
long int)amr_g.getGridInfoVoid(i).size(2))
540 size_t tot = (amr_g.getGridInfoVoid(i).size(0) + 2)*
541 (amr_g.getGridInfoVoid(i).size(1) + 2)*
542 (amr_g.getGridInfoVoid(i).size(2) + 2) - amr_g.getGridInfoVoid(i).size();
544 auto & v_cl = create_vcluster();
546 if (v_cl.
size() == 1)
551 BOOST_REQUIRE_EQUAL(tot,count);
555 auto it2 = amr_g.getDomainIterator(i);
559 auto key = it2.
get();
563 auto key_m1 = key.move(0,-1);
564 auto key_gm1 = it2.getGKey(key_m1);
565 match &= amr_g.template get<0>(i,key_m1) == key_gm1.get(0);
569 auto key_p1 = key.move(0,1);
570 auto key_gp1 = it2.getGKey(key_p1);
571 match &= amr_g.template get<0>(i,key_p1) == key_gp1.get(0);
575 key_m1 = key.move(1,-1);
576 key_gm1 = it2.getGKey(key_m1);
577 match &= amr_g.template get<1>(i,key_m1) == key_gm1.get(1);
581 key_p1 = key.move(1,1);
582 key_gp1 = it2.getGKey(key_p1);
583 match &= amr_g.template get<1>(i,key_p1) == key_gp1.get(1);
587 key_m1 = key.move(2,-1);
588 key_gm1 = it2.getGKey(key_m1);
589 match &= amr_g.template get<2>(i,key_m1) == key_gm1.get(2);
593 key_p1 = key.move(2,1);
594 key_gp1 = it2.getGKey(key_p1);
595 match &= amr_g.template get<2>(i,key_p1) == key_gp1.get(2);
600 BOOST_REQUIRE_EQUAL(match,
true);
606template <
typename gr
id>
607void Test3D_amr_domain_ghost_it(
grid & amr_g,
Box<3,float> & domain,
size_t coars_g,
size_t n_lvl)
609 size_t g_sz[3] = {coars_g,coars_g,coars_g};
611 size_t tot = coars_g*coars_g*coars_g;
612 size_t correct_result = 0;
615 for (
size_t i = 0 ; i < n_lvl ; i++)
617 correct_result += tot*fact;
621 amr_g.initLevels(n_lvl,g_sz);
623 size_t total_all_level = 0;
627 for (
size_t i = 0 ; i < amr_g.getNLvl() ; i++)
633 auto it = amr_g.getGridGhostIterator(i);
637 auto key = it.get_dist();
638 auto gkey = it.
get();
639 auto akey = amr_g.getAMRKey(i,key);
641 amr_g.template insert<0>(akey) = gkey.get(0);
642 amr_g.template insert<1>(akey) = gkey.get(1);
643 amr_g.template insert<2>(akey) = gkey.get(2);
650 size_t tot = (amr_g.getGridInfoVoid(i).size(0) + 2)*
651 (amr_g.getGridInfoVoid(i).size(1) + 2)*
652 (amr_g.getGridInfoVoid(i).size(2) + 2);
654 auto & v_cl = create_vcluster();
656 if (v_cl.
size() == 1)
661 BOOST_REQUIRE_EQUAL(tot,count);
666 auto it2 = amr_g.getDomainGhostIterator(i);
670 auto key = it2.
get();
671 auto key_g = it2.getGKey(key);
672 match &= amr_g.template get<0>(i,key) == key_g.get(0);
680 BOOST_REQUIRE_EQUAL(amr_cnt,count);
681 BOOST_REQUIRE_EQUAL(match,
true);
686 size_t gtot_count = 0;
687 auto tot_it = amr_g.getDomainGhostIterator();
689 while (tot_it.isNext())
696 BOOST_REQUIRE_EQUAL(gtot_count,total_all_level);
699template<
typename gr
id_amr>
700void Test3D_ghost_put(grid_amr & g_dist_amr,
long int k)
702 size_t sz[3] = {(size_t)k,(
size_t)k,(size_t)k};
704 g_dist_amr.initLevels(4,sz);
711 for (
size_t i = 0 ; i < g_dist_amr.getNLvl() ; i++)
713 auto dom = g_dist_amr.getGridIterator(i);
717 auto key = dom.get_dist();
719 g_dist_amr.template insert<0>(i,key) = -6.0;
731 auto dom = g_dist_amr.getDomainIterator();
735 auto key = dom.
get();
737 g_dist_amr.template insert<0>(key.moveSpace(0,1)) += 1.0;
738 g_dist_amr.template insert<0>(key.moveSpace(0,-1)) += 1.0;
739 g_dist_amr.template insert<0>(key.moveSpace(1,1)) += 1.0;
740 g_dist_amr.template insert<0>(key.moveSpace(1,-1)) += 1.0;
741 g_dist_amr.template insert<0>(key.moveSpace(2,1)) += 1.0;
742 g_dist_amr.template insert<0>(key.moveSpace(2,-1)) += 1.0;
751 auto dom_gi = g_dist_amr.getDomainIterator();
753 while (dom_gi.isNext())
755 auto key = dom_gi.
get();
757 correct &= (g_dist_amr.template get<0>(key) == 0);
762 g_dist_amr.template ghost_put<add_,0>();
765 {BOOST_REQUIRE_EQUAL(correct,
false);}
768 g_dist_amr.template ghost_get<0>();
773 auto dom_gi2 = g_dist_amr.getDomainIterator();
775 while (dom_gi2.isNext())
777 auto key = dom_gi2.
get();
779 correct &= (g_dist_amr.template get<0>(key) == 0);
784 BOOST_REQUIRE_EQUAL(correct,
true);
790BOOST_AUTO_TEST_CASE( grid_dist_amr_get_child_test_nop )
795 long int k = 16*16*16*create_vcluster().getProcessingUnits();
796 k = std::pow(k, 1/3.);
801 Test3D_amr_child_parent_get_no_periodic(amr_g,domain3,k,4);
804BOOST_AUTO_TEST_CASE( grid_dist_amr_get_child_test_p )
809 long int k = 16*16*16*create_vcluster().getProcessingUnits();
810 k = std::pow(k, 1/3.);
817 Test3D_amr_child_parent_get_periodic(amr_g,domain3,k,4);
820BOOST_AUTO_TEST_CASE( grid_dist_amr_test )
825 long int k = 16*16*16*create_vcluster().getProcessingUnits();
826 k = std::pow(k, 1/3.);
831 Test3D_amr_create_levels(amr_g,domain3,k,4);
835 Test3D_amr_create_levels(amr_g2,domain3,k,4);
838BOOST_AUTO_TEST_CASE( grid_dist_amr_ghost_it_test )
843 long int k = 16*16*16*create_vcluster().getProcessingUnits();
844 k = std::pow(k, 1/3.);
849 Test3D_amr_ghost_it(amr_g,domain3,k,4);
853 Test3D_amr_ghost_it(amr_g2,domain3,k,4);
855 for (
size_t i = 0 ; i < amr_g2.getNLvl() ; i++)
856 {BOOST_REQUIRE(amr_g2.size_inserted(i) != 0ul);}
860 for (
size_t i = 0 ; i < amr_g2.getNLvl() ; i++)
861 {BOOST_REQUIRE_EQUAL(amr_g2.size_inserted(i),0ul);}
864BOOST_AUTO_TEST_CASE( grid_dist_amr_domain_ghost_it_test )
869 long int k = 16*16*16*create_vcluster().getProcessingUnits();
870 k = std::pow(k, 1/3.);
875 Test3D_amr_domain_ghost_it(amr_g,domain3,k,4);
879 Test3D_amr_domain_ghost_it(amr_g2,domain3,k,4);
881 for (
size_t i = 0 ; i < amr_g2.getNLvl() ; i++)
882 {BOOST_REQUIRE(amr_g2.size_inserted(i) != 0ul);}
886 for (
size_t i = 0 ; i < amr_g2.getNLvl() ; i++)
887 {BOOST_REQUIRE_EQUAL(amr_g2.size_inserted(i),0ul);}
890BOOST_AUTO_TEST_CASE( grid_dist_amr_get_child_test_low_res )
900 Test3D_amr_child_parent_get_no_periodic(amr_g,domain3,k,4);
904 Test3D_amr_child_parent_get_no_periodic(amr_g2,domain3,k,4);
907BOOST_AUTO_TEST_CASE( grid_dist_amr_test_background_value )
916 size_t g_sz[3] = {4,4,4};
918 amr_g2.initLevels(4,g_sz);
925 amr_g2.setBackgroundValue(bck);
931 long int bck0 = amr_g2.get<0>(2,key);
932 BOOST_REQUIRE_EQUAL(bck0,-57);
933 long int bck1 = amr_g2.get<1>(2,key);
934 BOOST_REQUIRE_EQUAL(bck1,-90);
935 long int bck2 = amr_g2.get<2>(2,key);
936 BOOST_REQUIRE_EQUAL(bck2,-123);
939 amr_g2.insert<0>(2,key) = 5;
942 bck0 = amr_g2.get<0>(2,key2);
943 BOOST_REQUIRE_EQUAL(bck0,-57);
944 bck1 = amr_g2.get<1>(2,key2);
945 BOOST_REQUIRE_EQUAL(bck1,-90);
946 bck2 = amr_g2.get<2>(2,key2);
947 BOOST_REQUIRE_EQUAL(bck2,-123);
949 auto & g_dist_lvl2 = amr_g2.getDistGrid(2);
950 g_dist_lvl2.get_loc_grid(0).internal_clear_cache();
952 bck0 = amr_g2.get<0>(2,key2);
953 BOOST_REQUIRE_EQUAL(bck0,-57);
954 bck1 = amr_g2.get<1>(2,key2);
955 BOOST_REQUIRE_EQUAL(bck1,-90);
956 bck2 = amr_g2.get<2>(2,key2);
957 BOOST_REQUIRE_EQUAL(bck2,-123);
961BOOST_AUTO_TEST_CASE( grid_dist_amr_get_domain_ghost_check )
969 if ( v_cl.getProcessingUnits() > 32 )
974 BOOST_TEST_CHECKPOINT(
"Testing grid periodic k<=" << k );
985 Test3D_ghost_put(g_dist,k);
990 Test3D_ghost_put(sg_dist,k);
993BOOST_AUTO_TEST_CASE( grid_dist_amr_ghost_put_create )
1001 if ( v_cl.getProcessingUnits() > 32 )
1006 BOOST_TEST_CHECKPOINT(
"Testing grid periodic k<=" << k );
1017 Test3D_ghost_put(g_dist,k);
1022 Test3D_ghost_put(sg_dist,k);
1025BOOST_AUTO_TEST_SUITE_END()
This class represent an N-dimensional box.
void execute()
Execute all the requests.
size_t size()
Get the total number of processors.
void sum(T &num)
Sum the numbers across all processors and get the result.
Implementation of VCluster class.
Grid key for a distributed grid.
grid_key_dx is the key to access any element in the grid
__device__ __host__ index_type get(index_type i) const
Get the i index.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
__device__ __host__ boost::mpl::at< type, boost::mpl::int_< i > >::type & get()
get the properties i