mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 18:37:15 +02:00
refactored HEP units into separate files and corrected namespace where necessary
This commit is contained in:
@ -29,6 +29,7 @@ add_subdirectory(isq-natural)
|
||||
add_subdirectory(si)
|
||||
add_subdirectory(si-cgs)
|
||||
add_subdirectory(si-fps)
|
||||
add_subdirectory(si-hep)
|
||||
add_subdirectory(si-iau)
|
||||
add_subdirectory(si-imperial)
|
||||
add_subdirectory(si-international)
|
||||
@ -44,6 +45,7 @@ target_link_libraries(mp-units-systems INTERFACE
|
||||
mp-units::si
|
||||
mp-units::si-cgs
|
||||
mp-units::si-fps
|
||||
mp-units::si-hep
|
||||
mp-units::si-iau
|
||||
mp-units::si-imperial
|
||||
mp-units::si-international
|
||||
|
25
src/systems/si-hep/CMakeLists.txt
Normal file
25
src/systems/si-hep/CMakeLists.txt
Normal file
@ -0,0 +1,25 @@
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2021 Mateusz Pusz
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
add_units_module(si-hep mp-units::si)
|
104
src/systems/si-hep/include/units/isq/si/hep/area.h
Normal file
104
src/systems/si-hep/include/units/isq/si/hep/area.h
Normal file
@ -0,0 +1,104 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2021 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/area.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::hep {
|
||||
|
||||
// effective cross-sectional area according to EU council directive 80/181/EEC
|
||||
// https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:01980L0181-20090527#page=10
|
||||
// https://www.fedlex.admin.ch/eli/cc/1994/3109_3109_3109/de
|
||||
struct barn : named_scaled_unit<barn, "b", prefix, ratio(1, 1, -28), square_metre> {};
|
||||
struct yocto_barn : prefixed_unit<yocto_barn, yocto, barn> {};
|
||||
struct zepto_barn : prefixed_unit<zepto_barn, zepto, barn> {};
|
||||
struct atto_barn : prefixed_unit<atto_barn, atto, barn> {};
|
||||
struct femto_barn : prefixed_unit<femto_barn, femto, barn> {};
|
||||
struct pico_barn : prefixed_unit<pico_barn, pico, barn> {};
|
||||
struct nano_barn : prefixed_unit<nano_barn, nano, barn> {};
|
||||
struct micro_barn : prefixed_unit<micro_barn, micro, barn> {};
|
||||
struct milli_barn : prefixed_unit<milli_barn, milli, barn> {};
|
||||
|
||||
//template<UnitOf<dim_area> U, Representation Rep = double>
|
||||
// using area = quantity<dim_area, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
constexpr auto operator"" _q_yb(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<yocto_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_yb(long double l) { return area<yocto_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_zb(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<zepto_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_zb(long double l) { return area<zepto_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_ab(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<atto_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_ab(long double l) { return area<atto_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_fb(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<femto_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_fb(long double l) { return area<femto_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_pb(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<pico_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_pb(long double l) { return area<pico_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_nb(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<nano_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_nb(long double l) { return area<nano_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_ub(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<micro_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_ub(long double l) { return area<micro_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_mb(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<milli_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_mb(long double l) { return area<milli_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_b(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_b(long double l) { return area<barn, long double>(l); }
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace area_references {
|
||||
|
||||
inline constexpr auto barn = reference<dim_area, ::units::isq::si::hep::barn>{};
|
||||
|
||||
} // namespace area_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace area_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si::hep
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::si::hep::inline area {
|
||||
|
||||
template<Representation Rep = double> using barn = units::isq::si::hep::area<units::isq::si::hep::barn, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::hep::inline area
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
142
src/systems/si-hep/include/units/isq/si/hep/energy.h
Normal file
142
src/systems/si-hep/include/units/isq/si/hep/energy.h
Normal file
@ -0,0 +1,142 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2021 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/energy.h>
|
||||
#include <units/isq/si/energy.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::hep {
|
||||
|
||||
// N.B. electron charge (and eV) is an exact constant: https://www.bipm.org/documents/20126/41483022/SI-Brochure-9.pdf#page=147
|
||||
struct electronvolt : named_scaled_unit<electronvolt, "eV", prefix, ratio(1'602'176'634, 1'000'000'000, -19), ::units::isq::si::joule> {};
|
||||
|
||||
struct yeV : prefixed_unit<yeV, yocto, electronvolt> {}; // N.B. very rarely used
|
||||
struct zeV : prefixed_unit<zeV, zepto, electronvolt> {}; // N.B. very rarely used
|
||||
struct aeV : prefixed_unit<aeV, atto, electronvolt> {}; // N.B. very rarely used
|
||||
struct feV : prefixed_unit<feV, femto, electronvolt> {};
|
||||
struct peV : prefixed_unit<peV, pico, electronvolt> {};
|
||||
struct neV : prefixed_unit<neV, nano, electronvolt> {};
|
||||
struct ueV : prefixed_unit<ueV, micro, electronvolt> {};
|
||||
struct meV : prefixed_unit<meV, milli, electronvolt> {};
|
||||
using eV = electronvolt;
|
||||
struct keV : prefixed_unit<keV, kilo, electronvolt> {};
|
||||
struct MeV : prefixed_unit<MeV, mega, electronvolt> {};
|
||||
struct GeV : prefixed_unit<MeV, giga, electronvolt> {};
|
||||
struct TeV : prefixed_unit<TeV, tera, electronvolt> {};
|
||||
struct PeV : prefixed_unit<PeV, peta, electronvolt> {};
|
||||
struct EeV : prefixed_unit<EeV, exa, electronvolt> {}; // N.B. very rarely used
|
||||
struct ZeV : prefixed_unit<ZeV, zetta, electronvolt> {}; // N.B. very rarely used
|
||||
struct YeV : prefixed_unit<YeV, yotta, electronvolt> {}; // N.B. very rarely used
|
||||
|
||||
template<UnitOf<dim_energy> U, Representation Rep = double>
|
||||
using energy = quantity<dim_energy, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
constexpr auto operator"" _q_feV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<feV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_feV(long double l) { return energy<feV, long double>(l); }
|
||||
constexpr auto operator"" _q_peV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<peV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_peV(long double l) { return energy<peV, long double>(l); }
|
||||
constexpr auto operator"" _q_neV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<neV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_neV(long double l) { return energy<ueV, long double>(l); }
|
||||
constexpr auto operator"" _q_ueV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<neV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_ueV(long double l) { return energy<ueV, long double>(l); }
|
||||
constexpr auto operator"" _q_meV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<meV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_meV(long double l) { return energy<meV, long double>(l); }
|
||||
|
||||
constexpr auto operator"" _q_eV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<eV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_eV(long double l) { return energy<eV, long double>(l); }
|
||||
|
||||
constexpr auto operator"" _q_keV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<keV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_keV(long double l) { return energy<keV, long double>(l); }
|
||||
constexpr auto operator"" _q_MeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<MeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_MeV(long double l) { return energy<MeV, long double>(l); }
|
||||
constexpr auto operator"" _q_GeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<GeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_GeV(long double l) { return energy<GeV, long double>(l); }
|
||||
constexpr auto operator"" _q_TeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<TeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_TeV(long double l) { return energy<TeV, long double>(l); }
|
||||
constexpr auto operator"" _q_PeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<PeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_PeV(long double l) { return energy<PeV, long double>(l); }
|
||||
constexpr auto operator"" _q_EeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<EeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_EeV(long double l) { return energy<EeV, long double>(l); }
|
||||
constexpr auto operator"" _q_ZeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<ZeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_ZeV(long double l) { return energy<ZeV, long double>(l); }
|
||||
constexpr auto operator"" _q_YeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<YeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_YeV(long double l) { return energy<YeV, long double>(l); }
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace energy_references {
|
||||
|
||||
inline constexpr auto eV = reference<dim_energy, hep::eV>{};
|
||||
|
||||
} // namespace energy_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace energy_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si::hep
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::si::hep::inline energy {
|
||||
|
||||
template<Representation Rep = double> using yeV = units::isq::si::hep::energy<units::isq::si::hep::yeV, Rep>;
|
||||
template<Representation Rep = double> using zeV = units::isq::si::hep::energy<units::isq::si::hep::zeV, Rep>;
|
||||
template<Representation Rep = double> using aeV = units::isq::si::hep::energy<units::isq::si::hep::aeV, Rep>;
|
||||
template<Representation Rep = double> using feV = units::isq::si::hep::energy<units::isq::si::hep::feV, Rep>;
|
||||
template<Representation Rep = double> using peV = units::isq::si::hep::energy<units::isq::si::hep::peV, Rep>;
|
||||
template<Representation Rep = double> using neV = units::isq::si::hep::energy<units::isq::si::hep::neV, Rep>;
|
||||
template<Representation Rep = double> using ueV = units::isq::si::hep::energy<units::isq::si::hep::ueV, Rep>;
|
||||
template<Representation Rep = double> using meV = units::isq::si::hep::energy<units::isq::si::hep::meV, Rep>;
|
||||
|
||||
template<Representation Rep = double> using eV = units::isq::si::hep::energy<units::isq::si::hep::eV, Rep>;
|
||||
|
||||
template<Representation Rep = double> using keV = units::isq::si::hep::energy<units::isq::si::hep::keV, Rep>;
|
||||
template<Representation Rep = double> using MeV = units::isq::si::hep::energy<units::isq::si::hep::MeV, Rep>;
|
||||
template<Representation Rep = double> using GeV = units::isq::si::hep::energy<units::isq::si::hep::GeV, Rep>;
|
||||
template<Representation Rep = double> using TeV = units::isq::si::hep::energy<units::isq::si::hep::TeV, Rep>;
|
||||
template<Representation Rep = double> using PeV = units::isq::si::hep::energy<units::isq::si::hep::PeV, Rep>;
|
||||
template<Representation Rep = double> using EeV = units::isq::si::hep::energy<units::isq::si::hep::EeV, Rep>;
|
||||
template<Representation Rep = double> using ZeV = units::isq::si::hep::energy<units::isq::si::hep::ZeV, Rep>;
|
||||
template<Representation Rep = double> using YeV = units::isq::si::hep::energy<units::isq::si::hep::YeV, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::hep::inline energy
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
30
src/systems/si-hep/include/units/isq/si/hep/hep.h
Normal file
30
src/systems/si-hep/include/units/isq/si/hep/hep.h
Normal file
@ -0,0 +1,30 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2021 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/si/hep/area.h>
|
||||
#include <units/isq/si/hep/energy.h>
|
||||
#include <units/isq/si/hep/mass.h>
|
||||
#include <units/isq/si/hep/momentum.h>
|
||||
// IWYU pragma: end_exports
|
129
src/systems/si-hep/include/units/isq/si/hep/mass.h
Normal file
129
src/systems/si-hep/include/units/isq/si/hep/mass.h
Normal file
@ -0,0 +1,129 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2021 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/mass.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/mass.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::hep {
|
||||
|
||||
struct eV_per_c2 : named_scaled_unit<eV_per_c2, basic_symbol_text{"eV/c²", "eV/c^2"}, prefix, ratio(1'7826'619'216'279, 1'000'000'000'000, -35), kilogram> {};
|
||||
struct feV_per_c2 : prefixed_unit<feV_per_c2, femto, eV_per_c2> {};
|
||||
struct peV_per_c2 : prefixed_unit<peV_per_c2, pico, eV_per_c2> {};
|
||||
struct neV_per_c2 : prefixed_unit<neV_per_c2, nano, eV_per_c2> {};
|
||||
struct ueV_per_c2 : prefixed_unit<ueV_per_c2, micro, eV_per_c2> {};
|
||||
struct meV_per_c2 : prefixed_unit<meV_per_c2, milli, eV_per_c2> {}; // approximate mass of an electron/positron (0.511 MeV/c2)
|
||||
struct keV_per_c2 : prefixed_unit<keV_per_c2, kilo, eV_per_c2> {};
|
||||
struct MeV_per_c2 : prefixed_unit<MeV_per_c2, mega, eV_per_c2> {};
|
||||
struct GeV_per_c2 : prefixed_unit<GeV_per_c2, giga, eV_per_c2> {}; // approximate mass of a proton (0.938 GeV/c2) or neutron
|
||||
struct TeV_per_c2 : prefixed_unit<TeV_per_c2, tera, eV_per_c2> {};
|
||||
struct PeV_per_c2 : prefixed_unit<PeV_per_c2, peta, eV_per_c2> {};
|
||||
struct EeV_per_c2 : prefixed_unit<EeV_per_c2, exa, eV_per_c2> {};
|
||||
struct YeV_per_c2 : prefixed_unit<YeV_per_c2, yotta, eV_per_c2> {};
|
||||
struct electron_mass : named_scaled_unit<eV_per_c2, "m_e", prefix, ratio(9'109'383'701'528, 1'000'000'000'000, -31), kilogram> {};
|
||||
struct proton_mass : named_scaled_unit<eV_per_c2, "m_p", prefix, ratio(1'672'621'923'695, 1'000'000'000'000, -27), kilogram> {};
|
||||
struct neutron_mass : named_scaled_unit<eV_per_c2, "m_n", prefix, ratio(1'674'927'498'049, 1'000'000'000'000, -27), kilogram> {};
|
||||
|
||||
struct dim_mass : isq::dim_mass<eV_per_c2> {};
|
||||
|
||||
template<UnitOf<dim_mass> U, Representation Rep = double>
|
||||
using mass = quantity<dim_mass, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
constexpr auto operator"" _q_feV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<feV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_feV_per_c2(long double l) { return mass<feV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_peV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<peV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_peV_per_c2(long double l) { return mass<peV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_neV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<neV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_neV_per_c2(long double l) { return mass<neV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_ueV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<ueV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_ueV_per_c2(long double l) { return mass<ueV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_meV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<meV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_meV_per_c2(long double l) { return mass<meV_per_c2, long double>(l); }
|
||||
|
||||
// eV_per_c2
|
||||
constexpr auto operator"" _q_eV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<eV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_eV_per_c2(long double l) { return mass<eV_per_c2, long double>(l); }
|
||||
|
||||
constexpr auto operator"" _q_keV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<keV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_keV_per_c2(long double l) { return mass<keV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_MeV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<MeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_MeV_per_c2(long double l) { return mass<MeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_GeV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<GeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_GeV_per_c2(long double l) { return mass<GeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_TeV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<TeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_TeV_per_c2(long double l) { return mass<TeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_PeV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<PeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_PeV_per_c2(long double l) { return mass<PeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_EeV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<EeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_EeV_per_c2(long double l) { return mass<EeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_YeV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<YeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_YeV_per_c2(long double l) { return mass<YeV_per_c2, long double>(l); }
|
||||
|
||||
// special HEP masses
|
||||
constexpr auto operator"" _q_electron_mass(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<electron_mass, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_electron_mass(long double l) { return mass<electron_mass, long double>(l); }
|
||||
constexpr auto operator"" _q_proton_mass(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<proton_mass, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_proton_mass(long double l) { return mass<proton_mass, long double>(l); }
|
||||
constexpr auto operator"" _q_neutron_mass(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<neutron_mass, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_neutron_mass(long double l) { return mass<neutron_mass, long double>(l); }
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace mass_references {
|
||||
|
||||
inline constexpr auto eV_per_c2 = reference<dim_mass, ::units::isq::si::hep::eV_per_c2>{};
|
||||
|
||||
} // namespace mass_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace mass_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::si::hep
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::si::hep::inline mass {
|
||||
|
||||
template<Representation Rep = double> using eV_per_c2g = units::isq::si::hep::mass<units::isq::si::hep::eV_per_c2, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::hep::inline mass
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
105
src/systems/si-hep/include/units/isq/si/hep/momentum.h
Normal file
105
src/systems/si-hep/include/units/isq/si/hep/momentum.h
Normal file
@ -0,0 +1,105 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2021 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/momentum.h>
|
||||
#include <units/isq/si/momentum.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/mass.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::si::hep {
|
||||
|
||||
struct eV_per_c : named_scaled_unit<eV_per_c, "eV/c", prefix, ratio(5'344'285'992'678, 1'000'000'000'000, -35), ::units::isq::si::kilogram_metre_per_second> {};
|
||||
struct feV_per_c : prefixed_unit<feV_per_c, femto, eV_per_c> {};
|
||||
struct peV_per_c : prefixed_unit<peV_per_c, pico, eV_per_c> {};
|
||||
struct neV_per_c : prefixed_unit<neV_per_c, nano, eV_per_c> {};
|
||||
struct ueV_per_c : prefixed_unit<ueV_per_c, micro, eV_per_c> {};
|
||||
struct meV_per_c : prefixed_unit<meV_per_c, milli, eV_per_c> {};
|
||||
struct keV_per_c : prefixed_unit<keV_per_c, kilo, eV_per_c> {};
|
||||
struct MeV_per_c : prefixed_unit<MeV_per_c, mega, eV_per_c> {};
|
||||
struct GeV_per_c : prefixed_unit<GeV_per_c, giga, eV_per_c> {};
|
||||
struct TeV_per_c : prefixed_unit<TeV_per_c, tera, eV_per_c> {};
|
||||
struct PeV_per_c : prefixed_unit<PeV_per_c, peta, eV_per_c> {};
|
||||
struct EeV_per_c : prefixed_unit<EeV_per_c, exa, eV_per_c> {};
|
||||
struct YeV_per_c : prefixed_unit<YeV_per_c, yotta, eV_per_c> {};
|
||||
|
||||
struct dim_momentum : isq::dim_momentum<dim_momentum, eV_per_c, dim_mass, dim_speed> {};
|
||||
|
||||
template<UnitOf<dim_momentum> U, Representation Rep = double>
|
||||
using momentum = quantity<dim_momentum, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
|
||||
constexpr auto operator"" _q_feV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<feV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_feV_per_c(long double l) { return momentum<feV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_peV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<peV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_peV_per_c(long double l) { return momentum<peV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_neV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<neV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_neV_per_c(long double l) { return momentum<neV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_ueV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<ueV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_ueV_per_c(long double l) { return momentum<ueV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_meV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<meV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_meV_per_c(long double l) { return momentum<meV_per_c, long double>(l); }
|
||||
|
||||
// eV_per_c
|
||||
constexpr auto operator"" _q_eV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<eV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_eV_per_c(long double l) { return momentum<eV_per_c, long double>(l); }
|
||||
|
||||
constexpr auto operator"" _q_keV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<keV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_keV_per_c(long double l) { return momentum<keV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_MeV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<MeV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_MeV_per_c(long double l) { return momentum<MeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_GeV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<GeV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_GeV_per_c(long double l) { return momentum<GeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_TeV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<TeV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_TeV_per_c(long double l) { return momentum<TeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_PeV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<PeV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_PeV_per_c(long double l) { return momentum<PeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_EeV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<EeV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_EeV_per_c(long double l) { return momentum<EeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_YeV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<YeV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_YeV_per_c(long double l) { return momentum<YeV_per_c, long double>(l); }
|
||||
|
||||
} // namespace literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::si::inline momentum {
|
||||
|
||||
template<Representation Rep = double> using eV_per_c = units::isq::si::hep::momentum<units::isq::si::hep::eV_per_c, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::si::inline momentum
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@ -59,22 +59,10 @@ struct square_zettametre : derived_unit<square_zettametre, dim_area, zettametre>
|
||||
struct square_yottametre : derived_unit<square_yottametre, dim_area, yottametre> {};
|
||||
|
||||
struct hectare : alias_unit<square_hectometre, "ha", no_prefix> {};
|
||||
struct barn : named_scaled_unit<barn, "b", prefix, ratio(1, 1, -28), square_metre> {};
|
||||
|
||||
template<UnitOf<dim_area> U, Representation Rep = double>
|
||||
using area = quantity<dim_area, U, Rep>;
|
||||
|
||||
namespace hep {
|
||||
struct yocto_barn : prefixed_unit<yocto_barn, yocto, barn> {};
|
||||
struct zepto_barn : prefixed_unit<zepto_barn, zepto, barn> {};
|
||||
struct atto_barn : prefixed_unit<atto_barn, atto, barn> {};
|
||||
struct femto_barn : prefixed_unit<femto_barn, femto, barn> {};
|
||||
struct pico_barn : prefixed_unit<pico_barn, pico, barn> {};
|
||||
struct nano_barn : prefixed_unit<nano_barn, nano, barn> {};
|
||||
struct micro_barn : prefixed_unit<micro_barn, micro, barn> {};
|
||||
struct milli_barn : prefixed_unit<milli_barn, milli, barn> {};
|
||||
}
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
@ -169,27 +157,6 @@ constexpr auto operator"" _q_ha(long double l) { return area<hectare, long doubl
|
||||
|
||||
} // namespace literals
|
||||
|
||||
namespace hep::literals {
|
||||
constexpr auto operator"" _q_yb(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<yocto_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_yb(long double l) { return area<yocto_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_zb(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<zepto_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_zb(long double l) { return area<zepto_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_ab(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<atto_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_ab(long double l) { return area<atto_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_fb(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<femto_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_fb(long double l) { return area<femto_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_pb(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<pico_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_pb(long double l) { return area<pico_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_nb(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<nano_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_nb(long double l) { return area<nano_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_ub(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<micro_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_ub(long double l) { return area<micro_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_mb(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<milli_barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_mb(long double l) { return area<milli_barn, long double>(l); }
|
||||
constexpr auto operator"" _q_b(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return area<barn, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_b(long double l) { return area<barn, long double>(l); }
|
||||
} // namespace hep::literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
@ -62,21 +62,6 @@ struct dim_energy : isq::dim_energy<dim_energy, joule, dim_force, dim_length> {}
|
||||
template<UnitOf<dim_energy> U, Representation Rep = double>
|
||||
using energy = quantity<dim_energy, U, Rep>;
|
||||
|
||||
namespace hep {
|
||||
struct feV : prefixed_unit<feV, femto, electronvolt> {};
|
||||
struct peV : prefixed_unit<peV, pico, electronvolt> {};
|
||||
struct neV : prefixed_unit<neV, nano, electronvolt> {};
|
||||
struct ueV : prefixed_unit<ueV, micro, electronvolt> {};
|
||||
struct meV : prefixed_unit<meV, milli, electronvolt> {};
|
||||
struct keV : prefixed_unit<keV, kilo, electronvolt> {};
|
||||
struct MeV : prefixed_unit<MeV, mega, electronvolt> {};
|
||||
using GeV = gigaelectronvolt;
|
||||
struct TeV : prefixed_unit<TeV, tera, electronvolt> {};
|
||||
struct PeV : prefixed_unit<PeV, peta, electronvolt> {};
|
||||
struct EeV : prefixed_unit<EeV, exa, electronvolt> {};
|
||||
struct YeV : prefixed_unit<YeV, yotta, electronvolt> {};
|
||||
}
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
@ -159,38 +144,6 @@ constexpr auto operator"" _q_GeV(long double l) { return energy<gigaelectronvolt
|
||||
|
||||
} // namespace literals
|
||||
|
||||
namespace hep::literals {
|
||||
|
||||
constexpr auto operator"" _q_feV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<feV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_feV(long double l) { return energy<feV, long double>(l); }
|
||||
constexpr auto operator"" _q_peV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<peV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_peV(long double l) { return energy<peV, long double>(l); }
|
||||
constexpr auto operator"" _q_neV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<neV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_neV(long double l) { return energy<ueV, long double>(l); }
|
||||
constexpr auto operator"" _q_ueV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<neV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_ueV(long double l) { return energy<ueV, long double>(l); }
|
||||
constexpr auto operator"" _q_meV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<meV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_meV(long double l) { return energy<meV, long double>(l); }
|
||||
|
||||
constexpr auto operator"" _q_eV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<electronvolt, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_eV(long double l) { return energy<electronvolt, long double>(l); }
|
||||
|
||||
constexpr auto operator"" _q_keV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<keV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_keV(long double l) { return energy<keV, long double>(l); }
|
||||
constexpr auto operator"" _q_MeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<MeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_MeV(long double l) { return energy<MeV, long double>(l); }
|
||||
constexpr auto operator"" _q_GeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<GeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_GeV(long double l) { return energy<GeV, long double>(l); }
|
||||
constexpr auto operator"" _q_TeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<TeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_TeV(long double l) { return energy<TeV, long double>(l); }
|
||||
constexpr auto operator"" _q_PeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<PeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_PeV(long double l) { return energy<PeV, long double>(l); }
|
||||
constexpr auto operator"" _q_EeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<EeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_EeV(long double l) { return energy<EeV, long double>(l); }
|
||||
constexpr auto operator"" _q_YeV(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return energy<YeV, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_YeV(long double l) { return energy<YeV, long double>(l); }
|
||||
} // hep::literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
@ -85,25 +85,6 @@ struct dim_mass : isq::dim_mass<kilogram> {};
|
||||
template<UnitOf<dim_mass> U, Representation Rep = double>
|
||||
using mass = quantity<dim_mass, U, Rep>;
|
||||
|
||||
namespace hep {
|
||||
struct eV_per_c2 : named_scaled_unit<eV_per_c2, "eV/c^2", prefix, ratio(1'7826'619'216'279, 1'000'000'000'000, -35), kilogram> {};
|
||||
struct feV_per_c2 : prefixed_unit<feV_per_c2, femto, eV_per_c2> {};
|
||||
struct peV_per_c2 : prefixed_unit<peV_per_c2, pico, eV_per_c2> {};
|
||||
struct neV_per_c2 : prefixed_unit<neV_per_c2, nano, eV_per_c2> {};
|
||||
struct ueV_per_c2 : prefixed_unit<ueV_per_c2, micro, eV_per_c2> {};
|
||||
struct meV_per_c2 : prefixed_unit<meV_per_c2, milli, eV_per_c2> {}; // approximate mass of an electron/positron (0.511 MeV/c2)
|
||||
struct keV_per_c2 : prefixed_unit<keV_per_c2, kilo, eV_per_c2> {};
|
||||
struct MeV_per_c2 : prefixed_unit<MeV_per_c2, mega, eV_per_c2> {};
|
||||
struct GeV_per_c2 : prefixed_unit<GeV_per_c2, giga, eV_per_c2> {}; // approximate mass of a proton (0.938 GeV/c2) or neutron
|
||||
struct TeV_per_c2 : prefixed_unit<TeV_per_c2, tera, eV_per_c2> {};
|
||||
struct PeV_per_c2 : prefixed_unit<PeV_per_c2, peta, eV_per_c2> {};
|
||||
struct EeV_per_c2 : prefixed_unit<EeV_per_c2, exa, eV_per_c2> {};
|
||||
struct YeV_per_c2 : prefixed_unit<YeV_per_c2, yotta, eV_per_c2> {};
|
||||
struct electron_mass : named_scaled_unit<eV_per_c2, "m_e", prefix, ratio(9'109'383'701'528, 1'000'000'000'000, -31), kilogram> {};
|
||||
struct proton_mass : named_scaled_unit<eV_per_c2, "m_p", prefix, ratio(1'672'621'923'695, 1'000'000'000'000, -27), kilogram> {};
|
||||
struct neutron_mass : named_scaled_unit<eV_per_c2, "m_n", prefix, ratio(1'674'927'498'049, 1'000'000'000'000, -27), kilogram> {};
|
||||
} // namespace hep
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
@ -281,52 +262,8 @@ constexpr auto operator"" _q_Yt(long double l) { return mass<yottatonne, long do
|
||||
constexpr auto operator"" _q_Da(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<dalton, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_Da(long double l) { return mass<dalton, long double>(l); }
|
||||
|
||||
namespace units::isq::inline si::inline hep::literals {
|
||||
|
||||
}
|
||||
|
||||
} // namespace literals
|
||||
|
||||
namespace hep::literals {
|
||||
constexpr auto operator"" _q_feV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<feV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_feV_per_c2(long double l) { return mass<feV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_peV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<peV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_peV_per_c2(long double l) { return mass<peV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_neV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<neV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_neV_per_c2(long double l) { return mass<neV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_ueV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<ueV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_ueV_per_c2(long double l) { return mass<ueV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_meV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<meV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_meV_per_c2(long double l) { return mass<meV_per_c2, long double>(l); }
|
||||
|
||||
// eV_per_c2
|
||||
constexpr auto operator"" _q_eV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<eV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_eV_per_c2(long double l) { return mass<eV_per_c2, long double>(l); }
|
||||
|
||||
constexpr auto operator"" _q_keV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<keV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_keV_per_c2(long double l) { return mass<keV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_MeV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<MeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_MeV_per_c2(long double l) { return mass<MeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_GeV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<GeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_GeV_per_c2(long double l) { return mass<GeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_TeV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<TeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_TeV_per_c2(long double l) { return mass<TeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_PeV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<PeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_PeV_per_c2(long double l) { return mass<PeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_EeV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<EeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_EeV_per_c2(long double l) { return mass<EeV_per_c2, long double>(l); }
|
||||
constexpr auto operator"" _q_YeV_per_c2(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<YeV_per_c2, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_YeV_per_c2(long double l) { return mass<YeV_per_c2, long double>(l); }
|
||||
|
||||
// special HEP masses
|
||||
constexpr auto operator"" _q_electron_mass(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<electron_mass, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_electron_mass(long double l) { return mass<electron_mass, long double>(l); }
|
||||
constexpr auto operator"" _q_proton_mass(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<proton_mass, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_proton_mass(long double l) { return mass<proton_mass, long double>(l); }
|
||||
constexpr auto operator"" _q_neutron_mass(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return mass<neutron_mass, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_neutron_mass(long double l) { return mass<neutron_mass, long double>(l); }
|
||||
} // namespace hep::literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
@ -40,22 +40,6 @@ struct dim_momentum : isq::dim_momentum<dim_momentum, kilogram_metre_per_second,
|
||||
template<UnitOf<dim_momentum> U, Representation Rep = double>
|
||||
using momentum = quantity<dim_momentum, U, Rep>;
|
||||
|
||||
namespace hep {
|
||||
struct eV_per_c : named_scaled_unit<eV_per_c, "eV/c", prefix, ratio(5'344'285'992'678, 1'000'000'000'000, -35), kilogram_metre_per_second> {};
|
||||
struct feV_per_c : prefixed_unit<feV_per_c, femto, eV_per_c> {};
|
||||
struct peV_per_c : prefixed_unit<peV_per_c, pico, eV_per_c> {};
|
||||
struct neV_per_c : prefixed_unit<neV_per_c, nano, eV_per_c> {};
|
||||
struct ueV_per_c : prefixed_unit<ueV_per_c, micro, eV_per_c> {};
|
||||
struct meV_per_c : prefixed_unit<meV_per_c, milli, eV_per_c> {};
|
||||
struct keV_per_c : prefixed_unit<keV_per_c, kilo, eV_per_c> {};
|
||||
struct MeV_per_c : prefixed_unit<MeV_per_c, mega, eV_per_c> {};
|
||||
struct GeV_per_c : prefixed_unit<GeV_per_c, giga, eV_per_c> {};
|
||||
struct TeV_per_c : prefixed_unit<TeV_per_c, tera, eV_per_c> {};
|
||||
struct PeV_per_c : prefixed_unit<PeV_per_c, peta, eV_per_c> {};
|
||||
struct EeV_per_c : prefixed_unit<EeV_per_c, exa, eV_per_c> {};
|
||||
struct YeV_per_c : prefixed_unit<YeV_per_c, yotta, eV_per_c> {};
|
||||
}
|
||||
|
||||
#ifndef UNITS_NO_LITERALS
|
||||
|
||||
inline namespace literals {
|
||||
@ -66,38 +50,6 @@ constexpr auto operator"" _q_kg_m_per_s(long double l) { return momentum<kilogra
|
||||
|
||||
} // namespace literals
|
||||
|
||||
namespace hep::literals {
|
||||
constexpr auto operator"" _q_feV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<feV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_feV_per_c(long double l) { return momentum<feV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_peV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<peV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_peV_per_c(long double l) { return momentum<peV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_neV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<neV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_neV_per_c(long double l) { return momentum<neV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_ueV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<ueV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_ueV_per_c(long double l) { return momentum<ueV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_meV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<meV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_meV_per_c(long double l) { return momentum<meV_per_c, long double>(l); }
|
||||
|
||||
// eV_per_c
|
||||
constexpr auto operator"" _q_eV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<eV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_eV_per_c(long double l) { return momentum<eV_per_c, long double>(l); }
|
||||
|
||||
constexpr auto operator"" _q_keV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<keV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_keV_per_c(long double l) { return momentum<keV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_MeV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<MeV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_MeV_per_c(long double l) { return momentum<MeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_GeV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<GeV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_GeV_per_c(long double l) { return momentum<GeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_TeV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<TeV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_TeV_per_c(long double l) { return momentum<TeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_PeV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<PeV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_PeV_per_c(long double l) { return momentum<PeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_EeV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<EeV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_EeV_per_c(long double l) { return momentum<EeV_per_c, long double>(l); }
|
||||
constexpr auto operator"" _q_YeV_per_c(unsigned long long l) { gsl_ExpectsAudit(std::in_range<std::int64_t>(l)); return momentum<YeV_per_c, std::int64_t>(static_cast<std::int64_t>(l)); }
|
||||
constexpr auto operator"" _q_YeV_per_c(long double l) { return momentum<YeV_per_c, long double>(l); }
|
||||
} // namespace hep::literals
|
||||
|
||||
#endif // UNITS_NO_LITERALS
|
||||
|
||||
} // namespace units::isq::si
|
||||
|
@ -57,6 +57,7 @@ add_library(unit_tests_static
|
||||
si_test.cpp
|
||||
si_cgs_test.cpp
|
||||
si_fps_test.cpp
|
||||
si_hep_test.cpp
|
||||
symbol_text_test.cpp
|
||||
type_list_test.cpp
|
||||
unit_test.cpp
|
||||
|
70
test/unit_test/static/si_hep_test.cpp
Normal file
70
test/unit_test/static/si_hep_test.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2021 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/isq/si/area.h>
|
||||
#include <units/isq/si/hep/area.h>
|
||||
#include <units/isq/si/hep/energy.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/isq/si/hep/mass.h>
|
||||
#include <units/isq/si/hep/momentum.h>
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace units::isq;
|
||||
|
||||
static_assert(units::detail::quantity_ratio<si::length<si::metre>> == units::ratio(1));
|
||||
|
||||
// mass
|
||||
static_assert(si::hep::mass<si::hep::eV_per_c2>(1'000) == si::hep::mass<si::hep::keV_per_c2>(1));
|
||||
static_assert(si::hep::mass<si::hep::eV_per_c2>(1'000) == si::mass<si::hep::keV_per_c2>(1));
|
||||
static_assert(si::mass<si::hep::eV_per_c2>(1'000) == si::hep::mass<si::hep::keV_per_c2>(1));
|
||||
|
||||
// momentum
|
||||
static_assert(si::hep::momentum<si::hep::eV_per_c>(1'000'000) == si::hep::momentum<si::hep::MeV_per_c>(1));
|
||||
static_assert(si::hep::momentum<si::hep::eV_per_c>(1'000'000) == si::momentum<si::hep::MeV_per_c>(1));
|
||||
static_assert(si::momentum<si::hep::eV_per_c>(1'000'000) == si::hep::momentum<si::hep::MeV_per_c>(1));
|
||||
|
||||
// area
|
||||
static_assert(si::area<si::hep::barn>(1e28) == si::area<si::square_metre>(1));
|
||||
//static_assert(si::area<si::hep::barn>(1) == si::area<si::square_metre>(1e-28)); // numeric rounding issues on some platforms
|
||||
|
||||
|
||||
namespace hep_literal_test {
|
||||
|
||||
using namespace units::isq::si::hep::literals;
|
||||
|
||||
static_assert(si::hep::energy<si::hep::eV>(1'000) == 1_q_keV);
|
||||
static_assert(si::hep::energy<si::hep::eV>(1'000'000) == 1_q_MeV);
|
||||
|
||||
static_assert(si::hep::mass<si::hep::eV_per_c2>(1'000) == 1_q_keV_per_c2);
|
||||
static_assert(si::hep::mass<si::hep::eV_per_c2>(1'000'000) == 1_q_MeV_per_c2);
|
||||
|
||||
static_assert(si::hep::momentum<si::hep::eV_per_c>(1'000) == 1_q_keV_per_c);
|
||||
static_assert(si::hep::momentum<si::hep::eV_per_c>(1'000'000) == 1_q_MeV_per_c);
|
||||
|
||||
static_assert(si::area<si::square_metre, long double>(1e-28L) == 1_q_b);
|
||||
//static_assert(si::hep::area<si::square_yoctometre, long double>(1e-4L) == 1_q_b); // numeric rounding issues on some platforms
|
||||
static_assert(si::area<si::square_metre>(1e-43) == 1_q_fb);
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user