File indexing completed on 2025-02-22 10:31:15
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include "corecel/Macros.hh"
0011 #include "corecel/cont/Array.hh"
0012 #include "corecel/data/Collection.hh"
0013 #include "celeritas/Quantities.hh"
0014 #include "celeritas/Types.hh"
0015 #include "celeritas/grid/XsGridData.hh"
0016
0017 #include "CommonCoulombData.hh"
0018
0019 namespace celeritas
0020 {
0021
0022
0023
0024
0025 struct WentzelVIMscParameters
0026 {
0027 using Energy = units::MevEnergy;
0028
0029 real_type single_scattering_factor{1.25};
0030 Energy low_energy_limit{0};
0031 Energy high_energy_limit{0};
0032
0033
0034 static CELER_CONSTEXPR_FUNCTION real_type limit_min_fix()
0035 {
0036 return 1e-7 * units::centimeter;
0037 }
0038 };
0039
0040
0041
0042
0043
0044 template<Ownership W, MemSpace M>
0045 struct WentzelVIMscData
0046 {
0047
0048
0049 template<class T>
0050 using Items = Collection<T, W, M>;
0051
0052
0053
0054
0055 CoulombIds ids;
0056
0057 units::MevMass electron_mass;
0058
0059 WentzelVIMscParameters params;
0060
0061 Items<XsGridData> xs;
0062
0063
0064 Items<real_type> reals;
0065
0066
0067
0068
0069 explicit CELER_FUNCTION operator bool() const
0070 {
0071 return ids && electron_mass > zero_quantity() && !xs.empty()
0072 && !reals.empty();
0073 }
0074
0075
0076 template<Ownership W2, MemSpace M2>
0077 WentzelVIMscData& operator=(WentzelVIMscData<W2, M2> const& other)
0078 {
0079 CELER_EXPECT(other);
0080 ids = other.ids;
0081 electron_mass = other.electron_mass;
0082 params = other.params;
0083 xs = other.xs;
0084 reals = other.reals;
0085 return *this;
0086 }
0087
0088
0089 CELER_FUNCTION ItemId<XsGridData> at(MaterialId mat, ParticleId par) const
0090 {
0091 CELER_EXPECT(mat && par);
0092 size_type result = mat.unchecked_get() * 2;
0093 result += (par == this->ids.electron ? 0 : 1);
0094 CELER_ENSURE(result < this->xs.size());
0095 return ItemId<XsGridData>{result};
0096 }
0097 };
0098
0099 }