Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions Core/include/Acts/Geometry/CuboidPortalShell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ class CuboidPortalShell : public PortalShellBase {
/// Type alias for cuboid volume bounds face enumeration
using Face = CuboidVolumeBounds::Face;

/// Retrieve the portal associated to the given face. Can be nullptr if unset.
/// @param face The face to retrieve the portal for
/// @return The portal associated to the face
virtual Portal* portal(Face face) = 0;

/// Retrieve a shared_ptr for the portal associated to the given face. Can be
/// nullptr if unset.
/// @param face The face to retrieve the portal for
Expand Down Expand Up @@ -70,9 +65,6 @@ class SingleCuboidPortalShell : public CuboidPortalShell {
/// @copydoc PortalShellBase::size
std::size_t size() const final;

/// @copydoc CuboidPortalShell::portal
Portal* portal(Face face) final;

/// @copydoc CuboidPortalShell::portalPtr
std::shared_ptr<Portal> portalPtr(Face face) final;

Expand Down Expand Up @@ -116,9 +108,6 @@ class CuboidStackPortalShell final : public CuboidPortalShell {
/// @copydoc PortalShellBase::size
std::size_t size() const override;

/// @copydoc CuboidPortalShell::portal
Portal* portal(Face face) override;

/// @copydoc CuboidPortalShell::portalPtr
std::shared_ptr<Portal> portalPtr(Face face) override;

Expand Down
11 changes: 0 additions & 11 deletions Core/include/Acts/Geometry/CylinderPortalShell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ class CylinderPortalShell : public PortalShellBase {

using enum CylinderVolumeBounds::Face;

/// Retrieve the portal associated to the given face. Can be nullptr if unset.
/// @param face The face to retrieve the portal for
/// @return The portal associated to the face
virtual Portal* portal(Face face) = 0;

/// Retrieve a shared_ptr for the portal associated to the given face. Can be
/// nullptr if unset.
/// @param face The face to retrieve the portal for
Expand Down Expand Up @@ -72,9 +67,6 @@ class SingleCylinderPortalShell : public CylinderPortalShell {
/// @copydoc PortalShellBase::size
std::size_t size() const final;

/// @copydoc CylinderPortalShell::portal
Portal* portal(Face face) final;

/// @copydoc CylinderPortalShell::portalPtr
std::shared_ptr<Portal> portalPtr(Face face) final;

Expand Down Expand Up @@ -149,9 +141,6 @@ class CylinderStackPortalShell : public CylinderPortalShell {
/// @copydoc PortalShellBase::size
std::size_t size() const final;

/// @copydoc CylinderPortalShell::portal
Portal* portal(Face face) final;

/// @copydoc CylinderPortalShell::portalPtr
std::shared_ptr<Portal> portalPtr(Face face) final;

Expand Down
8 changes: 0 additions & 8 deletions Core/include/Acts/Geometry/TrapezoidPortalShell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ class TrapezoidPortalShell : public PortalShellBase {

using enum TrapezoidVolumeBounds::Face;

/// Retrieve the portal associated to the given face. Can be nullptr if unset.
/// @param face The face to retrieve the portal for
/// @return The portal associated to the face
virtual Portal* portal(Face face) = 0;

/// Retrieve a shared_ptr for the portal associated to the given face. Can be
/// nullptr if unset.
/// @param face The face to retrieve the portal for
Expand Down Expand Up @@ -68,9 +63,6 @@ class SingleTrapezoidPortalShell : public TrapezoidPortalShell {
/// @copydoc PortalShellBase::size
std::size_t size() const override;

/// @copydoc TrapezoidPortalShell::portal
Portal* portal(Face face) override;

/// @copydoc TrapezoidPortalShell::portalPtr
std::shared_ptr<Portal> portalPtr(Face face) override;

Expand Down
8 changes: 0 additions & 8 deletions Core/src/Geometry/CuboidPortalShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ SingleCuboidPortalShell::SingleCuboidPortalShell(TrackingVolume& volume)
handle(PositiveYFace, positiveFaceZX);
}

Portal* SingleCuboidPortalShell::portal(Face face) {
return portalPtr(face).get();
}

std::shared_ptr<Portal> SingleCuboidPortalShell::portalPtr(Face face) {
return m_portals.at(toUnderlying(face));
}
Expand Down Expand Up @@ -240,10 +236,6 @@ std::size_t CuboidStackPortalShell::size() const {
return 6;
}

Portal* CuboidStackPortalShell::portal(Face face) {
return portalPtr(face).get();
}

std::shared_ptr<Portal> CuboidStackPortalShell::portalPtr(Face face) {
if (face == m_backFace) {
return m_shells.back()->portalPtr(face);
Expand Down
8 changes: 0 additions & 8 deletions Core/src/Geometry/CylinderPortalShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ SingleCylinderPortalShell::SingleCylinderPortalShell(TrackingVolume& volume)
}
}

Portal* SingleCylinderPortalShell::portal(Face face) {
return portalPtr(face).get();
}

std::shared_ptr<Portal> SingleCylinderPortalShell::portalPtr(Face face) {
return m_portals.at(toUnderlying(face));
}
Expand Down Expand Up @@ -246,10 +242,6 @@ std::size_t CylinderStackPortalShell::size() const {
return m_hasInnerCylinder ? 4 : 3;
}

Portal* CylinderStackPortalShell::portal(Face face) {
return portalPtr(face).get();
}

std::shared_ptr<Portal> CylinderStackPortalShell::portalPtr(Face face) {
if (m_direction == AxisDirection::AxisR) {
switch (face) {
Expand Down
4 changes: 0 additions & 4 deletions Core/src/Geometry/TrapezoidPortalShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ SingleTrapezoidPortalShell::SingleTrapezoidPortalShell(TrackingVolume& volume)
}
}

Portal* SingleTrapezoidPortalShell::portal(Face face) {
return portalPtr(face).get();
}

std::shared_ptr<Portal> SingleTrapezoidPortalShell::portalPtr(Face face) {
return m_portals.at(toUnderlying(face));
}
Expand Down
6 changes: 3 additions & 3 deletions Core/src/Geometry/detail/MaterialDesignator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class CylinderProtoDesignator : public DesignatorBase {
using enum CylinderVolumeBounds::Face;

for (const auto& [face, loc0, loc1] : m_binning) {
auto* portal = cylShell->portal(face);
auto* portal = cylShell->portalPtr(face).get();
if (portal == nullptr) {
ACTS_ERROR(prefix << "Portal is nullptr");
throw std::runtime_error("Portal is nullptr");
Expand Down Expand Up @@ -197,7 +197,7 @@ class CuboidProtoDesignator : public DesignatorBase {
using enum CuboidVolumeBounds::Face;

for (const auto& [face, loc0, loc1] : m_binning) {
auto* portal = cuboidShell->portal(face);
auto* portal = cuboidShell->portalPtr(face).get();
if (portal == nullptr) {
ACTS_ERROR(prefix << "Portal is nullptr");
throw std::runtime_error("Portal is nullptr");
Expand Down Expand Up @@ -287,7 +287,7 @@ class ISurfaceMaterialDesignator : public DesignatorBase {
}

for (const auto& [face, material] : m_materials) {
auto* portal = concreteShell->portal(face);
auto* portal = concreteShell->portalPtr(face).get();
if (portal == nullptr) {
ACTS_ERROR(prefix << "Portal is nullptr");
throw std::runtime_error("Portal is nullptr");
Expand Down
90 changes: 46 additions & 44 deletions Tests/UnitTests/Core/Geometry/CuboidPortalShellTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(ConstructionFromVolume) {
using enum CuboidVolumeBounds::Face;

// XY plane
const auto* pXY = shell1.portal(PositiveZFace);
const auto pXY = shell1.portalPtr(PositiveZFace);
BOOST_REQUIRE_NE(pXY, nullptr);
BOOST_CHECK_EQUAL(
pXY->resolveVolume(gctx, Vector3{25_mm, 20_mm, 50_mm}, -Vector3::UnitZ())
Expand All @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(ConstructionFromVolume) {
.value(),
nullptr);

const auto* nXY = shell1.portal(NegativeZFace);
const auto nXY = shell1.portalPtr(NegativeZFace);
BOOST_REQUIRE_NE(nXY, nullptr);
BOOST_CHECK_EQUAL(
nXY->resolveVolume(gctx, Vector3{25_mm, 20_mm, -50_mm}, -Vector3::UnitZ())
Expand All @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(ConstructionFromVolume) {
&cube);

// YZ plane
const auto* pYZ = shell1.portal(PositiveXFace);
const auto pYZ = shell1.portalPtr(PositiveXFace);
BOOST_REQUIRE_NE(pYZ, nullptr);
BOOST_CHECK_EQUAL(
pYZ->resolveVolume(gctx, Vector3{30_mm, 10_mm, 30_mm}, -Vector3::UnitX())
Expand All @@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(ConstructionFromVolume) {
.value(),
nullptr);

const auto* nYZ = shell1.portal(NegativeXFace);
const auto nYZ = shell1.portalPtr(NegativeXFace);
BOOST_REQUIRE_NE(nYZ, nullptr);
BOOST_CHECK_EQUAL(
nYZ->resolveVolume(gctx, Vector3{-30_mm, 10_mm, 30_mm}, -Vector3::UnitX())
Expand All @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE(ConstructionFromVolume) {
&cube);

// ZX plane
const auto* pZX = shell1.portal(PositiveYFace);
const auto pZX = shell1.portalPtr(PositiveYFace);
BOOST_REQUIRE_NE(pZX, nullptr);
BOOST_CHECK_EQUAL(
pZX->resolveVolume(gctx, Vector3{15_mm, 40_mm, -10_mm}, -Vector3::UnitY())
Expand All @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(ConstructionFromVolume) {
.value(),
nullptr);

const auto* nZX = shell1.portal(NegativeYFace);
const auto nZX = shell1.portalPtr(NegativeYFace);
BOOST_REQUIRE_NE(nZX, nullptr);
BOOST_CHECK_EQUAL(nZX->resolveVolume(gctx, Vector3{15_mm, -40_mm, -10_mm},
-Vector3::UnitY())
Expand All @@ -144,12 +144,12 @@ BOOST_AUTO_TEST_CASE(PortalAssignment) {

SingleCuboidPortalShell shell{vol};

const auto* pXY = shell.portal(PositiveZFace);
const auto* nXY = shell.portal(NegativeZFace);
const auto* nYZ = shell.portal(NegativeXFace);
const auto* pZX = shell.portal(PositiveYFace);
auto* pYZ = shell.portal(PositiveXFace);
auto* nZX = shell.portal(NegativeYFace);
const auto pXY = shell.portalPtr(PositiveZFace);
const auto nXY = shell.portalPtr(NegativeZFace);
const auto nYZ = shell.portalPtr(NegativeXFace);
const auto pZX = shell.portalPtr(PositiveYFace);
auto pYZ = shell.portalPtr(PositiveXFace);
auto nZX = shell.portalPtr(NegativeYFace);

// Setting new pYZ
BOOST_REQUIRE_NE(pYZ, nullptr);
Expand All @@ -162,14 +162,14 @@ BOOST_AUTO_TEST_CASE(PortalAssignment) {
auto portal2 =
std::make_shared<Portal>(Direction::OppositeNormal(), std::move(grid));
shell.setPortal(portal2, PositiveXFace);
BOOST_CHECK_EQUAL(shell.portal(PositiveXFace), portal2.get());
BOOST_CHECK_EQUAL(shell.portalPtr(PositiveXFace), portal2);

// Other portals should stay the same
BOOST_CHECK_EQUAL(shell.portal(PositiveZFace), pXY);
BOOST_CHECK_EQUAL(shell.portal(NegativeZFace), nXY);
BOOST_CHECK_EQUAL(shell.portal(NegativeXFace), nYZ);
BOOST_CHECK_EQUAL(shell.portal(PositiveYFace), pZX);
BOOST_CHECK_EQUAL(shell.portal(NegativeYFace), nZX);
BOOST_CHECK_EQUAL(shell.portalPtr(PositiveZFace), pXY);
BOOST_CHECK_EQUAL(shell.portalPtr(NegativeZFace), nXY);
BOOST_CHECK_EQUAL(shell.portalPtr(NegativeXFace), nYZ);
BOOST_CHECK_EQUAL(shell.portalPtr(PositiveYFace), pZX);
BOOST_CHECK_EQUAL(shell.portalPtr(NegativeYFace), nZX);

// Setting new nZX
BOOST_REQUIRE_NE(nZX, nullptr);
Expand All @@ -182,14 +182,14 @@ BOOST_AUTO_TEST_CASE(PortalAssignment) {
auto portal3 =
std::make_shared<Portal>(Direction::AlongNormal(), std::move(grid));
shell.setPortal(portal3, NegativeYFace);
BOOST_CHECK_EQUAL(shell.portal(NegativeYFace), portal3.get());
BOOST_CHECK_EQUAL(shell.portalPtr(NegativeYFace), portal3);

// Other portals should stay the same
BOOST_CHECK_EQUAL(shell.portal(PositiveZFace), pXY);
BOOST_CHECK_EQUAL(shell.portal(NegativeZFace), nXY);
BOOST_CHECK_EQUAL(shell.portal(NegativeXFace), nYZ);
BOOST_CHECK_EQUAL(shell.portal(PositiveYFace), pZX);
BOOST_CHECK_EQUAL(shell.portal(PositiveXFace), portal2.get());
BOOST_CHECK_EQUAL(shell.portalPtr(PositiveZFace), pXY);
BOOST_CHECK_EQUAL(shell.portalPtr(NegativeZFace), nXY);
BOOST_CHECK_EQUAL(shell.portalPtr(NegativeXFace), nYZ);
BOOST_CHECK_EQUAL(shell.portalPtr(PositiveYFace), pZX);
BOOST_CHECK_EQUAL(shell.portalPtr(PositiveXFace), portal2);
}

BOOST_AUTO_TEST_SUITE(CuboidStack)
Expand Down Expand Up @@ -270,35 +270,35 @@ BOOST_DATA_TEST_CASE(XYZDirection,
break;
}

const auto center1 = shell1.portal(face)->surface().center(gctx);
const auto center2 = shell2.portal(face)->surface().center(gctx);
const auto center1 = shell1.portalPtr(face)->surface().center(gctx);
const auto center2 = shell2.portalPtr(face)->surface().center(gctx);

centers1[face] = center1;
centers2[face] = center2;

BOOST_CHECK_EQUAL(
shell1.portal(face)->resolveVolume(gctx, center1, normal).value(),
shell1.portalPtr(face)->resolveVolume(gctx, center1, normal).value(),
&vol1);
BOOST_CHECK_EQUAL(
shell1.portal(face)->resolveVolume(gctx, center1, -normal).value(),
shell1.portalPtr(face)->resolveVolume(gctx, center1, -normal).value(),
nullptr);

BOOST_CHECK_EQUAL(
shell2.portal(face)->resolveVolume(gctx, center2, normal).value(),
shell2.portalPtr(face)->resolveVolume(gctx, center2, normal).value(),
&vol2);
BOOST_CHECK_EQUAL(
shell2.portal(face)->resolveVolume(gctx, center2, -normal).value(),
shell2.portalPtr(face)->resolveVolume(gctx, center2, -normal).value(),
nullptr);
}

BOOST_CHECK_NE(shell1.portal(backFace), shell2.portal(frontFace));
BOOST_CHECK_NE(shell1.portalPtr(backFace), shell2.portalPtr(frontFace));

CuboidStackPortalShell stack(gctx, {&shell1, &shell2}, dir, *logger);
BOOST_CHECK_EQUAL(stack.size(), 6);

BOOST_CHECK_EQUAL(shell1.portal(frontFace), stack.portal(frontFace));
BOOST_CHECK_EQUAL(shell1.portal(backFace), shell2.portal(frontFace));
BOOST_CHECK_EQUAL(shell2.portal(backFace), stack.portal(backFace));
BOOST_CHECK_EQUAL(shell1.portalPtr(frontFace), stack.portalPtr(frontFace));
BOOST_CHECK_EQUAL(shell1.portalPtr(backFace), shell2.portalPtr(frontFace));
BOOST_CHECK_EQUAL(shell2.portalPtr(backFace), stack.portalPtr(backFace));

for (const auto& face : sideFaces) {
Vector3 normal{};
Expand All @@ -323,24 +323,24 @@ BOOST_DATA_TEST_CASE(XYZDirection,
break;
}

BOOST_CHECK_EQUAL(shell1.portal(face), stack.portal(face));
BOOST_CHECK_EQUAL(shell2.portal(face), stack.portal(face));
BOOST_CHECK_EQUAL(shell1.portalPtr(face), stack.portalPtr(face));
BOOST_CHECK_EQUAL(shell2.portalPtr(face), stack.portalPtr(face));

const auto& center1 = centers1.at(face);
const auto& center2 = centers2.at(face);

BOOST_CHECK_EQUAL(
shell1.portal(face)->resolveVolume(gctx, center1, normal).value(),
shell1.portalPtr(face)->resolveVolume(gctx, center1, normal).value(),
&vol1);
BOOST_CHECK_EQUAL(
shell1.portal(face)->resolveVolume(gctx, center1, -normal).value(),
shell1.portalPtr(face)->resolveVolume(gctx, center1, -normal).value(),
nullptr);

BOOST_CHECK_EQUAL(
shell2.portal(face)->resolveVolume(gctx, center2, normal).value(),
shell2.portalPtr(face)->resolveVolume(gctx, center2, normal).value(),
&vol2);
BOOST_CHECK_EQUAL(
shell2.portal(face)->resolveVolume(gctx, center2, -normal).value(),
shell2.portalPtr(face)->resolveVolume(gctx, center2, -normal).value(),
nullptr);
}

Expand Down Expand Up @@ -418,7 +418,7 @@ BOOST_AUTO_TEST_CASE(NestedStacks) {

auto lookup = [](auto& shell, CuboidPortalShell::Face face, Vector3 position,
Vector3 direction) -> const TrackingVolume* {
const auto* portal = shell.portal(face);
const auto portal = shell.portalPtr(face);
BOOST_REQUIRE_NE(portal, nullptr);
return portal->resolveVolume(gctx, position, direction).value();
};
Expand Down Expand Up @@ -758,12 +758,14 @@ BOOST_AUTO_TEST_CASE(Fill) {
using enum CuboidVolumeBounds::Face;

BOOST_CHECK_EQUAL(
shell.portal(PositiveZFace)->getLink(Direction::AlongNormal()), nullptr);
shell.portalPtr(PositiveZFace)->getLink(Direction::AlongNormal()),
nullptr);

shell.fill(vol2);

BOOST_CHECK_NE(shell.portal(PositiveZFace)->getLink(Direction::AlongNormal()),
nullptr);
BOOST_CHECK_NE(
shell.portalPtr(PositiveZFace)->getLink(Direction::AlongNormal()),
nullptr);
}

BOOST_AUTO_TEST_CASE(RegisterInto) {
Expand Down
Loading
Loading