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

Mass density. Mass per unit volume; see PhQ::Mass and PhQ::Volume. More...

#include "MassDensity.hpp"

Public Member Functions

 MassDensity ()=default
 Default constructor. Constructs a mass density with an uninitialized value. More...
 
 MassDensity (const NumericType value, const Unit::MassDensity unit)
 Constructor. Constructs a mass density with a given value expressed in a given mass density unit. More...
 
constexpr MassDensity (const Mass< NumericType > &mass, const Volume< NumericType > &volume)
 Constructor. Constructs a mass density from a given mass and volume using the definition of mass density. More...
 
constexpr MassDensity (const MassRate< NumericType > &mass_rate, const VolumeRate< NumericType > &volume_rate)
 Constructor. Constructs a mass density from a given mass rate and volume rate using the definition of mass density. More...
 
constexpr MassDensity (const DynamicViscosity< NumericType > &dynamic_viscosity, const KinematicViscosity< NumericType > &kinematic_viscosity)
 Constructor. Constructs a mass density from a given dynamic viscosity and kinematic viscosity using the definition of kinematic viscosity. More...
 
constexpr MassDensity (const ScalarThermalConductivity< NumericType > &scalar_thermal_conductivity, const ThermalDiffusivity< NumericType > &thermal_diffusivity, const SpecificIsobaricHeatCapacity< NumericType > &specific_isobaric_heat_capacity)
 Constructor. Constructs a mass density from a given scalar thermal conductivity, thermal diffusivity, and specific isobaric heat capacity using the definition of thermal diffusivity. More...
 
constexpr MassDensity (const DynamicPressure< NumericType > &dynamic_pressure, const Speed< NumericType > &speed)
 Constructor. Constructs a mass density from a given dynamic pressure and speed using the definition of dynamic pressure. More...
 
constexpr MassDensity (const ReynoldsNumber< NumericType > &reynolds_number, const DynamicViscosity< NumericType > &dynamic_viscosity, const Speed< NumericType > &speed, const Length< NumericType > &length)
 Constructor. Constructs a mass density from a given Reynolds number, dynamic viscosity, speed, and length using the definition of the Reynolds number. More...
 
constexpr MassDensity (const IsentropicBulkModulus< NumericType > &isentropic_bulk_modulus, const SoundSpeed< NumericType > &sound_speed)
 Constructor. Constructs a mass density from a given isentropic bulk modulus and sound speed using the definition of the isentropic bulk modulus. More...
 
 ~MassDensity () noexcept=default
 Destructor. Destroys this mass density. More...
 
constexpr MassDensity (const MassDensity< NumericType > &other)=default
 Copy constructor. Constructs a mass density by copying another one. More...
 
template<typename OtherNumericType >
constexpr MassDensity (const MassDensity< OtherNumericType > &other)
 Copy constructor. Constructs a mass density by copying another one. More...
 
constexpr MassDensity (MassDensity< NumericType > &&other) noexcept=default
 Move constructor. Constructs a mass density by moving another one. More...
 
constexpr MassDensity< NumericType > & operator= (const MassDensity< NumericType > &other)=default
 Copy assignment operator. Assigns this mass density by copying another one. More...
 
template<typename OtherNumericType >
constexpr MassDensity< NumericType > & operator= (const MassDensity< OtherNumericType > &other)
 Copy assignment operator. Assigns this mass density by copying another one. More...
 
constexpr MassDensity< NumericType > & operator= (MassDensity< NumericType > &&other) noexcept=default
 Move assignment operator. Assigns this mass density by moving another one. More...
 
constexpr MassDensity< NumericType > operator+ (const MassDensity< NumericType > &mass_density) const
 
constexpr MassDensity< NumericType > operator- (const MassDensity< NumericType > &mass_density) const
 
constexpr MassDensity< NumericType > operator* (const NumericType number) const
 
constexpr Mass< NumericType > operator* (const Volume< NumericType > &volume) const
 
constexpr MassRate< NumericType > operator* (const VolumeRate< NumericType > &volume_rate) const
 
constexpr DynamicViscosity< NumericType > operator* (const KinematicViscosity< NumericType > &kinematic_viscosity) const
 
constexpr MassDensity< NumericType > operator/ (const NumericType number) const
 
constexpr NumericType operator/ (const MassDensity< NumericType > &mass_density) const noexcept
 
constexpr void operator+= (const MassDensity< NumericType > &mass_density) noexcept
 
constexpr void operator-= (const MassDensity< NumericType > &mass_density) 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::MassDensity 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::MassDensity 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::MassDensity 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::MassDensity 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::MassDensity 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 MassDensity< NumericType > Zero ()
 Statically creates a mass density of zero. More...
 
template<Unit::MassDensity Unit>
static constexpr MassDensity< NumericType > Create (const NumericType value)
 Statically creates a mass density with a given value expressed in a given mass density unit. More...
 
static constexpr const PhQ::DimensionsDimensions ()
 Physical dimension set of this physical quantity. More...
 
static constexpr Unit::MassDensity 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 MassDensity (const NumericType value)
 Constructor. Constructs a mass density with a given value expressed in the standard mass density unit. More...
 

Detailed Description

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

Mass density. Mass per unit volume; see PhQ::Mass and PhQ::Volume.

Definition at line 83 of file MassDensity.hpp.

Constructor & Destructor Documentation

◆ MassDensity() [1/13]

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

Default constructor. Constructs a mass density with an uninitialized value.

◆ MassDensity() [2/13]

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

