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::SoundSpeed< NumericType > Class Template Reference

Speed of sound. Applies to any deformable material, including fluids and deformable solids. Defined as the ratio of a material's isentropic bulk modulus to its mass density; see PhQ::IsentropicBulkModulus and PhQ::MassDensity. The speed of sound also appears in the definition of the Mach number; see PhQ::MachNumber and PhQ::Speed. More...

#include "SoundSpeed.hpp"

Public Member Functions

 SoundSpeed ()=default
 Default constructor. Constructs a sound speed with an uninitialized value. More...
 
 SoundSpeed (const NumericType value, const Unit::Speed unit)
 Constructs a sound speed from a given value and speed unit. More...
 
 SoundSpeed (const IsentropicBulkModulus< NumericType > &isentropic_bulk_modulus, const MassDensity< NumericType > &mass_density)
 Constructs a sound speed from an isentropic bulk modulus and a mass density. This is the definition of the sound speed; this relation always holds true. More...
 
 SoundSpeed (const HeatCapacityRatio< NumericType > &heat_capacity_ratio, const StaticPressure< NumericType > &static_pressure, const MassDensity< NumericType > &mass_density)
 Constructs a sound speed from a heat capacity ratio, a static pressure, and a mass density. This relation applies only to an ideal gas. More...
 
 SoundSpeed (const HeatCapacityRatio< NumericType > &heat_capacity_ratio, const SpecificGasConstant< NumericType > &specific_gas_constant, const Temperature< NumericType > &temperature)
 Constructs a sound speed from a heat capacity ratio, a specific gas constant, and a temperature. This relation applies only to an ideal gas. More...
 
constexpr SoundSpeed (const Speed< NumericType > &speed, const MachNumber< NumericType > &mach_number)
 Constructs a sound speed from a speed and a Mach number. This uses the definition of the Mach number; this relation always holds true. More...
 
 ~SoundSpeed () noexcept=default
 Destructor. Destroys this sound speed. More...
 
constexpr SoundSpeed (const SoundSpeed< NumericType > &other)=default
 Copy constructor. Constructs a sound speed by copying another one. More...
 
template<typename OtherNumericType >
constexpr SoundSpeed (const SoundSpeed< OtherNumericType > &other)
 Copy constructor. Constructs a sound speed by copying another one. More...
 
constexpr SoundSpeed (SoundSpeed< NumericType > &&other) noexcept=default
 Move constructor. Constructs a sound speed by moving another one. More...
 
constexpr SoundSpeed< NumericType > & operator= (const SoundSpeed< NumericType > &other)=default
 Copy assignment operator. Assigns this sound speed by copying another one. More...
 
template<typename OtherNumericType >
constexpr SoundSpeed< NumericType > & operator= (const SoundSpeed< OtherNumericType > &other)
 Copy assignment operator. Assigns this sound speed by copying another one. More...
 
constexpr SoundSpeed< NumericType > & operator= (SoundSpeed< NumericType > &&other) noexcept=default
 Move assignment operator. Assigns this sound speed by moving another one. More...
 
constexpr SoundSpeed< NumericType > operator+ (const SoundSpeed< NumericType > &speed) const
 
constexpr Speed< NumericType > operator+ (const Speed< NumericType > &speed) const
 
constexpr SoundSpeed< NumericType > operator- (const SoundSpeed< NumericType > &speed) const
 
constexpr Speed< NumericType > operator- (const Speed< NumericType > &speed) const
 
constexpr SoundSpeed< NumericType > operator* (const NumericType number) const
 
constexpr Speed< NumericType > operator* (const MachNumber< NumericType > &mach_number) const
 
constexpr SoundSpeed< NumericType > operator/ (const NumericType number) const
 
constexpr NumericType operator/ (const SoundSpeed< NumericType > &sound_speed) const noexcept
 
constexpr void operator+= (const SoundSpeed< NumericType > &sound_speed) noexcept
 
constexpr void operator+= (const Speed< NumericType > &speed) noexcept
 
constexpr void operator-= (const SoundSpeed< NumericType > &sound_speed) noexcept
 
constexpr void operator-= (const Speed< NumericType > &speed) 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::Speed 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::Speed 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::Speed 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::Speed 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::Speed 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 SoundSpeed< NumericType > Zero ()
 
template<Unit::Speed Unit>
static constexpr SoundSpeed< NumericType > Create (const NumericType value)
 Creates a sound speed from a given value and speed unit. More...
 
static constexpr const PhQ::DimensionsDimensions ()
 Physical dimension set of this physical quantity. More...
 
static constexpr Unit::Speed 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 SoundSpeed (const NumericType value)
 Constructor. Constructs a sound speed with a given value expressed in the standard speed unit. More...
 

Detailed Description

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

Speed of sound. Applies to any deformable material, including fluids and deformable solids. Defined as the ratio of a material's isentropic bulk modulus to its mass density; see PhQ::IsentropicBulkModulus and PhQ::MassDensity. The speed of sound also appears in the definition of the Mach number; see PhQ::MachNumber and PhQ::Speed.

Definition at line 56 of file SoundSpeed.hpp.

Constructor & Destructor Documentation

◆ SoundSpeed() [1/10]

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

Default constructor. Constructs a sound speed with an uninitialized value.

◆ SoundSpeed() [2/10]

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

Constructs a sound speed from a given value and speed unit.

Definition at line 62 of file SoundSpeed.hpp.

◆ SoundSpeed() [3/10]

