Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:53:33

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/WentzelVIMscData.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 #include "corecel/cont/Array.hh"
0011 #include "corecel/data/Collection.hh"
0012 #include "celeritas/Quantities.hh"
0013 #include "celeritas/Types.hh"
0014 #include "celeritas/grid/XsGridData.hh"
0015 
0016 #include "CommonCoulombData.hh"
0017 
0018 namespace celeritas
0019 {
0020 //---------------------------------------------------------------------------//
0021 /*!
0022  * Settable parameters and default values for Wentzel VI multiple scattering.
0023  */
0024 struct WentzelVIMscParameters
0025 {
0026     using Energy = units::MevEnergy;
0027 
0028     real_type single_scattering_factor{1.25};
0029     Energy low_energy_limit{0};
0030     Energy high_energy_limit{0};
0031 
0032     //! The minimum value of the true path length limit
0033     static constexpr real_type min_step{real_type{1} * units::nanometer};
0034 };
0035 
0036 //---------------------------------------------------------------------------//
0037 /*!
0038  * Device data for Wentzel VI MSC.
0039  */
0040 template<Ownership W, MemSpace M>
0041 struct WentzelVIMscData
0042 {
0043     //// TYPES ////
0044 
0045     template<class T>
0046     using Items = Collection<T, W, M>;
0047     template<class T>
0048     using ParticleItems = Collection<T, W, M, ParticleId>;
0049 
0050     //// DATA ////
0051 
0052     //! Particle IDs
0053     CoulombIds ids;
0054     //! Mass of electron in MeV
0055     units::MevMass electron_mass;
0056     //! User-assignable options
0057     WentzelVIMscParameters params;
0058     //! Number of particles this model applies to
0059     ParticleId::size_type num_particles;
0060     //! Map from particle ID to index in cross sections
0061     ParticleItems<MscParticleId> pid_to_xs;
0062     //! Scaled xs data
0063     Items<UniformGridRecord> xs;  //!< [mat][particle]
0064 
0065     // Backend storage
0066     Items<real_type> reals;
0067 
0068     //// METHODS ////
0069 
0070     //! Check whether the data is assigned
0071     explicit CELER_FUNCTION operator bool() const
0072     {
0073         return ids && electron_mass > zero_quantity() && num_particles >= 2
0074                && !pid_to_xs.empty() && !xs.empty() && !reals.empty();
0075     }
0076 
0077     //! Assign from another set of data
0078     template<Ownership W2, MemSpace M2>
0079     WentzelVIMscData& operator=(WentzelVIMscData<W2, M2> const& other)
0080     {
0081         CELER_EXPECT(other);
0082         ids = other.ids;
0083         electron_mass = other.electron_mass;
0084         params = other.params;
0085         num_particles = other.num_particles;
0086         pid_to_xs = other.pid_to_xs;
0087         xs = other.xs;
0088         reals = other.reals;
0089         return *this;
0090     }
0091 };
0092 
0093 }  // namespace celeritas