Back to home page

EIC code displayed by LXR

 
 

    


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

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