Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:27:44

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Propagator/detail/action_list_implementation.hpp"
0012 #include "Acts/Utilities/detail/Extendable.hpp"
0013 #include "Acts/Utilities/detail/MPL/all_of.hpp"
0014 #include "Acts/Utilities/detail/MPL/has_duplicates.hpp"
0015 #include "Acts/Utilities/detail/MPL/type_collector.hpp"
0016 
0017 #include <boost/hana/type.hpp>
0018 #include <boost/hana/unpack.hpp>
0019 
0020 namespace hana = boost::hana;
0021 
0022 namespace Acts {
0023 
0024 /// @brief ActionList implementation to be used with the propagator
0025 ///
0026 /// This is the ActionList struct that is used in the propagator
0027 /// to define a list of different actors_t that are each
0028 /// executed during the stepping procedure
0029 template <typename... actors_t>
0030 struct ActionList : public detail::Extendable<actors_t...> {
0031  private:
0032   static_assert(!detail::has_duplicates_v<actors_t...>,
0033                 "same action type specified several times");
0034 
0035   using detail::Extendable<actors_t...>::tuple;
0036 
0037  public:
0038   /// @cond
0039   // This uses the type collector and unpacks using the `R` meta function
0040   template <template <typename...> class R>
0041   using result_type = typename decltype(hana::unpack(
0042       detail::type_collector_t<detail::result_type_extractor, actors_t...>,
0043       hana::template_<R>))::type;
0044   /// @endcond
0045 
0046   using detail::Extendable<actors_t...>::get;
0047 
0048   /// Default constructor
0049   ActionList() = default;
0050 
0051   /// Default copy constructor
0052   ///
0053   /// @param actors The source action list
0054   ActionList(const ActionList<actors_t...>& actors) = default;
0055 
0056   /// Default move constructor
0057   ///
0058   /// @param actors The source action list
0059   ActionList(ActionList<actors_t...>&& actors) = default;
0060 
0061   /// Default move assignment operator
0062   ///
0063   /// @param actors The source action list
0064   ActionList<actors_t...>& operator=(const ActionList<actors_t...>& actors) =
0065       default;
0066 
0067   /// Default move assignment operator
0068   ///
0069   /// @param actors The source action list
0070   ActionList<actors_t...>& operator=(ActionList<actors_t...>&& actors) =
0071       default;
0072 
0073   /// Call operator that is that broadcasts the call to the tuple()
0074   /// members of the list
0075   ///
0076   /// @tparam propagator_state_t is the state type of the propagator
0077   /// @tparam stepper_t Type of the stepper used for the propagation
0078   /// @tparam navigator_t Type of the navigator used for the propagation
0079   ///
0080   /// @param [in,out] state This is the propagator state object
0081   /// @param [in] stepper The stepper in use
0082   /// @param [in] navigator The navigator in use
0083   /// @param [in] args The arguments to be passed to the actions
0084   template <typename propagator_state_t, typename stepper_t,
0085             typename navigator_t, typename... Args>
0086   void operator()(propagator_state_t& state, const stepper_t& stepper,
0087                   const navigator_t& navigator, Args&&... args) const {
0088     using impl = detail::action_list_impl<actors_t...>;
0089     impl::action(tuple(), state, stepper, navigator,
0090                  std::forward<Args>(args)...);
0091   }
0092 };
0093 
0094 }  // namespace Acts