File indexing completed on 2025-01-18 09:12:57
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Utilities/Grid.hpp"
0012 #include "Acts/Utilities/GridBinFinder.hpp"
0013 #include "Acts/Utilities/GridIterator.hpp"
0014
0015 #include <array>
0016 #include <utility>
0017 #include <vector>
0018
0019 namespace Acts::Test {
0020
0021 BOOST_AUTO_TEST_CASE(grid_binfinder_boundTypes) {
0022 const std::size_t nBins = 10ul;
0023 Acts::GridBinFinder<1ul> binFinder(1);
0024
0025
0026 std::array<std::size_t, 1ul> lowerBound({1ul});
0027 std::array<std::size_t, 1ul> upperBound({10ul});
0028
0029
0030
0031 Acts::Axis xAxisClosed(AxisClosed, 0, 100, nBins);
0032 Acts::Grid gridClosed(Type<double>, std::move(xAxisClosed));
0033
0034 auto lowerClosedNeighbours = binFinder.findBins(lowerBound, gridClosed);
0035 BOOST_CHECK_EQUAL(lowerClosedNeighbours.size(), 3ul);
0036 BOOST_CHECK_EQUAL(lowerClosedNeighbours[0ul], 10ul);
0037 BOOST_CHECK_EQUAL(lowerClosedNeighbours[1ul], 1ul);
0038 BOOST_CHECK_EQUAL(lowerClosedNeighbours[2ul], 2ul);
0039
0040 auto upperClosedNeighbours = binFinder.findBins(upperBound, gridClosed);
0041 BOOST_CHECK_EQUAL(upperClosedNeighbours.size(), 3ul);
0042 BOOST_CHECK_EQUAL(upperClosedNeighbours[0ul], 9ul);
0043 BOOST_CHECK_EQUAL(upperClosedNeighbours[1ul], 10ul);
0044 BOOST_CHECK_EQUAL(upperClosedNeighbours[2ul], 1ul);
0045
0046
0047
0048 Acts::Axis xAxisOpen(AxisOpen, 0, 100, nBins);
0049 Acts::Grid gridOpen(Type<double>, std::move(xAxisOpen));
0050
0051 auto lowerOpenNeighbours = binFinder.findBins(lowerBound, gridOpen);
0052 BOOST_CHECK_EQUAL(lowerOpenNeighbours.size(), 3ul);
0053 BOOST_CHECK_EQUAL(lowerOpenNeighbours[0ul], 0ul);
0054 BOOST_CHECK_EQUAL(lowerOpenNeighbours[1ul], 1ul);
0055 BOOST_CHECK_EQUAL(lowerOpenNeighbours[2ul], 2ul);
0056
0057 auto upperOpenNeighbours = binFinder.findBins(upperBound, gridOpen);
0058 BOOST_CHECK_EQUAL(upperOpenNeighbours.size(), 3ul);
0059 BOOST_CHECK_EQUAL(upperOpenNeighbours[0ul], 9ul);
0060 BOOST_CHECK_EQUAL(upperOpenNeighbours[1ul], 10ul);
0061 BOOST_CHECK_EQUAL(upperOpenNeighbours[2ul], 11ul);
0062
0063
0064 Acts::Axis xAxisBound(AxisBound, 0, 100, nBins);
0065 Acts::Grid gridBound(Type<double>, std::move(xAxisBound));
0066
0067 auto lowerBoundNeighbours = binFinder.findBins(lowerBound, gridBound);
0068 BOOST_CHECK_EQUAL(lowerBoundNeighbours.size(), 2ul);
0069 BOOST_CHECK_EQUAL(lowerBoundNeighbours[0ul], 1ul);
0070 BOOST_CHECK_EQUAL(lowerBoundNeighbours[1ul], 2ul);
0071
0072 auto upperBoundNeighbours = binFinder.findBins(upperBound, gridBound);
0073 BOOST_CHECK_EQUAL(upperBoundNeighbours.size(), 2ul);
0074 BOOST_CHECK_EQUAL(upperBoundNeighbours[0ul], 9ul);
0075 BOOST_CHECK_EQUAL(upperBoundNeighbours[1ul], 10ul);
0076 }
0077
0078 BOOST_AUTO_TEST_CASE(grid_binfinder_constructor) {
0079 using list_t = std::vector<std::pair<int, int>>;
0080 Acts::GridBinFinder<1ul> binFinder_1d_1(1);
0081 Acts::GridBinFinder<1ul> binFinder_1d_2(list_t({}));
0082 Acts::GridBinFinder<1ul> binFinder_1d_3(list_t({{0, 2}, {-1, 1}}));
0083 Acts::GridBinFinder<1ul> binFinder_1d_4(std::make_pair(1, 1));
0084
0085 Acts::GridBinFinder<2ul> binFinder_2d_1(1, 5);
0086 Acts::GridBinFinder<2ul> binFinder_2d_2(list_t({}),
0087 list_t({{0, 2}, {-1, 1}}));
0088 Acts::GridBinFinder<2ul> binFinder_2d_3(list_t({}), 2);
0089 Acts::GridBinFinder<2ul> binFinder_2d_4(std::make_pair(1, 2), 2);
0090
0091 Acts::GridBinFinder<3ul> binFinder_3d_1(1, 1, 5);
0092
0093 Acts::GridBinFinder<10ul> binFinder_10d_1(1, 1, 5, 0, 4, 2, 3, 1, 1, 9);
0094 }
0095
0096 BOOST_AUTO_TEST_CASE(grid_binfinder_test_1d_ints) {
0097 const std::size_t nBins = 10ul;
0098 Acts::Axis xAxis(0, 100, nBins);
0099 Acts::Grid grid(Type<double>, std::move(xAxis));
0100
0101 std::array<std::size_t, 1ul> locPosition({3ul});
0102
0103 Acts::GridBinFinder<1ul> binFinder_1(1);
0104 auto neighbours_1 = binFinder_1.findBins(locPosition, grid);
0105 BOOST_CHECK_EQUAL(neighbours_1.size(), 3ul);
0106
0107 for (const std::size_t neighbour : neighbours_1) {
0108 std::array<std::size_t, 1ul> neighboutLocPosition =
0109 grid.localBinsFromGlobalBin(neighbour);
0110 std::size_t distance = locPosition[0ul] <= neighboutLocPosition[0ul]
0111 ? neighboutLocPosition[0ul] - locPosition[0ul]
0112 : locPosition[0ul] - neighboutLocPosition[0ul];
0113 BOOST_CHECK(distance <= 1ul);
0114 }
0115
0116 Acts::GridBinFinder<1ul> binFinder_2(2);
0117 auto neighbours_2 = binFinder_2.findBins(locPosition, grid);
0118 BOOST_CHECK_EQUAL(neighbours_2.size(), 5ul);
0119
0120 for (const std::size_t neighbour : neighbours_2) {
0121 std::array<std::size_t, 1ul> neighboutLocPosition =
0122 grid.localBinsFromGlobalBin(neighbour);
0123 std::size_t distance = locPosition[0ul] <= neighboutLocPosition[0ul]
0124 ? neighboutLocPosition[0ul] - locPosition[0ul]
0125 : locPosition[0ul] - neighboutLocPosition[0ul];
0126 BOOST_CHECK(distance <= 2ul);
0127 }
0128 }
0129
0130 BOOST_AUTO_TEST_CASE(grid_binfinder_test_2d_ints) {
0131 const std::size_t nBinsX = 10ul;
0132 const std::size_t nBinsY = 10ul;
0133 Acts::Axis xAxis(0, 100, nBinsX);
0134 Acts::Axis yAxis(0, 100, nBinsY);
0135 Acts::Grid grid(Type<double>, std::move(xAxis), std::move(yAxis));
0136
0137 std::array<std::size_t, 2ul> locPosition({3ul, 6ul});
0138
0139 Acts::GridBinFinder<2ul> binFinder_1(1, 3);
0140 std::array<std::size_t, 2ul> dims_1({1, 3});
0141 auto neighbours_1 = binFinder_1.findBins(locPosition, grid);
0142 BOOST_CHECK_EQUAL(neighbours_1.size(), 3ul * 7ul);
0143
0144 for (const std::size_t neighbour : neighbours_1) {
0145 std::array<std::size_t, 2ul> neighboutLocPosition =
0146 grid.localBinsFromGlobalBin(neighbour);
0147 for (std::size_t dim(0ul); dim < 2ul; ++dim) {
0148 std::size_t distance = locPosition[dim] <= neighboutLocPosition[dim]
0149 ? neighboutLocPosition[dim] - locPosition[dim]
0150 : locPosition[dim] - neighboutLocPosition[dim];
0151 BOOST_CHECK(distance <= dims_1[dim]);
0152 }
0153 }
0154
0155 Acts::GridBinFinder<2ul> binFinder_2(2, 1);
0156 std::array<std::size_t, 2ul> dims_2({2, 1});
0157 auto neighbours_2 = binFinder_2.findBins(locPosition, grid);
0158 BOOST_CHECK_EQUAL(neighbours_2.size(), 5ul * 3ul);
0159
0160 for (const std::size_t neighbour : neighbours_2) {
0161 std::array<std::size_t, 2ul> neighboutLocPosition =
0162 grid.localBinsFromGlobalBin(neighbour);
0163 for (std::size_t dim(0ul); dim < 2ul; ++dim) {
0164 std::size_t distance = locPosition[dim] <= neighboutLocPosition[dim]
0165 ? neighboutLocPosition[dim] - locPosition[dim]
0166 : locPosition[dim] - neighboutLocPosition[dim];
0167 BOOST_CHECK(distance <= dims_2[dim]);
0168 }
0169 }
0170 }
0171
0172 BOOST_AUTO_TEST_CASE(grid_binfinder_test_3d_ints) {
0173 const std::size_t nBinsX = 10ul;
0174 const std::size_t nBinsY = 10ul;
0175 const std::size_t nBinsZ = 3ul;
0176 Acts::Axis xAxis(0, 100, nBinsX);
0177 Acts::Axis yAxis(0, 100, nBinsY);
0178 Acts::Axis zAxis(0, 100, nBinsZ);
0179 Acts::Grid grid(Type<double>, std::move(xAxis), std::move(yAxis),
0180 std::move(zAxis));
0181
0182 std::array<std::size_t, 3ul> locPosition({3ul, 6ul, 2ul});
0183
0184 Acts::GridBinFinder<3ul> binFinder(1, 2, 0);
0185 std::array<std::size_t, 3ul> dims({1, 2, 0});
0186 auto neighbours = binFinder.findBins(locPosition, grid);
0187 BOOST_CHECK_EQUAL(neighbours.size(), 3ul * 5ul * 1ul);
0188
0189 for (const std::size_t neighbour : neighbours) {
0190 std::array<std::size_t, 3ul> neighboutLocPosition =
0191 grid.localBinsFromGlobalBin(neighbour);
0192 for (std::size_t dim(0ul); dim < 3ul; ++dim) {
0193 std::size_t distance = locPosition[dim] <= neighboutLocPosition[dim]
0194 ? neighboutLocPosition[dim] - locPosition[dim]
0195 : locPosition[dim] - neighboutLocPosition[dim];
0196 BOOST_CHECK(distance <= dims[dim]);
0197 }
0198 }
0199 }
0200
0201 BOOST_AUTO_TEST_CASE(grid_binfinder_test_1d_pair) {
0202 const std::size_t nBins = 10ul;
0203 Acts::Axis xAxis(0, 100, nBins);
0204 Acts::Grid grid(Type<double>, std::move(xAxis));
0205
0206 std::array<std::size_t, 1ul> locPosition({3ul});
0207
0208 Acts::GridBinFinder<1ul> binFinder_1(std::make_pair(1, 1));
0209 auto neighbours_1 = binFinder_1.findBins(locPosition, grid);
0210 BOOST_CHECK_EQUAL(neighbours_1.size(), 3ul);
0211
0212 for (const std::size_t neighbour : neighbours_1) {
0213 std::array<std::size_t, 1ul> neighboutLocPosition =
0214 grid.localBinsFromGlobalBin(neighbour);
0215 std::size_t distance = locPosition[0ul] <= neighboutLocPosition[0ul]
0216 ? neighboutLocPosition[0ul] - locPosition[0ul]
0217 : locPosition[0ul] - neighboutLocPosition[0ul];
0218 BOOST_CHECK(distance <= 1ul);
0219 }
0220
0221 Acts::GridBinFinder<1ul> binFinder_2(std::make_pair(2, 2));
0222 auto neighbours_2 = binFinder_2.findBins(locPosition, grid);
0223 BOOST_CHECK_EQUAL(neighbours_2.size(), 5ul);
0224
0225 for (const std::size_t neighbour : neighbours_2) {
0226 std::array<std::size_t, 1ul> neighboutLocPosition =
0227 grid.localBinsFromGlobalBin(neighbour);
0228 std::size_t distance = locPosition[0ul] <= neighboutLocPosition[0ul]
0229 ? neighboutLocPosition[0ul] - locPosition[0ul]
0230 : locPosition[0ul] - neighboutLocPosition[0ul];
0231 BOOST_CHECK(distance <= 2ul);
0232 }
0233 }
0234
0235 BOOST_AUTO_TEST_CASE(grid_binfinder_test_1d_pair_asymmetric) {
0236 const std::size_t nBins = 10ul;
0237 Acts::Axis xAxis(0, 100, nBins);
0238 Acts::Grid grid(Type<double>, std::move(xAxis));
0239
0240 std::array<std::size_t, 1ul> locPosition({3ul});
0241
0242 Acts::GridBinFinder<1ul> binFinder_1(std::make_pair(1, 2));
0243 auto neighbours_1 = binFinder_1.findBins(locPosition, grid);
0244 BOOST_CHECK_EQUAL(neighbours_1.size(), 4ul);
0245
0246 std::array<std::size_t, 4ul> expected({2ul, 3ul, 4ul, 5ul});
0247 for (std::size_t i(0ul); i < 4ul; ++i) {
0248 BOOST_CHECK_EQUAL(neighbours_1[i], expected[i]);
0249 }
0250 }
0251
0252 BOOST_AUTO_TEST_CASE(grid_binfinder_test_2d_pair) {
0253 const std::size_t nBinsX = 10ul;
0254 const std::size_t nBinsY = 10ul;
0255 Acts::Axis xAxis(0, 100, nBinsX);
0256 Acts::Axis yAxis(0, 100, nBinsY);
0257 Acts::Grid grid(Type<double>, std::move(xAxis), std::move(yAxis));
0258
0259 std::array<std::size_t, 2ul> locPosition({3ul, 6ul});
0260
0261 Acts::GridBinFinder<2ul> binFinder_1(std::make_pair(1, 1),
0262 std::make_pair(3, 3));
0263 std::array<std::size_t, 2ul> dims_1({1, 3});
0264 auto neighbours_1 = binFinder_1.findBins(locPosition, grid);
0265 BOOST_CHECK_EQUAL(neighbours_1.size(), 3ul * 7ul);
0266
0267 for (const std::size_t neighbour : neighbours_1) {
0268 std::array<std::size_t, 2ul> neighboutLocPosition =
0269 grid.localBinsFromGlobalBin(neighbour);
0270 for (std::size_t dim(0ul); dim < 2ul; ++dim) {
0271 std::size_t distance = locPosition[dim] <= neighboutLocPosition[dim]
0272 ? neighboutLocPosition[dim] - locPosition[dim]
0273 : locPosition[dim] - neighboutLocPosition[dim];
0274 BOOST_CHECK(distance <= dims_1[dim]);
0275 }
0276 }
0277
0278 Acts::GridBinFinder<2ul> binFinder_2(std::make_pair(2, 2),
0279 std::make_pair(1, 1));
0280 std::array<std::size_t, 2ul> dims_2({2, 1});
0281 auto neighbours_2 = binFinder_2.findBins(locPosition, grid);
0282 BOOST_CHECK_EQUAL(neighbours_2.size(), 5ul * 3ul);
0283
0284 for (const std::size_t neighbour : neighbours_2) {
0285 std::array<std::size_t, 2ul> neighboutLocPosition =
0286 grid.localBinsFromGlobalBin(neighbour);
0287 for (std::size_t dim(0ul); dim < 2ul; ++dim) {
0288 std::size_t distance = locPosition[dim] <= neighboutLocPosition[dim]
0289 ? neighboutLocPosition[dim] - locPosition[dim]
0290 : locPosition[dim] - neighboutLocPosition[dim];
0291 BOOST_CHECK(distance <= dims_2[dim]);
0292 }
0293 }
0294 }
0295
0296 BOOST_AUTO_TEST_CASE(grid_binfinder_test_1d_pattern) {
0297 const std::size_t nBins = 5ul;
0298 Acts::Axis xAxis(0, 100, nBins);
0299 Acts::Grid grid(Type<double>, std::move(xAxis));
0300
0301 std::array<std::vector<std::size_t>, 1ul> navigation;
0302 navigation[0ul].resize(nBins);
0303 std::iota(navigation[0ul].begin(), navigation[0ul].end(), 1ul);
0304
0305 std::vector<std::pair<int, int>> neighbours;
0306 neighbours.push_back(std::make_pair(0, 2));
0307 neighbours.push_back(std::make_pair(-1, 1));
0308 neighbours.push_back(std::make_pair(-1, 2));
0309 neighbours.push_back(std::make_pair(-2, 1));
0310 neighbours.push_back(std::make_pair(-1, 0));
0311
0312 BOOST_CHECK_EQUAL(neighbours.size(), grid.numLocalBins()[0ul]);
0313
0314 auto startGrid = grid.begin(navigation);
0315 auto stopGrid = grid.end(navigation);
0316
0317 Acts::GridBinFinder<1ul> binFinder(std::move(neighbours));
0318
0319 std::size_t counter = 0ul;
0320 std::vector<std::size_t> expectedNeighbours = {3, 3, 4, 4, 2};
0321
0322 for (; startGrid != stopGrid; startGrid++) {
0323 std::array<std::size_t, 1ul> locPosition = startGrid.localBinsIndices();
0324 auto all_neigh = binFinder.findBins(locPosition, grid);
0325 BOOST_CHECK_EQUAL(all_neigh.size(), expectedNeighbours[counter++]);
0326 }
0327
0328 std::vector<std::pair<int, int>> anotherNeighbours;
0329 anotherNeighbours.push_back(std::make_pair(1, 2));
0330 anotherNeighbours.push_back(std::make_pair(-1, 1));
0331 anotherNeighbours.push_back(std::make_pair(-1, 2));
0332 anotherNeighbours.push_back(std::make_pair(-2, 1));
0333 anotherNeighbours.push_back(std::make_pair(-1, 0));
0334
0335 Acts::GridBinFinder<1ul> anotherBinFinder(std::move(anotherNeighbours));
0336 std::array<std::size_t, 1ul> locPosition = {1ul};
0337
0338 auto neighs = anotherBinFinder.findBins(locPosition, grid);
0339 BOOST_CHECK_EQUAL(neighs.size(), 2ul);
0340
0341 for (const std::size_t neighbour : neighs) {
0342 std::array<std::size_t, 1ul> neighboutLocPosition =
0343 grid.localBinsFromGlobalBin(neighbour);
0344 std::size_t distance = locPosition[0ul] <= neighboutLocPosition[0ul]
0345 ? neighboutLocPosition[0ul] - locPosition[0ul]
0346 : locPosition[0ul] - neighboutLocPosition[0ul];
0347 BOOST_CHECK(distance <= 2ul);
0348 BOOST_CHECK(distance >= 1ul);
0349 }
0350 }
0351
0352 BOOST_AUTO_TEST_CASE(grid_binfinder_test_2d_pattern) {
0353 const std::size_t nBinsX = 5ul;
0354 const std::size_t nBinsY = 3ul;
0355 Acts::Axis xAxis(0, 100, nBinsX);
0356 Acts::Axis yAxis(0, 100, nBinsY);
0357 Acts::Grid grid(Type<double>, std::move(xAxis), std::move(yAxis));
0358
0359 std::array<std::vector<std::size_t>, 2ul> navigation;
0360 navigation[0ul].resize(nBinsX);
0361 navigation[1ul].resize(nBinsY);
0362 std::iota(navigation[0ul].begin(), navigation[0ul].end(), 1ul);
0363 std::iota(navigation[1ul].begin(), navigation[1ul].end(), 1ul);
0364
0365 std::vector<std::pair<int, int>> neighboursX;
0366 neighboursX.push_back(std::make_pair(0, 2));
0367 neighboursX.push_back(std::make_pair(-1, 1));
0368 neighboursX.push_back(std::make_pair(-1, 2));
0369 neighboursX.push_back(std::make_pair(-2, 1));
0370 neighboursX.push_back(std::make_pair(-1, 0));
0371
0372 std::vector<std::pair<int, int>> neighboursY;
0373 neighboursY.push_back(std::make_pair(0, 1));
0374 neighboursY.push_back(std::make_pair(-1, 1));
0375 neighboursY.push_back(std::make_pair(-1, 0));
0376
0377 BOOST_CHECK_EQUAL(neighboursX.size(), grid.numLocalBins()[0ul]);
0378 BOOST_CHECK_EQUAL(neighboursY.size(), grid.numLocalBins()[1ul]);
0379
0380 auto startGrid = grid.begin(navigation);
0381 auto stopGrid = grid.end(navigation);
0382
0383 std::size_t counter = 0ul;
0384 std::vector<std::size_t> expectedNeighbours = {6, 9, 6, 6, 9, 6, 8, 12,
0385 8, 8, 12, 8, 4, 6, 4};
0386
0387 BOOST_CHECK_EQUAL(expectedNeighbours.size(),
0388 neighboursX.size() * neighboursY.size());
0389
0390 Acts::GridBinFinder<2ul> binFinder(std::move(neighboursX),
0391 std::move(neighboursY));
0392
0393 for (; startGrid != stopGrid; startGrid++) {
0394 std::array<std::size_t, 2ul> locPosition = startGrid.localBinsIndices();
0395 auto all_neigh = binFinder.findBins(locPosition, grid);
0396 BOOST_CHECK_EQUAL(all_neigh.size(), expectedNeighbours[counter++]);
0397 }
0398 }
0399
0400 BOOST_AUTO_TEST_CASE(grid_binfinder_test_2d_empty_pattern) {
0401 const std::size_t nBinsX = 5ul;
0402 const std::size_t nBinsY = 3ul;
0403 Acts::Axis xAxis(0, 100, nBinsX);
0404 Acts::Axis yAxis(0, 100, nBinsY);
0405 Acts::Grid grid(Type<double>, std::move(xAxis), std::move(yAxis));
0406
0407 std::array<std::vector<std::size_t>, 2ul> navigation;
0408 navigation[0ul].resize(nBinsX);
0409 navigation[1ul].resize(nBinsY);
0410 std::iota(navigation[0ul].begin(), navigation[0ul].end(), 1ul);
0411 std::iota(navigation[1ul].begin(), navigation[1ul].end(), 1ul);
0412
0413 std::vector<std::pair<int, int>> neighboursX;
0414 std::vector<std::pair<int, int>> neighboursY;
0415
0416 auto startGrid = grid.begin(navigation);
0417 auto stopGrid = grid.end(navigation);
0418
0419 Acts::GridBinFinder<2ul> binFinder(std::move(neighboursX),
0420 std::move(neighboursY));
0421
0422 for (; startGrid != stopGrid; startGrid++) {
0423 std::array<std::size_t, 2ul> locPosition = startGrid.localBinsIndices();
0424 auto all_neigh = binFinder.findBins(locPosition, grid);
0425 BOOST_CHECK_EQUAL(all_neigh.size(), 9ul);
0426 }
0427 }
0428
0429 BOOST_AUTO_TEST_CASE(grid_binfinder_test_2d_mixed) {
0430 const std::size_t nBinsX = 5ul;
0431 const std::size_t nBinsY = 3ul;
0432 Acts::Axis xAxis(0, 100, nBinsX);
0433 Acts::Axis yAxis(0, 100, nBinsY);
0434 Acts::Grid grid(Type<double>, std::move(xAxis), std::move(yAxis));
0435
0436 std::array<std::vector<std::size_t>, 2ul> navigation;
0437 navigation[0ul].resize(nBinsX);
0438 navigation[1ul].resize(nBinsY);
0439 std::iota(navigation[0ul].begin(), navigation[0ul].end(), 1ul);
0440 std::iota(navigation[1ul].begin(), navigation[1ul].end(), 1ul);
0441
0442 std::vector<std::pair<int, int>> neighboursX;
0443 neighboursX.push_back(std::make_pair(0, 2));
0444 neighboursX.push_back(std::make_pair(-1, 1));
0445 neighboursX.push_back(std::make_pair(-1, 2));
0446 neighboursX.push_back(std::make_pair(-2, 1));
0447 neighboursX.push_back(std::make_pair(-1, 0));
0448
0449 BOOST_CHECK_EQUAL(neighboursX.size(), grid.numLocalBins()[0ul]);
0450
0451 auto startGrid = grid.begin(navigation);
0452 auto stopGrid = grid.end(navigation);
0453
0454 std::size_t counter = 0ul;
0455 std::vector<std::size_t> expectedNeighbours = {9, 9, 9, 9, 9, 9, 12, 12,
0456 12, 12, 12, 12, 6, 6, 6};
0457
0458 BOOST_CHECK_EQUAL(expectedNeighbours.size(), neighboursX.size() * nBinsY);
0459
0460 Acts::GridBinFinder<2ul> binFinder(std::move(neighboursX), 1);
0461
0462 for (; startGrid != stopGrid; startGrid++) {
0463 std::array<std::size_t, 2ul> locPosition = startGrid.localBinsIndices();
0464 auto all_neigh = binFinder.findBins(locPosition, grid);
0465 BOOST_CHECK_EQUAL(all_neigh.size(), expectedNeighbours[counter++]);
0466 }
0467 }
0468
0469 }