Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:31

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