9 #include <boost/test/unit_test.hpp>
20 using namespace detail;
25 using Point = std::array<double, 1>;
26 using indices = std::array<size_t, 1>;
31 BOOST_CHECK_EQUAL(g.
size(), 6
u);
58 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1}}), 1
u);
59 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2}}), 2
u);
60 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3}}), 3
u);
61 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4}}), 4
u);
62 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5}}), 5
u);
64 BOOST_CHECK(
g.localBinsFromGlobalBin(
65 g.globalBinFromPosition(Point({{2.7}}))) == indices({{3}}));
68 BOOST_CHECK(not
g.isInside(Point({{-2.}})));
69 BOOST_CHECK(
g.isInside(Point({{0.}})));
70 BOOST_CHECK(
g.isInside(Point({{2.5}})));
71 BOOST_CHECK(not
g.isInside(Point({{4.}})));
72 BOOST_CHECK(not
g.isInside(Point({{6.}})));
98 const auto&
point = Point({{0.7}});
99 size_t globalBin =
g.globalBinFromPosition(
point);
100 indices localBins =
g.localBinsFromGlobalBin(globalBin);
102 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
103 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
107 using Point = std::array<double, 2>;
108 using indices = std::array<size_t, 2>;
112 std::make_tuple(std::move(a), std::move(b)));
115 BOOST_CHECK_EQUAL(g.
size(), 30
u);
200 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1}}), 1
u);
201 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 2}}), 2
u);
202 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 3}}), 3
u);
203 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 4}}), 4
u);
204 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 0}}), 5
u);
205 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1}}), 6
u);
206 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 2}}), 7
u);
207 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 3}}), 8
u);
208 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 4}}), 9
u);
209 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 0}}), 10
u);
210 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 1}}), 11
u);
211 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 2}}), 12
u);
212 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3}}), 13
u);
213 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 4}}), 14
u);
214 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0}}), 15
u);
215 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 1}}), 16
u);
216 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 2}}), 17
u);
217 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 3}}), 18
u);
218 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 4}}), 19
u);
219 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 0}}), 20
u);
220 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 1}}), 21
u);
221 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 2}}), 22
u);
222 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 3}}), 23
u);
223 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 4}}), 24
u);
224 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 0}}), 25
u);
225 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 1}}), 26
u);
226 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 2}}), 27
u);
227 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 3}}), 28
u);
228 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 4}}), 29
u);
230 BOOST_CHECK(
g.localBinsFromGlobalBin(
g.globalBinFromPosition(
231 Point({{1.2, 0.7}}))) == indices({{2, 1}}));
234 BOOST_CHECK(not
g.isInside(Point({{-2., -1}})));
235 BOOST_CHECK(not
g.isInside(Point({{-2., 1.}})));
236 BOOST_CHECK(not
g.isInside(Point({{-2., 5.}})));
237 BOOST_CHECK(not
g.isInside(Point({{1., -1.}})));
238 BOOST_CHECK(not
g.isInside(Point({{6., -1.}})));
239 BOOST_CHECK(
g.isInside(Point({{0.5, 1.3}})));
240 BOOST_CHECK(not
g.isInside(Point({{4., -1.}})));
241 BOOST_CHECK(not
g.isInside(Point({{4., 0.3}})));
242 BOOST_CHECK(not
g.isInside(Point({{4., 3.}})));
243 BOOST_CHECK(not
g.isInside(Point({{-1., 3.}})));
244 BOOST_CHECK(not
g.isInside(Point({{2., 3.}})));
245 BOOST_CHECK(not
g.isInside(Point({{5., 3.}})));
271 const auto&
point = Point({{0.7, 1.3}});
272 size_t globalBin =
g.globalBinFromPosition(
point);
273 indices localBins =
g.localBinsFromGlobalBin(globalBin);
275 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
276 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
280 using Point = std::array<double, 3>;
281 using indices = std::array<size_t, 3>;
286 std::make_tuple(std::move(a), std::move(b), std::move(c)));
289 BOOST_CHECK_EQUAL(g.
size(), 80
u);
360 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 0, 1}}), 1
u);
361 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 0, 2}}), 2
u);
362 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 0, 3}}), 3
u);
363 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1, 0}}), 4
u);
364 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1, 1}}), 5
u);
365 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1, 2}}), 6
u);
366 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1, 3}}), 7
u);
367 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1, 0}}), 24
u);
368 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1, 1}}), 25
u);
369 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1, 2}}), 26
u);
370 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1, 3}}), 27
u);
371 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3, 0}}), 52
u);
372 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3, 1}}), 53
u);
373 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3, 2}}), 54
u);
374 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3, 3}}), 55
u);
375 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0, 0}}), 60
u);
376 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0, 1}}), 61
u);
377 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0, 2}}), 62
u);
378 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0, 3}}), 63
u);
379 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 4, 0}}), 76
u);
380 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 4, 1}}), 77
u);
381 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 4, 2}}), 78
u);
382 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 4, 3}}), 79
u);
384 BOOST_CHECK(
g.localBinsFromGlobalBin(
g.globalBinFromPosition(
385 Point({{1.2, 0.7, 1.4}}))) == indices({{2, 1, 2}}));
388 BOOST_CHECK(not
g.isInside(Point({{-2., -1, -2}})));
389 BOOST_CHECK(not
g.isInside(Point({{-2., 1., 0.}})));
390 BOOST_CHECK(not
g.isInside(Point({{-2., 5., -1}})));
391 BOOST_CHECK(not
g.isInside(Point({{1., -1., 1.}})));
392 BOOST_CHECK(not
g.isInside(Point({{6., -1., 4.}})));
393 BOOST_CHECK(
g.isInside(Point({{0.5, 1.3, 1.7}})));
394 BOOST_CHECK(not
g.isInside(Point({{2., -1., -0.4}})));
395 BOOST_CHECK(not
g.isInside(Point({{2., 0.3, 3.4}})));
396 BOOST_CHECK(not
g.isInside(Point({{2., 3., 0.8}})));
397 BOOST_CHECK(not
g.isInside(Point({{-1., 3., 5.}})));
398 BOOST_CHECK(not
g.isInside(Point({{2., 3., -1.}})));
399 BOOST_CHECK(not
g.isInside(Point({{5., 3., 0.5}})));
429 const auto&
point = Point({{0.7, 2.3, 1.3}});
430 size_t globalBin =
g.globalBinFromPosition(
point);
431 indices localBins =
g.localBinsFromGlobalBin(globalBin);
433 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
434 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
438 using Point = std::array<double, 1>;
439 using indices = std::array<size_t, 1>;
444 BOOST_CHECK_EQUAL(g.size(), 4
u);
445 BOOST_CHECK_EQUAL(g.numLocalBins().at(0), 2
u);
448 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-0.3}})), 0
u);
449 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.}})), 1
u);
450 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.7}})), 1
u);
451 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1}})), 2
u);
452 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1.2}})), 2
u);
453 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{2.7}})), 2
u);
454 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{4.}})), 3
u);
455 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{4.98}})), 3
u);
458 BOOST_CHECK(g.localBinsFromGlobalBin(0) == indices({{0}}));
459 BOOST_CHECK(g.localBinsFromGlobalBin(1) == indices({{1}}));
460 BOOST_CHECK(g.localBinsFromGlobalBin(2) == indices({{2}}));
461 BOOST_CHECK(g.localBinsFromGlobalBin(3) == indices({{3}}));
464 BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{0}}), 0
u);
465 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1}}), 1
u);
466 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2}}), 2
u);
467 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3}}), 3
u);
469 BOOST_CHECK(
g.localBinsFromGlobalBin(
470 g.globalBinFromPosition(Point({{0.8}}))) == indices({{1}}));
473 BOOST_CHECK(not
g.isInside(Point({{-2.}})));
474 BOOST_CHECK(
g.isInside(Point({{0.}})));
475 BOOST_CHECK(
g.isInside(Point({{2.5}})));
476 BOOST_CHECK(not
g.isInside(Point({{4.}})));
477 BOOST_CHECK(not
g.isInside(Point({{6.}})));
497 const auto&
point = Point({{0.7}});
498 size_t globalBin =
g.globalBinFromPosition(
point);
499 indices localBins =
g.localBinsFromGlobalBin(globalBin);
501 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
502 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
506 using Point = std::array<double, 2>;
507 using indices = std::array<size_t, 2>;
511 std::make_tuple(std::move(
a), std::move(
b)));
514 BOOST_CHECK_EQUAL(g.size(), 16
u);
515 BOOST_CHECK_EQUAL(g.numLocalBins().at(0), 2
u);
516 BOOST_CHECK_EQUAL(g.numLocalBins().at(1), 2
u);
519 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0}})), 5
u);
520 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 1}})), 6
u);
521 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 4}})), 7
u);
522 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.5, 0}})), 9
u);
523 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.5, 1}})), 10
u);
524 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.5, 4}})), 11
u);
525 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{3, 0}})), 13
u);
526 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{3, 1}})), 14
u);
527 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{3, 4}})), 15
u);
530 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.3, 1.2}})), 6
u);
531 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{3.3, 2.2}})), 14
u);
532 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1.8, 0.9}})), 9
u);
533 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{3.1, 0.7}})), 13
u);
534 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{2.3, 1.4}})), 10
u);
535 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{2, -3}})), 8
u);
536 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 8}})), 11
u);
537 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-3, 1}})), 2
u);
538 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{11, 3}})), 14
u);
539 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-3, -2}})), 0
u);
540 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{7, -2}})), 12
u);
541 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-1, 12}})), 3
u);
542 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{11, 12}})), 15
u);
545 BOOST_CHECK(g.localBinsFromGlobalBin(0) == indices({{0, 0}}));
546 BOOST_CHECK(g.localBinsFromGlobalBin(1) == indices({{0, 1}}));
547 BOOST_CHECK(g.localBinsFromGlobalBin(2) == indices({{0, 2}}));
548 BOOST_CHECK(g.localBinsFromGlobalBin(3) == indices({{0, 3}}));
549 BOOST_CHECK(g.localBinsFromGlobalBin(4) == indices({{1, 0}}));
550 BOOST_CHECK(g.localBinsFromGlobalBin(5) == indices({{1, 1}}));
551 BOOST_CHECK(g.localBinsFromGlobalBin(6) == indices({{1, 2}}));
552 BOOST_CHECK(g.localBinsFromGlobalBin(7) == indices({{1, 3}}));
553 BOOST_CHECK(g.localBinsFromGlobalBin(8) == indices({{2, 0}}));
554 BOOST_CHECK(g.localBinsFromGlobalBin(9) == indices({{2, 1}}));
555 BOOST_CHECK(g.localBinsFromGlobalBin(10) == indices({{2, 2}}));
556 BOOST_CHECK(g.localBinsFromGlobalBin(11) == indices({{2, 3}}));
557 BOOST_CHECK(g.localBinsFromGlobalBin(12) == indices({{3, 0}}));
558 BOOST_CHECK(g.localBinsFromGlobalBin(13) == indices({{3, 1}}));
559 BOOST_CHECK(g.localBinsFromGlobalBin(14) == indices({{3, 2}}));
560 BOOST_CHECK(g.localBinsFromGlobalBin(15) == indices({{3, 3}}));
563 BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{0, 0}}), 0
u);
564 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1}}), 1
u);
565 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 2}}), 2
u);
566 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 3}}), 3
u);
567 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 0}}), 4
u);
568 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1}}), 5
u);
569 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 2}}), 6
u);
570 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 3}}), 7
u);
571 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 0}}), 8
u);
572 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 1}}), 9
u);
573 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 2}}), 10
u);
574 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3}}), 11
u);
575 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0}}), 12
u);
576 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 1}}), 13
u);
577 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 2}}), 14
u);
578 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 3}}), 15
u);
580 BOOST_CHECK(
g.localBinsFromGlobalBin(
g.globalBinFromPosition(
581 Point({{3.2, 1.8}}))) == indices({{3, 2}}));
584 BOOST_CHECK(not
g.isInside(Point({{-2., -1}})));
585 BOOST_CHECK(not
g.isInside(Point({{-2., 1.}})));
586 BOOST_CHECK(not
g.isInside(Point({{-2., 5.}})));
587 BOOST_CHECK(not
g.isInside(Point({{1., -1.}})));
588 BOOST_CHECK(not
g.isInside(Point({{6., -1.}})));
589 BOOST_CHECK(
g.isInside(Point({{0.5, 1.3}})));
590 BOOST_CHECK(not
g.isInside(Point({{3., -1.}})));
591 BOOST_CHECK(not
g.isInside(Point({{3., 0.3}})));
592 BOOST_CHECK(not
g.isInside(Point({{3., 4.}})));
593 BOOST_CHECK(not
g.isInside(Point({{-1., 4.}})));
594 BOOST_CHECK(not
g.isInside(Point({{2., 4.}})));
595 BOOST_CHECK(not
g.isInside(Point({{5., 4.}})));
621 const auto&
point = Point({{0.7, 1.3}});
622 size_t globalBin =
g.globalBinFromPosition(
point);
623 indices localBins =
g.localBinsFromGlobalBin(globalBin);
625 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
626 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
630 using Point = std::array<double, 3>;
631 using indices = std::array<size_t, 3>;
636 std::make_tuple(std::move(
a), std::move(
b), std::move(
c)));
639 BOOST_CHECK_EQUAL(g.size(), 60
u);
640 BOOST_CHECK_EQUAL(g.numLocalBins().at(0), 1
u);
641 BOOST_CHECK_EQUAL(g.numLocalBins().at(1), 2
u);
642 BOOST_CHECK_EQUAL(g.numLocalBins().at(2), 3
u);
645 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0, 0}})), 26
u);
646 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0, 0}})), 46
u);
647 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0.5, 0}})), 31
u);
648 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0.5, 0}})), 51
u);
649 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 3, 0}})), 36
u);
650 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 3, 0}})), 56
u);
651 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0, 0.5}})), 27
u);
652 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0, 0.5}})), 47
u);
653 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0.5, 0.5}})), 32
u);
654 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0.5, 0.5}})), 52
u);
655 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 3, 0.5}})), 37
u);
656 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 3, 0.5}})), 57
u);
657 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0, 3}})), 28
u);
658 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0, 3}})), 48
u);
659 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0.5, 3}})), 33
u);
660 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0.5, 3}})), 53
u);
661 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 3, 3}})), 38
u);
662 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 3, 3}})), 58
u);
663 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0, 3.3}})), 29
u);
664 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0, 3.3}})), 49
u);
665 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0.5, 3.3}})), 34
u);
666 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0.5, 3.3}})), 54
u);
667 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 3, 3.3}})), 39
u);
668 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 3, 3.3}})), 59
u);
671 BOOST_CHECK(g.localBinsFromGlobalBin(0) == indices({{0, 0, 0}}));
672 BOOST_CHECK(g.localBinsFromGlobalBin(1) == indices({{0, 0, 1}}));
673 BOOST_CHECK(g.localBinsFromGlobalBin(2) == indices({{0, 0, 2}}));
674 BOOST_CHECK(g.localBinsFromGlobalBin(3) == indices({{0, 0, 3}}));
675 BOOST_CHECK(g.localBinsFromGlobalBin(4) == indices({{0, 0, 4}}));
676 BOOST_CHECK(g.localBinsFromGlobalBin(5) == indices({{0, 1, 0}}));
677 BOOST_CHECK(g.localBinsFromGlobalBin(21) == indices({{1, 0, 1}}));
678 BOOST_CHECK(g.localBinsFromGlobalBin(22) == indices({{1, 0, 2}}));
679 BOOST_CHECK(g.localBinsFromGlobalBin(23) == indices({{1, 0, 3}}));
680 BOOST_CHECK(g.localBinsFromGlobalBin(24) == indices({{1, 0, 4}}));
681 BOOST_CHECK(g.localBinsFromGlobalBin(25) == indices({{1, 1, 0}}));
682 BOOST_CHECK(g.localBinsFromGlobalBin(26) == indices({{1, 1, 1}}));
683 BOOST_CHECK(g.localBinsFromGlobalBin(57) == indices({{2, 3, 2}}));
684 BOOST_CHECK(g.localBinsFromGlobalBin(58) == indices({{2, 3, 3}}));
685 BOOST_CHECK(g.localBinsFromGlobalBin(59) == indices({{2, 3, 4}}));
688 BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{0, 0, 0}}), 0
u);
689 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 0, 0}}), 20
u);
690 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 0, 0}}), 40
u);
691 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1, 0}}), 5
u);
692 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1, 0}}), 25
u);
693 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 1, 0}}), 45
u);
694 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 3, 1}}), 16
u);
695 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 3, 1}}), 36
u);
696 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3, 1}}), 56
u);
697 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 0, 2}}), 2
u);
698 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 0, 2}}), 22
u);
699 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 0, 2}}), 42
u);
700 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 3, 4}}), 19
u);
701 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 3, 4}}), 39
u);
702 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3, 4}}), 59
u);
704 BOOST_CHECK(
g.localBinsFromGlobalBin(
g.globalBinFromPosition(
705 Point({{1.8, 0.7, 3.2}}))) == indices({{2, 2, 3}}));
708 BOOST_CHECK(not
g.isInside(Point({{-2., -1, -2}})));
709 BOOST_CHECK(not
g.isInside(Point({{-2., 1., 0.}})));
710 BOOST_CHECK(not
g.isInside(Point({{-2., 5., -1}})));
711 BOOST_CHECK(not
g.isInside(Point({{1., -1., 1.}})));
712 BOOST_CHECK(not
g.isInside(Point({{6., -1., 4.}})));
713 BOOST_CHECK(
g.isInside(Point({{0.5, 1.3, 1.7}})));
714 BOOST_CHECK(not
g.isInside(Point({{1., -1., -0.4}})));
715 BOOST_CHECK(not
g.isInside(Point({{1., 0.3, 3.4}})));
716 BOOST_CHECK(not
g.isInside(Point({{1., 3., 0.8}})));
717 BOOST_CHECK(not
g.isInside(Point({{-1., 3., 5.}})));
718 BOOST_CHECK(not
g.isInside(Point({{2., 3., -1.}})));
719 BOOST_CHECK(not
g.isInside(Point({{5., 3., 0.5}})));
761 const auto&
point = Point({{0.7, 1.3, 3.7}});
762 size_t globalBin =
g.globalBinFromPosition(
point);
763 indices localBins =
g.localBinsFromGlobalBin(globalBin);
765 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
766 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
770 using Point = std::array<double, 2>;
771 using indices = std::array<size_t, 2>;
775 std::make_tuple(std::move(a), std::move(
b)));
778 BOOST_CHECK_EQUAL(g.size(), 24
u);
779 BOOST_CHECK_EQUAL(g.numLocalBins().at(0), 4
u);
780 BOOST_CHECK_EQUAL(g.numLocalBins().at(1), 2
u);
783 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0}})), 5
u);
784 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.25, 0}})), 9
u);
785 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.5, 0}})), 13
u);
786 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.75, 0}})), 17
u);
787 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0}})), 21
u);
788 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0.5}})), 6
u);
789 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.25, 0.5}})), 10
u);
790 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.5, 0.5}})), 14
u);
791 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.75, 0.5}})), 18
u);
792 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0.5}})), 22
u);
793 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 3}})), 7
u);
794 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.25, 3}})), 11
u);
795 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.5, 3}})), 15
u);
796 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.75, 3}})), 19
u);
797 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 3}})), 23
u);
800 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1.2, 0.3}})), 21
u);
801 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.2, 1.3}})), 6
u);
802 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.9, 1.8}})), 18
u);
803 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.7, 2.1}})), 14
u);
804 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.4, 0.3}})), 9
u);
805 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-3, 2}})), 2
u);
806 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{8, 1}})), 22
u);
807 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.1, -3}})), 4
u);
808 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.8, 11}})), 19
u);
809 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-2, -3}})), 0
u);
810 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-2, 7}})), 3
u);
811 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{12, -1}})), 20
u);
812 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{12, 11}})), 23
u);
815 using indices = std::array<size_t, 2>;
816 BOOST_CHECK(g.localBinsFromGlobalBin(0) == indices({{0, 0}}));
817 BOOST_CHECK(g.localBinsFromGlobalBin(1) == indices({{0, 1}}));
818 BOOST_CHECK(g.localBinsFromGlobalBin(2) == indices({{0, 2}}));
819 BOOST_CHECK(g.localBinsFromGlobalBin(3) == indices({{0, 3}}));
820 BOOST_CHECK(g.localBinsFromGlobalBin(4) == indices({{1, 0}}));
821 BOOST_CHECK(g.localBinsFromGlobalBin(5) == indices({{1, 1}}));
822 BOOST_CHECK(g.localBinsFromGlobalBin(6) == indices({{1, 2}}));
823 BOOST_CHECK(g.localBinsFromGlobalBin(7) == indices({{1, 3}}));
824 BOOST_CHECK(g.localBinsFromGlobalBin(8) == indices({{2, 0}}));
825 BOOST_CHECK(g.localBinsFromGlobalBin(9) == indices({{2, 1}}));
826 BOOST_CHECK(g.localBinsFromGlobalBin(10) == indices({{2, 2}}));
827 BOOST_CHECK(g.localBinsFromGlobalBin(11) == indices({{2, 3}}));
828 BOOST_CHECK(g.localBinsFromGlobalBin(12) == indices({{3, 0}}));
829 BOOST_CHECK(g.localBinsFromGlobalBin(13) == indices({{3, 1}}));
830 BOOST_CHECK(g.localBinsFromGlobalBin(14) == indices({{3, 2}}));
831 BOOST_CHECK(g.localBinsFromGlobalBin(15) == indices({{3, 3}}));
832 BOOST_CHECK(g.localBinsFromGlobalBin(16) == indices({{4, 0}}));
833 BOOST_CHECK(g.localBinsFromGlobalBin(17) == indices({{4, 1}}));
834 BOOST_CHECK(g.localBinsFromGlobalBin(18) == indices({{4, 2}}));
835 BOOST_CHECK(g.localBinsFromGlobalBin(19) == indices({{4, 3}}));
836 BOOST_CHECK(g.localBinsFromGlobalBin(20) == indices({{5, 0}}));
837 BOOST_CHECK(g.localBinsFromGlobalBin(21) == indices({{5, 1}}));
838 BOOST_CHECK(g.localBinsFromGlobalBin(22) == indices({{5, 2}}));
839 BOOST_CHECK(g.localBinsFromGlobalBin(23) == indices({{5, 3}}));
842 BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{0, 0}}), 0
u);
843 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1}}), 1
u);
844 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 2}}), 2
u);
845 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 3}}), 3
u);
846 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 0}}), 4
u);
847 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1}}), 5
u);
848 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 2}}), 6
u);
849 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 3}}), 7
u);
850 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 0}}), 8
u);
851 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 1}}), 9
u);
852 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 2}}), 10
u);
853 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3}}), 11
u);
854 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0}}), 12
u);
855 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 1}}), 13
u);
856 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 2}}), 14
u);
857 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 3}}), 15
u);
858 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 0}}), 16
u);
859 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 1}}), 17
u);
860 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 2}}), 18
u);
861 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 3}}), 19
u);
862 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 0}}), 20
u);
863 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 1}}), 21
u);
864 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 2}}), 22
u);
865 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 3}}), 23
u);
867 BOOST_CHECK(
g.localBinsFromGlobalBin(
g.globalBinFromPosition(
868 Point({{1.1, 1.7}}))) == indices({{5, 2}}));
871 BOOST_CHECK(not
g.isInside(Point({{-2., -1}})));
872 BOOST_CHECK(not
g.isInside(Point({{-2., 1.}})));
873 BOOST_CHECK(not
g.isInside(Point({{-2., 5.}})));
874 BOOST_CHECK(not
g.isInside(Point({{0.1, -1.}})));
875 BOOST_CHECK(not
g.isInside(Point({{6., -1.}})));
876 BOOST_CHECK(
g.isInside(Point({{0.5, 1.3}})));
877 BOOST_CHECK(not
g.isInside(Point({{1., -1.}})));
878 BOOST_CHECK(not
g.isInside(Point({{1., 0.3}})));
879 BOOST_CHECK(not
g.isInside(Point({{1., 3.}})));
880 BOOST_CHECK(not
g.isInside(Point({{-1., 3.}})));
881 BOOST_CHECK(not
g.isInside(Point({{0.2, 3.}})));
882 BOOST_CHECK(not
g.isInside(Point({{5., 3.}})));
920 const auto&
point = Point({{1.3, 3.7}});
921 size_t globalBin =
g.globalBinFromPosition(
point);
922 indices localBins =
g.localBinsFromGlobalBin(globalBin);
924 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
925 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
932 std::make_tuple(std::move(a), std::move(
b)));
935 using Point = std::array<double, 2>;
936 g.atPosition(Point({{0, 0}})) = 0.;
937 g.atPosition(Point({{1.5, 0}})) = 1.;
938 g.atPosition(Point({{3, 0}})) = 2.;
939 g.atPosition(Point({{4.5, 0}})) = 3.;
940 g.atPosition(Point({{6, 0}})) = 4.;
941 g.atPosition(Point({{0, 1.5}})) = 5.;
942 g.atPosition(Point({{1.5, 1.5}})) = 6.;
943 g.atPosition(Point({{3, 1.5}})) = 7.;
944 g.atPosition(Point({{4.5, 1.5}})) = 8.;
945 g.atPosition(Point({{6, 1.5}})) = 9.;
946 g.atPosition(Point({{0, 3}})) = 10.;
947 g.atPosition(Point({{1.5, 3}})) = 11.;
948 g.atPosition(Point({{3, 3}})) = 12.;
949 g.atPosition(Point({{4.5, 3}})) = 13.;
950 g.atPosition(Point({{6, 3}})) = 14.;
953 BOOST_CHECK_EQUAL(g.size(), 24
u);
956 BOOST_CHECK_EQUAL(g.atPosition(Point({{1.2, 0.3}})), 0.);
957 BOOST_CHECK_EQUAL(g.atPosition(Point({{2.2, 1.3}})), 1.);
958 BOOST_CHECK_EQUAL(g.atPosition(Point({{4.9, 1.8}})), 8.);
959 BOOST_CHECK_EQUAL(g.atPosition(Point({{3.7, 2.1}})), 7.);
960 BOOST_CHECK_EQUAL(g.atPosition(Point({{0.4, 2.3}})), 5.);
964 using Point = std::array<double, 3>;
969 std::make_tuple(std::move(a), std::move(b), std::move(c)));
1006 using bins_t = std::vector<size_t>;
1015 Grid1_t g1(std::make_tuple(
a));
1016 Grid2_t g2(std::make_tuple(
a,
b));
1017 Grid3_t g3(std::make_tuple(std::move(
a), std::move(
b), std::move(
c)));
1021 BOOST_CHECK(g1.neighborHoodIndices({{0}}, 1).collect()
1023 BOOST_CHECK(g1.neighborHoodIndices({{0}}, 2).collect()
1024 == bins_t({0, 1, 2}));
1025 BOOST_CHECK(g1.neighborHoodIndices({{1}}, 1).collect()
1026 == bins_t({0, 1, 2}));
1027 BOOST_CHECK(g1.neighborHoodIndices({{1}}, 3).collect()
1028 == bins_t({0, 1, 2, 3, 4}));
1029 BOOST_CHECK(g1.neighborHoodIndices({{4}}, 2).collect()
1030 == bins_t({2, 3, 4, 5, 6}));
1031 BOOST_CHECK(g1.neighborHoodIndices({{9}}, 2).collect()
1032 == bins_t({7, 8, 9, 10, 11}));
1033 BOOST_CHECK(g1.neighborHoodIndices({{10}}, 2).collect()
1034 == bins_t({8, 9, 10, 11}));
1035 BOOST_CHECK(g1.neighborHoodIndices({{11}}, 2).collect()
1036 == bins_t({9, 10, 11}));
1039 BOOST_CHECK(g2.neighborHoodIndices({{0, 0}}, 1).collect()
1040 == bins_t({0, 1, 12, 13}));
1041 BOOST_CHECK(g2.neighborHoodIndices({{0, 1}}, 1).collect()
1042 == bins_t({0, 1, 2, 12, 13, 14}));
1043 BOOST_CHECK(g2.neighborHoodIndices({{1, 0}}, 1).collect()
1044 == bins_t({0, 1, 12, 13, 24, 25}));
1045 BOOST_CHECK(g2.neighborHoodIndices({{1, 1}}, 1).collect()
1046 == bins_t({0, 1, 2, 12, 13, 14, 24, 25, 26}));
1047 BOOST_CHECK(g2.neighborHoodIndices({{5, 5}}, 1).collect()
1048 == bins_t({52, 53, 54, 64, 65, 66, 76, 77, 78}));
1049 BOOST_CHECK(g2.neighborHoodIndices({{9, 10}}, 2).collect()
1050 == bins_t({92, 93, 94, 95, 104, 105, 106, 107, 116, 117, 118,
1051 119, 128, 129, 130, 131, 140, 141, 142, 143}));
1054 BOOST_CHECK(g3.neighborHoodIndices({{0, 0, 0}}, 1).collect()
1055 == bins_t({0, 1, 12, 13, 144, 145, 156, 157}));
1056 BOOST_CHECK(g3.neighborHoodIndices({{0, 0, 1}}, 1).collect()
1057 == bins_t({0, 1, 2, 12, 13, 14, 144, 145, 146, 156, 157, 158}));
1058 BOOST_CHECK(g3.neighborHoodIndices({{0, 1, 0}}, 1).collect()
1059 == bins_t({0, 1, 12, 13, 24, 25, 144, 145, 156, 157, 168, 169}));
1060 BOOST_CHECK(g3.neighborHoodIndices({{1, 0, 0}}, 1).collect()
1061 == bins_t({0, 1, 12, 13, 144, 145, 156, 157, 288, 289, 300, 301}));
1062 BOOST_CHECK(g3.neighborHoodIndices({{0, 1, 1}}, 1).collect()
1063 == bins_t({0, 1, 2, 12, 13, 14, 24, 25, 26, 144, 145, 146,
1064 156, 157, 158, 168, 169, 170}));
1065 BOOST_CHECK(g3.neighborHoodIndices({{1, 1, 1}}, 1).collect()
1066 == bins_t({0, 1, 2, 12, 13, 14, 24, 25, 26, 144, 145, 146,
1067 156, 157, 158, 168, 169, 170, 288, 289, 290, 300,
1068 301, 302, 312, 313, 314}));
1069 BOOST_CHECK(g3.neighborHoodIndices({{11, 10, 9}}, 1).collect()
1070 == bins_t({1556, 1557, 1558, 1568, 1569, 1570, 1580, 1581,
1071 1582, 1700, 1701, 1702, 1712, 1713, 1714, 1724,
1076 using Grid1Closed_t = Grid<double, EAxisClosed>;
1077 EAxisClosed
d(0.0, 1.0, 10
u);
1079 Grid1Closed_t g1Cl(std::make_tuple(std::move(
d)));
1080 BOOST_CHECK(g1Cl.neighborHoodIndices({{0}}, 1).collect() ==
1082 BOOST_CHECK(g1Cl.neighborHoodIndices({{11}}, 1).collect() ==
1084 BOOST_CHECK(g1Cl.neighborHoodIndices({{1}}, 1).collect() ==
1085 bins_t({10, 1, 2}));
1086 BOOST_CHECK(g1Cl.neighborHoodIndices({{5}}, 1).collect() ==
1089 using Grid2Closed_t = Grid<double, EAxisClosed, EAxisClosed>;
1092 EAxisClosed
e(0.0, 1.0, 5
u);
1093 EAxisClosed
f(0.0, 1.0, 5
u);
1094 EAxisClosed
g(0.0, 1.0, 5
u);
1095 Grid2Closed_t g2Cl(std::make_tuple(std::move(
e), std::move(
f)));
1096 BOOST_CHECK(g2Cl.neighborHoodIndices({{3, 3}}, 1).collect() ==
1097 bins_t({16, 17, 18, 23, 24, 25, 30, 31, 32}));
1098 BOOST_CHECK(g2Cl.neighborHoodIndices({{1, 1}}, 1).collect() ==
1099 bins_t({40, 36, 37, 12, 8, 9, 19, 15, 16}));
1100 BOOST_CHECK(g2Cl.neighborHoodIndices({{1, 5}}, 1).collect() ==
1101 bins_t({39, 40, 36, 11, 12, 8, 18, 19, 15}));
1102 BOOST_CHECK(g2Cl.neighborHoodIndices({{5, 1}}, 1).collect() ==
1103 bins_t({33, 29, 30, 40, 36, 37, 12, 8, 9}));
1104 BOOST_CHECK(g2Cl.neighborHoodIndices({{5, 5}}, 1).collect() ==
1105 bins_t({32, 33, 29, 39, 40, 36, 11, 12, 8}));
1107 BOOST_CHECK(g2Cl.neighborHoodIndices({{3, 3}}, 2).collect() ==
1108 bins_t({8, 9, 10, 11, 12, 15, 16, 17, 18, 19, 22, 23, 24,
1109 25, 26, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40}));
1110 BOOST_CHECK(g2Cl.neighborHoodIndices({{1, 1}}, 2).collect() ==
1111 bins_t({32, 33, 29, 30, 31, 39, 40, 36, 37, 38, 11, 12, 8,
1112 9, 10, 18, 19, 15, 16, 17, 25, 26, 22, 23, 24}));
1113 BOOST_CHECK(g2Cl.neighborHoodIndices({{1, 5}}, 2).collect() ==
1114 bins_t({31, 32, 33, 29, 30, 38, 39, 40, 36, 37, 10, 11, 12,
1115 8, 9, 17, 18, 19, 15, 16, 24, 25, 26, 22, 23}));
1116 BOOST_CHECK(g2Cl.neighborHoodIndices({{5, 1}}, 2).collect() ==
1117 bins_t({25, 26, 22, 23, 24, 32, 33, 29, 30, 31, 39, 40, 36,
1118 37, 38, 11, 12, 8, 9, 10, 18, 19, 15, 16, 17}));
1119 BOOST_CHECK(g2Cl.neighborHoodIndices({{5, 5}}, 2).collect() ==
1120 bins_t({24, 25, 26, 22, 23, 31, 32, 33, 29, 30, 38, 39, 40,
1121 36, 37, 10, 11, 12, 8, 9, 17, 18, 19, 15, 16}));
1145 using Point = std::array<double, 3>;
1146 using bins_t = std::vector<size_t>;
1155 Grid1_t g1(std::make_tuple(a));
1156 Grid2_t g2(std::make_tuple(a, b));
1157 Grid3_t g3(std::make_tuple(std::move(a), std::move(b), std::move(c)));
1161 BOOST_CHECK(g1.closestPointsIndices(Point({{0.52}})).collect()
1163 BOOST_CHECK(g1.closestPointsIndices(Point({{0.98}})).collect()
1164 == bins_t({10, 11}));
1167 BOOST_CHECK(g2.closestPointsIndices(Point({{0.52, 0.08}})).collect()
1168 == bins_t({43, 44, 50, 51}));
1169 BOOST_CHECK(g2.closestPointsIndices(Point({{0.05, 0.08}})).collect()
1170 == bins_t({8, 9, 15, 16}));
1173 BOOST_CHECK(g3.closestPointsIndices(Point({{0.23, 0.13, 0.61}})).collect()
1174 == bins_t({112, 113, 117, 118, 147, 148, 152, 153}));
1175 BOOST_CHECK(g3.closestPointsIndices(Point({{0.52, 0.35, 0.71}})).collect()
1176 == bins_t({223, 224, 228, 229, 258, 259, 263, 264}));
1182 EAxisClosed aCl(0.0, 1.0, 10
u);
1183 EAxisClosed bCl(0.0, 1.0, 5
u);
1184 EAxisClosed cCl(0.0, 1.0, 3
u);
1185 Grid1Cl_t g1Cl(std::make_tuple(aCl));
1186 Grid2Cl_t g2Cl(std::make_tuple(std::move(aCl), std::move(bCl)));
1189 BOOST_CHECK(g1Cl.closestPointsIndices(Point({{0.52}})).collect()
1191 BOOST_CHECK(g1Cl.closestPointsIndices(Point({{0.98}})).collect()
1192 == bins_t({10, 1}));
1195 BOOST_CHECK(g2Cl.closestPointsIndices(Point({{0.52, 0.08}})).collect()
1196 == bins_t({43, 44, 50, 51}));
1197 BOOST_CHECK(g2Cl.closestPointsIndices(Point({{0.52, 0.68}})).collect()
1198 == bins_t({46, 47, 53, 54}));
1199 BOOST_CHECK(g2Cl.closestPointsIndices(Point({{0.52, 0.88}})).collect()
1200 == bins_t({47, 43, 54, 50}));
1201 BOOST_CHECK(g2Cl.closestPointsIndices(Point({{0.05, 0.08}})).collect()
1202 == bins_t({8, 9, 15, 16}));
1203 BOOST_CHECK(g2Cl.closestPointsIndices(Point({{0.9, 0.95}})).collect()
1204 == bins_t({75, 71, 12, 8}));
1213 EAxisOpen aOp(0.0, 1.0, 10
u);
1214 EAxisOpen bOp(0.0, 1.0, 5
u);
1215 EAxisOpen cOp(0.0, 1.0, 3
u);
1216 Grid1Op_t g1Op(std::make_tuple(aOp));
1217 Grid2Op_t g2Op(std::make_tuple(std::move(aOp), std::move(bOp)));
1220 BOOST_CHECK(g1Op.closestPointsIndices(Point({{0.52}})).collect()
1222 BOOST_CHECK(g1Op.closestPointsIndices(Point({{0.98}})).collect()
1224 BOOST_CHECK(g1Op.closestPointsIndices(Point({{0.88}})).collect()
1225 == bins_t({9, 10}));
1228 BOOST_CHECK(g2Op.closestPointsIndices(Point({{0.52, 0.08}})).collect()
1229 == bins_t({43, 44, 50, 51}));
1230 BOOST_CHECK(g2Op.closestPointsIndices(Point({{0.52, 0.68}})).collect()
1231 == bins_t({46, 47, 53, 54}));
1232 BOOST_CHECK(g2Op.closestPointsIndices(Point({{0.52, 0.88}})).collect()
1233 == bins_t({47, 54}));
1234 BOOST_CHECK(g2Op.closestPointsIndices(Point({{0.05, 0.1}})).collect()
1235 == bins_t({8, 9, 15, 16}));
1236 BOOST_CHECK(g2Op.closestPointsIndices(Point({{0.95, 0.95}})).collect()