9 #include <boost/test/unit_test.hpp>
29 using namespace detail;
34 using Point = std::array<double, 1>;
35 using indices = std::array<size_t, 1>;
40 BOOST_CHECK_EQUAL(g.
size(), 6
u);
67 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1}}), 1
u);
68 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2}}), 2
u);
69 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3}}), 3
u);
70 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4}}), 4
u);
71 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5}}), 5
u);
73 BOOST_CHECK(
g.localBinsFromGlobalBin(
74 g.globalBinFromPosition(Point({{2.7}}))) == indices({{3}}));
77 BOOST_CHECK(not
g.isInside(Point({{-2.}})));
78 BOOST_CHECK(
g.isInside(Point({{0.}})));
79 BOOST_CHECK(
g.isInside(Point({{2.5}})));
80 BOOST_CHECK(not
g.isInside(Point({{4.}})));
81 BOOST_CHECK(not
g.isInside(Point({{6.}})));
102 for (
size_t bin = 0; bin <
g.size(); ++bin) {
107 const auto&
point = Point({{0.7}});
108 size_t globalBin =
g.globalBinFromPosition(
point);
109 indices localBins =
g.localBinsFromGlobalBin(globalBin);
111 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
112 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
116 using Point = std::array<double, 2>;
117 using indices = std::array<size_t, 2>;
124 BOOST_CHECK_EQUAL(g.
size(), 30
u);
209 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1}}), 1
u);
210 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 2}}), 2
u);
211 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 3}}), 3
u);
212 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 4}}), 4
u);
213 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 0}}), 5
u);
214 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1}}), 6
u);
215 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 2}}), 7
u);
216 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 3}}), 8
u);
217 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 4}}), 9
u);
218 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 0}}), 10
u);
219 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 1}}), 11
u);
220 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 2}}), 12
u);
221 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3}}), 13
u);
222 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 4}}), 14
u);
223 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0}}), 15
u);
224 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 1}}), 16
u);
225 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 2}}), 17
u);
226 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 3}}), 18
u);
227 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 4}}), 19
u);
228 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 0}}), 20
u);
229 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 1}}), 21
u);
230 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 2}}), 22
u);
231 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 3}}), 23
u);
232 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 4}}), 24
u);
233 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 0}}), 25
u);
234 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 1}}), 26
u);
235 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 2}}), 27
u);
236 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 3}}), 28
u);
237 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 4}}), 29
u);
239 BOOST_CHECK(
g.localBinsFromGlobalBin(
g.globalBinFromPosition(
240 Point({{1.2, 0.7}}))) == indices({{2, 1}}));
243 BOOST_CHECK(not
g.isInside(Point({{-2., -1}})));
244 BOOST_CHECK(not
g.isInside(Point({{-2., 1.}})));
245 BOOST_CHECK(not
g.isInside(Point({{-2., 5.}})));
246 BOOST_CHECK(not
g.isInside(Point({{1., -1.}})));
247 BOOST_CHECK(not
g.isInside(Point({{6., -1.}})));
248 BOOST_CHECK(
g.isInside(Point({{0.5, 1.3}})));
249 BOOST_CHECK(not
g.isInside(Point({{4., -1.}})));
250 BOOST_CHECK(not
g.isInside(Point({{4., 0.3}})));
251 BOOST_CHECK(not
g.isInside(Point({{4., 3.}})));
252 BOOST_CHECK(not
g.isInside(Point({{-1., 3.}})));
253 BOOST_CHECK(not
g.isInside(Point({{2., 3.}})));
254 BOOST_CHECK(not
g.isInside(Point({{5., 3.}})));
275 for (
size_t bin = 0; bin <
g.size(); ++bin) {
280 const auto&
point = Point({{0.7, 1.3}});
281 size_t globalBin =
g.globalBinFromPosition(
point);
282 indices localBins =
g.localBinsFromGlobalBin(globalBin);
284 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
285 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
289 using Point = std::array<double, 3>;
290 using indices = std::array<size_t, 3>;
298 BOOST_CHECK_EQUAL(g.
size(), 80
u);
369 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 0, 1}}), 1
u);
370 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 0, 2}}), 2
u);
371 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 0, 3}}), 3
u);
372 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1, 0}}), 4
u);
373 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1, 1}}), 5
u);
374 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1, 2}}), 6
u);
375 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1, 3}}), 7
u);
376 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1, 0}}), 24
u);
377 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1, 1}}), 25
u);
378 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1, 2}}), 26
u);
379 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1, 3}}), 27
u);
380 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3, 0}}), 52
u);
381 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3, 1}}), 53
u);
382 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3, 2}}), 54
u);
383 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3, 3}}), 55
u);
384 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0, 0}}), 60
u);
385 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0, 1}}), 61
u);
386 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0, 2}}), 62
u);
387 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0, 3}}), 63
u);
388 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 4, 0}}), 76
u);
389 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 4, 1}}), 77
u);
390 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 4, 2}}), 78
u);
391 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 4, 3}}), 79
u);
393 BOOST_CHECK(
g.localBinsFromGlobalBin(
g.globalBinFromPosition(
394 Point({{1.2, 0.7, 1.4}}))) == indices({{2, 1, 2}}));
397 BOOST_CHECK(not
g.isInside(Point({{-2., -1, -2}})));
398 BOOST_CHECK(not
g.isInside(Point({{-2., 1., 0.}})));
399 BOOST_CHECK(not
g.isInside(Point({{-2., 5., -1}})));
400 BOOST_CHECK(not
g.isInside(Point({{1., -1., 1.}})));
401 BOOST_CHECK(not
g.isInside(Point({{6., -1., 4.}})));
402 BOOST_CHECK(
g.isInside(Point({{0.5, 1.3, 1.7}})));
403 BOOST_CHECK(not
g.isInside(Point({{2., -1., -0.4}})));
404 BOOST_CHECK(not
g.isInside(Point({{2., 0.3, 3.4}})));
405 BOOST_CHECK(not
g.isInside(Point({{2., 3., 0.8}})));
406 BOOST_CHECK(not
g.isInside(Point({{-1., 3., 5.}})));
407 BOOST_CHECK(not
g.isInside(Point({{2., 3., -1.}})));
408 BOOST_CHECK(not
g.isInside(Point({{5., 3., 0.5}})));
433 for (
size_t bin = 0; bin <
g.size(); ++bin) {
438 const auto&
point = Point({{0.7, 2.3, 1.3}});
439 size_t globalBin =
g.globalBinFromPosition(
point);
440 indices localBins =
g.localBinsFromGlobalBin(globalBin);
442 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
443 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
447 using Point = std::array<double, 1>;
448 using indices = std::array<size_t, 1>;
453 BOOST_CHECK_EQUAL(g.size(), 4
u);
454 BOOST_CHECK_EQUAL(g.numLocalBins().at(0), 2
u);
457 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-0.3}})), 0
u);
458 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.}})), 1
u);
459 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.7}})), 1
u);
460 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1}})), 2
u);
461 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1.2}})), 2
u);
462 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{2.7}})), 2
u);
463 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{4.}})), 3
u);
464 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{4.98}})), 3
u);
467 BOOST_CHECK(g.localBinsFromGlobalBin(0) == indices({{0}}));
468 BOOST_CHECK(g.localBinsFromGlobalBin(1) == indices({{1}}));
469 BOOST_CHECK(g.localBinsFromGlobalBin(2) == indices({{2}}));
470 BOOST_CHECK(g.localBinsFromGlobalBin(3) == indices({{3}}));
473 BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{0}}), 0
u);
474 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1}}), 1
u);
475 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2}}), 2
u);
476 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3}}), 3
u);
478 BOOST_CHECK(
g.localBinsFromGlobalBin(
479 g.globalBinFromPosition(Point({{0.8}}))) == indices({{1}}));
482 BOOST_CHECK(not
g.isInside(Point({{-2.}})));
483 BOOST_CHECK(
g.isInside(Point({{0.}})));
484 BOOST_CHECK(
g.isInside(Point({{2.5}})));
485 BOOST_CHECK(not
g.isInside(Point({{4.}})));
486 BOOST_CHECK(not
g.isInside(Point({{6.}})));
501 for (
size_t bin = 0; bin <
g.size(); ++bin) {
506 const auto&
point = Point({{0.7}});
507 size_t globalBin =
g.globalBinFromPosition(
point);
508 indices localBins =
g.localBinsFromGlobalBin(globalBin);
510 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
511 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
515 using Point = std::array<double, 2>;
516 using indices = std::array<size_t, 2>;
523 BOOST_CHECK_EQUAL(g.size(), 16
u);
524 BOOST_CHECK_EQUAL(g.numLocalBins().at(0), 2
u);
525 BOOST_CHECK_EQUAL(g.numLocalBins().at(1), 2
u);
528 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0}})), 5
u);
529 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 1}})), 6
u);
530 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 4}})), 7
u);
531 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.5, 0}})), 9
u);
532 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.5, 1}})), 10
u);
533 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.5, 4}})), 11
u);
534 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{3, 0}})), 13
u);
535 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{3, 1}})), 14
u);
536 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{3, 4}})), 15
u);
539 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.3, 1.2}})), 6
u);
540 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{3.3, 2.2}})), 14
u);
541 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1.8, 0.9}})), 9
u);
542 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{3.1, 0.7}})), 13
u);
543 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{2.3, 1.4}})), 10
u);
544 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{2, -3}})), 8
u);
545 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 8}})), 11
u);
546 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-3, 1}})), 2
u);
547 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{11, 3}})), 14
u);
548 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-3, -2}})), 0
u);
549 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{7, -2}})), 12
u);
550 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-1, 12}})), 3
u);
551 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{11, 12}})), 15
u);
554 BOOST_CHECK(g.localBinsFromGlobalBin(0) == indices({{0, 0}}));
555 BOOST_CHECK(g.localBinsFromGlobalBin(1) == indices({{0, 1}}));
556 BOOST_CHECK(g.localBinsFromGlobalBin(2) == indices({{0, 2}}));
557 BOOST_CHECK(g.localBinsFromGlobalBin(3) == indices({{0, 3}}));
558 BOOST_CHECK(g.localBinsFromGlobalBin(4) == indices({{1, 0}}));
559 BOOST_CHECK(g.localBinsFromGlobalBin(5) == indices({{1, 1}}));
560 BOOST_CHECK(g.localBinsFromGlobalBin(6) == indices({{1, 2}}));
561 BOOST_CHECK(g.localBinsFromGlobalBin(7) == indices({{1, 3}}));
562 BOOST_CHECK(g.localBinsFromGlobalBin(8) == indices({{2, 0}}));
563 BOOST_CHECK(g.localBinsFromGlobalBin(9) == indices({{2, 1}}));
564 BOOST_CHECK(g.localBinsFromGlobalBin(10) == indices({{2, 2}}));
565 BOOST_CHECK(g.localBinsFromGlobalBin(11) == indices({{2, 3}}));
566 BOOST_CHECK(g.localBinsFromGlobalBin(12) == indices({{3, 0}}));
567 BOOST_CHECK(g.localBinsFromGlobalBin(13) == indices({{3, 1}}));
568 BOOST_CHECK(g.localBinsFromGlobalBin(14) == indices({{3, 2}}));
569 BOOST_CHECK(g.localBinsFromGlobalBin(15) == indices({{3, 3}}));
572 BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{0, 0}}), 0
u);
573 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1}}), 1
u);
574 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 2}}), 2
u);
575 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 3}}), 3
u);
576 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 0}}), 4
u);
577 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1}}), 5
u);
578 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 2}}), 6
u);
579 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 3}}), 7
u);
580 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 0}}), 8
u);
581 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 1}}), 9
u);
582 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 2}}), 10
u);
583 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3}}), 11
u);
584 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0}}), 12
u);
585 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 1}}), 13
u);
586 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 2}}), 14
u);
587 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 3}}), 15
u);
589 BOOST_CHECK(
g.localBinsFromGlobalBin(
g.globalBinFromPosition(
590 Point({{3.2, 1.8}}))) == indices({{3, 2}}));
593 BOOST_CHECK(not
g.isInside(Point({{-2., -1}})));
594 BOOST_CHECK(not
g.isInside(Point({{-2., 1.}})));
595 BOOST_CHECK(not
g.isInside(Point({{-2., 5.}})));
596 BOOST_CHECK(not
g.isInside(Point({{1., -1.}})));
597 BOOST_CHECK(not
g.isInside(Point({{6., -1.}})));
598 BOOST_CHECK(
g.isInside(Point({{0.5, 1.3}})));
599 BOOST_CHECK(not
g.isInside(Point({{3., -1.}})));
600 BOOST_CHECK(not
g.isInside(Point({{3., 0.3}})));
601 BOOST_CHECK(not
g.isInside(Point({{3., 4.}})));
602 BOOST_CHECK(not
g.isInside(Point({{-1., 4.}})));
603 BOOST_CHECK(not
g.isInside(Point({{2., 4.}})));
604 BOOST_CHECK(not
g.isInside(Point({{5., 4.}})));
625 for (
size_t bin = 0; bin <
g.size(); ++bin) {
630 const auto&
point = Point({{0.7, 1.3}});
631 size_t globalBin =
g.globalBinFromPosition(
point);
632 indices localBins =
g.localBinsFromGlobalBin(globalBin);
634 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
635 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
639 using Point = std::array<double, 3>;
640 using indices = std::array<size_t, 3>;
648 BOOST_CHECK_EQUAL(g.size(), 60
u);
649 BOOST_CHECK_EQUAL(g.numLocalBins().at(0), 1
u);
650 BOOST_CHECK_EQUAL(g.numLocalBins().at(1), 2
u);
651 BOOST_CHECK_EQUAL(g.numLocalBins().at(2), 3
u);
654 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0, 0}})), 26
u);
655 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0, 0}})), 46
u);
656 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0.5, 0}})), 31
u);
657 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0.5, 0}})), 51
u);
658 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 3, 0}})), 36
u);
659 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 3, 0}})), 56
u);
660 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0, 0.5}})), 27
u);
661 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0, 0.5}})), 47
u);
662 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0.5, 0.5}})), 32
u);
663 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0.5, 0.5}})), 52
u);
664 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 3, 0.5}})), 37
u);
665 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 3, 0.5}})), 57
u);
666 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0, 3}})), 28
u);
667 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0, 3}})), 48
u);
668 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0.5, 3}})), 33
u);
669 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0.5, 3}})), 53
u);
670 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 3, 3}})), 38
u);
671 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 3, 3}})), 58
u);
672 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0, 3.3}})), 29
u);
673 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0, 3.3}})), 49
u);
674 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0.5, 3.3}})), 34
u);
675 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0.5, 3.3}})), 54
u);
676 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 3, 3.3}})), 39
u);
677 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 3, 3.3}})), 59
u);
680 BOOST_CHECK(g.localBinsFromGlobalBin(0) == indices({{0, 0, 0}}));
681 BOOST_CHECK(g.localBinsFromGlobalBin(1) == indices({{0, 0, 1}}));
682 BOOST_CHECK(g.localBinsFromGlobalBin(2) == indices({{0, 0, 2}}));
683 BOOST_CHECK(g.localBinsFromGlobalBin(3) == indices({{0, 0, 3}}));
684 BOOST_CHECK(g.localBinsFromGlobalBin(4) == indices({{0, 0, 4}}));
685 BOOST_CHECK(g.localBinsFromGlobalBin(5) == indices({{0, 1, 0}}));
686 BOOST_CHECK(g.localBinsFromGlobalBin(21) == indices({{1, 0, 1}}));
687 BOOST_CHECK(g.localBinsFromGlobalBin(22) == indices({{1, 0, 2}}));
688 BOOST_CHECK(g.localBinsFromGlobalBin(23) == indices({{1, 0, 3}}));
689 BOOST_CHECK(g.localBinsFromGlobalBin(24) == indices({{1, 0, 4}}));
690 BOOST_CHECK(g.localBinsFromGlobalBin(25) == indices({{1, 1, 0}}));
691 BOOST_CHECK(g.localBinsFromGlobalBin(26) == indices({{1, 1, 1}}));
692 BOOST_CHECK(g.localBinsFromGlobalBin(57) == indices({{2, 3, 2}}));
693 BOOST_CHECK(g.localBinsFromGlobalBin(58) == indices({{2, 3, 3}}));
694 BOOST_CHECK(g.localBinsFromGlobalBin(59) == indices({{2, 3, 4}}));
697 BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{0, 0, 0}}), 0
u);
698 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 0, 0}}), 20
u);
699 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 0, 0}}), 40
u);
700 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1, 0}}), 5
u);
701 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1, 0}}), 25
u);
702 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 1, 0}}), 45
u);
703 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 3, 1}}), 16
u);
704 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 3, 1}}), 36
u);
705 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3, 1}}), 56
u);
706 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 0, 2}}), 2
u);
707 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 0, 2}}), 22
u);
708 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 0, 2}}), 42
u);
709 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 3, 4}}), 19
u);
710 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 3, 4}}), 39
u);
711 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3, 4}}), 59
u);
713 BOOST_CHECK(
g.localBinsFromGlobalBin(
g.globalBinFromPosition(
714 Point({{1.8, 0.7, 3.2}}))) == indices({{2, 2, 3}}));
717 BOOST_CHECK(not
g.isInside(Point({{-2., -1, -2}})));
718 BOOST_CHECK(not
g.isInside(Point({{-2., 1., 0.}})));
719 BOOST_CHECK(not
g.isInside(Point({{-2., 5., -1}})));
720 BOOST_CHECK(not
g.isInside(Point({{1., -1., 1.}})));
721 BOOST_CHECK(not
g.isInside(Point({{6., -1., 4.}})));
722 BOOST_CHECK(
g.isInside(Point({{0.5, 1.3, 1.7}})));
723 BOOST_CHECK(not
g.isInside(Point({{1., -1., -0.4}})));
724 BOOST_CHECK(not
g.isInside(Point({{1., 0.3, 3.4}})));
725 BOOST_CHECK(not
g.isInside(Point({{1., 3., 0.8}})));
726 BOOST_CHECK(not
g.isInside(Point({{-1., 3., 5.}})));
727 BOOST_CHECK(not
g.isInside(Point({{2., 3., -1.}})));
728 BOOST_CHECK(not
g.isInside(Point({{5., 3., 0.5}})));
765 for (
size_t bin = 0; bin <
g.size(); ++bin) {
770 const auto&
point = Point({{0.7, 1.3, 3.7}});
771 size_t globalBin =
g.globalBinFromPosition(
point);
772 indices localBins =
g.localBinsFromGlobalBin(globalBin);
774 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
775 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
779 using Point = std::array<double, 2>;
780 using indices = std::array<size_t, 2>;
787 BOOST_CHECK_EQUAL(g.size(), 24
u);
788 BOOST_CHECK_EQUAL(g.numLocalBins().at(0), 4
u);
789 BOOST_CHECK_EQUAL(g.numLocalBins().at(1), 2
u);
792 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0}})), 5
u);
793 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.25, 0}})), 9
u);
794 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.5, 0}})), 13
u);
795 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.75, 0}})), 17
u);
796 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0}})), 21
u);
797 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 0.5}})), 6
u);
798 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.25, 0.5}})), 10
u);
799 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.5, 0.5}})), 14
u);
800 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.75, 0.5}})), 18
u);
801 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 0.5}})), 22
u);
802 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0, 3}})), 7
u);
803 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.25, 3}})), 11
u);
804 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.5, 3}})), 15
u);
805 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.75, 3}})), 19
u);
806 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1, 3}})), 23
u);
809 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{1.2, 0.3}})), 21
u);
810 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.2, 1.3}})), 6
u);
811 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.9, 1.8}})), 18
u);
812 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.7, 2.1}})), 14
u);
813 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.4, 0.3}})), 9
u);
814 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-3, 2}})), 2
u);
815 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{8, 1}})), 22
u);
816 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.1, -3}})), 4
u);
817 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{0.8, 11}})), 19
u);
818 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-2, -3}})), 0
u);
819 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{-2, 7}})), 3
u);
820 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{12, -1}})), 20
u);
821 BOOST_CHECK_EQUAL(g.globalBinFromPosition(Point({{12, 11}})), 23
u);
824 using indices = std::array<size_t, 2>;
825 BOOST_CHECK(g.localBinsFromGlobalBin(0) == indices({{0, 0}}));
826 BOOST_CHECK(g.localBinsFromGlobalBin(1) == indices({{0, 1}}));
827 BOOST_CHECK(g.localBinsFromGlobalBin(2) == indices({{0, 2}}));
828 BOOST_CHECK(g.localBinsFromGlobalBin(3) == indices({{0, 3}}));
829 BOOST_CHECK(g.localBinsFromGlobalBin(4) == indices({{1, 0}}));
830 BOOST_CHECK(g.localBinsFromGlobalBin(5) == indices({{1, 1}}));
831 BOOST_CHECK(g.localBinsFromGlobalBin(6) == indices({{1, 2}}));
832 BOOST_CHECK(g.localBinsFromGlobalBin(7) == indices({{1, 3}}));
833 BOOST_CHECK(g.localBinsFromGlobalBin(8) == indices({{2, 0}}));
834 BOOST_CHECK(g.localBinsFromGlobalBin(9) == indices({{2, 1}}));
835 BOOST_CHECK(g.localBinsFromGlobalBin(10) == indices({{2, 2}}));
836 BOOST_CHECK(g.localBinsFromGlobalBin(11) == indices({{2, 3}}));
837 BOOST_CHECK(g.localBinsFromGlobalBin(12) == indices({{3, 0}}));
838 BOOST_CHECK(g.localBinsFromGlobalBin(13) == indices({{3, 1}}));
839 BOOST_CHECK(g.localBinsFromGlobalBin(14) == indices({{3, 2}}));
840 BOOST_CHECK(g.localBinsFromGlobalBin(15) == indices({{3, 3}}));
841 BOOST_CHECK(g.localBinsFromGlobalBin(16) == indices({{4, 0}}));
842 BOOST_CHECK(g.localBinsFromGlobalBin(17) == indices({{4, 1}}));
843 BOOST_CHECK(g.localBinsFromGlobalBin(18) == indices({{4, 2}}));
844 BOOST_CHECK(g.localBinsFromGlobalBin(19) == indices({{4, 3}}));
845 BOOST_CHECK(g.localBinsFromGlobalBin(20) == indices({{5, 0}}));
846 BOOST_CHECK(g.localBinsFromGlobalBin(21) == indices({{5, 1}}));
847 BOOST_CHECK(g.localBinsFromGlobalBin(22) == indices({{5, 2}}));
848 BOOST_CHECK(g.localBinsFromGlobalBin(23) == indices({{5, 3}}));
851 BOOST_CHECK_EQUAL(g.globalBinFromLocalBins({{0, 0}}), 0
u);
852 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 1}}), 1
u);
853 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 2}}), 2
u);
854 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{0, 3}}), 3
u);
855 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 0}}), 4
u);
856 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 1}}), 5
u);
857 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 2}}), 6
u);
858 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{1, 3}}), 7
u);
859 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 0}}), 8
u);
860 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 1}}), 9
u);
861 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 2}}), 10
u);
862 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{2, 3}}), 11
u);
863 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 0}}), 12
u);
864 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 1}}), 13
u);
865 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 2}}), 14
u);
866 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{3, 3}}), 15
u);
867 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 0}}), 16
u);
868 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 1}}), 17
u);
869 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 2}}), 18
u);
870 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{4, 3}}), 19
u);
871 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 0}}), 20
u);
872 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 1}}), 21
u);
873 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 2}}), 22
u);
874 BOOST_CHECK_EQUAL(
g.globalBinFromLocalBins({{5, 3}}), 23
u);
876 BOOST_CHECK(
g.localBinsFromGlobalBin(
g.globalBinFromPosition(
877 Point({{1.1, 1.7}}))) == indices({{5, 2}}));
880 BOOST_CHECK(not
g.isInside(Point({{-2., -1}})));
881 BOOST_CHECK(not
g.isInside(Point({{-2., 1.}})));
882 BOOST_CHECK(not
g.isInside(Point({{-2., 5.}})));
883 BOOST_CHECK(not
g.isInside(Point({{0.1, -1.}})));
884 BOOST_CHECK(not
g.isInside(Point({{6., -1.}})));
885 BOOST_CHECK(
g.isInside(Point({{0.5, 1.3}})));
886 BOOST_CHECK(not
g.isInside(Point({{1., -1.}})));
887 BOOST_CHECK(not
g.isInside(Point({{1., 0.3}})));
888 BOOST_CHECK(not
g.isInside(Point({{1., 3.}})));
889 BOOST_CHECK(not
g.isInside(Point({{-1., 3.}})));
890 BOOST_CHECK(not
g.isInside(Point({{0.2, 3.}})));
891 BOOST_CHECK(not
g.isInside(Point({{5., 3.}})));
924 for (
size_t bin = 0; bin <
g.size(); ++bin) {
929 const auto&
point = Point({{1.3, 3.7}});
930 size_t globalBin =
g.globalBinFromPosition(
point);
931 indices localBins =
g.localBinsFromGlobalBin(globalBin);
933 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.at(globalBin));
934 BOOST_CHECK_EQUAL(
g.atPosition(
point),
g.atLocalBins(localBins));
944 using Point = std::array<double, 2>;
945 g.atPosition(Point({{0, 0}})) = 0.;
946 g.atPosition(Point({{1.5, 0}})) = 1.;
947 g.atPosition(Point({{3, 0}})) = 2.;
948 g.atPosition(Point({{4.5, 0}})) = 3.;
949 g.atPosition(Point({{6, 0}})) = 4.;
950 g.atPosition(Point({{0, 1.5}})) = 5.;
951 g.atPosition(Point({{1.5, 1.5}})) = 6.;
952 g.atPosition(Point({{3, 1.5}})) = 7.;
953 g.atPosition(Point({{4.5, 1.5}})) = 8.;
954 g.atPosition(Point({{6, 1.5}})) = 9.;
955 g.atPosition(Point({{0, 3}})) = 10.;
956 g.atPosition(Point({{1.5, 3}})) = 11.;
957 g.atPosition(Point({{3, 3}})) = 12.;
958 g.atPosition(Point({{4.5, 3}})) = 13.;
959 g.atPosition(Point({{6, 3}})) = 14.;
962 BOOST_CHECK_EQUAL(g.size(), 24
u);
965 BOOST_CHECK_EQUAL(g.atPosition(Point({{1.2, 0.3}})), 0.);
966 BOOST_CHECK_EQUAL(g.atPosition(Point({{2.2, 1.3}})), 1.);
967 BOOST_CHECK_EQUAL(g.atPosition(Point({{4.9, 1.8}})), 8.);
968 BOOST_CHECK_EQUAL(g.atPosition(Point({{3.7, 2.1}})), 7.);
969 BOOST_CHECK_EQUAL(g.atPosition(Point({{0.4, 2.3}})), 5.);
973 using Point = std::array<double, 3>;
1015 using bins_t = std::vector<size_t>;
1030 BOOST_CHECK(g1.neighborHoodIndices({{0}}, 1).collectVector()
1032 BOOST_CHECK(g1.neighborHoodIndices({{0}}, 2).collectVector()
1033 == bins_t({0, 1, 2}));
1034 BOOST_CHECK(g1.neighborHoodIndices({{1}}, 1).collectVector()
1035 == bins_t({0, 1, 2}));
1036 BOOST_CHECK(g1.neighborHoodIndices({{1}}, 3).collectVector()
1037 == bins_t({0, 1, 2, 3, 4}));
1038 BOOST_CHECK(g1.neighborHoodIndices({{4}}, 2).collectVector()
1039 == bins_t({2, 3, 4, 5, 6}));
1040 BOOST_CHECK(g1.neighborHoodIndices({{9}}, 2).collectVector()
1041 == bins_t({7, 8, 9, 10, 11}));
1042 BOOST_CHECK(g1.neighborHoodIndices({{10}}, 2).collectVector()
1043 == bins_t({8, 9, 10, 11}));
1044 BOOST_CHECK(g1.neighborHoodIndices({{11}}, 2).collectVector()
1045 == bins_t({9, 10, 11}));
1048 BOOST_CHECK(g2.neighborHoodIndices({{0, 0}}, 1).collectVector()
1049 == bins_t({0, 1, 12, 13}));
1050 BOOST_CHECK(g2.neighborHoodIndices({{0, 1}}, 1).collectVector()
1051 == bins_t({0, 1, 2, 12, 13, 14}));
1052 BOOST_CHECK(g2.neighborHoodIndices({{1, 0}}, 1).collectVector()
1053 == bins_t({0, 1, 12, 13, 24, 25}));
1054 BOOST_CHECK(g2.neighborHoodIndices({{1, 1}}, 1).collectVector()
1055 == bins_t({0, 1, 2, 12, 13, 14, 24, 25, 26}));
1056 BOOST_CHECK(g2.neighborHoodIndices({{5, 5}}, 1).collectVector()
1057 == bins_t({52, 53, 54, 64, 65, 66, 76, 77, 78}));
1058 BOOST_CHECK(g2.neighborHoodIndices({{9, 10}}, 2).collectVector()
1059 == bins_t({92, 93, 94, 95, 104, 105, 106, 107, 116, 117, 118,
1060 119, 128, 129, 130, 131, 140, 141, 142, 143}));
1063 BOOST_CHECK(g3.neighborHoodIndices({{0, 0, 0}}, 1).collectVector()
1064 == bins_t({0, 1, 12, 13, 144, 145, 156, 157}));
1065 BOOST_CHECK(g3.neighborHoodIndices({{0, 0, 1}}, 1).collectVector()
1066 == bins_t({0, 1, 2, 12, 13, 14, 144, 145, 146, 156, 157, 158}));
1067 BOOST_CHECK(g3.neighborHoodIndices({{0, 1, 0}}, 1).collectVector()
1068 == bins_t({0, 1, 12, 13, 24, 25, 144, 145, 156, 157, 168, 169}));
1069 BOOST_CHECK(g3.neighborHoodIndices({{1, 0, 0}}, 1).collectVector()
1070 == bins_t({0, 1, 12, 13, 144, 145, 156, 157, 288, 289, 300, 301}));
1071 BOOST_CHECK(g3.neighborHoodIndices({{0, 1, 1}}, 1).collectVector()
1072 == bins_t({0, 1, 2, 12, 13, 14, 24, 25, 26, 144, 145, 146,
1073 156, 157, 158, 168, 169, 170}));
1074 BOOST_CHECK(g3.neighborHoodIndices({{1, 1, 1}}, 1).collectVector()
1075 == bins_t({0, 1, 2, 12, 13, 14, 24, 25, 26, 144, 145, 146,
1076 156, 157, 158, 168, 169, 170, 288, 289, 290, 300,
1077 301, 302, 312, 313, 314}));
1078 BOOST_CHECK(g3.neighborHoodIndices({{11, 10, 9}}, 1).collectVector()
1079 == bins_t({1556, 1557, 1558, 1568, 1569, 1570, 1580, 1581,
1080 1582, 1700, 1701, 1702, 1712, 1713, 1714, 1724,
1084 std::array<std::pair<int,int>,1> a1;
1085 a1.at(0) = std::make_pair<int,int>(-1,1);
1086 BOOST_CHECK(g1.neighborHoodIndices({{0}}, a1).collectVector()
1088 BOOST_CHECK(g1.neighborHoodIndices({{2}}, a1).collectVector()
1089 == bins_t({1,2,3}));
1091 a1.at(0) = std::make_pair<int,int>(2,3);
1092 BOOST_CHECK(g1.neighborHoodIndices({{2}}, a1).collectVector()
1095 a1.at(0) = std::make_pair<int,int>(-2,-1);
1096 BOOST_CHECK(g1.neighborHoodIndices({{2}}, a1).collectVector()
1099 a1.at(0) = std::make_pair<int,int>(-3,-1);
1100 BOOST_CHECK(g1.neighborHoodIndices({{2}}, a1).collectVector()
1105 using Grid1Closed_t = Grid<double, EAxisClosed>;
1106 EAxisClosed d(0.0, 1.0, 10
u);
1109 BOOST_CHECK(g1Cl.neighborHoodIndices({{0}}, 1).collectVector() ==
1111 BOOST_CHECK(g1Cl.neighborHoodIndices({{11}}, 1).collectVector() ==
1113 BOOST_CHECK(g1Cl.neighborHoodIndices({{1}}, 1).collectVector() ==
1114 bins_t({10, 1, 2}));
1115 BOOST_CHECK(g1Cl.neighborHoodIndices({{5}}, 1).collectVector() ==
1118 using Grid2Closed_t = Grid<double, EAxisClosed, EAxisClosed>;
1121 EAxisClosed
e(0.0, 1.0, 5
u);
1122 EAxisClosed
f(0.0, 1.0, 5
u);
1124 BOOST_CHECK(g2Cl.neighborHoodIndices({{3, 3}}, 1).collectVector() ==
1125 bins_t({16, 17, 18, 23, 24, 25, 30, 31, 32}));
1126 BOOST_CHECK(g2Cl.neighborHoodIndices({{1, 1}}, 1).collectVector() ==
1127 bins_t({40, 36, 37, 12, 8, 9, 19, 15, 16}));
1128 BOOST_CHECK(g2Cl.neighborHoodIndices({{1, 5}}, 1).collectVector() ==
1129 bins_t({39, 40, 36, 11, 12, 8, 18, 19, 15}));
1130 BOOST_CHECK(g2Cl.neighborHoodIndices({{5, 1}}, 1).collectVector() ==
1131 bins_t({33, 29, 30, 40, 36, 37, 12, 8, 9}));
1132 BOOST_CHECK(g2Cl.neighborHoodIndices({{5, 5}}, 1).collectVector() ==
1133 bins_t({32, 33, 29, 39, 40, 36, 11, 12, 8}));
1135 BOOST_CHECK(g2Cl.neighborHoodIndices({{3, 3}}, 2).collectVector() ==
1136 bins_t({8, 9, 10, 11, 12, 15, 16, 17, 18, 19, 22, 23, 24,
1137 25, 26, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40}));
1138 BOOST_CHECK(g2Cl.neighborHoodIndices({{1, 1}}, 2).collectVector() ==
1139 bins_t({32, 33, 29, 30, 31, 39, 40, 36, 37, 38, 11, 12, 8,
1140 9, 10, 18, 19, 15, 16, 17, 25, 26, 22, 23, 24}));
1141 BOOST_CHECK(g2Cl.neighborHoodIndices({{1, 5}}, 2).collectVector() ==
1142 bins_t({31, 32, 33, 29, 30, 38, 39, 40, 36, 37, 10, 11, 12,
1143 8, 9, 17, 18, 19, 15, 16, 24, 25, 26, 22, 23}));
1144 BOOST_CHECK(g2Cl.neighborHoodIndices({{5, 1}}, 2).collectVector() ==
1145 bins_t({25, 26, 22, 23, 24, 32, 33, 29, 30, 31, 39, 40, 36,
1146 37, 38, 11, 12, 8, 9, 10, 18, 19, 15, 16, 17}));
1147 BOOST_CHECK(g2Cl.neighborHoodIndices({{5, 5}}, 2).collectVector() ==
1148 bins_t({24, 25, 26, 22, 23, 31, 32, 33, 29, 30, 38, 39, 40,
1149 36, 37, 10, 11, 12, 8, 9, 17, 18, 19, 15, 16}));
1151 std::array<std::pair<int, int>, 2>
a2;
1153 std::make_pair<int, int>(-2, -1);
1155 a2.at(1) = std::make_pair<int, int>(
1158 std::set<size_t> returnedBins;
1160 auto returnedBinsVec = g2Cl.neighborHoodIndices({{3, 2}},
a2).collectVector();
1161 returnedBins.insert(returnedBinsVec.begin(), returnedBinsVec.end());
1162 std::set<size_t> expectedBins{{8, 9, 10, 11, 15, 16, 17, 18}};
1163 BOOST_CHECK(returnedBins == expectedBins);
1165 returnedBinsVec = g2Cl.neighborHoodIndices({{1, 5}},
a2).collectVector();
1166 returnedBins.clear();
1167 returnedBins.insert(returnedBinsVec.begin(), returnedBinsVec.end());
1168 expectedBins = {{29, 30, 32, 33, 36, 37, 39, 40}};
1169 BOOST_CHECK(returnedBins == expectedBins);
1173 returnedBinsVec = g2Cl.neighborHoodIndices({{1, 5}},
a2).collectVector();
1174 returnedBins.clear();
1175 returnedBins.insert(returnedBinsVec.begin(), returnedBinsVec.end());
1176 expectedBins = {{12, 19, 26, 33, 40}};
1177 BOOST_CHECK(returnedBins == expectedBins);
1201 using Point = std::array<double, 3>;
1202 using bins_t = std::vector<size_t>;
1217 BOOST_CHECK(g1.closestPointsIndices(Point({{0.52}})).collectVector()
1219 BOOST_CHECK(g1.closestPointsIndices(Point({{0.98}})).collectVector()
1220 == bins_t({10, 11}));
1223 BOOST_CHECK(g2.closestPointsIndices(Point({{0.52, 0.08}})).collectVector()
1224 == bins_t({43, 44, 50, 51}));
1225 BOOST_CHECK(g2.closestPointsIndices(Point({{0.05, 0.08}})).collectVector()
1226 == bins_t({8, 9, 15, 16}));
1229 BOOST_CHECK(g3.closestPointsIndices(Point({{0.23, 0.13, 0.61}})).collectVector()
1230 == bins_t({112, 113, 117, 118, 147, 148, 152, 153}));
1231 BOOST_CHECK(g3.closestPointsIndices(Point({{0.52, 0.35, 0.71}})).collectVector()
1232 == bins_t({223, 224, 228, 229, 258, 259, 263, 264}));
1238 EAxisClosed aCl(0.0, 1.0, 10
u);
1239 EAxisClosed bCl(0.0, 1.0, 5
u);
1240 EAxisClosed cCl(0.0, 1.0, 3
u);
1245 BOOST_CHECK(g1Cl.closestPointsIndices(Point({{0.52}})).collectVector()
1247 BOOST_CHECK(g1Cl.closestPointsIndices(Point({{0.98}})).collectVector()
1248 == bins_t({10, 1}));
1251 BOOST_CHECK(g2Cl.closestPointsIndices(Point({{0.52, 0.08}})).collectVector()
1252 == bins_t({43, 44, 50, 51}));
1253 BOOST_CHECK(g2Cl.closestPointsIndices(Point({{0.52, 0.68}})).collectVector()
1254 == bins_t({46, 47, 53, 54}));
1255 BOOST_CHECK(g2Cl.closestPointsIndices(Point({{0.52, 0.88}})).collectVector()
1256 == bins_t({47, 43, 54, 50}));
1257 BOOST_CHECK(g2Cl.closestPointsIndices(Point({{0.05, 0.08}})).collectVector()
1258 == bins_t({8, 9, 15, 16}));
1259 BOOST_CHECK(g2Cl.closestPointsIndices(Point({{0.9, 0.95}})).collectVector()
1260 == bins_t({75, 71, 12, 8}));
1269 EAxisOpen aOp(0.0, 1.0, 10
u);
1270 EAxisOpen bOp(0.0, 1.0, 5
u);
1271 EAxisOpen cOp(0.0, 1.0, 3
u);
1276 BOOST_CHECK(g1Op.closestPointsIndices(Point({{0.52}})).collectVector()
1278 BOOST_CHECK(g1Op.closestPointsIndices(Point({{0.98}})).collectVector()
1280 BOOST_CHECK(g1Op.closestPointsIndices(Point({{0.88}})).collectVector()
1281 == bins_t({9, 10}));
1284 BOOST_CHECK(g2Op.closestPointsIndices(Point({{0.52, 0.08}})).collectVector()
1285 == bins_t({43, 44, 50, 51}));
1286 BOOST_CHECK(g2Op.closestPointsIndices(Point({{0.52, 0.68}})).collectVector()
1287 == bins_t({46, 47, 53, 54}));
1288 BOOST_CHECK(g2Op.closestPointsIndices(Point({{0.52, 0.88}})).collectVector()
1289 == bins_t({47, 54}));
1290 BOOST_CHECK(g2Op.closestPointsIndices(Point({{0.05, 0.1}})).collectVector()
1291 == bins_t({8, 9, 15, 16}));
1292 BOOST_CHECK(g2Op.closestPointsIndices(Point({{0.95, 0.95}})).collectVector()