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