Phyth v0.1.0
A dimensional safe C++ header-only mechanics and electromagnetics simulation library.
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs | Functions | Variables
Dimension.hpp File Reference
#include <ratio>
#include <type_traits>
#include <string>
#include <tuple>
#include <cmath>
Include dependency graph for Dimension.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Phyth::Dimension< Ratios >
 Compile-time physical dimension as 7 SI base exponents. More...
 
struct  Phyth::DimComponent< N, Dimension< Ratios... > >
 
struct  Phyth::DimMul< Dimension< R1... >, Dimension< R2... > >
 
struct  Phyth::DimDiv< Dimension< R1... >, Dimension< R2... > >
 
struct  Phyth::DimRoot< N, Dimension< Ratios... > >
 
struct  Phyth::DimRcp< Dimension< Ratios... > >
 
struct  Phyth::DimEqual< Dimension< R1... >, Dimension< R2... > >
 
struct  Phyth::is_dim< typename >
 Trait: check if a type is a Dimension instantiation. More...
 
struct  Phyth::is_dim< Dimension< Ratios... > >
 
struct  Phyth::DimToString< Dimension< Ratios... > >
 
struct  Phyth::is_dimensionless< UnitT >
 Trait: check if a quantity's dimension is dimensionless. More...
 
struct  Phyth::DimPower< N, Dimension< Ratios... > >
 
struct  Phyth::DimPowerHelper< P, D >
 Raise a Dimension to an integer power. More...
 
struct  Phyth::DimPowerHelper< 0, D >
 
struct  Phyth::DimPowerType< Power, D >
 

Namespaces

namespace  Phyth
 

Typedefs

template<int N, typename D >
using Phyth::DimComponentT = typename DimComponent< N, D >::type
 Convenience alias for DimComponent.
 
template<typename D1 , typename D2 >
using Phyth::DimMulT = typename DimMul< D1, D2 >::type
 Convenience alias for DimMul.
 
template<typename D1 , typename D2 >
using Phyth::DimDivT = typename DimDiv< D1, D2 >::type
 Convenience alias for DimDiv.
 
template<int N, typename D >
using Phyth::DimRootT = typename DimRoot< N, D >::type
 Convenience alias for DimRoot.
 
template<typename D >
using Phyth::DimRcpT = typename DimRcp< D >::type
 Convenience alias for DimRcp.
 
using Phyth::Dimensionless = Dimension< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 > >
 
using Phyth::Length = Dimension< std::ratio< 1 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 > >
 
using Phyth::Mass = Dimension< std::ratio< 0 >, std::ratio< 1 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 > >
 
using Phyth::Time = Dimension< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 > >
 
using Phyth::ElectricCurrent = Dimension< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 > >
 
using Phyth::ThermodynamicTemperature = Dimension< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 >, std::ratio< 0 >, std::ratio< 0 > >
 
using Phyth::AmountOfSubstance = Dimension< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 >, std::ratio< 0 > >
 
using Phyth::LuminousIntensity = Dimension< std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 0 >, std::ratio< 1 > >
 
using Phyth::Velocity = DimDivT< Length, Time >
 
using Phyth::Acceleration = DimDivT< Velocity, Time >
 
using Phyth::Force = DimMulT< Mass, Acceleration >
 
using Phyth::Energy = DimMulT< Force, Length >
 
using Phyth::Power = DimDivT< Energy, Time >
 
using Phyth::Pressure = DimDivT< Force, DimMulT< Length, Length > >
 
using Phyth::Frequency = DimDivT< Dimensionless, Time >
 
using Phyth::Charge = DimMulT< Time, ElectricCurrent >
 
using Phyth::ElectricFieldIntensity = DimDivT< Force, Charge >
 
using Phyth::Voltage = DimDivT< Power, ElectricCurrent >
 
using Phyth::Resistance = DimDivT< Voltage, ElectricCurrent >
 
using Phyth::Capacitance = DimDivT< Charge, Voltage >
 
using Phyth::Inductance = DimDivT< Voltage, DimDivT< ElectricCurrent, Time > >
 
using Phyth::MagneticFlux = DimMulT< Voltage, Time >
 
using Phyth::MagneticFluxDensity = DimDivT< MagneticFlux, DimMulT< Length, Length > >
 
using Phyth::Area = DimMulT< Length, Length >
 
using Phyth::Volume = DimMulT< Length, Area >
 
using Phyth::TranslationalStiffness = DimDivT< Force, Length >
 
using Phyth::DampingCoefficient = DimDivT< Mass, Time >
 
using Phyth::MassDensity = DimDivT< Mass, Volume >
 
