Physical Quantities  v1.0.0
C++ library of physical quantities, physical models, and units of measure for scientific computing. https://github.com/acodcha/phq
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | List of all members
PhQ::Power< NumericType > Class Template Reference

Power. Time rate of change of energy or energy transfer rate; see PhQ::Energy, PhQ::Time, and PhQ::Frequency. More...

#include "Power.hpp"

Public Member Functions

 Power ()=default
 Default constructor. Constructs a power quantity with an uninitialized value. More...
 
 Power (const NumericType value, const Unit::Power unit)
 Constructor. Constructs a power quantity with a given value expressed in a given power unit. More...
 
constexpr Power (const Energy< NumericType > &energy, const Time< NumericType > &time)
 Constructor. Constructs a power quantity from a given energy and time duration using the definition of power. More...
 
constexpr Power (const Energy< NumericType > &energy, const Frequency< NumericType > &frequency)
 Constructor. Constructs a power quantity from a given energy and frequency using the definition of power. More...
 
constexpr Power (const SpecificPower< NumericType > &specific_power, const Mass< NumericType > &mass)
 Constructor. Constructs a power quantity from a given specific power and mass using the definition of specific power. More...
 
constexpr Power (const TransportEnergyConsumption< NumericType > &transport_energy_consumption, const Speed< NumericType > &speed)
 Constructor. Constructs a power quantity from a given transport energy consumption and speed using the definition of transport energy consumption. More...
 
 ~Power () noexcept=default
 Destructor. Destroys this power quantity. More...
 
constexpr Power (const Power< NumericType > &other)=default
 Copy constructor. Constructs a power quantity by copying another one. More...
 
template<typename OtherNumericType >
constexpr Power (const Power< OtherNumericType > &other)
 Copy constructor. Constructs a power quantity by copying another one. More...
 
constexpr Power (Power< NumericType > &&other) noexcept=default
 Move constructor. Constructs a power quantity by moving another one. More...
 
constexpr Power< NumericType > & operator= (const Power< NumericType > &other)=default
 Copy assignment operator. Assigns this power quantity by copying another one. More...
 
template<typename OtherNumericType >
constexpr Power< NumericType > & operator= (const Power< OtherNumericType > &other)
 Copy assignment operator. Assigns this power quantity by copying another one. More...
 
constexpr Power< NumericType > & operator= (Power< NumericType > &&other) noexcept=default
 Move assignment operator. Assigns this power quantity by moving another one. More...
 
constexpr Power< NumericType > operator+ (const Power< NumericType > &power) const
 
constexpr Power< NumericType > operator- (const Power< NumericType > &power) const
 
constexpr Power< NumericType > operator* (const NumericType number) const
 
constexpr Energy< NumericType > operator* (const Time< NumericType > &time) const
 
constexpr Power< NumericType > operator/ (const NumericType number) const
 
constexpr Energy< NumericType > operator/ (const Frequency< NumericType > &frequency) const
 
constexpr Frequency< NumericType > operator/ (const Energy< NumericType > &energy) const
 
constexpr SpecificPower< NumericType > operator/ (const Mass< NumericType > &mass) const
 
constexpr Mass< NumericType > operator/ (const SpecificPower< NumericType > &specific_power) const
 
constexpr NumericType operator/ (const Power< NumericType > &power) const noexcept
 
constexpr void operator+= (const Power< NumericType > &power) noexcept
 
constexpr void operator-= (const Power< NumericType > &power) noexcept
 
constexpr void operator*= (const NumericType number) noexcept
 
constexpr void operator/= (const NumericType number) noexcept
 
constexpr double Value () const noexcept
 Value of this physical quantity expressed in its standard unit of measure. More...
 
double Value (const Unit::Power unit) const
 Value of this physical quantity expressed in a given unit of measure. More...
 
constexpr double StaticValue () const
 Value of this physical quantity expressed in a given unit of measure. This method can be evaluated statically at compile-time. More...
 
constexpr double & MutableValue () noexcept
 Returns the value of this physical quantity expressed in its standard unit of measure as a mutable value. More...
 
constexpr void SetValue (const double value) noexcept
 Sets the value of this physical quantity expressed in its standard unit of measure to the given value. More...
 
std::string Print () const
 Prints this physical quantity as a string. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string Print (const Unit::Power unit) const
 Prints this physical quantity as a string. This physical quantity's value is expressed in the given unit of measure. More...
 
std::string JSON () const
 Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string JSON (const Unit::Power unit) const
 Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in the given unit of measure. More...
 
std::string XML () const
 Serializes this physical quantity as an XML message. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string XML (const Unit::Power unit) const
 Serializes this physical quantity as an XML message. This physical quantity's value is expressed in the given unit of measure. More...
 
