Skip to content

Commit

Permalink
shell: Fix a few sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Oct 2, 2024
1 parent 33acb0d commit 7e079e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
5 changes: 3 additions & 2 deletions Core/include/Acts/Geometry/PortalShell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,9 @@ class CylinderStackPortalShell : public CylinderPortalShell {
/// @copydoc CylinderPortalShell::setPortal
void setPortal(std::shared_ptr<Portal> portal, Face face) final;

/// No-op, because it's a composite portal shell
void applyToVolume() override {}
void applyToVolume() override {
// No-op, because it's a composite portal shell
}

/// @copydoc PortalShellBase::isValid
bool isValid() const override;
Expand Down
17 changes: 9 additions & 8 deletions Core/src/Geometry/PortalShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@ CylinderStackPortalShell::CylinderStackPortalShell(
throw std::invalid_argument("Invalid shell");
}

auto merge = [&gctx, direction, &shells = m_shells, &logger](Face face) {
auto merge = [&](Face face) {
std::vector<std::shared_ptr<Portal>> portals;
std::transform(shells.begin(), shells.end(), std::back_inserter(portals),
[face](auto* shell) { return shell->portalPtr(face); });
std::ranges::transform(
m_shells, std::back_inserter(portals),
[face](auto* shell) { return shell->portalPtr(face); });

auto merged = std::accumulate(
std::next(portals.begin()), portals.end(), portals.front(),
Expand All @@ -172,15 +173,15 @@ CylinderStackPortalShell::CylinderStackPortalShell(
assert(merged->isValid());

// reset merged portal on all shells
for (auto& shell : shells) {
for (auto& shell : m_shells) {
shell->setPortal(merged, face);
}
};

auto fuse = [&gctx, &shells = m_shells, &logger](Face faceA, Face faceB) {
for (std::size_t i = 1; i < shells.size(); i++) {
auto& shellA = shells.at(i - 1);
auto& shellB = shells.at(i);
auto fuse = [&](Face faceA, Face faceB) {
for (std::size_t i = 1; i < m_shells.size(); i++) {
auto& shellA = m_shells.at(i - 1);
auto& shellB = m_shells.at(i);
ACTS_VERBOSE("Fusing " << shellA->label() << " and " << shellB->label());

auto fused = std::make_shared<Portal>(Portal::fuse(
Expand Down

0 comments on commit 7e079e5

Please sign in to comment.