Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-12 08:52:56

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/track/SortTracksAction.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "celeritas/global/ActionInterface.hh"
0010 
0011 namespace celeritas
0012 {
0013 //---------------------------------------------------------------------------//
0014 /*!
0015  * Sort tracks according to a given strategy specified by TrackOrder.
0016  *
0017  * This action can be applied at different stage of a simulation step,
0018  * automatically determined by TrackOrder. This should not have any impact on
0019  * simulation output: it is only useful for GPU device optimizations.
0020  *
0021  * \todo Keep weak pointer to actions? Use aux data?
0022  */
0023 class SortTracksAction final : public CoreStepActionInterface,
0024                                public CoreBeginRunActionInterface
0025 {
0026   public:
0027     // Construct with action ID and sort criteria
0028     SortTracksAction(ActionId id, TrackOrder track_order);
0029 
0030     //! Default destructor
0031     ~SortTracksAction() final = default;
0032 
0033     //! Execute the action with host data
0034     void step(CoreParams const& params, CoreStateHost& state) const final;
0035 
0036     //! Execute the action with device data
0037     void step(CoreParams const& params, CoreStateDevice& state) const final;
0038 
0039     //! Set host data at the beginning of a run
0040     void begin_run(CoreParams const&, CoreStateHost&) final;
0041 
0042     //! Set device data at the beginning of a run
0043     void begin_run(CoreParams const&, CoreStateDevice&) final;
0044 
0045     //! ID of the action
0046     ActionId action_id() const final { return id_; }
0047 
0048     //! Short name for the action
0049     std::string_view label() const final;
0050 
0051     //! Description of the action for user interaction
0052     std::string_view description() const final { return "sort tracks states"; }
0053 
0054     //! Dependency ordering of the action
0055     StepActionOrder order() const final { return action_order_; }
0056 
0057   private:
0058     ActionId id_;
0059     StepActionOrder action_order_{StepActionOrder::size_};
0060     TrackOrder track_order_;
0061 };
0062 
0063 //---------------------------------------------------------------------------//
0064 }  // namespace celeritas