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 | Friends | List of all members
PhQ::ScalarForce< NumericType > Class Template Reference

Scalar force component or magnitude of a force vector. For a three-dimensional Euclidean force vector, see PhQ::Force. For a two-dimensional Euclidean force vector in the XY plane, see PhQ::PlanarForce. More...

#include "ScalarForce.hpp"

Public Member Functions

 ScalarForce ()=default
 Default constructor. Constructs a scalar force with an uninitialized value. More...
 
 ScalarForce (const NumericType value, const Unit::Force unit)
 Constructor. Constructs a scalar force with a given value expressed in a given force unit. More...
 
constexpr ScalarForce (const ScalarTraction< NumericType > &scalar_traction, const Area< NumericType > &area)
 Constructor. Constructs a scalar force from a given scalar traction and area using the definition of traction. More...
 
constexpr ScalarForce (const StaticPressure< NumericType > &static_pressure, const Area< NumericType > &area)
 Constructor. Constructs a scalar force from a given static pressure and area using the definition of pressure. More...
 
 ~ScalarForce () noexcept=default
 Destructor. Destroys this scalar force. More...
 
constexpr ScalarForce (const ScalarForce< NumericType > &other)=default
 Copy constructor. Constructs a scalar force by copying another one. More...
 
template<typename OtherNumericType >
constexpr ScalarForce (const ScalarForce< OtherNumericType > &other)
 Copy constructor. Constructs a scalar force by copying another one. More...
 
constexpr ScalarForce (ScalarForce< NumericType > &&other) noexcept=default
 Move constructor. Constructs a scalar force by moving another one. More...
 
constexpr ScalarForce< NumericType > & operator= (const ScalarForce< NumericType > &other)=default
 Copy assignment operator. Assigns this scalar force by copying another one. More...
 
template<typename OtherNumericType >
constexpr ScalarForce< NumericType > & operator= (const ScalarForce< OtherNumericType > &other)
 Copy assignment operator. Assigns this scalar force by copying another one. More...
 
constexpr ScalarForce< NumericType > & operator= (ScalarForce< NumericType > &&other) noexcept=default
 Move assignment operator. Assigns this scalar force by moving another one. More...
 
constexpr ScalarForce< NumericType > operator+ (const ScalarForce< NumericType > &scalar_force) const
 
constexpr ScalarForce< NumericType > operator- (const ScalarForce< NumericType > &scalar_force) const
 
constexpr ScalarForce< NumericType > operator* (const NumericType number) const
 
constexpr PlanarForce< NumericType > operator* (const PlanarDirection< NumericType > &planar_direction) const
 
constexpr Force< NumericType > operator* (const Direction< NumericType > &direction) const
 
constexpr ScalarForce< NumericType > operator/ (const NumericType number) const
 
constexpr StaticPressure< NumericType > operator/ (const Area< NumericType > &area) const
 
constexpr NumericType operator/ (const ScalarForce< NumericType > &scalar_force) const noexcept
 
constexpr void operator+= (const ScalarForce< NumericType > &scalar_force) noexcept
 
constexpr void operator-= (const ScalarForce< NumericType > &scalar_force) 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::Force 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::Force 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::Force 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::Force 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::Force 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 ScalarForce< NumericType > Zero ()
 Statically creates a scalar force of zero. More...
 
template<Unit::Force Unit>
static constexpr ScalarForce< NumericType > Create (const NumericType value)
 Statically creates a scalar force with a given value expressed in a given force unit. More...
 
static constexpr const PhQ::DimensionsDimensions ()
 Physical dimension set of this physical quantity. More...
 
static constexpr Unit::Force 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 ScalarForce (const NumericType value)
 Constructor. Constructs a scalar force with a given value expressed in the standard force unit. More...
 

Friends

template<typename OtherNumericType >
class PlanarForce
 
template<typename OtherNumericType >
class Force
 Force units. More...
 

Detailed Description

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

Scalar force component or magnitude of a force vector. For a three-dimensional Euclidean force vector, see PhQ::Force. For a two-dimensional Euclidean force vector in the XY plane, see PhQ::PlanarForce.

