Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-19 08:49:41

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/alongstep/AlongStepGeneralLinearAction.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <memory>
0010 #include <string>
0011 
0012 #include "corecel/Assert.hh"
0013 #include "corecel/Macros.hh"
0014 #include "celeritas/Types.hh"
0015 #include "celeritas/em/data/FluctuationData.hh"
0016 #include "celeritas/em/data/UrbanMscData.hh"
0017 #include "celeritas/global/ActionInterface.hh"
0018 
0019 namespace celeritas
0020 {
0021 class UrbanMscParams;
0022 class FluctuationParams;
0023 class PhysicsParams;
0024 class MaterialParams;
0025 class ParticleParams;
0026 
0027 //---------------------------------------------------------------------------//
0028 /*!
0029  * Along-step kernel for particles without fields.
0030  *
0031  * This kernel is for problems without EM fields, for particle types that may
0032  * have (but do not *need* to have) along-step energy loss, optional energy
0033  * fluctuation, and optional multiple scattering.
0034  */
0035 class AlongStepGeneralLinearAction final : public CoreStepActionInterface
0036 {
0037   public:
0038     //!@{
0039     //! \name Type aliases
0040     using SPConstFluctuations = std::shared_ptr<FluctuationParams const>;
0041     using SPConstMsc = std::shared_ptr<UrbanMscParams const>;
0042     //!@}
0043 
0044   public:
0045     static std::shared_ptr<AlongStepGeneralLinearAction>
0046     from_params(ActionId id,
0047                 MaterialParams const& materials,
0048                 ParticleParams const& particles,
0049                 SPConstMsc const& msc,
0050                 bool eloss_fluctuation);
0051 
0052     // Construct with next action ID, and optional EM energy fluctuation
0053     AlongStepGeneralLinearAction(ActionId id,
0054                                  SPConstFluctuations fluct,
0055                                  SPConstMsc msc);
0056 
0057     // Default destructor
0058     ~AlongStepGeneralLinearAction() final;
0059 
0060     // Launch kernel with host data
0061     void step(CoreParams const&, CoreStateHost&) const final;
0062 
0063     // Launch kernel with device data
0064     void step(CoreParams const&, CoreStateDevice&) const final;
0065 
0066     //! ID of the model
0067     ActionId action_id() const final { return id_; }
0068 
0069     //! Short name for the along-step kernel
0070     std::string_view label() const final
0071     {
0072         return "along-step-general-linear";
0073     }
0074 
0075     //! Short description of the action
0076     std::string_view description() const final
0077     {
0078         return "apply along-step for particles with no field";
0079     }
0080 
0081     //! Dependency ordering of the action
0082     StepActionOrder order() const final { return StepActionOrder::along; }
0083 
0084     //// ACCESSORS ////
0085 
0086     //! Whether energy flucutation is in use
0087     bool has_fluct() const { return static_cast<bool>(fluct_); }
0088 
0089     //! Whether MSC is in use
0090     bool has_msc() const { return static_cast<bool>(msc_); }
0091 
0092   private:
0093     ActionId id_;
0094     SPConstFluctuations fluct_;
0095     SPConstMsc msc_;
0096 };
0097 
0098 //---------------------------------------------------------------------------//
0099 // INLINE DEFINITIONS
0100 //---------------------------------------------------------------------------//
0101 
0102 #if !CELER_USE_DEVICE
0103 inline void
0104 AlongStepGeneralLinearAction::step(CoreParams const&, CoreStateDevice&) const
0105 {
0106     CELER_NOT_CONFIGURED("CUDA OR HIP");
0107 }
0108 #endif
0109 
0110 //---------------------------------------------------------------------------//
0111 }  // namespace celeritas