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

Mass. For the time rate of change of mass, see PhQ::MassRate; see also PhQ::Time and PhQ::Frequency. More...

#include "Mass.hpp"

Public Member Functions

 Mass ()=default
 Default constructor. Constructs a mass with an uninitialized value. More...
 
 Mass (const NumericType value, const Unit::Mass unit)
 Constructor. Constructs a mass with a given value expressed in a given mass unit. More...
 
constexpr Mass (const MassDensity< NumericType > &mass_density, const Volume< NumericType > &volume)
 Constructor. Constructs a mass from a given mass density and volume using the definition of mass density. More...
 
constexpr Mass (const MassRate< NumericType > &mass_rate, const Time< NumericType > &time)
 Constructor. Constructs a mass from a given mass rate and time using the definition of mass rate. More...
 
constexpr Mass (const MassRate< NumericType > &mass_rate, const Frequency< NumericType > &frequency)
 Constructor. Constructs a mass from a given mass rate and frequency using the definition of mass rate. More...
 
constexpr Mass (const Energy< NumericType > &energy, const SpecificEnergy< NumericType > &specific_energy)
 Constructor. Constructs a mass from a given energy and specific energy using the definition of specific energy. More...
 
constexpr Mass (const Power< NumericType > &power, const SpecificPower< NumericType > &specific_power)
 Constructor. Constructs a mass from a given power and specific power using the definition of specific power. More...
 
constexpr Mass (const GasConstant< NumericType > &gas_constant, const SpecificGasConstant< NumericType > &specific_gas_constant)
 Constructor. Constructs a mass from a given gas constant and specific gas constant using the definition of the specific gas constant. More...
 
constexpr Mass (const IsobaricHeatCapacity< NumericType > &isobaric_heat_capacity, const SpecificIsobaricHeatCapacity< NumericType > &specific_isobaric_heat_capacity)
 Constructor. Constructs a mass from a given isobaric heat capacity and specific isobaric heat capacity using the definition of the specific isobaric heat capacity. More...
 
constexpr Mass (const IsochoricHeatCapacity< NumericType > &isochoric_heat_capacity, const SpecificIsochoricHeatCapacity< NumericType > &specific_isochoric_heat_capacity)
 Constructor. Constructs a mass from a given isochoric heat capacity and specific isochoric heat capacity using the definition of the specific isochoric heat capacity. More...
 
 ~Mass () noexcept=default
 Destructor. Destroys this mass. More...
 
constexpr Mass (const Mass< NumericType > &other)=default
 Copy constructor. Constructs a mass by copying another one. More...
 
template<typename OtherNumericType >
constexpr Mass (const Mass< OtherNumericType > &other)
 Copy constructor. Constructs a mass by copying another one. More...
 
constexpr Mass (Mass< NumericType > &&other) noexcept=default
 Move constructor. Constructs a mass by moving another one. More...
 
constexpr Mass< NumericType > & operator= (const Mass< NumericType > &other)=default
 Copy assignment operator. Assigns this mass by copying another one. More...
 
template<typename OtherNumericType >
constexpr Mass< NumericType > & operator= (const Mass< OtherNumericType > &other)
 Copy assignment operator. Assigns this mass by copying another one. More...
 
constexpr Mass< NumericType > & operator= (Mass< NumericType > &&other) noexcept=default
 Move assignment operator. Assigns this mass by moving another one. More...
 
constexpr Mass< NumericType > operator+ (const Mass< NumericType > &mass) const
 
constexpr Mass< NumericType > operator- (const Mass< NumericType > &mass) const
 
constexpr Mass< NumericType > operator* (const NumericType number) const
 
constexpr MassRate< NumericType > operator* (const Frequency< NumericType > &frequency) const
 
constexpr Energy< NumericType > operator* (const SpecificEnergy< NumericType > &specific_energy) const
 
constexpr Power< NumericType > operator* (const SpecificPower< NumericType > &specific_power) const
 
constexpr IsobaricHeatCapacity< NumericType > operator* (const SpecificIsobaricHeatCapacity< NumericType > &specific_isobaric_heat_capacity) const
 
constexpr IsochoricHeatCapacity< NumericType > operator* (const SpecificIsochoricHeatCapacity< NumericType > &specific_isochoric_heat_capacity) const
 
constexpr GasConstant< NumericType > operator* (const SpecificGasConstant< NumericType > &specific_gas_constant) const
 
constexpr Mass< NumericType > operator/ (const NumericType number) const
 
constexpr MassDensity< NumericType > operator/ (const Volume< NumericType > &volume) const
 
constexpr Volume< NumericType > operator/ (const MassDensity< NumericType > &mass_density) const
 
constexpr MassRate< NumericType > operator/ (const Time< NumericType > &time) const
 
constexpr Time< NumericType > operator/ (const MassRate< NumericType > &mass_rate) const
 
constexpr NumericType operator/ (const Mass< NumericType > &mass) const noexcept
 
constexpr void operator+= (const Mass< NumericType > &mass) noexcept
 
constexpr void operator-= (const Mass< NumericType > &mass) 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::Mass 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::Mass 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::Mass 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::Mass 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::Mass 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 Mass< NumericType > Zero ()
 Statically creates a mass of zero. More...
 
template<Unit::Mass Unit>
static constexpr Mass< NumericType > Create (const NumericType value)
 Statically creates a mass with a given value expressed in a given mass unit. More...
 
static constexpr const PhQ::DimensionsDimensions ()
 Physical dimension set of this physical quantity. More...
 
static constexpr Unit::Mass 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 Mass (const NumericType value)
 Constructor. Constructs a mass with a given value expressed in the standard mass unit. More...
 

Detailed Description

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

