Back to home page

EIC code displayed by LXR

 
 

    


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

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