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::DimensionalDyad< UnitType, NumericType > Class Template Reference

Abstract base class that represents any dimensional dyadic tensor physical quantity. Such a physical quantity is composed of a value and a unit of measure where the value is a three-dimensional dyadic tensor. The tensor may be non-symmetric. More...

#include "DimensionalDyad.hpp"

Public Member Functions

constexpr const PhQ::Dyad< NumericType > & Value () const noexcept
 Value of this physical quantity expressed in its standard unit of measure. More...
 
PhQ::Dyad< NumericType > Value (const UnitType unit) const
 Value of this physical quantity expressed in a given unit of measure. More...
 
template<UnitType NewUnit>
constexpr PhQ::Dyad< 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::Dyad< 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::Dyad< 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

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

Protected Attributes

PhQ::Dyad< 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::DimensionalDyad< UnitType, NumericType >

Abstract base class that represents any dimensional dyadic tensor physical quantity. Such a physical quantity is composed of a value and a unit of measure where the value is a three-dimensional dyadic tensor. The tensor may be non-symmetric.

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 DimensionalDyad.hpp.

Constructor & Destructor Documentation

◆ DimensionalDyad() [1/6]

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

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

◆ DimensionalDyad() [2/6]

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

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

Definition at line 168 of file DimensionalDyad.hpp.

◆ DimensionalDyad() [3/6]

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

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

Definition at line 172 of file DimensionalDyad.hpp.

References PhQ::ConvertInPlace().

◆ ~DimensionalDyad()

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

Destructor. Destroys this dimensional dyadic tensor physical quantity.

◆ DimensionalDyad() [4/6]

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

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

◆ DimensionalDyad() [5/6]

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

Copy constructor. Constructs a dimensional dyadic tensor 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 DimensionalDyad.hpp.

◆ DimensionalDyad() [6/6]

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

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

Member Function Documentation

◆ Dimensions()

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

Physical dimension set of this physical quantity.

Definition at line 50 of file DimensionalDyad.hpp.

◆ JSON() [1/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalDyad< 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 DimensionalDyad.hpp.

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

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

◆ JSON() [2/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalDyad< 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 DimensionalDyad.hpp.

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

◆ MutableValue()

template<typename UnitType , typename NumericType = double>
constexpr PhQ::Dyad<NumericType>& PhQ::DimensionalDyad< 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 DimensionalDyad.hpp.

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

◆ operator=() [1/3]

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

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

◆ operator=() [2/3]

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

Copy assignment operator. Assigns this dimensional dyadic tensor 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 DimensionalDyad.hpp.

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

◆ operator=() [3/3]

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

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

◆ Print() [1/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalDyad< 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 DimensionalDyad.hpp.

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

Referenced by PhQ::operator<<().

◆ Print() [2/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalDyad< 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 DimensionalDyad.hpp.

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

◆ SetValue()

template<typename UnitType , typename NumericType = double>
constexpr void PhQ::DimensionalDyad< UnitType, NumericType >::SetValue ( const PhQ::Dyad< 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 DimensionalDyad.hpp.

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

◆ StaticValue()

template<typename UnitType , typename NumericType = double>
template<UnitType NewUnit>
constexpr PhQ::Dyad<NumericType> PhQ::DimensionalDyad< 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 DimensionalDyad.hpp.

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

◆ Unit()

template<typename UnitType , typename NumericType = double>
static constexpr UnitType PhQ::DimensionalDyad< 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 DimensionalDyad.hpp.

◆ Value() [1/2]

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

◆ Value() [2/2]

template<typename UnitType , typename NumericType = double>
PhQ::Dyad<NumericType> PhQ::DimensionalDyad< 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 DimensionalDyad.hpp.

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

◆ XML() [1/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalDyad< 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 DimensionalDyad.hpp.

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

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

◆ XML() [2/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalDyad< 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 DimensionalDyad.hpp.

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

◆ YAML() [1/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalDyad< 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 DimensionalDyad.hpp.

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

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

◆ YAML() [2/2]

template<typename UnitType , typename NumericType = double>
std::string PhQ::DimensionalDyad< 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 DimensionalDyad.hpp.

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

Member Data Documentation

◆ value

template<typename UnitType , typename NumericType = double>
PhQ::Dyad<NumericType> PhQ::DimensionalDyad< UnitType, NumericType >::value
protected

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