Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/celeritas/global/ActionInterface.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file celeritas/global/ActionInterface.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/sys/ActionInterface.hh"
0010 #include "celeritas/Types.hh"
0011 
0012 namespace celeritas
0013 {
0014 //---------------------------------------------------------------------------//
0015 class CoreParams;
0016 template<MemSpace M>
0017 class CoreState;
0018 
0019 //---------------------------------------------------------------------------//
0020 // TYPE ALIASES
0021 //---------------------------------------------------------------------------//
0022 //! Interface called at beginning of the core stepping loop
0023 using CoreBeginRunActionInterface
0024     = BeginRunActionInterface<CoreParams, CoreState>;
0025 
0026 //! Action interface for core stepping loop
0027 using CoreStepActionInterface = StepActionInterface<CoreParams, CoreState>;
0028 
0029 //---------------------------------------------------------------------------//
0030 // HELPER FUNCTIONS
0031 //---------------------------------------------------------------------------//
0032 /*!
0033  * Whether the TrackOrder will sort tracks by actions at the given step order.
0034  */
0035 inline constexpr bool
0036 is_action_sorted(StepActionOrder aorder, TrackOrder torder)
0037 {
0038     // CAUTION: check that this matches \c SortTracksAction::SortTracksAction
0039     return (aorder == StepActionOrder::post
0040             && torder == TrackOrder::reindex_step_limit_action)
0041            || (aorder == StepActionOrder::along
0042                && torder == TrackOrder::reindex_along_step_action)
0043            || (torder == TrackOrder::reindex_both_action
0044                && (aorder == StepActionOrder::post
0045                    || aorder == StepActionOrder::along));
0046 }
0047 
0048 //---------------------------------------------------------------------------//
0049 /*!
0050  * Whether track sorting (reindexing) is enabled.
0051  */
0052 inline constexpr bool is_action_sorted(TrackOrder torder)
0053 {
0054     auto to_int = [](TrackOrder v) {
0055         return static_cast<std::underlying_type_t<TrackOrder>>(v);
0056     };
0057     return to_int(torder) >= to_int(TrackOrder::begin_reindex_)
0058            && to_int(torder) < to_int(TrackOrder::end_reindex_);
0059 }
0060 
0061 //---------------------------------------------------------------------------//
0062 }  // namespace celeritas