9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/included/unit_test.hpp>
39 std::vector<double> rPos = {0., 1., 2.};
40 std::vector<double> xPos = {0., 1., 2.};
41 std::vector<double> yPos = {0., 1., 2.};
42 std::vector<double> zPos = {0., 1., 2.};
45 std::vector<Material> material_rz;
46 for (
int i = 0; i < 9; i++) {
47 material_rz.push_back(
Material(i, i, i, i, i));
50 auto localToGlobalBin_rz = [](std::array<size_t, 2> binsRZ,
51 std::array<size_t, 2> nBinsRZ) {
52 return (binsRZ.at(1) * nBinsRZ.at(0) + binsRZ.at(0));
58 std::vector<size_t> nBins_rz = {rPos.size(), zPos.size()};
59 std::vector<double> minima_rz = {0., 0.};
60 std::vector<double> maxima_rz = {3., 3.};
61 BOOST_CHECK(mapper_rz.getNBins() == nBins_rz);
64 BOOST_CHECK(mapper_rz.getMin() == minima_rz);
67 BOOST_CHECK(mapper_rz.getMax() == maxima_rz);
70 std::vector<Material> material_xyz;
71 for (
int i = 0; i < 27; i++) {
72 material_xyz.push_back(
Material(i, i, i, i, i));
75 auto localToGlobalBin_xyz = [](std::array<size_t, 3> binsXYZ,
76 std::array<size_t, 3> nBinsXYZ) {
77 return (binsXYZ.at(0) * (nBinsXYZ.at(1) * nBinsXYZ.at(2)) +
78 binsXYZ.at(1) * nBinsXYZ.at(2) + binsXYZ.at(2));
85 std::vector<size_t> nBins_xyz = {xPos.size(), yPos.size(), zPos.size()};
86 std::vector<double> minima_xyz = {0., 0., 0.};
87 std::vector<double> maxima_xyz = {3., 3., 3.};
88 BOOST_CHECK(mapper_xyz.getNBins() == nBins_xyz);
91 BOOST_CHECK(mapper_xyz.getMin() == minima_xyz);
94 BOOST_CHECK(mapper_xyz.getMax() == maxima_xyz);
100 auto value0_rz = mapper_rz.getMaterial(pos0_rz);
101 auto value1_rz = mapper_rz.getMaterial(pos1_rz);
102 auto value2_rz = mapper_rz.getMaterial(pos2_rz);
105 localToGlobalBin_rz({{0, 0}}, {{rPos.size(), zPos.size()}}));
107 localToGlobalBin_rz({{1, 1}}, {{rPos.size(), zPos.size()}}));
109 localToGlobalBin_rz({{2, 2}}, {{rPos.size(), zPos.size()}}));
124 auto value0_xyz = mapper_xyz.getMaterial(pos0_xyz);
125 auto value1_xyz = mapper_xyz.getMaterial(pos1_xyz);
126 auto value2_xyz = mapper_xyz.getMaterial(pos2_xyz);
128 Material mat0_xyz = material_xyz.at(localToGlobalBin_xyz(
129 {{0, 0, 0}}, {{xPos.size(), yPos.size(), zPos.size()}}));
130 Material mat1_xyz = material_xyz.at(localToGlobalBin_xyz(
131 {{1, 1, 1}}, {{xPos.size(), yPos.size(), zPos.size()}}));
132 Material mat2_xyz = material_xyz.at(localToGlobalBin_xyz(
133 {{2, 2, 2}}, {{xPos.size(), yPos.size(), zPos.size()}}));