Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-10 10:05: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/gen/detail/OffloadGatherAction.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <memory>
0010 #include <vector>
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 
0017 #include "../OffloadData.hh"
0018 
0019 namespace celeritas
0020 {
0021 class CoreParams;
0022 
0023 namespace detail
0024 {
0025 //---------------------------------------------------------------------------//
0026 /*!
0027  * Collect pre-step data needed to generate optical distribution data.
0028  *
0029  * This pre-step action stores the optical material ID and other
0030  * beginning-of-step properties so that optical photons can be generated
0031  * between the start and end points of the step.
0032  *
0033  * \sa OffloadGatherExecutor
0034  */
0035 class OffloadGatherAction final : public CoreStepActionInterface,
0036                                   public AuxParamsInterface
0037 {
0038   public:
0039     // Construct and add to core params
0040     static std::shared_ptr<OffloadGatherAction>
0041     make_and_insert(CoreParams const&);
0042 
0043     // Construct with action ID and storage
0044     OffloadGatherAction(ActionId id, AuxId aux_id);
0045 
0046     //!@{
0047     //! \name Aux interface
0048 
0049     //! Index of this class instance in its registry
0050     AuxId aux_id() const final { return aux_id_; }
0051     // Build state data for a stream
0052     UPState create_state(MemSpace, StreamId, size_type) const final;
0053     //!@}
0054 
0055     //!@{
0056     //! \name Action interface
0057 
0058     //! ID of the model
0059     ActionId action_id() const final { return action_id_; }
0060     //! Short name for the action
0061     std::string_view label() const final { return "optical-offload-gather"; }
0062     // Name of the action (for user output)
0063     std::string_view description() const final;
0064     //!@}
0065 
0066     //!@{
0067     //! \name StepAction interface
0068 
0069     //! Dependency ordering of the action
0070     StepActionOrder order() const final { return StepActionOrder::user_pre; }
0071     // Launch kernel with host data
0072     void step(CoreParams const&, CoreStateHost&) const final;
0073     // Launch kernel with device data
0074     void step(CoreParams const&, CoreStateDevice&) const final;
0075     //!@}
0076 
0077   private:
0078     //// DATA ////
0079 
0080     ActionId action_id_;
0081     AuxId aux_id_;
0082 };
0083 
0084 //---------------------------------------------------------------------------//
0085 }  // namespace detail
0086 }  // namespace celeritas