File indexing completed on 2025-11-08 09:20:27
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/Surfaces/BoundaryTolerance.hpp"
0013 #include "Acts/Surfaces/SurfaceBounds.hpp"
0014
0015 #include <cstddef>
0016 #include <numeric>
0017 #include <ostream>
0018 #include <vector>
0019
0020 namespace Acts {
0021
0022
0023 class SurfaceBoundsStub : public SurfaceBounds {
0024 public:
0025
0026 explicit SurfaceBoundsStub(std::size_t nValues = 0) : m_values(nValues, 0) {
0027 std::iota(m_values.begin(), m_values.end(), 0);
0028 }
0029
0030 #if defined(__GNUC__) && (__GNUC__ == 13 || __GNUC__ == 14) && \
0031 !defined(__clang__)
0032 #pragma GCC diagnostic push
0033 #pragma GCC diagnostic ignored "-Warray-bounds"
0034 #pragma GCC diagnostic ignored "-Wstringop-overflow"
0035 #endif
0036 SurfaceBoundsStub(const SurfaceBoundsStub& other) = default;
0037 SurfaceBoundsStub& operator=(const SurfaceBoundsStub& other) = default;
0038 #if defined(__GNUC__) && (__GNUC__ == 13 || __GNUC__ == 14) && \
0039 !defined(__clang__)
0040 #pragma GCC diagnostic pop
0041 #endif
0042
0043 BoundsType type() const final { return eOther; }
0044
0045 bool isCartesian() const final { return true; }
0046
0047 SquareMatrix2 boundToCartesianJacobian(const Vector2& lposition) const final {
0048 (void)lposition;
0049 return SquareMatrix2::Identity();
0050 }
0051
0052 SquareMatrix2 boundToCartesianMetric(const Vector2& lposition) const final {
0053 (void)lposition;
0054 return SquareMatrix2::Identity();
0055 }
0056
0057 std::vector<double> values() const final { return m_values; }
0058
0059 bool inside(const Vector2& lposition) const final {
0060 (void)lposition;
0061 return true;
0062 }
0063
0064 Vector2 closestPoint(const Vector2& lposition,
0065 const SquareMatrix2& metric) const final {
0066 (void)metric;
0067 return lposition;
0068 }
0069
0070 Vector2 center() const final { return Vector2(0.0, 0.0); }
0071
0072 bool inside(const Vector2& lposition,
0073 const BoundaryTolerance& boundaryTolerance) const final {
0074 (void)lposition;
0075 (void)boundaryTolerance;
0076 return true;
0077 }
0078
0079 std::ostream& toStream(std::ostream& sl) const final {
0080 sl << "SurfaceBoundsStub";
0081 return sl;
0082 }
0083
0084 private:
0085 std::vector<double> m_values;
0086 };
0087
0088 }
0089
0090 using namespace Acts;
0091
0092 namespace ActsTests {
0093
0094 BOOST_AUTO_TEST_SUITE(SurfacesSuite)
0095
0096
0097 BOOST_AUTO_TEST_CASE(SurfaceBoundsConstruction) {
0098 SurfaceBoundsStub u;
0099 SurfaceBoundsStub s(1);
0100 SurfaceBoundsStub t(s);
0101 SurfaceBoundsStub v(u);
0102 }
0103
0104 BOOST_AUTO_TEST_CASE(SurfaceBoundsProperties) {
0105 SurfaceBoundsStub surface(5);
0106 std::vector<double> reference{0, 1, 2, 3, 4};
0107 const auto& boundValues = surface.values();
0108 BOOST_CHECK_EQUAL_COLLECTIONS(reference.cbegin(), reference.cend(),
0109 boundValues.cbegin(), boundValues.cend());
0110 }
0111
0112
0113 BOOST_AUTO_TEST_CASE(SurfaceBoundsEquality) {
0114 SurfaceBoundsStub surface(1);
0115 SurfaceBoundsStub copiedSurface(surface);
0116 SurfaceBoundsStub differentSurface(2);
0117 BOOST_CHECK_EQUAL(surface, copiedSurface);
0118 BOOST_CHECK_NE(surface, differentSurface);
0119
0120 SurfaceBoundsStub assignedSurface;
0121 assignedSurface = surface;
0122 BOOST_CHECK_EQUAL(surface, assignedSurface);
0123
0124 const auto& surfaceboundValues = surface.values();
0125 const auto& assignedboundValues = assignedSurface.values();
0126 BOOST_CHECK_EQUAL_COLLECTIONS(
0127 surfaceboundValues.cbegin(), surfaceboundValues.cend(),
0128 assignedboundValues.cbegin(), assignedboundValues.cend());
0129 }
0130
0131 BOOST_AUTO_TEST_SUITE_END()
0132
0133 }