Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-05 10:27:45

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/data/ElectroNuclearData.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "corecel/data/Collection.hh"
0012 #include "corecel/grid/NonuniformGridData.hh"
0013 #include "corecel/math/Quantity.hh"
0014 #include "celeritas/Quantities.hh"
0015 #include "celeritas/Types.hh"
0016 
0017 namespace celeritas
0018 {
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * Scalar data for the electro-nuclear model.
0022  */
0023 struct ElectroNuclearScalars
0024 {
0025     // Particle IDs
0026     ParticleId electron_id;
0027     ParticleId positron_id;
0028 
0029     //! Model's minimum energy limit [MeV]
0030     static CELER_CONSTEXPR_FUNCTION units::MevEnergy min_valid_energy()
0031     {
0032         return units::MevEnergy{1e+2};
0033     }
0034 
0035     //! Model's maximum energy limit [MeV]
0036     static CELER_CONSTEXPR_FUNCTION units::MevEnergy max_valid_energy()
0037     {
0038         return units::MevEnergy{1e+8};
0039     }
0040 
0041     //! Whether data are assigned
0042     explicit CELER_FUNCTION operator bool() const
0043     {
0044         return electron_id && positron_id;
0045     }
0046 };
0047 
0048 //---------------------------------------------------------------------------//
0049 /*!
0050  * Device data for calculating micro (element) cross sections.
0051  */
0052 template<Ownership W, MemSpace M>
0053 struct ElectroNuclearData
0054 {
0055     template<class T>
0056     using Items = Collection<T, W, M>;
0057     template<class T>
0058     using ElementItems = Collection<T, W, M, ElementId>;
0059 
0060     //// MEMBER DATA ////
0061 
0062     // Scalar data
0063     ElectroNuclearScalars scalars;
0064 
0065     // Microscopic cross sections using parameterized data
0066     ElementItems<NonuniformGridRecord> micro_xs;
0067     Items<real_type> reals;
0068 
0069     //! Whether the data are assigned
0070     explicit CELER_FUNCTION operator bool() const
0071     {
0072         return scalars && !micro_xs.empty() && !reals.empty();
0073     }
0074 
0075     //! Assign from another set of data
0076     template<Ownership W2, MemSpace M2>
0077     ElectroNuclearData& operator=(ElectroNuclearData<W2, M2> const& other)
0078     {
0079         CELER_EXPECT(other);
0080         scalars = other.scalars;
0081         micro_xs = other.micro_xs;
0082         reals = other.reals;
0083 
0084         return *this;
0085     }
0086 };
0087 
0088 //---------------------------------------------------------------------------//
0089 }  // namespace celeritas