Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-19 10:36:42

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/em/model/ElectroNuclearModel.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <memory>
0010 
0011 #include "corecel/data/ParamsDataStore.hh"
0012 #include "corecel/inp/Grid.hh"
0013 #include "celeritas/Quantities.hh"
0014 #include "celeritas/em/data/ElectroNuclearData.hh"
0015 #include "celeritas/mat/MaterialView.hh"
0016 #include "celeritas/phys/AtomicNumber.hh"
0017 #include "celeritas/phys/Model.hh"
0018 
0019 namespace celeritas
0020 {
0021 class MaterialParams;
0022 class ParticleParams;
0023 
0024 class EmExtraPhysicsHelper;
0025 
0026 //---------------------------------------------------------------------------//
0027 /*!
0028  * Set up and launch the electro-nuclear model interaction.
0029  */
0030 class ElectroNuclearModel final : public Model, public StaticConcreteAction
0031 {
0032   public:
0033     //!@{
0034     using MevEnergy = units::MevEnergy;
0035     using HostRef = HostCRef<ElectroNuclearData>;
0036     using DeviceRef = DeviceCRef<ElectroNuclearData>;
0037     //!@}
0038 
0039   public:
0040     // Construct from model ID and other necessary data
0041     ElectroNuclearModel(ActionId id,
0042                         ParticleParams const& particles,
0043                         MaterialParams const& materials);
0044 
0045     // Particle types and energy ranges that this model applies to
0046     SetApplicability applicability() const final;
0047 
0048     // Get the microscopic cross sections for the given particle and material
0049     XsTable micro_xs(Applicability) const final;
0050 
0051     //! Apply the interaction kernel to host data
0052     void step(CoreParams const&, CoreStateHost&) const final;
0053 
0054     // Apply the interaction kernel to device data
0055     void step(CoreParams const&, CoreStateDevice&) const final;
0056 
0057     //!@{
0058     //! Access model data
0059     HostRef const& host_ref() const { return data_.host_ref(); }
0060     DeviceRef const& device_ref() const { return data_.device_ref(); }
0061     //!@}
0062 
0063   private:
0064     //// DATA ////
0065     std::shared_ptr<EmExtraPhysicsHelper> helper_;
0066 
0067     // Host/device storage and reference
0068     ParamsDataStore<ElectroNuclearData> data_;
0069 
0070     //// TYPES ////
0071 
0072     using HostXsData = HostVal<ElectroNuclearData>;
0073 
0074     //// HELPER FUNCTIONS ////
0075 
0076     inp::Grid calc_micro_xs(
0077         AtomicNumber atomic_number, double emin, double emax) const;
0078 };
0079 
0080 //---------------------------------------------------------------------------//
0081 }  // namespace celeritas