Constructor. Constructs a mass density with a given value expressed in a given mass density unit.

Definition at line 90 of file MassDensity.hpp.

◆ MassDensity() [3/13]

template<typename NumericType = double>
constexpr PhQ::MassDensity< NumericType >::MassDensity ( const Mass< NumericType > &  mass,
const Volume< NumericType > &  volume 
)
inlineconstexpr

Constructor. Constructs a mass density from a given mass and volume using the definition of mass density.

Definition at line 95 of file MassDensity.hpp.

◆ MassDensity() [4/13]

template<typename NumericType = double>
constexpr PhQ::MassDensity< NumericType >::MassDensity ( const MassRate< NumericType > &  mass_rate,
const VolumeRate< NumericType > &  volume_rate 
)
inlineconstexpr

Constructor. Constructs a mass density from a given mass rate and volume rate using the definition of mass density.

Definition at line 100 of file MassDensity.hpp.

◆ MassDensity() [5/13]

template<typename NumericType = double>
constexpr PhQ::MassDensity< NumericType >::MassDensity ( const DynamicViscosity< NumericType > &  dynamic_viscosity,
const KinematicViscosity< NumericType > &  kinematic_viscosity 
)
constexpr

Constructor. Constructs a mass density from a given dynamic viscosity and kinematic viscosity using the definition of kinematic viscosity.

◆ MassDensity() [6/13]

template<typename NumericType = double>
constexpr PhQ::MassDensity< NumericType >::MassDensity ( const ScalarThermalConductivity< NumericType > &  scalar_thermal_conductivity,
const ThermalDiffusivity< NumericType > &  thermal_diffusivity,
const SpecificIsobaricHeatCapacity< NumericType > &  specific_isobaric_heat_capacity 
)
constexpr

Constructor. Constructs a mass density from a given scalar thermal conductivity, thermal diffusivity, and specific isobaric heat capacity using the definition of thermal diffusivity.

◆ MassDensity() [7/13]

template<typename NumericType = double>
constexpr PhQ::MassDensity< NumericType >::MassDensity ( const DynamicPressure< NumericType > &  dynamic_pressure,
const Speed< NumericType > &  speed 
)
constexpr

Constructor. Constructs a mass density from a given dynamic pressure and speed using the definition of dynamic pressure.

◆ MassDensity() [8/13]

template<typename NumericType = double>
constexpr PhQ::MassDensity< NumericType >::MassDensity ( const ReynoldsNumber< NumericType > &  reynolds_number,
const DynamicViscosity< NumericType > &  dynamic_viscosity,
const Speed< NumericType > &  speed,
const Length< NumericType > &  length 
)
constexpr

Constructor. Constructs a mass density from a given Reynolds number, dynamic viscosity, speed, and length using the definition of the Reynolds number.

◆ MassDensity() [9/13]

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

Constructor. Constructs a mass density from a given isentropic bulk modulus and sound speed using the definition of the isentropic bulk modulus.

◆ ~MassDensity()

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

Destructor. Destroys this mass density.

◆ MassDensity() [10/13]

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

Copy constructor. Constructs a mass density by copying another one.

◆ MassDensity() [11/13]

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

Copy constructor. Constructs a mass density by copying another one.

Definition at line 141 of file MassDensity.hpp.

◆ MassDensity() [12/13]

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

Move constructor. Constructs a mass density by moving another one.

◆ MassDensity() [13/13]

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

Constructor. Constructs a mass density with a given value expressed in the standard mass density unit.

Definition at line 224 of file MassDensity.hpp.

Member Function Documentation

◆ Create()

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

Statically creates a mass density with a given value expressed in a given mass density unit.

Definition at line 169 of file MassDensity.hpp.

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

◆ Dimensions()

static constexpr const PhQ::Dimensions& PhQ::DimensionalScalar< Unit::MassDensity , 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::MassDensity , 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::MassDensity , double >::JSON ( const Unit::MassDensity  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::MassDensity , 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/4]

template<typename NumericType = double>
constexpr DynamicViscosity<NumericType> PhQ::MassDensity< NumericType >::operator* ( const KinematicViscosity< NumericType > &  kinematic_viscosity) const
constexpr

◆ operator*() [2/4]

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

◆ operator*() [3/4]

template<typename NumericType = double>
constexpr Mass<NumericType> PhQ::MassDensity< NumericType >::operator* ( const Volume< NumericType > &  volume) const
inlineconstexpr

Definition at line 186 of file MassDensity.hpp.

◆ operator*() [4/4]

template<typename NumericType = double>
constexpr MassRate<NumericType> PhQ::MassDensity< NumericType >::operator* ( const VolumeRate< NumericType > &  volume_rate) const
inlineconstexpr

Definition at line 190 of file MassDensity.hpp.

◆ operator*=()

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

◆ operator+()

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

◆ operator+=()

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

◆ operator-()

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

◆ operator-=()

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

◆ operator/() [1/2]

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

◆ operator/() [2/2]

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

◆ operator/=()

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

◆ operator=() [1/3]

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

Copy assignment operator. Assigns this mass density by copying another one.

◆ operator=() [2/3]

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

Copy assignment operator. Assigns this mass density by copying another one.

Definition at line 152 of file MassDensity.hpp.

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

◆ operator=() [3/3]

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

Move assignment operator. Assigns this mass density by moving another one.

◆ Print() [1/2]

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

Statically creates a mass density of zero.

Definition at line 162 of file MassDensity.hpp.

Member Data Documentation

◆ value

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