mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-06 13:44:27 +02:00
refactor: natural units system refactored for V2
This commit is contained in:
@@ -25,8 +25,7 @@ cmake_minimum_required(VERSION 3.19)
|
||||
# systems
|
||||
add_subdirectory(isq)
|
||||
|
||||
# add_subdirectory(isq-iec80000)
|
||||
# add_subdirectory(isq-natural)
|
||||
add_subdirectory(natural)
|
||||
add_subdirectory(si)
|
||||
add_subdirectory(si-cgs)
|
||||
|
||||
|
@@ -25,15 +25,5 @@ cmake_minimum_required(VERSION 3.19)
|
||||
add_units_module(
|
||||
natural
|
||||
DEPENDENCIES mp-units::isq
|
||||
HEADERS include/units/isq/natural/acceleration.h
|
||||
include/units/isq/natural/constants.h
|
||||
include/units/isq/natural/energy.h
|
||||
include/units/isq/natural/force.h
|
||||
include/units/isq/natural/length.h
|
||||
include/units/isq/natural/mass.h
|
||||
include/units/isq/natural/momentum.h
|
||||
include/units/isq/natural/natural.h
|
||||
include/units/isq/natural/speed.h
|
||||
include/units/isq/natural/time.h
|
||||
include/units/isq/natural/units.h
|
||||
HEADERS include/units/natural/natural.h
|
||||
)
|
||||
|
@@ -1,70 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 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
|
||||
|
||||
#include <units/isq/natural/length.h>
|
||||
#include <units/isq/natural/time.h>
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/acceleration.h>
|
||||
#include <units/isq/natural/units.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
struct dim_acceleration : isq::dim_acceleration<dim_acceleration, gigaelectronvolt, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_acceleration> U, Representation Rep = double>
|
||||
using acceleration = quantity<dim_acceleration, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace acceleration_references {
|
||||
|
||||
inline constexpr auto GeV = reference<dim_acceleration, gigaelectronvolt>{};
|
||||
|
||||
} // namespace acceleration_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace acceleration_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::natural
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::natural::inline acceleration {
|
||||
|
||||
template<Representation Rep = double>
|
||||
using GeV = units::isq::natural::acceleration<units::isq::natural::gigaelectronvolt, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::natural::inline acceleration
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@@ -1,32 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 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
|
||||
|
||||
#include <units/isq/natural/speed.h>
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
template<Representation Rep = double>
|
||||
inline constexpr auto speed_of_light = speed<one, Rep>(1);
|
||||
|
||||
} // namespace units::isq::natural
|
@@ -1,70 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 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
|
||||
|
||||
#include <units/isq/natural/force.h>
|
||||
#include <units/isq/natural/length.h>
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/energy.h>
|
||||
#include <units/isq/natural/units.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
struct dim_energy : isq::dim_energy<dim_energy, gigaelectronvolt, dim_force, dim_length> {};
|
||||
|
||||
template<UnitOf<dim_energy> U, Representation Rep = double>
|
||||
using energy = quantity<dim_energy, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace energy_references {
|
||||
|
||||
inline constexpr auto GeV = reference<dim_energy, gigaelectronvolt>{};
|
||||
|
||||
} // namespace energy_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace energy_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::natural
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::natural::inline energy {
|
||||
|
||||
template<Representation Rep = double>
|
||||
using GeV = units::isq::natural::energy<units::isq::natural::gigaelectronvolt, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::natural::inline energy
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@@ -1,70 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 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
|
||||
|
||||
#include <units/isq/natural/acceleration.h>
|
||||
#include <units/isq/natural/mass.h>
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/force.h>
|
||||
#include <units/isq/natural/units.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
struct dim_force : isq::dim_force<dim_force, square_gigaelectronvolt, dim_mass, dim_acceleration> {};
|
||||
|
||||
template<UnitOf<dim_force> U, Representation Rep = double>
|
||||
using force = quantity<dim_force, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace force_references {
|
||||
|
||||
inline constexpr auto GeV2 = reference<dim_force, square_gigaelectronvolt>{};
|
||||
|
||||
} // namespace force_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace force_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::natural
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::natural::inline force {
|
||||
|
||||
template<Representation Rep = double>
|
||||
using GeV2 = units::isq::natural::force<units::isq::natural::square_gigaelectronvolt, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::natural::inline force
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@@ -1,67 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 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/length.h>
|
||||
#include <units/isq/natural/units.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
struct dim_length : isq::dim_length<inverted_gigaelectronvolt> {};
|
||||
|
||||
template<UnitOf<dim_length> U, Representation Rep = double>
|
||||
using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace length_references {
|
||||
|
||||
inline constexpr auto inv_GeV = reference<dim_length, inverted_gigaelectronvolt>{};
|
||||
|
||||
} // namespace length_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace length_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::natural
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::natural::inline length {
|
||||
|
||||
template<Representation Rep = double>
|
||||
using inv_GeV = units::isq::natural::length<units::isq::natural::inverted_gigaelectronvolt, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::natural::inline length
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@@ -1,67 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 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/isq/natural/units.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
struct dim_mass : isq::dim_mass<gigaelectronvolt> {};
|
||||
|
||||
template<UnitOf<dim_mass> U, Representation Rep = double>
|
||||
using mass = quantity<dim_mass, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace mass_references {
|
||||
|
||||
inline constexpr auto GeV = reference<dim_mass, gigaelectronvolt>{};
|
||||
|
||||
} // namespace mass_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace mass_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::natural
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::natural::inline mass {
|
||||
|
||||
template<Representation Rep = double>
|
||||
using GeV = units::isq::natural::mass<units::isq::natural::gigaelectronvolt, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::natural::inline mass
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@@ -1,70 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 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
|
||||
|
||||
#include <units/isq/natural/mass.h>
|
||||
#include <units/isq/natural/speed.h>
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/dimensions/momentum.h>
|
||||
#include <units/isq/natural/units.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
struct dim_momentum : isq::dim_momentum<dim_momentum, gigaelectronvolt, dim_mass, dim_speed> {};
|
||||
|
||||
template<UnitOf<dim_momentum> U, Representation Rep = double>
|
||||
using momentum = quantity<dim_momentum, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace momentum_references {
|
||||
|
||||
inline constexpr auto GeV = reference<dim_momentum, gigaelectronvolt>{};
|
||||
|
||||
} // namespace momentum_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace momentum_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::natural
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::natural::inline momentum {
|
||||
|
||||
template<Representation Rep = double>
|
||||
using GeV = units::isq::natural::momentum<units::isq::natural::gigaelectronvolt, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::natural::inline momentum
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@@ -22,14 +22,39 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/isq/natural/acceleration.h>
|
||||
#include <units/isq/natural/constants.h>
|
||||
#include <units/isq/natural/energy.h>
|
||||
#include <units/isq/natural/force.h>
|
||||
#include <units/isq/natural/length.h>
|
||||
#include <units/isq/natural/mass.h>
|
||||
#include <units/isq/natural/momentum.h>
|
||||
#include <units/isq/natural/speed.h>
|
||||
#include <units/isq/natural/time.h>
|
||||
// IWYU pragma: end_exports
|
||||
#include <units/isq/mechanics.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/si/prefixes.h>
|
||||
#include <units/system_reference.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::natural {
|
||||
|
||||
// clang-format off
|
||||
// units
|
||||
inline constexpr struct electronvolt : named_unit<"eV"> {} electronvolt;
|
||||
inline constexpr struct gigaelectronvolt : decltype(si::giga<electronvolt>) {} gigaelectronvolt;
|
||||
|
||||
// system references
|
||||
inline constexpr struct time : system_reference<isq::time, 1 / gigaelectronvolt> {} time;
|
||||
inline constexpr struct length : system_reference<isq::length, 1 / gigaelectronvolt> {} length;
|
||||
inline constexpr struct mass : system_reference<isq::mass, gigaelectronvolt> {} mass;
|
||||
inline constexpr struct velocity : system_reference<isq::velocity, one> {} velocity;
|
||||
inline constexpr struct speed : system_reference<isq::speed, one> {} speed;
|
||||
inline constexpr struct acceleration : system_reference<isq::acceleration, gigaelectronvolt> {} acceleration;
|
||||
inline constexpr struct momentum : system_reference<isq::momentum, gigaelectronvolt> {} momentum;
|
||||
inline constexpr struct force : system_reference<isq::force, square<gigaelectronvolt>> {} force;
|
||||
inline constexpr struct energy : system_reference<isq::mechanical_energy, gigaelectronvolt> {} energy;
|
||||
// clang-format on
|
||||
|
||||
// constants
|
||||
inline constexpr auto speed_of_light_in_vacuum = speed[one];
|
||||
|
||||
namespace unit_symbols {
|
||||
|
||||
inline constexpr auto GeV = gigaelectronvolt;
|
||||
inline constexpr auto GeV2 = square<gigaelectronvolt>;
|
||||
|
||||
} // namespace unit_symbols
|
||||
|
||||
} // namespace units::natural
|
||||
|
@@ -1,44 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 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
|
||||
|
||||
#include <units/isq/natural/length.h>
|
||||
#include <units/isq/natural/time.h>
|
||||
|
||||
// IWYU pragma: begin_exports
|
||||
#include <units/generic/dimensionless.h>
|
||||
#include <units/isq/dimensions/speed.h>
|
||||
#include <units/isq/natural/units.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
struct dim_speed : isq::dim_speed<dim_speed, one, dim_length, dim_time> {};
|
||||
|
||||
template<UnitOf<dim_speed> U, Representation Rep = double>
|
||||
using speed = quantity<dim_speed, U, Rep>;
|
||||
|
||||
} // namespace units::isq::natural
|
@@ -1,67 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 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/time.h>
|
||||
#include <units/isq/natural/units.h>
|
||||
#include <units/quantity.h>
|
||||
#include <units/reference.h>
|
||||
#include <units/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
struct dim_time : isq::dim_time<inverted_gigaelectronvolt> {};
|
||||
|
||||
template<UnitOf<dim_time> U, Representation Rep = double>
|
||||
using time = quantity<dim_time, U, Rep>;
|
||||
|
||||
#ifndef UNITS_NO_REFERENCES
|
||||
|
||||
namespace time_references {
|
||||
|
||||
inline constexpr auto inv_GeV = reference<dim_time, inverted_gigaelectronvolt>{};
|
||||
|
||||
} // namespace time_references
|
||||
|
||||
namespace references {
|
||||
|
||||
using namespace time_references;
|
||||
|
||||
} // namespace references
|
||||
|
||||
#endif // UNITS_NO_REFERENCES
|
||||
|
||||
} // namespace units::isq::natural
|
||||
|
||||
#ifndef UNITS_NO_ALIASES
|
||||
|
||||
namespace units::aliases::isq::natural::inline time {
|
||||
|
||||
template<Representation Rep = double>
|
||||
using inv_GeV = units::isq::natural::time<units::isq::natural::inverted_gigaelectronvolt, Rep>;
|
||||
|
||||
} // namespace units::aliases::isq::natural::inline time
|
||||
|
||||
#endif // UNITS_NO_ALIASES
|
@@ -1,44 +0,0 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 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/symbol_text.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/unit.h>
|
||||
|
||||
namespace units::isq::natural {
|
||||
|
||||
struct electronvolt : named_unit<electronvolt, "eV"> {};
|
||||
struct gigaelectronvolt : prefixed_unit<gigaelectronvolt, si::giga, electronvolt> {};
|
||||
struct inverted_gigaelectronvolt : named_unit<inverted_gigaelectronvolt, basic_symbol_text{"GeV⁻¹", "GeV^-1"}> {};
|
||||
struct square_gigaelectronvolt : named_unit<square_gigaelectronvolt, basic_symbol_text{"GeV²", "GeV^2"}> {};
|
||||
|
||||
// NOTE: eV as a base unit with no relation to joule prevents us from going back
|
||||
// from natural units to SI. Do we need such a support or should we treat
|
||||
// natural units as an isolated island with ev = 1 which simplifies all
|
||||
// the maths a lot?
|
||||
|
||||
} // namespace units::isq::natural
|
Reference in New Issue
Block a user