Back to home page

EIC code displayed by LXR

 
 

    


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

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