File indexing completed on 2025-02-22 10:31:28
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include <functional>
0011 #include <tuple>
0012
0013 #include "corecel/Assert.hh"
0014 #include "corecel/OpaqueId.hh"
0015 #include "corecel/Types.hh"
0016 #include "celeritas/Quantities.hh"
0017 #include "celeritas/Types.hh"
0018
0019 namespace celeritas
0020 {
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 struct Applicability
0034 {
0035 using EnergyUnits = units::Mev;
0036 using Energy = Quantity<EnergyUnits>;
0037
0038 MaterialId material{};
0039 ParticleId particle{};
0040 Energy lower = zero_quantity();
0041 Energy upper = max_quantity();
0042
0043
0044 inline explicit operator bool() const
0045 {
0046 return static_cast<bool>(particle) && lower < upper;
0047 }
0048 };
0049
0050
0051
0052 inline bool operator==(Applicability const& lhs, Applicability const& rhs)
0053 {
0054 return std::make_tuple(lhs.material, lhs.particle, lhs.lower, lhs.upper)
0055 == std::make_tuple(rhs.material, rhs.particle, rhs.lower, rhs.upper);
0056 }
0057
0058 inline bool operator<(Applicability const& lhs, Applicability const& rhs)
0059 {
0060 return std::make_tuple(lhs.material, lhs.particle, lhs.lower, lhs.upper)
0061 < std::make_tuple(rhs.material, rhs.particle, rhs.lower, rhs.upper);
0062 }
0063
0064
0065
0066 }