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

refactor!: Fuse Actor and Aborter #3573

Merged
merged 19 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 17 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
16 changes: 7 additions & 9 deletions Core/include/Acts/Material/PropagatorMaterialAssigner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/MagneticField/MagneticFieldContext.hpp"
#include "Acts/Material/interface/IAssignmentFinder.hpp"
#include "Acts/Propagator/AbortList.hpp"
#include "Acts/Propagator/ActionList.hpp"
#include "Acts/Propagator/ActorList.hpp"
#include "Acts/Propagator/Propagator.hpp"
#include "Acts/Propagator/SurfaceCollector.hpp"
#include "Acts/Surfaces/Surface.hpp"
Expand Down Expand Up @@ -62,9 +61,9 @@ struct InteractionVolumeCollector {
/// @param [in,out] result is the mutable result object
template <typename propagator_state_t, typename stepper_t,
typename navigator_t>
void operator()(propagator_state_t& state, const stepper_t& stepper,
const navigator_t& navigator, result_type& result,
const Logger& /*logger*/) const {
void act(propagator_state_t& state, const stepper_t& stepper,
const navigator_t& navigator, result_type& result,
const Logger& /*logger*/) const {
// Retrieve the current volume
auto currentVolume = navigator.currentVolume(state.navigation);

Expand Down Expand Up @@ -131,11 +130,10 @@ class PropagatorMaterialAssigner final : public IAssignmentFinder {
// Prepare Action list and abort list
using MaterialSurfaceCollector =
SurfaceCollector<MaterialSurfaceIdentifier>;
using ActionList =
ActionList<MaterialSurfaceCollector, InteractionVolumeCollector>;
using AbortList = AbortList<EndOfWorldReached>;
using ActorList = ActorList<MaterialSurfaceCollector,
InteractionVolumeCollector, EndOfWorldReached>;
using PropagatorOptions =
typename propagator_t::template Options<ActionList, AbortList>;
typename propagator_t::template Options<ActorList>;

PropagatorOptions options(gctx, mctx);

Expand Down
115 changes: 0 additions & 115 deletions Core/include/Acts/Propagator/AbortList.hpp

This file was deleted.

94 changes: 0 additions & 94 deletions Core/include/Acts/Propagator/ActionList.hpp

This file was deleted.

87 changes: 87 additions & 0 deletions Core/include/Acts/Propagator/ActorConcepts.hpp
andiwand marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// This file is part of the Acts project.
//
// Copyright (C) 2024 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 <concepts>
#include <type_traits>
#include <utility>

namespace Acts {

template <typename actor_t>
concept ActorHasResult = requires { typename actor_t::result_type; };

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept ActorHasActWithoutResult = requires(
const actor_t& a, propagator_state_t& state, const stepper_t& stepper,
const navigator_t& navigator, Args&&... args) {
{
a.act(state, stepper, navigator, std::move<Args>(args)...)
} -> std::same_as<void>;
};

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept ActorHasActWithResult =
ActorHasResult<actor_t> &&
requires(const actor_t& a, propagator_state_t& state,
const stepper_t& stepper, const navigator_t& navigator,
typename actor_t::result_type& result, Args&&... args) {
{
a.act(state, stepper, navigator, result, std::move<Args>(args)...)
} -> std::same_as<void>;
};

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept ActorHasAct =
ActorHasActWithoutResult<actor_t, propagator_state_t, stepper_t,
navigator_t, Args...> ||
ActorHasActWithResult<actor_t, propagator_state_t, stepper_t, navigator_t,
Args...>;

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept ActorHasAbortWithoutResult = requires(
const actor_t& a, propagator_state_t& state, const stepper_t& stepper,
const navigator_t& navigator, Args&&... args) {
{
a.checkAbort(state, stepper, navigator, std::move<Args>(args)...)
} -> std::same_as<bool>;
};

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept ActorHasAbortWithResult =
ActorHasResult<actor_t> &&
requires(const actor_t& a, propagator_state_t& state,
const stepper_t& stepper, const navigator_t& navigator,
typename actor_t::result_type& result, Args&&... args) {
{
a.checkAbort(state, stepper, navigator, result,
std::move<Args>(args)...)
} -> std::same_as<bool>;
};

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept ActorHasAbort =
ActorHasAbortWithoutResult<actor_t, propagator_state_t, stepper_t,
navigator_t, Args...> ||
ActorHasAbortWithResult<actor_t, propagator_state_t, stepper_t, navigator_t,
Args...>;

template <typename actor_t, typename propagator_state_t, typename stepper_t,
typename navigator_t, typename... Args>
concept Actor =
ActorHasAct<actor_t, propagator_state_t, stepper_t, navigator_t, Args...> ||
ActorHasAbort<actor_t, propagator_state_t, stepper_t, navigator_t, Args...>;

} // namespace Acts
Loading
Loading