std::string YAML () const
 Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in its standard unit of measure. More...
 
std::string YAML (const Unit::Power unit) const
 Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in the given unit of measure. More...
 

Static Public Member Functions

static constexpr Power< NumericType > Zero ()
 Statically creates a power quantity of zero. More...
 
template<Unit::Power Unit>
static constexpr Power< NumericType > Create (const NumericType value)
 Statically creates a power quantity with a given value expressed in a given power unit. More...
 
static constexpr const PhQ::DimensionsDimensions ()
 Physical dimension set of this physical quantity. More...
 
static constexpr Unit::Power Unit ()
 Standard unit of measure for this physical quantity. This physical quantity's value is stored internally in this unit of measure. More...
 

Protected Attributes

double value
 Value of this physical quantity expressed in its standard unit of measure. More...
 

Private Member Functions

constexpr Power (const NumericType value)
 Constructor. Constructs a power quantity with a given value expressed in the standard power unit. More...
 

Detailed Description

template<typename NumericType = double>
class PhQ::Power< NumericType >

Power. Time rate of change of energy or energy transfer rate; see PhQ::Energy, PhQ::Time, and PhQ::Frequency.

Definition at line 51 of file Power.hpp.

Constructor & Destructor Documentation

◆ Power() [1/10]

template<typename NumericType = double>
PhQ::Power< NumericType >::Power ( )
default

Default constructor. Constructs a power quantity with an uninitialized value.

◆ Power() [2/10]

template<typename NumericType = double>
PhQ::Power< NumericType >::Power ( const NumericType  value,
const Unit::Power< NumericType >  unit 
)
inline

Constructor. Constructs a power quantity with a given value expressed in a given power unit.

Definition at line 58 of file Power.hpp.

◆ Power() [3/10]

template<typename NumericType = double>
constexpr PhQ::Power< NumericType >::Power ( const Energy< NumericType > &  energy,
const Time< NumericType > &  time 
)
inlineconstexpr

Constructor. Constructs a power quantity from a given energy and time duration using the definition of power.

Definition at line 63 of file Power.hpp.

◆ Power() [4/10]

template<typename NumericType = double>
constexpr PhQ::Power< NumericType >::Power ( const Energy< NumericType > &  energy,
const Frequency< NumericType > &  frequency 
)
inlineconstexpr

Constructor. Constructs a power quantity from a given energy and frequency using the definition of power.

Definition at line 68 of file Power.hpp.

◆ Power() [5/10]

template<typename NumericType = double>
constexpr PhQ::Power< NumericType >::Power ( const SpecificPower< NumericType > &  specific_power,
const Mass< NumericType > &  mass 
)
constexpr

Constructor. Constructs a power quantity from a given specific power and mass using the definition of specific power.

◆ Power() [6/10]

template<typename NumericType = double>
constexpr PhQ::Power< NumericType >::Power ( const TransportEnergyConsumption< NumericType > &  transport_energy_consumption,
const Speed< NumericType > &  speed 
)
constexpr

Constructor. Constructs a power quantity from a given transport energy consumption and speed using the definition of transport energy consumption.

◆ ~Power()

template<typename NumericType = double>
PhQ::Power< NumericType >::~Power ( )
defaultnoexcept

Destructor. Destroys this power quantity.

◆ Power() [7/10]

template<typename NumericType = double>
constexpr PhQ::Power< NumericType >::Power ( const Power< NumericType > &  other)
constexprdefault

Copy constructor. Constructs a power quantity by copying another one.

◆ Power() [8/10]

template<typename NumericType = double>
template<typename OtherNumericType >
constexpr PhQ::Power< NumericType >::Power ( const Power< OtherNumericType > &  other)
inlineexplicitconstexpr

Copy constructor. Constructs a power quantity by copying another one.

Definition at line 88 of file Power.hpp.

◆ Power() [9/10]

template<typename NumericType = double>
constexpr PhQ::Power< NumericType >::Power ( Power< NumericType > &&  other)
constexprdefaultnoexcept

Move constructor. Constructs a power quantity by moving another one.

◆ Power() [10/10]

template<typename NumericType = double>
constexpr PhQ::Power< NumericType >::Power ( const NumericType  value)
inlineexplicitconstexprprivate

Constructor. Constructs a power quantity with a given value expressed in the standard power unit.

Definition at line 173 of file Power.hpp.

Member Function Documentation

◆ Create()

template<typename NumericType = double>
template<Unit::Power Unit>
static constexpr Power<NumericType> PhQ::Power< NumericType >::Create ( const NumericType  value)
inlinestaticconstexpr

Statically creates a power quantity with a given value expressed in a given power unit.

Definition at line 114 of file Power.hpp.

References PhQ::DimensionalScalar< Unit::Power, double >::value.

