Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:53:35

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