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