Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2022-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/global/alongstep/AlongStepUniformMscAction.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <memory>
0011 #include <string>
0012 
0013 #include "corecel/Assert.hh"
0014 #include "corecel/Macros.hh"
0015 #include "celeritas/em/data/FluctuationData.hh"
0016 #include "celeritas/em/data/UrbanMscData.hh"
0017 #include "celeritas/field/UniformFieldData.hh"
0018 #include "celeritas/global/ActionInterface.hh"
0019 
0020 namespace celeritas
0021 {
0022 class UrbanMscParams;
0023 class FluctuationParams;
0024 class PhysicsParams;
0025 class MaterialParams;
0026 class ParticleParams;
0027 
0028 //---------------------------------------------------------------------------//
0029 /*!
0030  * Along-step kernel with optional MSC and uniform magnetic field.
0031  */
0032 class AlongStepUniformMscAction final : public CoreStepActionInterface
0033 {
0034   public:
0035     //!@{
0036     //! \name Type aliases
0037     using SPConstFluctuations = std::shared_ptr<FluctuationParams const>;
0038     using SPConstMsc = std::shared_ptr<UrbanMscParams const>;
0039     //!@}
0040 
0041   public:
0042     // Construct the along-step action from input parameters
0043     static std::shared_ptr<AlongStepUniformMscAction>
0044     from_params(ActionId id,
0045                 MaterialParams const& materials,
0046                 ParticleParams const& particles,
0047                 UniformFieldParams const& field_params,
0048                 SPConstMsc msc,
0049                 bool eloss_fluctuation);
0050 
0051     // Construct with next action ID, optional MSC, magnetic field
0052     AlongStepUniformMscAction(ActionId id,
0053                               UniformFieldParams const& field_params,
0054                               SPConstFluctuations fluct,
0055                               SPConstMsc msc);
0056 
0057     // Default destructor
0058     ~AlongStepUniformMscAction();
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 interaction kernel
0070     std::string_view label() const final { return "along-step-uniform-msc"; }
0071 
0072     //! Short description of the action
0073     std::string_view description() const final
0074     {
0075         return "apply along-step in a uniform field with Urban MSC";
0076     }
0077 
0078     //! Dependency ordering of the action
0079     StepActionOrder order() const final { return StepActionOrder::along; }
0080 
0081     //// ACCESSORS ////
0082 
0083     //! Whether energy flucutation is in use
0084     bool has_fluct() const { return static_cast<bool>(fluct_); }
0085 
0086     //! Whether MSC is in use
0087     bool has_msc() const { return static_cast<bool>(msc_); }
0088 
0089     //! Field strength
0090     Real3 const& field() const { return field_params_.field; }
0091 
0092   private:
0093     ActionId id_;
0094     SPConstFluctuations fluct_;
0095     SPConstMsc msc_;
0096     UniformFieldParams field_params_;
0097 };
0098 
0099 //---------------------------------------------------------------------------//
0100 }  // namespace celeritas