Physical Quantities  v1.0.0
C++ library of physical quantities, physical models, and units of measure for scientific computing. https://github.com/acodcha/phq
Loading...
Searching...
No Matches
Namespaces | Enumerations | Functions | Variables
UnitSystem.hpp File Reference
#include <cstdint>
#include <map>
#include <optional>
#include <ostream>
#include <string_view>
#include <unordered_map>
#include "Base.hpp"

Go to the source code of this file.

Namespaces

namespace  PhQ
 Namespace that encompasses all of the Physical Quantities library's content.
 

Enumerations

enum class  PhQ::UnitSystem : int8_t { PhQ::MetreKilogramSecondKelvin , PhQ::MillimetreGramSecondKelvin , PhQ::FootPoundSecondRankine , PhQ::InchPoundSecondRankine }
 Systems of units of measure. All units of measure in a unit system are standard units of measure. When a physical quantity is expressed in terms of a standard unit of measure, its value does not need to be converted when used in mathematical expressions with other physical quantities expressed in standard units of measure. More...
 

Functions

template<typename Unit >
Unit PhQ::ConsistentUnit (const UnitSystem &system)
 Returns the unit of a given type that corresponds to a given unit system. For example, PhQ::ConsistentUnit<Force>(PhQ::UnitSystem::MetreKilogramSecondKelvin) returns PhQ::Unit::Force::Newton.
 
template<typename Unit >
std::optional< UnitSystemPhQ::RelatedUnitSystem (const Unit &unit)
 Returns the unit system, if any, that corresponds to a given unit, or std::nullptr otherwise. For example, PhQ::RelatedUnitSystem(PhQ::Unit::Length::Millimetre) returns PhQ::UnitSystem::MillimetreGramSecondKelvin.
 
std::ostream & PhQ::operator<< (std::ostream &stream, const UnitSystem unit_system)
 

Variables

template<typename Type >
constexpr const Type PhQ::Standard
 Standard unit of measure of a given type. Standard units of measure of different types can be combined with each other without the need for conversions. When a physical quantity is expressed in terms of a standard unit of measure, its value does not need to be converted when used in mathematical expressions with other physical quantities expressed in standard units of measure. For example, the standard unit of time is the second and the standard unit of length is the metre. Correspondingly, the standard unit of speed is the metre per second. Thus, when forming a speed quantity from a length quantity and a time quantity, if all quantities are expressed in these standard units, no unit conversions are needed.
 
template<>
constexpr const UnitSystem PhQ::Standard< UnitSystem > {UnitSystem::MetreKilogramSecondKelvin}
 The standard unit system: the International System of Units (SI). It uses the following standard units: second (s) for time, metre (m) for length, kilogram (kg) for mass, ampere (A) for electric current, kelvin (K) for temperature, mole (mol) for substance amount, and candela (cd) for luminous intensity.