Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2020-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/em/model/RayleighModel.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <memory>
0011 
0012 #include "corecel/data/CollectionMirror.hh"
0013 #include "celeritas/em/data/RayleighData.hh"
0014 #include "celeritas/phys/AtomicNumber.hh"
0015 #include "celeritas/phys/ImportedModelAdapter.hh"
0016 #include "celeritas/phys/ImportedProcessAdapter.hh"
0017 #include "celeritas/phys/Model.hh"
0018 
0019 namespace celeritas
0020 {
0021 class MaterialParams;
0022 class ParticleParams;
0023 
0024 //---------------------------------------------------------------------------//
0025 /*!
0026  * Set up and launch Rayleigh scattering.
0027  */
0028 class RayleighModel final : public Model, public StaticConcreteAction
0029 {
0030   public:
0031     //@{
0032     //! Type aliases
0033     using HostRef = HostCRef<RayleighData>;
0034     using DeviceRef = DeviceCRef<RayleighData>;
0035     using SPConstImported = std::shared_ptr<ImportedProcesses const>;
0036     //@}
0037 
0038   public:
0039     // Construct from model ID and other necessary data
0040     RayleighModel(ActionId id,
0041                   ParticleParams const& particles,
0042                   MaterialParams const& materials,
0043                   SPConstImported data);
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     MicroXsBuilders 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     //! Access Rayleigh data on the host
0058     HostRef const& host_ref() const { return mirror_.host_ref(); }
0059 
0060     //! Access Rayleigh data on the device
0061     DeviceRef const& device_ref() const { return mirror_.device_ref(); }
0062 
0063   private:
0064     //// DATA ////
0065 
0066     // Host/device storage and reference
0067     CollectionMirror<RayleighData> mirror_;
0068 
0069     ImportedModelAdapter imported_;
0070 
0071     //// TYPES ////
0072 
0073     using HostValue = HostVal<RayleighData>;
0074     using ElScatParams = RayleighParameters;
0075 
0076     //// HELPER FUNCTIONS ////
0077 
0078     void build_data(HostValue* host_data, MaterialParams const& materials);
0079     static ElScatParams const& get_el_parameters(AtomicNumber atomic_number);
0080 };
0081 
0082 //---------------------------------------------------------------------------//
0083 }  // namespace celeritas