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 Member Functions | Protected Attributes | List of all members
PhQ::DimensionalVector< UnitType, NumericType > Class Template Reference

Abstract base class that represents any dimensional vector physical quantity. Such a physical quantity is composed of a value and a unit of measure where the value is a three-dimensional vector. More...

#include "DimensionalVector.hpp"

Public Member Functions

constexpr const PhQ::Vector< NumericType > & Value () const noexcept
 Value of this physical quantity expressed in its standard unit of measure. More...
 
PhQ::Vector< NumericType > Value (const UnitType unit) const
 Value of this physical quantity expressed in a given unit of measure. More...
 
template<UnitType NewUnit>
constexpr PhQ::Vector< NumericType > 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 PhQ::Vector< NumericType > & 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 PhQ::Vector< NumericType > &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 UnitType 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 UnitType 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 UnitType 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 UnitType 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 const PhQ::DimensionsDimensions ()
 Physical dimension set of this physical quantity. More...
 
static constexpr UnitType Unit ()
 Standard unit of measure for this physical quantity. This physical quantity's value is stored internally in this unit of measure. More...
 

Protected Member Functions

 DimensionalVector ()=default
 Default constructor. Constructs a dimensional vector physical quantity with an uninitialized value. More...
 
constexpr DimensionalVector (const PhQ::Vector< NumericType > &value)
 Constructor. Constructs a dimensional vector physical quantity with a given value expressed in its standard unit of measure. More...
 
 DimensionalVector (const PhQ::Vector< NumericType > &value, const UnitType unit)
 Constructor. Constructs a dimensional vector physical quantity with a given value expressed in a given unit of measure. More...
 
 ~DimensionalVector () noexcept=default
 Destructor. Destroys this dimensional vector physical quantity. More...
 
constexpr DimensionalVector (const DimensionalVector< UnitType, NumericType > &other)=default
 Copy constructor. Constructs a dimensional vector physical quantity by copying another one. More...
 
template<typename OtherNumericType >
constexpr DimensionalVector (const DimensionalVector< UnitType, OtherNumericType > &other)
 Copy constructor. Constructs a dimensional vector physical quantity by copying another one. More...
 
constexpr DimensionalVector (DimensionalVector< UnitType, NumericType > &&other) noexcept=default
 Move constructor. Constructs a dimensional vector physical quantity by moving another one. More...
 
constexpr DimensionalVector< UnitType, NumericType > & operator= (const DimensionalVector< UnitType, NumericType > &other)=default
 Copy assignment operator. Assigns this dimensional vector physical quantity by copying another one. More...
 
template<typename OtherNumericType >
constexpr DimensionalVector< UnitType, NumericType > & operator= (const DimensionalVector< UnitType, OtherNumericType > &other)
 Copy assignment operator. Assigns this dimensional vector physical quantity by copying another one. More...
 
constexpr DimensionalVector< UnitType, NumericType > & operator= (DimensionalVector< UnitType, NumericType > &&other) noexcept=default
 Move assignment operator. Assigns this dimensional vector physical quantity by moving another one. More...
 

Protected Attributes

PhQ::Vector< NumericType > value
 Value of this physical quantity expressed in its standard unit of measure. More...
 

Detailed Description

template<typename UnitType, typename NumericType = double>
class PhQ::DimensionalVector< UnitType, NumericType >

Abstract base class that represents any dimensional vector physical quantity. Such a physical quantity is composed of a value and a unit of measure where the value is a three-dimensional vector.

Template Parameters
UnitTypeUnit of measure enumeration type.
NumericTypeFloating-point numeric type: float, double, or long double. Defaults to double if unspecified.

Definition at line 47 of file DimensionalVector.hpp.

Constructor & Destructor Documentation

◆ DimensionalVector() [1/6]

template<typename UnitType , typename NumericType = double>
PhQ::DimensionalVector< UnitType, NumericType >::DimensionalVector ( )
protecteddefault

Default constructor. Constructs a dimensional vector physical quantity with an uninitialized value.

◆ DimensionalVector() [2/6]

template<typename UnitType , typename NumericType = double>
constexpr PhQ::DimensionalVector< UnitType, NumericType >::DimensionalVector ( const PhQ::Vector< NumericType > &  value)
inlineexplicitconstexprprotected

Constructor. Constructs a dimensional vector physical quantity with a given value expressed in its standard unit of measure.

Definition at line 168 of file DimensionalVector.hpp.

◆ DimensionalVector() [3/6]

template<typename UnitType , typename NumericType = double>
PhQ::DimensionalVector< UnitType, NumericType >::DimensionalVector ( const PhQ::Vector< NumericType > &  value,
const UnitType  unit 
)
inlineprotected

Constructor. Constructs a dimensional vector physical quantity with a given value expressed in a given unit of measure.

Definition at line 172 of file DimensionalVector.hpp.

References PhQ::ConvertInPlace().

◆ ~DimensionalVector()

