File indexing completed on 2025-02-22 10:31:25
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include "corecel/Macros.hh"
0011 #include "corecel/Types.hh"
0012 #include "corecel/data/Collection.hh"
0013 #include "corecel/math/Quantity.hh"
0014 #include "celeritas/Quantities.hh"
0015 #include "celeritas/Types.hh"
0016 #include "celeritas/grid/GenericGridData.hh"
0017
0018 namespace celeritas
0019 {
0020
0021
0022
0023
0024
0025 struct ExchangeParameters
0026 {
0027 using Real4 = Array<real_type, 4>;
0028
0029
0030 real_type ss{};
0031 Real4 slope{0, 0, 0, 0};
0032 Real4 expnt{0, 0, 0, 0};
0033 };
0034
0035
0036
0037
0038
0039
0040 struct ChipsDiffXsCoefficients
0041 {
0042 using ChipsArray = Array<real_type, 42>;
0043
0044
0045 ChipsArray par{};
0046 };
0047
0048
0049
0050
0051
0052 template<Ownership W, MemSpace M>
0053 struct NeutronElasticData
0054 {
0055 using XsUnits = units::Native;
0056
0057 template<class T>
0058 using Items = Collection<T, W, M>;
0059 template<class T>
0060 using ElementItems = Collection<T, W, M, ElementId>;
0061 template<class T>
0062 using IsotopeItems = Collection<T, W, M, IsotopeId>;
0063
0064
0065
0066
0067 ParticleId neutron;
0068
0069
0070 units::MevMass neutron_mass;
0071
0072
0073 ElementItems<GenericGridRecord> micro_xs;
0074
0075
0076 IsotopeItems<ChipsDiffXsCoefficients> coeffs;
0077
0078
0079 Items<real_type> reals;
0080
0081
0082
0083
0084 static CELER_CONSTEXPR_FUNCTION units::MevEnergy min_valid_energy()
0085 {
0086 return units::MevEnergy{1e-5};
0087 }
0088
0089 static CELER_CONSTEXPR_FUNCTION units::MevEnergy max_valid_energy()
0090 {
0091 return units::MevEnergy{2e+4};
0092 }
0093
0094
0095 explicit CELER_FUNCTION operator bool() const
0096 {
0097 return neutron && neutron_mass > zero_quantity() && !micro_xs.empty()
0098 && !coeffs.empty() && !reals.empty();
0099 }
0100
0101
0102 template<Ownership W2, MemSpace M2>
0103 NeutronElasticData& operator=(NeutronElasticData<W2, M2> const& other)
0104 {
0105 CELER_EXPECT(other);
0106 neutron = other.neutron;
0107 neutron_mass = other.neutron_mass;
0108 micro_xs = other.micro_xs;
0109 coeffs = other.coeffs;
0110 reals = other.reals;
0111 return *this;
0112 }
0113 };
0114
0115 using NeutronElasticHostRef = HostCRef<NeutronElasticData>;
0116 using NeutronElasticDeviceRef = DeviceCRef<NeutronElasticData>;
0117 using NeutronElasticRef = NativeCRef<NeutronElasticData>;
0118
0119
0120 }