Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:54:50

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/InitializeTracksAction.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "celeritas/global/ActionInterface.hh"
0010 
0011 namespace celeritas
0012 {
0013 //---------------------------------------------------------------------------//
0014 /*!
0015  * Initialize track states.
0016  *
0017  * Tracks created from secondaries produced in this action will have the
0018  * geometry state copied over from the parent instead of initialized from the
0019  * position. If there are more empty slots than new secondaries, they will be
0020  * filled by any track initializers remaining from previous steps using the
0021  * position.
0022  */
0023 class InitializeTracksAction final : public CoreStepActionInterface
0024 {
0025   public:
0026     //! Construct with explicit Id
0027     explicit InitializeTracksAction(ActionId id) : id_(id) {}
0028 
0029     //! Execute the action with host data
0030     void step(CoreParams const& params, CoreStateHost& state) const final;
0031 
0032     //! Execute the action with device data
0033     void step(CoreParams const& params, CoreStateDevice& state) const final;
0034 
0035     //! ID of the action
0036     ActionId action_id() const final { return id_; }
0037 
0038     //! Short name for the action
0039     std::string_view label() const final { return "initialize-tracks"; }
0040 
0041     //! Description of the action for user interaction
0042     std::string_view description() const final
0043     {
0044         return "initialize track states";
0045     }
0046 
0047     //! Dependency ordering of the action
0048     StepActionOrder order() const final { return StepActionOrder::start; }
0049 
0050   private:
0051     ActionId id_;
0052 
0053     template<MemSpace M>
0054     void step_impl(CoreParams const&, CoreState<M>&) const;
0055 
0056     void step_impl(CoreParams const&, CoreStateHost&, size_type) const;
0057     void step_impl(CoreParams const&, CoreStateDevice&, size_type) const;
0058 };
0059 
0060 //---------------------------------------------------------------------------//
0061 }  // namespace celeritas