Definition at line 66 of file ScalarForce.hpp.

Constructor & Destructor Documentation

◆ ScalarForce() [1/8]

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

Default constructor. Constructs a scalar force with an uninitialized value.

◆ ScalarForce() [2/8]

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

Constructor. Constructs a scalar force with a given value expressed in a given force unit.

Definition at line 73 of file ScalarForce.hpp.

◆ ScalarForce() [3/8]

template<typename NumericType >
constexpr PhQ::ScalarForce< NumericType >::ScalarForce ( const ScalarTraction< NumericType > &  scalar_traction,
const Area< NumericType > &  area 
)
inlineconstexpr

Constructor. Constructs a scalar force from a given scalar traction and area using the definition of traction.

Definition at line 232 of file ScalarTraction.hpp.

◆ ScalarForce() [4/8]

template<typename NumericType >
constexpr PhQ::ScalarForce< NumericType >::ScalarForce ( const StaticPressure< NumericType > &  static_pressure,
const Area< NumericType > &  area 
)
inlineconstexpr

Constructor. Constructs a scalar force from a given static pressure and area using the definition of pressure.

Definition at line 248 of file StaticPressure.hpp.

◆ ~ScalarForce()

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

Destructor. Destroys this scalar force.

◆ ScalarForce() [5/8]

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

Copy constructor. Constructs a scalar force by copying another one.

◆ ScalarForce() [6/8]

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

Copy constructor. Constructs a scalar force by copying another one.

Definition at line 94 of file ScalarForce.hpp.

◆ ScalarForce() [7/8]

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

Move constructor. Constructs a scalar force by moving another one.

◆ ScalarForce() [8/8]

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

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

Definition at line 172 of file ScalarForce.hpp.

Member Function Documentation

◆ Create()

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

Statically creates a scalar force with a given value expressed in a given force unit.

Definition at line 121 of file ScalarForce.hpp.

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

◆ Dimensions()

static constexpr const PhQ::Dimensions& PhQ::DimensionalScalar< Unit::Force , 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::Force , 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::Force , double >::JSON ( const Unit::Force  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::Force , 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 >
constexpr Force< NumericType > PhQ::ScalarForce< NumericType >::operator* ( const Direction< NumericType > &  direction) const
inlineconstexpr

Definition at line 272 of file Force.hpp.

◆ operator*() [2/3]

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

◆ operator*() [3/3]

template<typename NumericType >
constexpr PlanarForce< NumericType > PhQ::ScalarForce< NumericType >::operator* ( const PlanarDirection< NumericType > &  planar_direction) const
inlineconstexpr

Definition at line 271 of file PlanarForce.hpp.

◆ operator*=()

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

◆ operator+()

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

◆ operator+=()

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

◆ operator-()

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

◆ operator-=()

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

◆ operator/() [1/3]

template<typename NumericType >
constexpr StaticPressure< NumericType > PhQ::ScalarForce< NumericType >::operator/ ( const Area< NumericType > &  area) const
inlineconstexpr

Definition at line 259 of file StaticPressure.hpp.

◆ operator/() [2/3]

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

◆ operator/() [3/3]

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

◆ operator/=()

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

◆ operator=() [1/3]

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

Copy assignment operator. Assigns this scalar force by copying another one.

◆ operator=() [2/3]

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

Copy assignment operator. Assigns this scalar force by copying another one.

Definition at line 105 of file ScalarForce.hpp.

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

◆ operator=() [3/3]

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

Move assignment operator. Assigns this scalar force by moving another one.

◆ Print() [1/2]

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

Statically creates a scalar force of zero.

Definition at line 115 of file ScalarForce.hpp.

Friends And Related Function Documentation

◆ Force

template<typename NumericType = double>
template<typename OtherNumericType >
friend class Force
friend

Force units.

Definition at line 179 of file ScalarForce.hpp.

◆ PlanarForce

template<typename NumericType = double>
template<typename OtherNumericType >
friend class PlanarForce
friend

Definition at line 176 of file ScalarForce.hpp.

Member Data Documentation

◆ value

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