File indexing completed on 2025-09-18 09:09:08
0001
0002
0003
0004
0005
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/grid/TwodGridData.hh"
0014 #include "corecel/math/Quantity.hh"
0015 #include "celeritas/Quantities.hh"
0016 #include "celeritas/Types.hh"
0017
0018 namespace celeritas
0019 {
0020
0021
0022
0023
0024 struct NeutronInelasticScalars
0025 {
0026
0027 ParticleId neutron_id;
0028 ParticleId proton_id;
0029
0030
0031 units::MevMass neutron_mass;
0032 units::MevMass proton_mass;
0033
0034
0035 static CELER_CONSTEXPR_FUNCTION size_type num_channels() { return 2; }
0036
0037
0038 static CELER_CONSTEXPR_FUNCTION units::MevEnergy max_valid_energy()
0039 {
0040
0041 return units::MevEnergy{320};
0042 }
0043
0044
0045 explicit CELER_FUNCTION operator bool() const
0046 {
0047 return neutron_id && proton_id && neutron_mass > zero_quantity()
0048 && neutron_mass > zero_quantity();
0049 }
0050 };
0051
0052
0053
0054
0055
0056
0057 struct StepanovParameters
0058 {
0059 real_type xs_zero;
0060 real_type slope;
0061 Real3 coeffs;
0062 };
0063
0064
0065
0066
0067
0068 struct ZoneComponent
0069 {
0070 using NucleonArray = Array<real_type, 2>;
0071
0072 real_type radius{};
0073 real_type volume{};
0074 NucleonArray density{0, 0};
0075 NucleonArray fermi_mom{0, 0};
0076 NucleonArray potential{0, 0};
0077 };
0078
0079
0080
0081
0082
0083 struct NuclearZones
0084 {
0085 ItemRange<ZoneComponent> zones;
0086
0087
0088 explicit CELER_FUNCTION operator bool() const { return !zones.empty(); }
0089 };
0090
0091
0092
0093
0094
0095 template<Ownership W, MemSpace M>
0096 struct NuclearZoneData
0097 {
0098 template<class T>
0099 using Items = Collection<T, W, M>;
0100 template<class T>
0101 using IsotopeItems = Collection<T, W, M, IsotopeId>;
0102
0103
0104
0105
0106 Items<ZoneComponent> components;
0107 IsotopeItems<NuclearZones> zones;
0108
0109
0110 explicit CELER_FUNCTION operator bool() const
0111 {
0112 return !components.empty() && !zones.empty();
0113 }
0114
0115
0116 template<Ownership W2, MemSpace M2>
0117 NuclearZoneData& operator=(NuclearZoneData<W2, M2> const& other)
0118 {
0119 CELER_EXPECT(other);
0120 components = other.components;
0121 zones = other.zones;
0122
0123 return *this;
0124 }
0125 };
0126
0127
0128
0129
0130
0131 template<Ownership W, MemSpace M>
0132 struct NeutronInelasticData
0133 {
0134 template<class T>
0135 using Items = Collection<T, W, M>;
0136 template<class T>
0137 using ElementItems = Collection<T, W, M, ElementId>;
0138 template<class T>
0139 using ChannelItems = Collection<T, W, M, ChannelId>;
0140
0141
0142
0143
0144 NeutronInelasticScalars scalars;
0145
0146
0147 ElementItems<NonuniformGridRecord> micro_xs;
0148
0149
0150 ChannelItems<NonuniformGridRecord> nucleon_xs;
0151
0152
0153 ChannelItems<StepanovParameters> xs_params;
0154
0155
0156 ChannelItems<TwodGridData> angular_cdf;
0157
0158
0159 Items<real_type> reals;
0160
0161
0162 NuclearZoneData<W, M> nuclear_zones;
0163
0164
0165 explicit CELER_FUNCTION operator bool() const
0166 {
0167 return scalars && !micro_xs.empty() && !nucleon_xs.empty()
0168 && !xs_params.empty() && !reals.empty() && nuclear_zones
0169 && !angular_cdf.empty();
0170 }
0171
0172
0173 template<Ownership W2, MemSpace M2>
0174 NeutronInelasticData& operator=(NeutronInelasticData<W2, M2> const& other)
0175 {
0176 CELER_EXPECT(other);
0177 scalars = other.scalars;
0178 micro_xs = other.micro_xs;
0179 nucleon_xs = other.nucleon_xs;
0180 xs_params = other.xs_params;
0181 reals = other.reals;
0182 nuclear_zones = other.nuclear_zones;
0183 angular_cdf = other.angular_cdf;
0184
0185 return *this;
0186 }
0187 };
0188
0189 using NeutronInelasticHostRef = HostCRef<NeutronInelasticData>;
0190 using NeutronInelasticDeviceRef = DeviceCRef<NeutronInelasticData>;
0191 using NeutronInelasticRef = NativeCRef<NeutronInelasticData>;
0192
0193
0194 }