using Phyth::ElectricPotential = DimDivT< Capacitance, Length >
 
using Phyth::EnergyDensity = DimDivT< Energy, Volume >
 
using Phyth::LinearChargeDensity = DimDivT< Charge, Length >
 
using Phyth::SurfaceChargeDensity = DimDivT< Charge, Area >
 
using Phyth::BulkChargeDensity = DimDivT< Charge, Volume >
 
using Phyth::ElectricDipoleMoment = DimMulT< Charge, Length >
 
using Phyth::MagneticDipoleMoment = DimMulT< ElectricCurrent, Area >
 
using Phyth::MomentOfInertia = DimMulT< Mass, Area >
 
using Phyth::AngularVelocity = DimDivT< Dimensionless, Time >
 
using Phyth::ForceDensity = DimDivT< Force, Volume >
 
template<int Power, typename D >
using Phyth::DimPowerTypeT = typename DimPowerType< Power, D >::type
 Convenience alias for DimPowerType.
 

Functions

std::string Phyth::formatPower (const double power)
 Format a floating-point exponent for string output.
 

Variables

template<typename D1 , typename D2 >
constexpr bool Phyth::dim_equal_v = DimEqual<D1, D2>::value
 Convenience variable template for DimEqual.
 
template<typename T >
constexpr bool Phyth::is_dim_v = is_dim<T>::value
 Convenience variable template for is_dim.
 
template<typename UnitT >
constexpr bool Phyth::is_dimensionless_v = is_dimensionless<UnitT>::value
 Convenience variable template for is_dimensionless.
 
template<int N, typename D >
constexpr double Phyth::dim_power_v = DimPower<N, D>::value
 Convenience variable template for DimPower.
 

Class Documentation

◆ Phyth::DimComponent< N, Dimension< Ratios... > >

struct Phyth::DimComponent< N, Dimension< Ratios... > >
template<int N, typename... Ratios>
struct Phyth::DimComponent< N, Dimension< Ratios... > >

Definition at line 42 of file Dimension.hpp.

Class Members
typedef tuple_element_t< N, tuple< Ratios... > > type

◆ Phyth::DimMul< Dimension< R1... >, Dimension< R2... > >

struct Phyth::DimMul< Dimension< R1... >, Dimension< R2... > >
template<typename... R1, typename... R2>
struct Phyth::DimMul< Dimension< R1... >, Dimension< R2... > >

Definition at line 62 of file Dimension.hpp.

Class Members
typedef Dimension< ratio_add< R1, R2 >... > type

◆ Phyth::DimDiv< Dimension< R1... >, Dimension< R2... > >

struct Phyth::DimDiv< Dimension< R1... >, Dimension< R2... > >
template<typename... R1, typename... R2>
struct Phyth::DimDiv< Dimension< R1... >, Dimension< R2... > >

Definition at line 82 of file Dimension.hpp.

Class Members
typedef Dimension< ratio_subtract< R1, R2 >... > type

◆ Phyth::DimRoot< N, Dimension< Ratios... > >

struct Phyth::DimRoot< N, Dimension< Ratios... > >
template<int N, typename... Ratios>
struct Phyth::DimRoot< N, Dimension< Ratios... > >

Definition at line 104 of file Dimension.hpp.

Class Members
typedef Dimension< ratio_divide< Ratios, ratio< N > >... > type

◆ Phyth::DimRcp< Dimension< Ratios... > >

struct Phyth::DimRcp< Dimension< Ratios... > >
template<typename... Ratios>
struct Phyth::DimRcp< Dimension< Ratios... > >

Definition at line 124 of file Dimension.hpp.

Class Members
typedef Dimension< ratio_multiply< Ratios, ratio<-1 > >... > type

◆ Phyth::DimPowerHelper

struct Phyth::DimPowerHelper
template<int P, typename D>
struct Phyth::DimPowerHelper< P, D >

Raise a Dimension to an integer power.

Template Parameters
PThe exponent (non-negative integer)
DThe Dimension to raise

Definition at line 376 of file Dimension.hpp.

Class Members
typedef type > type

◆ Phyth::DimPowerHelper< 0, D >

struct Phyth::DimPowerHelper< 0, D >
template<typename D>
struct Phyth::DimPowerHelper< 0, D >

Definition at line 381 of file Dimension.hpp.

Class Members
typedef Dimensionless type

◆ Phyth::DimPowerType

struct Phyth::DimPowerType
template<int Power, typename D>
struct Phyth::DimPowerType< Power, D >

Definition at line 386 of file Dimension.hpp.

Class Members
typedef typename type type