template<typename UnitType , typename NumericType = double>
PhQ::DimensionalVector< UnitType, NumericType >::~DimensionalVector ( )
protecteddefaultnoexcept

Destructor. Destroys this dimensional vector physical quantity.

◆ DimensionalVector() [4/6]

template<typename UnitType , typename NumericType = double>
constexpr PhQ::DimensionalVector< UnitType, NumericType >::DimensionalVector ( const DimensionalVector< UnitType, NumericType > &  other)
constexprprotecteddefault

Copy constructor. Constructs a dimensional vector physical quantity by copying another one.

◆ DimensionalVector() [5/6]

template<typename UnitType , typename NumericType = double>
template<typename OtherNumericType >
constexpr PhQ::DimensionalVector< UnitType, NumericType >::DimensionalVector ( const DimensionalVector< UnitType, OtherNumericType > &  other)
inlineexplicitconstexprprotected

Copy constructor. Constructs a dimensional vector physical quantity by copying another one.

Template Parameters
OtherNumericTypeFloating-point numeric type of the other physical quantity. Deduced automatically.

Definition at line 188 of file DimensionalVector.hpp.

◆ DimensionalVector() [6/6]

template<typename UnitType , typename NumericType = double>
constexpr PhQ::DimensionalVector< UnitType, NumericType >::DimensionalVector ( DimensionalVector< UnitType, NumericType > &&  other)
constexprprotecteddefaultnoexcept

Move constructor. Constructs a dimensional vector physical quantity by moving another one.

Member Function Documentation

◆ Dimensions()

template<typename UnitType , typename NumericType = double>
static constexpr const PhQ::Dimensions& PhQ::DimensionalVector< UnitType, NumericType >::Dimensions ( )
inlinestaticconstexpr

Physical dimension set of this physical quantity.

Definition at line 50 of file DimensionalVector.hpp.

