11 #include <boost/test/data/test_case.hpp>
12 #include <boost/test/unit_test.hpp>
26 constexpr
unsigned int dim = 2;
31 return {global.x(), global.y()};
36 std::array<double, dim> lowerLeft{{0., 0.}};
37 std::array<double, dim> upperRight{{1., 1.}};
40 std::array<ActsVectorF<5>, 4> matArray = {mat, mat, mat, mat};
65 auto grid =
grid_t(std::make_tuple(std::move(axisX), std::move(axisY)));
69 for (
size_t i = 0; i < grid.size(); i++) {
79 matMap.getMaterialCell({0.5, 0.5, 0.5});
83 std::vector<size_t> nBins = matMap.getNBins();
84 BOOST_CHECK_EQUAL(nBins[0], 3
u);
85 BOOST_CHECK_EQUAL(nBins[1], 3
u);
88 std::vector<double> limits = matMap.getMin();
93 limits = matMap.getMax();
98 BOOST_CHECK_EQUAL(matMap.isInside(
Vector3D(1., 1., 1.)),
true);
99 BOOST_CHECK_EQUAL(matMap.isInside(
Vector3D(-1., 0., 0.)),
false);
100 BOOST_CHECK_EQUAL(matMap.isInside(
Vector3D(0., -1., 0.)),
false);
101 BOOST_CHECK_EQUAL(matMap.isInside(
Vector3D(0., 0., -1.)),
true);
102 BOOST_CHECK_EQUAL(matMap.isInside(
Vector3D(4., 0., 0.)),
false);
103 BOOST_CHECK_EQUAL(matMap.isInside(
Vector3D(0., 4., 0.)),
false);
104 BOOST_CHECK_EQUAL(matMap.isInside(
Vector3D(0., 0., 4.)),
true);
107 auto matMapGrid = matMap.getGrid();
108 for (
unsigned int i = 0; i <
dim; i++) {
109 BOOST_CHECK_EQUAL(grid.numLocalBins()[i], matMapGrid.numLocalBins()[i]);
110 BOOST_CHECK_EQUAL(grid.minPosition()[i], matMapGrid.minPosition()[i]);
111 BOOST_CHECK_EQUAL(grid.maxPosition()[i], matMapGrid.maxPosition()[i]);
113 for (
size_t i = 0; i < grid.size(); i++) {
124 auto grid =
grid_t(std::make_tuple(std::move(axisX), std::move(axisY)));
126 mat << 1, 2, 3, 4, 5;
128 for (
size_t i = 0; i < grid.size(); i++) {
139 std::array<double, dim> lowerLeft{{0., 0.}};
140 std::array<double, dim> upperRight{{1., 1.}};
141 std::array<ActsVectorF<5>, 4> matArray = {mat, mat, mat, mat};
143 MaterialMapper<grid_t>::MaterialCell materialCell(
145 InterpolatedMaterialMap<MaterialMapper<grid_t>>::Cache cache;
146 cache.matCell = materialCell;
147 cache.initialized =
true;
149 Material(mat), 1
e-4);
152 BOOST_CHECK_EQUAL(ipolMatMap.isInside(
Vector3D(1., 1., 1.)),
true);
153 BOOST_CHECK_EQUAL(ipolMatMap.isInside(
Vector3D(-1., 0., 0.)),
false);
154 BOOST_CHECK_EQUAL(ipolMatMap.isInside(
Vector3D(0., -1., 0.)),
false);
155 BOOST_CHECK_EQUAL(ipolMatMap.isInside(
Vector3D(0., 0., -1.)),
true);
156 BOOST_CHECK_EQUAL(ipolMatMap.isInside(
Vector3D(4., 0., 0.)),
false);
157 BOOST_CHECK_EQUAL(ipolMatMap.isInside(
Vector3D(0., 4., 0.)),
false);
158 BOOST_CHECK_EQUAL(ipolMatMap.isInside(
Vector3D(0., 0., 4.)),
true);