Mass. For the time rate of change of mass, see PhQ::MassRate; see also PhQ::Time and PhQ::Frequency.

Definition at line 100 of file Mass.hpp.

Constructor & Destructor Documentation

◆ Mass() [1/14]

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

Default constructor. Constructs a mass with an uninitialized value.

◆ Mass() [2/14]

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

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

Definition at line 106 of file Mass.hpp.

◆ Mass() [3/14]

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

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

◆ Mass() [4/14]

template<typename NumericType = double>
constexpr PhQ::Mass< NumericType >::Mass ( const MassRate< NumericType > &  mass_rate,
const Time< NumericType > &  time 
)
constexpr

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

◆ Mass() [5/14]

template<typename NumericType = double>
constexpr PhQ::Mass< NumericType >::Mass ( const MassRate< NumericType > &  mass_rate,
const Frequency< NumericType > &  frequency 
)
constexpr

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

◆ Mass() [6/14]

template<typename NumericType = double>
constexpr PhQ::Mass< NumericType >::Mass ( const Energy< NumericType > &  energy,
const SpecificEnergy< NumericType > &  specific_energy 
)
constexpr

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

◆ Mass() [7/14]

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

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

◆ Mass() [8/14]

template<typename NumericType = double>
constexpr PhQ::Mass< NumericType >::Mass ( const GasConstant< NumericType > &  gas_constant,
const SpecificGasConstant< NumericType > &  specific_gas_constant 
)
constexpr

Constructor. Constructs a mass from a given gas constant and specific gas constant using the definition of the specific gas constant.

◆ Mass() [9/14]

template<typename NumericType = double>
constexpr PhQ::Mass< NumericType >::Mass ( const IsobaricHeatCapacity< NumericType > &  isobaric_heat_capacity,
const SpecificIsobaricHeatCapacity< NumericType > &  specific_isobaric_heat_capacity 
)
constexpr

Constructor. Constructs a mass from a given isobaric heat capacity and specific isobaric heat capacity using the definition of the specific isobaric heat capacity.

◆ Mass() [10/14]

template<typename NumericType = double>
constexpr PhQ::Mass< NumericType >::Mass ( const IsochoricHeatCapacity< NumericType > &  isochoric_heat_capacity,
const SpecificIsochoricHeatCapacity< NumericType > &  specific_isochoric_heat_capacity 
)
constexpr

Constructor. Constructs a mass from a given isochoric heat capacity and specific isochoric heat capacity using the definition of the specific isochoric heat capacity.

◆ ~Mass()

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

Destructor. Destroys this mass.

◆ Mass() [11/14]

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

Copy constructor. Constructs a mass by copying another one.

◆ Mass() [12/14]

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

Copy constructor. Constructs a mass by copying another one.

Definition at line 154 of file Mass.hpp.

◆ Mass() [13/14]

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

Move constructor. Constructs a mass by moving another one.

◆ Mass() [14/14]

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

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

Definition at line 245 of file Mass.hpp.

Member Function Documentation

◆ Create()

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

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

Definition at line 180 of file Mass.hpp.

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

◆ Dimensions()

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

template<typename NumericType = double>
constexpr MassRate<NumericType> PhQ::Mass< NumericType >::operator* ( const Frequency< NumericType > &  frequency) const
constexpr

◆ operator*() [2/7]

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

Definition at line 192 of file Mass.hpp.

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

◆ operator*() [3/7]

template<typename NumericType = double>
constexpr Energy<NumericType> PhQ::Mass< NumericType >::operator* ( const SpecificEnergy< NumericType > &  specific_energy) const
constexpr

◆ operator*() [4/7]

template<typename NumericType = double>
constexpr GasConstant<NumericType> PhQ::Mass< NumericType >::operator* ( const SpecificGasConstant< NumericType > &  specific_gas_constant) const
constexpr

◆ operator*() [5/7]

template<typename NumericType = double>
constexpr IsobaricHeatCapacity<NumericType> PhQ::Mass< NumericType >::operator* ( const SpecificIsobaricHeatCapacity< NumericType > &  specific_isobaric_heat_capacity) const
constexpr

◆ operator*() [6/7]

template<typename NumericType = double>
constexpr IsochoricHeatCapacity<NumericType> PhQ::Mass< NumericType >::operator* ( const SpecificIsochoricHeatCapacity< NumericType > &  specific_isochoric_heat_capacity) const
constexpr

◆ operator*() [7/7]

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

◆ operator*=()

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

Definition at line 235 of file Mass.hpp.

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

◆ operator+()

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

◆ operator+=()

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

Definition at line 227 of file Mass.hpp.

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

◆ operator-()

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

◆ operator-=()

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

Definition at line 231 of file Mass.hpp.

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

◆ operator/() [1/6]

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

Definition at line 223 of file Mass.hpp.

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

◆ operator/() [2/6]

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

◆ operator/() [3/6]

template<typename NumericType = double>
constexpr Time<NumericType> PhQ::Mass< NumericType >::operator/ ( const MassRate< NumericType > &  mass_rate) const
constexpr

◆ operator/() [4/6]

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

Definition at line 211 of file Mass.hpp.

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

◆ operator/() [5/6]

template<typename NumericType = double>
constexpr MassRate<NumericType> PhQ::Mass< NumericType >::operator/ ( const Time< NumericType > &  time) const
constexpr

◆ operator/() [6/6]

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

◆ operator/=()

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

Definition at line 239 of file Mass.hpp.

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

◆ operator=() [1/3]

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

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

◆ operator=() [2/3]

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

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

Definition at line 165 of file Mass.hpp.

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

◆ operator=() [3/3]

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

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

◆ Print() [1/2]

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

Statically creates a mass of zero.

Definition at line 174 of file Mass.hpp.

Member Data Documentation

◆ value

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