Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:11: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/neutron/model/ChipsNeutronElasticModel.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <functional>
0010 
0011 #include "corecel/data/CollectionMirror.hh"
0012 #include "celeritas/Quantities.hh"
0013 #include "celeritas/inp/Grid.hh"
0014 #include "celeritas/mat/IsotopeView.hh"
0015 #include "celeritas/mat/MaterialView.hh"
0016 #include "celeritas/neutron/data/NeutronElasticData.hh"
0017 #include "celeritas/phys/AtomicNumber.hh"
0018 #include "celeritas/phys/Model.hh"
0019 
0020 namespace celeritas
0021 {
0022 class MaterialParams;
0023 class ParticleParams;
0024 
0025 //---------------------------------------------------------------------------//
0026 /*!
0027  * Set up and launch the neutron elastic CHIPS model interaction.
0028  */
0029 class ChipsNeutronElasticModel final : public Model, public StaticConcreteAction
0030 {
0031   public:
0032     //!@{
0033     using AtomicMassNumber = IsotopeView::AtomicMassNumber;
0034     using MevEnergy = units::MevEnergy;
0035     using ReadData = std::function<inp::Grid(AtomicNumber)>;
0036     using HostRef = NeutronElasticHostRef;
0037     using DeviceRef = NeutronElasticDeviceRef;
0038     //!@}
0039 
0040   public:
0041     // Construct from model ID and other necessary data
0042     ChipsNeutronElasticModel(ActionId id,
0043                              ParticleParams const& particles,
0044                              MaterialParams const& materials,
0045                              ReadData load_data);
0046 
0047     // Particle types and energy ranges that this model applies to
0048     SetApplicability applicability() const final;
0049 
0050     // Get the microscopic cross sections for the given particle and material
0051     MicroXsBuilders micro_xs(Applicability) const final;
0052 
0053     //! Apply the interaction kernel to host data
0054     void step(CoreParams const&, CoreStateHost&) const final;
0055 
0056     // Apply the interaction kernel to device data
0057     void step(CoreParams const&, CoreStateDevice&) const final;
0058 
0059     //!@{
0060     //! Access model data
0061     HostRef const& host_ref() const { return mirror_.host_ref(); }
0062     DeviceRef const& device_ref() const { return mirror_.device_ref(); }
0063     //!@}
0064 
0065   private:
0066     //// DATA ////
0067 
0068     // Host/device storage and reference
0069     CollectionMirror<NeutronElasticData> mirror_;
0070 
0071     //// TYPES ////
0072 
0073     using HostXsData = HostVal<NeutronElasticData>;
0074 
0075     //// HELPER FUNCTIONS ////
0076     void append_coeffs(AtomicMassNumber A, HostXsData* xs_data) const;
0077 };
0078 
0079 //---------------------------------------------------------------------------//
0080 }  // namespace celeritas