template<typename NumericType = double>
PhQ::SoundSpeed< NumericType >::SoundSpeed ( const IsentropicBulkModulus< NumericType > &  isentropic_bulk_modulus,
const MassDensity< NumericType > &  mass_density 
)
inline

Constructs a sound speed from an isentropic bulk modulus and a mass density. This is the definition of the sound speed; this relation always holds true.

Definition at line 67 of file SoundSpeed.hpp.

◆ SoundSpeed() [4/10]

template<typename NumericType = double>
PhQ::SoundSpeed< NumericType >::SoundSpeed ( const HeatCapacityRatio< NumericType > &  heat_capacity_ratio,
const StaticPressure< NumericType > &  static_pressure,
const MassDensity< NumericType > &  mass_density 
)
inline

Constructs a sound speed from a heat capacity ratio, a static pressure, and a mass density. This relation applies only to an ideal gas.

Definition at line 73 of file SoundSpeed.hpp.

◆ SoundSpeed() [5/10]

template<typename NumericType = double>
PhQ::SoundSpeed< NumericType >::SoundSpeed ( const HeatCapacityRatio< NumericType > &  heat_capacity_ratio,
const SpecificGasConstant< NumericType > &  specific_gas_constant,
const Temperature< NumericType > &  temperature 
)
inline

Constructs a sound speed from a heat capacity ratio, a specific gas constant, and a temperature. This relation applies only to an ideal gas.

Definition at line 81 of file SoundSpeed.hpp.

◆ SoundSpeed() [6/10]

template<typename NumericType >
constexpr PhQ::SoundSpeed< NumericType >::SoundSpeed ( const Speed< NumericType > &  speed,
const MachNumber< NumericType > &  mach_number 
)
constexpr

Constructs a sound speed from a speed and a Mach number. This uses the definition of the Mach number; this relation always holds true.

Definition at line 178 of file MachNumber.hpp.

◆ ~SoundSpeed()

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

Destructor. Destroys this sound speed.

◆ SoundSpeed() [7/10]

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

Copy constructor. Constructs a sound speed by copying another one.

◆ SoundSpeed() [8/10]

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

Copy constructor. Constructs a sound speed by copying another one.

Definition at line 99 of file SoundSpeed.hpp.

◆ SoundSpeed() [9/10]

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

Move constructor. Constructs a sound speed by moving another one.

◆ SoundSpeed() [10/10]

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

Constructor. Constructs a sound speed with a given value expressed in the standard speed unit.

Definition at line 186 of file SoundSpeed.hpp.

Member Function Documentation

◆ Create()

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

Creates a sound speed from a given value and speed unit.

Definition at line 124 of file SoundSpeed.hpp.

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

◆ Dimensions()

static constexpr const PhQ::Dimensions& PhQ::DimensionalScalar< Unit::Speed , 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::Speed , 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::Speed , double >::JSON ( const UnitType  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::Speed , 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 >
constexpr Speed< NumericType > PhQ::SoundSpeed< NumericType >::operator* ( const MachNumber< NumericType > &  mach_number) const
inlineconstexpr

Definition at line 188 of file MachNumber.hpp.

◆ operator*() [2/2]

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

◆ operator*=()

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

◆ operator+() [1/2]

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

◆ operator+() [2/2]

template<typename NumericType = double>
constexpr Speed<NumericType> PhQ::SoundSpeed< NumericType >::operator+ ( const Speed< NumericType > &  speed) const
inlineconstexpr

◆ operator+=() [1/2]

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

◆ operator+=() [2/2]

template<typename NumericType = double>
constexpr void PhQ::SoundSpeed< NumericType >::operator+= ( const Speed< NumericType > &  speed)
inlineconstexprnoexcept

◆ operator-() [1/2]

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

◆ operator-() [2/2]

template<typename NumericType = double>
constexpr Speed<NumericType> PhQ::SoundSpeed< NumericType >::operator- ( const Speed< NumericType > &  speed) const
inlineconstexpr

◆ operator-=() [1/2]

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

◆ operator-=() [2/2]

template<typename NumericType = double>
constexpr void PhQ::SoundSpeed< NumericType >::operator-= ( const Speed< NumericType > &  speed)
inlineconstexprnoexcept

◆ operator/() [1/2]

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

◆ operator/() [2/2]

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

◆ operator/=()

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

◆ operator=() [1/3]

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

Copy assignment operator. Assigns this sound speed by copying another one.

◆ operator=() [2/3]

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

Copy assignment operator. Assigns this sound speed by copying another one.

Definition at line 110 of file SoundSpeed.hpp.

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

◆ operator=() [3/3]

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

Move assignment operator. Assigns this sound speed by moving another one.

◆ Print() [1/2]

std::string PhQ::DimensionalScalar< Unit::Speed , 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::Speed , double >::Print ( const UnitType  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::Speed , double >::SetValue ( const NumericType  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::Speed , 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::Speed PhQ::DimensionalScalar< Unit::Speed , 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::Speed , 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::Speed , double >::Value ( const UnitType  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::Speed , 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::Speed , double >::XML ( const UnitType  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::Speed , 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::Speed , double >::YAML ( const UnitType  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 SoundSpeed<NumericType> PhQ::SoundSpeed< NumericType >::Zero ( )
inlinestaticconstexpr

Definition at line 118 of file SoundSpeed.hpp.

Member Data Documentation

◆ value

double PhQ::DimensionalScalar< Unit::Speed , 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: