Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:53:42

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/CherenkovOffloadAction.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 CherenkovParams;
0024 class MaterialParams;
0025 }  // namespace optical
0026 
0027 namespace detail
0028 {
0029 //---------------------------------------------------------------------------//
0030 /*!
0031  * Generate optical distribution data.
0032  */
0033 class CherenkovOffloadAction final : public CoreStepActionInterface
0034 {
0035   public:
0036     //!@{
0037     //! \name Type aliases
0038     using SPConstCherenkov
0039         = std::shared_ptr<celeritas::optical::CherenkovParams const>;
0040     using SPConstMaterial
0041         = std::shared_ptr<celeritas::optical::MaterialParams const>;
0042     //!@}
0043 
0044   public:
0045     // Construct with action ID, optical material, and storage
0046     CherenkovOffloadAction(ActionId id,
0047                           AuxId data_id,
0048                           SPConstMaterial material,
0049                           SPConstCherenkov cherenkov);
0050 
0051     // Launch kernel with host data
0052     void step(CoreParams const&, CoreStateHost&) const final;
0053 
0054     // Launch kernel with device data
0055     void step(CoreParams const&, CoreStateDevice&) const final;
0056 
0057     //! ID of the model
0058     ActionId action_id() const final { return id_; }
0059 
0060     //! Short name for the action
0061     std::string_view label() const final { return "cherenkov-offload"; }
0062 
0063     // Name of the action (for user output)
0064     std::string_view description() const final;
0065 
0066     //! Dependency ordering of the action
0067     StepActionOrder order() const final { return StepActionOrder::user_post; }
0068 
0069   private:
0070     //// DATA ////
0071 
0072     ActionId id_;
0073     AuxId data_id_;
0074     SPConstMaterial material_;
0075     SPConstCherenkov cherenkov_;
0076 
0077     //// HELPER FUNCTIONS ////
0078 
0079     template<MemSpace M>
0080     void step_impl(CoreParams const&, CoreState<M>&) const;
0081 
0082     void pre_generate(CoreParams const&, CoreStateHost&) const;
0083     void pre_generate(CoreParams const&, CoreStateDevice&) const;
0084 };
0085 
0086 //---------------------------------------------------------------------------//
0087 }  // namespace detail
0088 }  // namespace celeritas