Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: experimental navigator for experimental geometry #1932

Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions Core/include/Acts/Detector/ProtoDetector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace Acts {
struct ProtoVolume;

namespace Experimental {

class DetectorVolume;
class Portal;

Expand Down
1 change: 1 addition & 0 deletions Core/include/Acts/Navigation/DetectorVolumeUpdators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Navigation/NavigationStateFillers.hpp"
#include "Acts/Navigation/NavigationStateUpdators.hpp"
#include "Acts/Utilities/detail/Axis.hpp"
#include "Acts/Utilities/detail/Grid.hpp"
Expand Down
52 changes: 4 additions & 48 deletions Core/include/Acts/Navigation/NavigationState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct NavigationState {
const Portal* portal = nullptr;
/// The boundary check used for the candidate, boundary checks
/// can differ for sensitive surfaces and portals
BoundaryCheck bCheck = true;
BoundaryCheck boundaryCheck = true;
};

/// Surface candidate vector alias, this allows to use e.g. boost_small vector
Expand Down Expand Up @@ -75,6 +75,9 @@ struct NavigationState {
/// The current surface, i.e the position is on surface
const Surface* currentSurface = nullptr;

/// The current portal, i.e the position is on portal
const Portal* currentPortal = nullptr;

/// That are the candidate surfaces to process
SurfaceCandidates surfaceCandidates = {};
SurfaceCandidates::iterator surfaceCandidate = surfaceCandidates.end();
Expand All @@ -89,52 +92,5 @@ struct NavigationState {
std::any auxilliary;
};

/// Filler of the current volume
struct DetectorVolumeFiller {
/// Helper struct that allows to fill a volume into the
/// navigation state, it allows to use common navigation
/// structs for volume, portal, surfaces
///
/// @param nState the navigation state
/// @param volume the volume that is filled
inline static void fill(NavigationState& nState,
const DetectorVolume* volume) {
nState.currentVolume = volume;
}
};

/// Fillers and attachers for surfaces to act on the navigation state
struct SurfacesFiller {
/// Helper struct that allows to fill surfaces into the candidate vector it
/// allows to use common navigation structs for volume, portal, surfaces
///
/// @param nState the navigation state
/// @param surfaces the surfaces that are filled in
inline static void fill(NavigationState& nState,
const std::vector<const Surface*>& surfaces) {
std::for_each(surfaces.begin(), surfaces.end(), [&](const auto& s) {
nState.surfaceCandidates.push_back(NavigationState::SurfaceCandidate{
ObjectIntersection<Surface>{}, s, nullptr,
nState.surfaceBoundaryCheck});
});
}
};

/// Fillers and attachers for portals to act on the navigation state
struct PortalsFiller {
/// Helper struct that allows to fill surfaces into the candidate vector it
/// allows to use common navigation structs for volume, portal, surfaces
///
/// @param nState the navigation state
/// @param portals the portals that are filled in
inline static void fill(NavigationState& nState,
const std::vector<const Portal*>& portals) {
std::for_each(portals.begin(), portals.end(), [&](const auto& p) {
nState.surfaceCandidates.push_back(NavigationState::SurfaceCandidate{
ObjectIntersection<Surface>{}, nullptr, p, true});
});
}
};

} // namespace Experimental
} // namespace Acts
76 changes: 76 additions & 0 deletions Core/include/Acts/Navigation/NavigationStateFillers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// This file is part of the Acts project.
//
// Copyright (C) 2021 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Utilities/Intersection.hpp"

#include <vector>

namespace Acts {

class Surface;

namespace Experimental {

class Portal;
class Detector;
class DetectorVolume;

/// Filler of the current volume
struct DetectorVolumeFiller {
/// Helper struct that allows to fill a volume into the
/// navigation state, it allows to use common navigation
/// structs for volume, portal, surfaces
///
/// @param nState the navigation state
/// @param volume the volume that is filled
inline static void fill(NavigationState& nState,
const DetectorVolume* volume) {
nState.currentVolume = volume;
}
};

/// Fillers and attachers for surfaces to act on the navigation state
struct SurfacesFiller {
/// Helper struct that allows to fill surfaces into the candidate vector it
/// allows to use common navigation structs for volume, portal, surfaces
///
/// @param nState the navigation state
/// @param surfaces the surfaces that are filled in
inline static void fill(NavigationState& nState,
const std::vector<const Surface*>& surfaces) {
std::for_each(surfaces.begin(), surfaces.end(), [&](const auto& s) {
nState.surfaceCandidates.push_back(NavigationState::SurfaceCandidate{
ObjectIntersection<Surface>{}, s, nullptr,
nState.surfaceBoundaryCheck});
});
}
};

/// Fillers and attachers for portals to act on the navigation state
struct PortalsFiller {
/// Helper struct that allows to fill surfaces into the candidate vector it
/// allows to use common navigation structs for volume, portal, surfaces
///
/// @param nState the navigation state
/// @param portals the portals that are filled in
inline static void fill(NavigationState& nState,
const std::vector<const Portal*>& portals) {
std::for_each(portals.begin(), portals.end(), [&](const auto& p) {
nState.surfaceCandidates.push_back(NavigationState::SurfaceCandidate{
ObjectIntersection<Surface>{}, nullptr, p, true});
});
}
};

} // namespace Experimental
} // namespace Acts
Loading