◆ JSON() [1/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalVector< UnitType, NumericType >::JSON ( ) const
inline

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

Definition at line 103 of file DimensionalVector.hpp.

References PhQ::Abbreviation(), and PhQ::DimensionalVector< UnitType, NumericType >::value.

Referenced by PhQ::DimensionalVector< UnitType, NumericType >::JSON().

◆ JSON() [2/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalVector< UnitType, NumericType >::JSON ( const UnitType  unit) const
inline

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

Definition at line 113 of file DimensionalVector.hpp.

References PhQ::Abbreviation(), PhQ::DimensionalVector< UnitType, NumericType >::JSON(), and PhQ::DimensionalVector< UnitType, NumericType >::Value().

◆ MutableValue()

template<typename UnitType , typename NumericType = double>
constexpr PhQ::Vector<NumericType>& PhQ::DimensionalVector< UnitType, NumericType >::MutableValue ( )
inlineconstexprnoexcept

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

Definition at line 79 of file DimensionalVector.hpp.

References PhQ::DimensionalVector< UnitType, NumericType >::value.

◆ operator=() [1/3]

template<typename UnitType , typename NumericType = double>
constexpr DimensionalVector<UnitType, NumericType>& PhQ::DimensionalVector< UnitType, NumericType >::operator= ( const DimensionalVector< UnitType, NumericType > &  other)
constexprprotecteddefault

Copy assignment operator. Assigns this dimensional vector physical quantity by copying another one.

◆ operator=() [2/3]

template<typename UnitType , typename NumericType = double>
template<typename OtherNumericType >
constexpr DimensionalVector<UnitType, NumericType>& PhQ::DimensionalVector< UnitType, NumericType >::operator= ( const DimensionalVector< UnitType, OtherNumericType > &  other)
inlineconstexprprotected

Copy assignment operator. Assigns this dimensional vector physical quantity by copying another one.

Template Parameters
OtherNumericTypeFloating-point numeric type of the other physical quantity. Deduced automatically.

Definition at line 205 of file DimensionalVector.hpp.

References PhQ::DimensionalVector< UnitType, NumericType >::Value(), and PhQ::DimensionalVector< UnitType, NumericType >::value.

◆ operator=() [3/3]

template<typename UnitType , typename NumericType = double>
constexpr DimensionalVector<UnitType, NumericType>& PhQ::DimensionalVector< UnitType, NumericType >::operator= ( DimensionalVector< UnitType, NumericType > &&  other)
constexprprotecteddefaultnoexcept

Move assignment operator. Assigns this dimensional vector physical quantity by moving another one.

◆ Print() [1/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalVector< UnitType, NumericType >::Print ( ) const
inline

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

Definition at line 91 of file DimensionalVector.hpp.

References PhQ::Abbreviation(), and PhQ::DimensionalVector< UnitType, NumericType >::value.

Referenced by PhQ::operator<<().

◆ Print() [2/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalVector< UnitType, NumericType >::Print ( const UnitType  unit) const
inline

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

Definition at line 97 of file DimensionalVector.hpp.

References PhQ::Abbreviation(), and PhQ::DimensionalVector< UnitType, NumericType >::Value().

◆ SetValue()

template<typename UnitType , typename NumericType = double>
constexpr void PhQ::DimensionalVector< UnitType, NumericType >::SetValue ( const PhQ::Vector< NumericType > &  value)
inlineconstexprnoexcept

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

Definition at line 85 of file DimensionalVector.hpp.

References PhQ::DimensionalVector< UnitType, NumericType >::value.

◆ StaticValue()

template<typename UnitType , typename NumericType = double>
template<UnitType NewUnit>
constexpr PhQ::Vector<NumericType> PhQ::DimensionalVector< UnitType, NumericType >::StaticValue ( ) const
inlineconstexpr

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

Definition at line 73 of file DimensionalVector.hpp.

References PhQ::DimensionalVector< UnitType, NumericType >::value.

◆ Unit()

template<typename UnitType , typename NumericType = double>
static constexpr UnitType PhQ::DimensionalVector< UnitType, NumericType >::Unit ( )
inlinestaticconstexpr

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

Definition at line 56 of file DimensionalVector.hpp.

◆ Value() [1/2]

template<typename UnitType , typename NumericType = double>
constexpr const PhQ::Vector<NumericType>& PhQ::DimensionalVector< UnitType, NumericType >::Value ( ) const
inlineconstexprnoexcept

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

Definition at line 61 of file DimensionalVector.hpp.

References PhQ::DimensionalVector< UnitType, NumericType >::value.

Referenced by PhQ::DimensionalVector< UnitType, NumericType >::JSON(), PhQ::Position< NumericType >::operator+(), PhQ::Displacement< NumericType >::operator+(), PhQ::Position< NumericType >::operator-(), PhQ::Displacement< NumericType >::operator-(), PhQ::Acceleration< NumericType >::operator=(), PhQ::DimensionalVector< UnitType, NumericType >::operator=(), PhQ::Displacement< NumericType >::operator=(), PhQ::Force< NumericType >::operator=(), PhQ::HeatFlux< NumericType >::operator=(), PhQ::Position< NumericType >::operator=(), PhQ::TemperatureGradient< NumericType >::operator=(), PhQ::Traction< NumericType >::operator=(), PhQ::VectorArea< NumericType >::operator=(), PhQ::Velocity< NumericType >::operator=(), PhQ::PlanarAcceleration< NumericType >::PlanarAcceleration(), PhQ::PlanarDisplacement< NumericType >::PlanarDisplacement(), PhQ::PlanarForce< NumericType >::PlanarForce(), PhQ::PlanarHeatFlux< NumericType >::PlanarHeatFlux(), PhQ::PlanarPosition< NumericType >::PlanarPosition(), PhQ::PlanarTemperatureGradient< NumericType >::PlanarTemperatureGradient(), PhQ::PlanarTraction< NumericType >::PlanarTraction(), PhQ::PlanarVelocity< NumericType >::PlanarVelocity(), PhQ::DimensionalVector< UnitType, NumericType >::Print(), PhQ::DimensionalVector< UnitType, NumericType >::XML(), and PhQ::DimensionalVector< UnitType, NumericType >::YAML().

◆ Value() [2/2]

template<typename UnitType , typename NumericType = double>
PhQ::Vector<NumericType> PhQ::DimensionalVector< UnitType, NumericType >::Value ( const UnitType  unit) const
inline

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

Definition at line 66 of file DimensionalVector.hpp.

References PhQ::Convert(), and PhQ::DimensionalVector< UnitType, NumericType >::value.

◆ XML() [1/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalVector< UnitType, NumericType >::XML ( ) const
inline

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

Definition at line 123 of file DimensionalVector.hpp.

References PhQ::Abbreviation(), and PhQ::DimensionalVector< UnitType, NumericType >::value.

Referenced by PhQ::DimensionalVector< UnitType, NumericType >::XML().

◆ XML() [2/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalVector< UnitType, NumericType >::XML ( const UnitType  unit) const
inline

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

Definition at line 133 of file DimensionalVector.hpp.

References PhQ::Abbreviation(), PhQ::DimensionalVector< UnitType, NumericType >::Value(), and PhQ::DimensionalVector< UnitType, NumericType >::XML().

◆ YAML() [1/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalVector< UnitType, NumericType >::YAML ( ) const
inline

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

Definition at line 143 of file DimensionalVector.hpp.

References PhQ::Abbreviation(), and PhQ::DimensionalVector< UnitType, NumericType >::value.

Referenced by PhQ::DimensionalVector< UnitType, NumericType >::YAML().

◆ YAML() [2/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalVector< UnitType, NumericType >::YAML ( const UnitType  unit) const
inline

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

Definition at line 153 of file DimensionalVector.hpp.

References PhQ::Abbreviation(), PhQ::DimensionalVector< UnitType, NumericType >::Value(), and PhQ::DimensionalVector< UnitType, NumericType >::YAML().

Member Data Documentation

◆ value

template<typename UnitType , typename NumericType = double>
PhQ::Vector<NumericType> PhQ::DimensionalVector< UnitType, NumericType >::value
protected

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