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: splitting fill and update function #3465

Merged
merged 6 commits into from
Aug 1, 2024
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
110 changes: 70 additions & 40 deletions Core/include/Acts/Navigation/InternalNavigation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,70 +25,83 @@
namespace Acts::Experimental {

struct AllPortalsNavigation : public IInternalNavigation {
/// A ordered portal provider
/// Fills all portals into the navigation state
///
/// @param gctx is the Geometry context of this call
/// @param nState is the navigation state to be updated
///
/// @note that the intersections are ordered, such that the
/// smallest intersection pathlength >= overstep tolerance is the lowest
///
/// @return an ordered list of portal candidates
inline void update(const GeometryContext& gctx,
NavigationState& nState) const {
/// @note no intersection ordering is done at this stage
inline void fill([[maybe_unused]] const GeometryContext& gctx,
NavigationState& nState) const {
if (nState.currentVolume == nullptr) {
throw std::runtime_error(
"AllPortalsNavigation: no detector volume set to navigation state.");
}
// Retrieval necessary
if (nState.surfaceCandidates.empty()) {
// Fill internal portals if existing
for (const auto v : nState.currentVolume->volumes()) {
const auto& iPortals = v->portals();
PortalsFiller::fill(nState, iPortals);
}
// Filling the new portal candidates
const auto& portals = nState.currentVolume->portals();
PortalsFiller::fill(nState, portals);
// Fill internal portals if existing
for (const auto v : nState.currentVolume->volumes()) {
const auto& iPortals = v->portals();
PortalsFiller::fill(nState, iPortals);
}
// Sort and update
updateCandidates(gctx, nState);
// Filling the new portal candidates
const auto& portals = nState.currentVolume->portals();
PortalsFiller::fill(nState, portals);
}
};

struct AllPortalsAndSurfacesNavigation : public IInternalNavigation {
/// An ordered list of portals and surfaces provider
/// A ordered portal provider - update method that calls fill and initialize
///
/// @param gctx is the Geometry context of this call
/// @param nState is the navigation state to be updated
///
/// @note that the intersections are ordered, such that the
/// smallest intersection pathlength >= overstep tolerance is the lowest
///
/// @return an ordered list of portal and surface candidates
inline void update(const GeometryContext& gctx,
NavigationState& nState) const {
fill(gctx, nState);
intitializeCandidates(gctx, nState);
}
};

struct AllPortalsAndSurfacesNavigation : public IInternalNavigation {
/// Fills all portals and surfaces into the navigation state
///
/// @param gctx is the Geometry context of this call
/// @param nState is the navigation state to be updated
///
/// @note no intersection ordering is done at this stage
inline void fill([[maybe_unused]] const GeometryContext& gctx,
NavigationState& nState) const {
if (nState.currentDetector == nullptr) {
throw std::runtime_error(
"AllPortalsAndSurfacesNavigation: no detector volume set to "
"navigation "
"state.");
}
// A volume switch has happened, update list of portals & surfaces
if (nState.surfaceCandidates.empty()) {
// Fill internal portals if existing
for (const auto v : nState.currentVolume->volumes()) {
const auto& iPortals = v->portals();
PortalsFiller::fill(nState, iPortals);
}
// Assign the new volume
const auto& portals = nState.currentVolume->portals();
const auto& surfaces = nState.currentVolume->surfaces();
PortalsFiller::fill(nState, portals);
SurfacesFiller::fill(nState, surfaces);
for (const auto v : nState.currentVolume->volumes()) {
const auto& iPortals = v->portals();
PortalsFiller::fill(nState, iPortals);
}
// Update internal candidates
updateCandidates(gctx, nState);
// Assign the new volume
const auto& portals = nState.currentVolume->portals();
const auto& surfaces = nState.currentVolume->surfaces();
PortalsFiller::fill(nState, portals);
SurfacesFiller::fill(nState, surfaces);
}

/// A ordered list of portals and surfaces provider
/// - update method that calls fill and initialize
///
/// @param gctx is the Geometry context of this call
/// @param nState is the navigation state to be updated
///
/// @note that the intersections are ordered, such that the
/// smallest intersection pathlength >= overstep tolerance is the lowest
///
/// @return an ordered list of portal and surface candidates
inline void update(const GeometryContext& gctx,
NavigationState& nState) const {
fill(gctx, nState);
intitializeCandidates(gctx, nState);
}
};

Expand Down Expand Up @@ -124,15 +137,32 @@ struct AdditionalSurfacesNavigation : public IInternalNavigation {
/// The volumes held by this collection
std::vector<const Surface*> surfaces = {};

/// Extract the sub volumes from the volume
/// Extract the additional surfaces from the this volume
///
/// @param gctx the geometry contextfor this extraction call (ignored)
/// @param nState is the navigation state
///
inline void update([[maybe_unused]] const GeometryContext& gctx,
NavigationState& nState) const {
/// @note no intersection ordering is done at this stage
inline void fill([[maybe_unused]] const GeometryContext& gctx,
NavigationState& nState) const {
SurfacesFiller::fill(nState, surfaces);
}

/// Extract the additional surfaces from the this volume
/// - update method that calls fill and initialize
///
/// @param gctx is the Geometry context of this call
/// @param nState is the navigation state to be updated
///
/// @note that the intersections are ordered, such that the
/// smallest intersection pathlength >= overstep tolerance is the lowest
///
/// @return an ordered list of portal and surface candidates
inline void update(const GeometryContext& gctx,
NavigationState& nState) const {
fill(gctx, nState);
intitializeCandidates(gctx, nState);
}
};

/// @brief An indexed surface implementation access
Expand Down
19 changes: 15 additions & 4 deletions Core/include/Acts/Navigation/MultiLayerNavigation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ class MultiLayerNavigation : public IInternalNavigation {

MultiLayerNavigation() = delete;

/// Update the navigation state
/// Fill the navigation state
///
/// @note no initialization is done here (sorting and update)
///
/// @param gctx is the geometry context
/// @param nState is the navigation state
void update(const GeometryContext& gctx, NavigationState& nState) const {
void fill(const GeometryContext& gctx, NavigationState& nState) const {
// get the local position and direction
auto lposition = transform * nState.position;
auto ldirection = transform.linear() * nState.direction;
Expand All @@ -72,8 +75,16 @@ class MultiLayerNavigation : public IInternalNavigation {

resolveDuplicates(gctx, surfCandidates);
SurfacesFiller::fill(nState, surfCandidates);

updateCandidates(gctx, nState);
}
/// Fill the update the navigation state with candidates
///
/// @note initialization is done here (sorting and update)
///
/// @param gctx is the geometry context
/// @param nState is the navigation state
void update(const GeometryContext& gctx, NavigationState& nState) const {
fill(gctx, nState);
intitializeCandidates(gctx, nState);
}

/// Cast into a lookup position
Expand Down
Loading
Loading