◆ Dimensions()

static constexpr const PhQ::Dimensions& PhQ::DimensionalScalar< Unit::Power , double >::Dimensions ( )
inlinestaticconstexprinherited

Physical dimension set of this physical quantity.

Definition at line 54 of file DimensionalScalar.hpp.

◆ JSON() [1/2]

std::string PhQ::DimensionalScalar< Unit::Power , double >::JSON ( ) const
inlineinherited

Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 107 of file DimensionalScalar.hpp.

◆ JSON() [2/2]

std::string PhQ::DimensionalScalar< Unit::Power , double >::JSON ( const Unit::Power  unit) const
inlineinherited

Serializes this physical quantity as a JSON message. This physical quantity's value is expressed in the given unit of measure.

Definition at line 117 of file DimensionalScalar.hpp.

◆ MutableValue()

constexpr double & PhQ::DimensionalScalar< Unit::Power , double >::MutableValue ( )
inlineconstexprnoexceptinherited

Returns the value of this physical quantity expressed in its standard unit of measure as a mutable value.

Definition at line 83 of file DimensionalScalar.hpp.

◆ operator*() [1/2]

template<typename NumericType = double>
constexpr Power<NumericType> PhQ::Power< NumericType >::operator* ( const NumericType  number) const
inlineconstexpr

Definition at line 126 of file Power.hpp.

References PhQ::DimensionalScalar< Unit::Power, double >::value.

◆ operator*() [2/2]

template<typename NumericType = double>
constexpr Energy<NumericType> PhQ::Power< NumericType >::operator* ( const Time< NumericType > &  time) const
inlineconstexpr

Definition at line 130 of file Power.hpp.

◆ operator*=()

template<typename NumericType = double>
constexpr void PhQ::Power< NumericType >::operator*= ( const NumericType  number)
inlineconstexprnoexcept

Definition at line 162 of file Power.hpp.

References PhQ::DimensionalScalar< Unit::Power, double >::value.

◆ operator+()

template<typename NumericType = double>
constexpr Power<NumericType> PhQ::Power< NumericType >::operator+ ( const Power< NumericType > &  power) const
inlineconstexpr

◆ operator+=()

template<typename NumericType = double>
constexpr void PhQ::Power< NumericType >::operator+= ( const Power< NumericType > &  power)
inlineconstexprnoexcept

Definition at line 154 of file Power.hpp.

References PhQ::DimensionalScalar< Unit::Power, double >::value.

◆ operator-()

template<typename NumericType = double>
constexpr Power<NumericType> PhQ::Power< NumericType >::operator- ( const Power< NumericType > &  power) const
inlineconstexpr

◆ operator-=()

template<typename NumericType = double>
constexpr void PhQ::Power< NumericType >::operator-= ( const Power< NumericType > &  power)
inlineconstexprnoexcept

Definition at line 158 of file Power.hpp.

References PhQ::DimensionalScalar< Unit::Power, double >::value.

◆ operator/() [1/6]

template<typename NumericType = double>
constexpr Frequency<NumericType> PhQ::Power< NumericType >::operator/ ( const Energy< NumericType > &  energy) const
inlineconstexpr

Definition at line 142 of file Power.hpp.

◆ operator/() [2/6]

template<typename NumericType = double>
constexpr Energy<NumericType> PhQ::Power< NumericType >::operator/ ( const Frequency< NumericType > &  frequency) const
inlineconstexpr

Definition at line 138 of file Power.hpp.

◆ operator/() [3/6]

template<typename NumericType = double>
constexpr SpecificPower<NumericType> PhQ::Power< NumericType >::operator/ ( const Mass< NumericType > &  mass) const
constexpr

◆ operator/() [4/6]

template<typename NumericType = double>
constexpr Power<NumericType> PhQ::Power< NumericType >::operator/ ( const NumericType  number) const
inlineconstexpr

Definition at line 134 of file Power.hpp.

References PhQ::DimensionalScalar< Unit::Power, double >::value.

◆ operator/() [5/6]

template<typename NumericType = double>
constexpr NumericType PhQ::Power< NumericType >::operator/ ( const Power< NumericType > &  power) const
inlineconstexprnoexcept

Definition at line 150 of file Power.hpp.

References PhQ::DimensionalScalar< Unit::Power, double >::value.

◆ operator/() [6/6]

template<typename NumericType = double>
constexpr Mass<NumericType> PhQ::Power< NumericType >::operator/ ( const SpecificPower< NumericType > &  specific_power) const
constexpr

◆ operator/=()

template<typename NumericType = double>
constexpr void PhQ::Power< NumericType >::operator/= ( const NumericType  number)
inlineconstexprnoexcept

Definition at line 166 of file Power.hpp.

