Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-31 08:58:47

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/optical/detail/ScintOffloadAction.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <memory>
0010 
0011 #include "corecel/Macros.hh"
0012 #include "corecel/data/AuxInterface.hh"
0013 #include "corecel/data/Collection.hh"
0014 #include "celeritas/global/ActionInterface.hh"
0015 
0016 #include "OffloadParams.hh"
0017 #include "../GeneratorDistributionData.hh"
0018 
0019 namespace celeritas
0020 {
0021 namespace optical
0022 {
0023 class ScintillationParams;
0024 }  // namespace optical
0025 
0026 namespace detail
0027 {
0028 //---------------------------------------------------------------------------//
0029 /*!
0030  * Generate optical distribution data.
0031  */
0032 class ScintOffloadAction final : public CoreStepActionInterface
0033 {
0034   public:
0035     //!@{
0036     //! \name Type aliases
0037     using SPConstScintillation
0038         = std::shared_ptr<celeritas::optical::ScintillationParams const>;
0039     //!@}
0040 
0041   public:
0042     // Construct with action ID, optical properties, and storage
0043     ScintOffloadAction(ActionId id,
0044                        AuxId data_id,
0045                        SPConstScintillation scintillation);
0046 
0047     // Launch kernel with host data
0048     void step(CoreParams const&, CoreStateHost&) const final;
0049 
0050     // Launch kernel with device data
0051     void step(CoreParams const&, CoreStateDevice&) const final;
0052 
0053     //! ID of the model
0054     ActionId action_id() const final { return id_; }
0055 
0056     //! Short name for the action
0057     std::string_view label() const final { return "scintillation-offload"; }
0058 
0059     // Name of the action (for user output)
0060     std::string_view description() const final;
0061 
0062     //! Dependency ordering of the action
0063     StepActionOrder order() const final { return StepActionOrder::user_post; }
0064 
0065   private:
0066     //// DATA ////
0067 
0068     ActionId id_;
0069     AuxId data_id_;
0070     SPConstScintillation scintillation_;
0071 
0072     //// HELPER FUNCTIONS ////
0073 
0074     template<MemSpace M>
0075     void step_impl(CoreParams const&, CoreState<M>&) const;
0076 
0077     void pre_generate(CoreParams const&, CoreStateHost&) const;
0078     void pre_generate(CoreParams const&, CoreStateDevice&) const;
0079 };
0080 
0081 //---------------------------------------------------------------------------//
0082 }  // namespace detail
0083 }  // namespace celeritas