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/AlongStepUniformMscAction.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/em/data/FluctuationData.hh"
0015 #include "celeritas/em/data/UrbanMscData.hh"
0016 #include "celeritas/field/UniformFieldData.hh"
0017 #include "celeritas/field/UniformFieldParams.hh"
0018 #include "celeritas/geo/GeoFwd.hh"
0019 #include "celeritas/global/ActionInterface.hh"
0020 #include "celeritas/inp/Field.hh"
0021 
0022 namespace celeritas
0023 {
0024 class UrbanMscParams;
0025 class FluctuationParams;
0026 class PhysicsParams;
0027 class MaterialParams;
0028 class ParticleParams;
0029 
0030 //---------------------------------------------------------------------------//
0031 /*!
0032  * Along-step kernel with optional MSC and uniform magnetic field.
0033  */
0034 class AlongStepUniformMscAction final : public CoreStepActionInterface
0035 {
0036   public:
0037     //!@{
0038     //! \name Type aliases
0039     using Input = inp::UniformField;
0040     using SPConstFluctuations = std::shared_ptr<FluctuationParams const>;
0041     using SPConstMsc = std::shared_ptr<UrbanMscParams const>;
0042     using SPConstFieldParams = std::shared_ptr<UniformFieldParams const>;
0043     //!@}
0044 
0045   public:
0046     // Construct the along-step action from input parameters
0047     static std::shared_ptr<AlongStepUniformMscAction>
0048     from_params(ActionId id,
0049                 GeoParams const& geometry,
0050                 MaterialParams const& materials,
0051                 ParticleParams const& particles,
0052                 Input const& field_input,
0053                 SPConstMsc msc,
0054                 bool eloss_fluctuation);
0055 
0056     // Construct with next action ID, optional MSC, magnetic field
0057     AlongStepUniformMscAction(ActionId id,
0058                               GeoParams const& geometry,
0059                               Input const& field_input,
0060                               SPConstFluctuations fluct,
0061                               SPConstMsc msc);
0062 
0063     // Default destructor
0064     ~AlongStepUniformMscAction() final;
0065 
0066     // Launch kernel with host data
0067     void step(CoreParams const&, CoreStateHost&) const final;
0068 
0069     // Launch kernel with device data
0070     void step(CoreParams const&, CoreStateDevice&) const final;
0071 
0072     //! ID of the model
0073     ActionId action_id() const final { return id_; }
0074 
0075     //! Short name for the interaction kernel
0076     std::string_view label() const final { return "along-step-uniform-msc"; }
0077 
0078     //! Short description of the action
0079     std::string_view description() const final
0080     {
0081         return "apply along-step in a uniform field with Urban MSC";
0082     }
0083 
0084     //! Dependency ordering of the action
0085     StepActionOrder order() const final { return StepActionOrder::along; }
0086 
0087     //// ACCESSORS ////
0088 
0089     //! Whether energy flucutation is in use
0090     bool has_fluct() const { return static_cast<bool>(fluct_); }
0091 
0092     //! Whether MSC is in use
0093     bool has_msc() const { return static_cast<bool>(msc_); }
0094 
0095   private:
0096     ActionId id_;
0097     SPConstFieldParams field_;
0098     SPConstFluctuations fluct_;
0099     SPConstMsc msc_;
0100 };
0101 
0102 //---------------------------------------------------------------------------//
0103 }  // namespace celeritas