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/Definitions/Algebra.hpp"
0012 #include "Acts/Utilities/Axis.hpp"
0013 #include "Acts/Utilities/AxisDefinitions.hpp"
0014 #include "Acts/Utilities/Grid.hpp"
0015 #include "Acts/Utilities/GridAxisGenerators.hpp"
0016
0017 #include <cmath>
0018 #include <numbers>
0019 #include <tuple>
0020 #include <utility>
0021
0022 using namespace Acts;
0023 using namespace Acts::detail;
0024 using namespace Acts::GridAxisGenerators;
0025
0026 BOOST_AUTO_TEST_SUITE(Detector)
0027
0028 BOOST_AUTO_TEST_CASE(Eq1D) {
0029 EqBound eqb{{-10, 10}, 10};
0030 auto axisTupleB = eqb();
0031 BOOST_CHECK_EQUAL(std::tuple_size<decltype(axisTupleB)>{}, 1u);
0032 auto axisB = std::get<0u>(axisTupleB);
0033 BOOST_CHECK(axisB.getBoundaryType() == AxisBoundaryType::Bound);
0034
0035 EqOpen eqo{{-10, 10}, 10};
0036 auto axisTupleO = eqo();
0037 BOOST_CHECK_EQUAL(std::tuple_size<decltype(axisTupleO)>{}, 1u);
0038 auto axisO = std::get<0u>(axisTupleO);
0039 BOOST_CHECK(axisO.getBoundaryType() == AxisBoundaryType::Open);
0040
0041 EqClosed eqc{{-10, 10}, 10};
0042 auto axisTupleC = eqc();
0043 BOOST_CHECK_EQUAL(std::tuple_size<decltype(axisTupleC)>{}, 1u);
0044 auto axisC = std::get<0u>(axisTupleC);
0045 BOOST_CHECK(axisC.getBoundaryType() == AxisBoundaryType::Closed);
0046
0047
0048 EqBound::grid_type<bool> eqbGrid(std::move(axisTupleB));
0049 }
0050
0051 BOOST_AUTO_TEST_CASE(EqEq2D) {
0052 EqOpenEqClosed eoec{{0, 10}, 10u, {-std::numbers::pi, std::numbers::pi}, 16u};
0053 auto axisTuple = eoec();
0054 BOOST_CHECK_EQUAL(std::tuple_size<decltype(axisTuple)>{}, 2u);
0055 auto axisVar = std::get<0u>(axisTuple);
0056 BOOST_CHECK(axisVar.getBoundaryType() == AxisBoundaryType::Open);
0057 BOOST_CHECK(axisVar.isEquidistant());
0058 auto axisEq = std::get<1u>(axisTuple);
0059 BOOST_CHECK(axisEq.getBoundaryType() == AxisBoundaryType::Closed);
0060 BOOST_CHECK(axisEq.isEquidistant());
0061
0062 EqOpenEqClosed::grid_type<bool> eoecGrid(std::move(axisTuple));
0063 }
0064
0065 BOOST_AUTO_TEST_CASE(EqVar2D) {
0066 EqBoundVarOpen ebvo{{0, 10}, 10u, {10., 20, 30, 40}};
0067 auto axisTuple = ebvo();
0068 BOOST_CHECK_EQUAL(std::tuple_size<decltype(axisTuple)>{}, 2u);
0069 auto axisVar = std::get<0u>(axisTuple);
0070 BOOST_CHECK(axisVar.getBoundaryType() == AxisBoundaryType::Bound);
0071 BOOST_CHECK(axisVar.isEquidistant());
0072 auto axisEq = std::get<1u>(axisTuple);
0073 BOOST_CHECK(axisEq.getBoundaryType() == AxisBoundaryType::Open);
0074 BOOST_CHECK(axisEq.isVariable());
0075
0076 EqBoundVarOpen::grid_type<bool> ebvoGrid(std::move(axisTuple));
0077 }
0078
0079 BOOST_AUTO_TEST_CASE(VarEq2D) {
0080 VarBoundEqClosed vbec{
0081 {10., 20, 30, 40}, {-std::numbers::pi, std::numbers::pi}, 12u};
0082 auto axisTuple = vbec();
0083 BOOST_CHECK_EQUAL(std::tuple_size<decltype(axisTuple)>{}, 2u);
0084 auto axisVar = std::get<0u>(axisTuple);
0085 BOOST_CHECK(axisVar.getBoundaryType() == AxisBoundaryType::Bound);
0086 BOOST_CHECK(axisVar.isVariable());
0087 auto axisEq = std::get<1u>(axisTuple);
0088 BOOST_CHECK(axisEq.getBoundaryType() == AxisBoundaryType::Closed);
0089 BOOST_CHECK(axisEq.isEquidistant());
0090
0091 VarBoundEqClosed::grid_type<bool> vbecGrid(std::move(axisTuple));
0092 }
0093
0094 BOOST_AUTO_TEST_CASE(VarVar2D) {
0095 VarBoundVarBound vbvb{{10., 20, 30, 40}, {10., 20, 30, 40}};
0096 auto axisTuple = vbvb();
0097 BOOST_CHECK_EQUAL(std::tuple_size<decltype(axisTuple)>{}, 2u);
0098 auto axisVar = std::get<0u>(axisTuple);
0099 BOOST_CHECK(axisVar.getBoundaryType() == AxisBoundaryType::Bound);
0100 BOOST_CHECK(axisVar.isVariable());
0101 auto axisEq = std::get<1u>(axisTuple);
0102 BOOST_CHECK(axisEq.getBoundaryType() == AxisBoundaryType::Bound);
0103 BOOST_CHECK(axisEq.isVariable());
0104
0105 VarBoundVarBound::grid_type<bool> vbvbGrid(std::move(axisTuple));
0106 }
0107
0108 BOOST_AUTO_TEST_SUITE_END()