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

Volume. For the time rate of change of volume, see PhQ::VolumeRate; see also PhQ::Time and PhQ::Frequency. More...

#include "Volume.hpp"

Public Member Functions

 Volume ()=default
 Default constructor. Constructs a volume with an uninitialized value. More...
 
 Volume (const NumericType value, const Unit::Volume unit)
 Constructor. Constructs a volume with a given value expressed in a given volume unit. More...
 
constexpr Volume (const Area< NumericType > &area, const Length< NumericType > &length)
 Constructor. Constructs a volume from a given area and length. More...
 
constexpr Volume (const VolumeRate< NumericType > &volume_rate, const Time< NumericType > &time)
 Constructor. Constructs a volume from a given volume rate and time using the definition of volume rate. More...
 
constexpr Volume (const VolumeRate< NumericType > &volume_rate, const Frequency< NumericType > &frequency)
 Constructor. Constructs a volume from a given volume rate and frequency using the definition of volume rate. More...
 
constexpr Volume (const Mass< NumericType > &mass, const MassDensity< NumericType > &mass_density)
 Constructor. Constructs a volume from a given mass and mass density using the definition of volume. More...
 
 ~Volume () noexcept=default
 Destructor. Destroys this volume. More...
 
constexpr Volume (const Volume< NumericType > &other)=default
 Copy constructor. Constructs a volume by copying another one. More...
 
template<typename OtherNumericType >
constexpr Volume (const Volume< OtherNumericType > &other)
 Copy constructor. Constructs a volume by copying another one. More...
 
constexpr Volume (Volume< NumericType > &&other) noexcept=default
 Move constructor. Constructs a volume by moving another one. More...
 
constexpr Volume< NumericType > & operator= (const Volume< NumericType > &other)=default
 Copy assignment operator. Assigns this volume by copying another one. More...
 
template<typename OtherNumericType >
constexpr Volume< NumericType > & operator= (const Volume< OtherNumericType > &other)
 Copy assignment operator. Assigns this volume by copying another one. More...
 
constexpr Volume< NumericType > & operator= (Volume< NumericType > &&other) noexcept=default
 Move assignment operator. Assigns this volume by moving another one. More...
 
constexpr Volume< NumericType > operator+ (const Volume< NumericType > &volume) const
 
constexpr Volume< NumericType > operator- (const Volume< NumericType > &volume) const
 
constexpr Volume< NumericType > operator* (const NumericType number) const
 
constexpr Mass< NumericType > operator* (const MassDensity< NumericType > &mass_density) const
 
constexpr VolumeRate< NumericType > operator* (const Frequency< NumericType > &frequency) const
 
constexpr Volume< NumericType > operator/ (const NumericType number) const
 
constexpr Area< NumericType > operator/ (const Length< NumericType > &length) const
 
constexpr Length< NumericType > operator/ (const Area< NumericType > &area) const
 
constexpr VolumeRate< NumericType > operator/ (const Time< NumericType > &time) const
 
constexpr Time< NumericType > operator/ (const VolumeRate< NumericType > &volume_rate) const
 
constexpr NumericType operator/ (const Volume< NumericType > &volume) const noexcept
 
constexpr void operator+= (const Volume< NumericType > &volume) noexcept
 
constexpr void operator-= (const Volume< NumericType > &volume) 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::Volume 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::Volume 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::Volume 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::Volume 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::Volume 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 Volume< NumericType > Zero ()
 Statically creates a volume of zero. More...
 
template<Unit::Volume Unit>
static constexpr Volume< NumericType > Create (const NumericType value)
 Statically creates a volume with a given value expressed in a given volume unit. More...
 
static constexpr const PhQ::DimensionsDimensions ()
 Physical dimension set of this physical quantity. More...
 
static constexpr Unit::Volume 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 Volume (const NumericType value)
 Constructor. Constructs a volume with a given value expressed in the standard volume unit. More...
 

Detailed Description

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

Volume. For the time rate of change of volume, see PhQ::VolumeRate; see also PhQ::Time and PhQ::Frequency.

Definition at line 62 of file Volume.hpp.

Constructor & Destructor Documentation

◆ Volume() [1/10]

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

Default constructor. Constructs a volume with an uninitialized value.

◆ Volume() [2/10]

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

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

Definition at line 68 of file Volume.hpp.

◆ Volume() [3/10]

template<typename NumericType = double>
constexpr PhQ::Volume< NumericType >::Volume ( const Area< NumericType > &  area,
const Length< NumericType > &  length 
)
inlineconstexpr

Constructor. Constructs a volume from a given area and length.

Definition at line 72 of file Volume.hpp.

◆ Volume() [4/10]

template<typename NumericType = double>
constexpr PhQ::Volume< NumericType >::Volume ( const VolumeRate< NumericType > &  volume_rate,
const Time< NumericType > &  time 
)
constexpr

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

◆ Volume() [5/10]

template<typename NumericType = double>
constexpr PhQ::Volume< NumericType >::Volume ( const VolumeRate< NumericType > &  volume_rate,
const Frequency< NumericType > &  frequency 
)
constexpr

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

◆ Volume() [6/10]

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

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

◆ ~Volume()

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

Destructor. Destroys this volume.

◆ Volume() [7/10]

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

Copy constructor. Constructs a volume by copying another one.

◆ Volume() [8/10]

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

Copy constructor. Constructs a volume by copying another one.

Definition at line 96 of file Volume.hpp.

◆ Volume() [9/10]

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

Move constructor. Constructs a volume by moving another one.

◆ Volume() [10/10]

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

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

Definition at line 182 of file Volume.hpp.

Member Function Documentation

◆ Create()

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

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

Definition at line 122 of file Volume.hpp.

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

◆ Dimensions()

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

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

◆ operator*() [2/3]

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

◆ operator*() [3/3]

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

Definition at line 135 of file Volume.hpp.

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

◆ operator*=()

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

Definition at line 171 of file Volume.hpp.

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

◆ operator+()

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

◆ operator+=()

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

Definition at line 163 of file Volume.hpp.

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

◆ operator-()

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

◆ operator-=()

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

Definition at line 167 of file Volume.hpp.

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

◆ operator/() [1/6]

template<typename NumericType = double>
constexpr Length<NumericType> PhQ::Volume< NumericType >::operator/ ( const Area< NumericType > &  area) const
inlineconstexpr

Definition at line 151 of file Volume.hpp.

◆ operator/() [2/6]

template<typename NumericType = double>
constexpr Area<NumericType> PhQ::Volume< NumericType >::operator/ ( const Length< NumericType > &  length) const
inlineconstexpr

Definition at line 147 of file Volume.hpp.

◆ operator/() [3/6]

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

Definition at line 143 of file Volume.hpp.

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

◆ operator/() [4/6]

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

◆ operator/() [5/6]

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

Definition at line 159 of file Volume.hpp.

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

◆ operator/() [6/6]

template<typename NumericType = double>
constexpr Time<NumericType> PhQ::Volume< NumericType >::operator/ ( const VolumeRate< NumericType > &  volume_rate) const
constexpr

◆ operator/=()

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

Definition at line 175 of file Volume.hpp.

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

◆ operator=() [1/3]

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

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

◆ operator=() [2/3]

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

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

Definition at line 107 of file Volume.hpp.

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

◆ operator=() [3/3]

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

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

◆ Print() [1/2]

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

Statically creates a volume of zero.

Definition at line 116 of file Volume.hpp.

Member Data Documentation

◆ value

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