Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2023-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/mat/IsotopeView.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Macros.hh"
0011 #include "celeritas/Quantities.hh"
0012 #include "celeritas/Types.hh"
0013 #include "celeritas/phys/AtomicNumber.hh"
0014 
0015 #include "MaterialData.hh"
0016 
0017 namespace celeritas
0018 {
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * Access amalgamated data for a nuclide (isotope of an element).
0022  *
0023  * This encapsulates general data specific to a single nuclide.
0024  *
0025  * \todo This will be renamed to NuclideView.
0026  */
0027 class IsotopeView
0028 {
0029   public:
0030     //!@{
0031     //! \name Type aliases
0032     using MaterialParamsRef = NativeCRef<MaterialParamsData>;
0033     using MevEnergy = units::MevEnergy;
0034     using MevMass = units::MevMass;
0035     using AtomicMassNumber = AtomicNumber;
0036     //!@}
0037 
0038   public:
0039     // Construct from shared material data and global isotope ID
0040     inline CELER_FUNCTION
0041     IsotopeView(MaterialParamsRef const& params, IsotopeId isot_id);
0042 
0043     // ID of this isotope
0044     CELER_FORCEINLINE_FUNCTION IsotopeId isotope_id() const;
0045 
0046     // Atomic number Z
0047     CELER_FORCEINLINE_FUNCTION AtomicNumber atomic_number() const;
0048 
0049     // Atomic number A
0050     CELER_FORCEINLINE_FUNCTION AtomicMassNumber atomic_mass_number() const;
0051 
0052     // Nuclear binding energy
0053     CELER_FORCEINLINE_FUNCTION MevEnergy binding_energy() const;
0054 
0055     // Nuclear binding energy difference for a proton loss
0056     CELER_FORCEINLINE_FUNCTION MevEnergy proton_loss_energy() const;
0057 
0058     // Nuclear binding energy difference for a neutron loss
0059     CELER_FORCEINLINE_FUNCTION MevEnergy neutron_loss_energy() const;
0060 
0061     // Sum of nucleons + binding energy
0062     CELER_FORCEINLINE_FUNCTION MevMass nuclear_mass() const;
0063 
0064   private:
0065     MaterialParamsRef const& params_;
0066     IsotopeId isotope_;
0067 
0068     // HELPER FUNCTIONS
0069 
0070     CELER_FORCEINLINE_FUNCTION IsotopeRecord const& isotope_def() const
0071     {
0072         return params_.isotopes[isotope_];
0073     }
0074 };
0075 
0076 //---------------------------------------------------------------------------//
0077 // INLINE DEFINITIONS
0078 //---------------------------------------------------------------------------//
0079 /*!
0080  * Construct from shared material data and global isotope ID.
0081  */
0082 CELER_FUNCTION
0083 IsotopeView::IsotopeView(MaterialParamsRef const& params, IsotopeId isot_id)
0084     : params_{params}, isotope_{isot_id}
0085 {
0086     CELER_EXPECT(isotope_ < params.isotopes.size());
0087 }
0088 
0089 //---------------------------------------------------------------------------//
0090 /*!
0091  * Isotope ID.
0092  */
0093 CELER_FUNCTION IsotopeId IsotopeView::isotope_id() const
0094 {
0095     return isotope_;
0096 }
0097 
0098 //---------------------------------------------------------------------------//
0099 /*!
0100  * Atomic number Z.
0101  */
0102 CELER_FUNCTION AtomicNumber IsotopeView::atomic_number() const
0103 {
0104     return isotope_def().atomic_number;
0105 }
0106 
0107 //---------------------------------------------------------------------------//
0108 /*!
0109  * Atomic number A.
0110  */
0111 CELER_FUNCTION IsotopeView::AtomicMassNumber
0112 IsotopeView::atomic_mass_number() const
0113 {
0114     return isotope_def().atomic_mass_number;
0115 }
0116 
0117 //---------------------------------------------------------------------------//
0118 /*!
0119  * Nuclear binding energy.
0120  */
0121 CELER_FUNCTION units::MevEnergy IsotopeView::binding_energy() const
0122 {
0123     return isotope_def().binding_energy;
0124 }
0125 
0126 //---------------------------------------------------------------------------//
0127 /*!
0128  * Nuclear binding energy difference for a proton loss.
0129  */
0130 CELER_FUNCTION units::MevEnergy IsotopeView::proton_loss_energy() const
0131 {
0132     return isotope_def().proton_loss_energy;
0133 }
0134 
0135 //---------------------------------------------------------------------------//
0136 /*!
0137  * Nuclear binding energy difference for a neutron loss.
0138  */
0139 CELER_FUNCTION units::MevEnergy IsotopeView::neutron_loss_energy() const
0140 {
0141     return isotope_def().neutron_loss_energy;
0142 }
0143 
0144 //---------------------------------------------------------------------------//
0145 /*!
0146  * Nuclear mass, the sum of the nucleons' mass and their binding energy.
0147  */
0148 CELER_FUNCTION units::MevMass IsotopeView::nuclear_mass() const
0149 {
0150     return isotope_def().nuclear_mass;
0151 }
0152 
0153 //---------------------------------------------------------------------------//
0154 }  // namespace celeritas