References PhQ::DimensionalScalar< Unit::Power, double >::value.

◆ operator=() [1/3]

template<typename NumericType = double>
constexpr Power<NumericType>& PhQ::Power< NumericType >::operator= ( const Power< NumericType > &  other)
constexprdefault

Copy assignment operator. Assigns this power quantity by copying another one.

◆ operator=() [2/3]

template<typename NumericType = double>
template<typename OtherNumericType >
constexpr Power<NumericType>& PhQ::Power< NumericType >::operator= ( const Power< OtherNumericType > &  other)
inlineconstexpr

Copy assignment operator. Assigns this power quantity by copying another one.

Definition at line 99 of file Power.hpp.

References PhQ::DimensionalScalar< UnitType, NumericType >::Value(), and PhQ::DimensionalScalar< Unit::Power, double >::value.

◆ operator=() [3/3]

template<typename NumericType = double>
constexpr Power<NumericType>& PhQ::Power< NumericType >::operator= ( Power< NumericType > &&  other)
constexprdefaultnoexcept

Move assignment operator. Assigns this power quantity by moving another one.

◆ Print() [1/2]

std::string PhQ::DimensionalScalar< Unit::Power , double >::Print ( ) const
inlineinherited

Prints this physical quantity as a string. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 95 of file DimensionalScalar.hpp.

◆ Print() [2/2]

std::string PhQ::DimensionalScalar< Unit::Power , double >::Print ( const Unit::Power  unit) const
inlineinherited

Prints this physical quantity as a string. This physical quantity's value is expressed in the given unit of measure.

Definition at line 101 of file DimensionalScalar.hpp.

◆ SetValue()

constexpr void PhQ::DimensionalScalar< Unit::Power , double >::SetValue ( const double  value)
inlineconstexprnoexceptinherited

Sets the value of this physical quantity expressed in its standard unit of measure to the given value.

Definition at line 89 of file DimensionalScalar.hpp.

◆ StaticValue()

constexpr double PhQ::DimensionalScalar< Unit::Power , double >::StaticValue ( ) const
inlineconstexprinherited

Value of this physical quantity expressed in a given unit of measure. This method can be evaluated statically at compile-time.

Definition at line 77 of file DimensionalScalar.hpp.

◆ Unit()

static constexpr Unit::Power PhQ::DimensionalScalar< Unit::Power , double >::Unit ( )
inlinestaticconstexprinherited

Standard unit of measure for this physical quantity. This physical quantity's value is stored internally in this unit of measure.

Definition at line 60 of file DimensionalScalar.hpp.

◆ Value() [1/2]

constexpr double PhQ::DimensionalScalar< Unit::Power , double >::Value ( ) const
inlineconstexprnoexceptinherited

Value of this physical quantity expressed in its standard unit of measure.

Definition at line 65 of file DimensionalScalar.hpp.

◆ Value() [2/2]

double PhQ::DimensionalScalar< Unit::Power , double >::Value ( const Unit::Power  unit) const
inlineinherited

Value of this physical quantity expressed in a given unit of measure.

Definition at line 70 of file DimensionalScalar.hpp.

◆ XML() [1/2]

std::string PhQ::DimensionalScalar< Unit::Power , double >::XML ( ) const
inlineinherited

Serializes this physical quantity as an XML message. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 127 of file DimensionalScalar.hpp.

◆ XML() [2/2]

std::string PhQ::DimensionalScalar< Unit::Power , double >::XML ( const Unit::Power  unit) const
inlineinherited

Serializes this physical quantity as an XML message. This physical quantity's value is expressed in the given unit of measure.

Definition at line 137 of file DimensionalScalar.hpp.

◆ YAML() [1/2]

std::string PhQ::DimensionalScalar< Unit::Power , double >::YAML ( ) const
inlineinherited

Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in its standard unit of measure.

Definition at line 147 of file DimensionalScalar.hpp.

◆ YAML() [2/2]

std::string PhQ::DimensionalScalar< Unit::Power , double >::YAML ( const Unit::Power  unit) const
inlineinherited

Serializes this physical quantity as a YAML message. This physical quantity's value is expressed in the given unit of measure.

Definition at line 157 of file DimensionalScalar.hpp.

◆ Zero()

template<typename NumericType = double>
static constexpr Power<NumericType> PhQ::Power< NumericType >::Zero ( )
inlinestaticconstexpr

Statically creates a power quantity of zero.

Definition at line 108 of file Power.hpp.

Member Data Documentation

◆ value

double PhQ::DimensionalScalar< Unit::Power , double >::value
protectedinherited

Value of this physical quantity expressed in its standard unit of measure.

Definition at line 221 of file DimensionalScalar.hpp.


The documentation for this class was generated from the following files: