Go to the documentation of this file.
25 #include "spdlog/fmt/ostr.h"
26 #include "spdlog/spdlog.h"
39 #define AD_PHYSICS_PARAMETRICVALUE_THROWS_EXCEPTION 1
41 #if SAFE_DATATYPES_EXPLICIT_CONVERSION
45 #define _AD_PHYSICS_PARAMETRICVALUE_EXPLICIT_CONVERSION_ explicit
50 #define _AD_PHYSICS_PARAMETRICVALUE_EXPLICIT_CONVERSION_
85 : mParametricValue(std::numeric_limits<double>::quiet_NaN())
95 : mParametricValue(iParametricValue)
138 return std::fabs(mParametricValue - other.mParametricValue) <
cPrecisionValue;
166 return (mParametricValue > other.mParametricValue) &&
operator!=(other);
182 return (mParametricValue < other.mParametricValue) &&
operator!=(other);
198 return ((mParametricValue > other.mParametricValue) ||
operator==(other));
214 return ((mParametricValue < other.mParametricValue) ||
operator==(other));
231 ParametricValue const result(mParametricValue + other.mParametricValue);
250 mParametricValue += other.mParametricValue;
269 ParametricValue const result(mParametricValue - other.mParametricValue);
288 mParametricValue -= other.mParametricValue;
344 double const result = mParametricValue / other.mParametricValue;
372 return mParametricValue;
384 auto const valueClass = std::fpclassify(mParametricValue);
385 return ((valueClass == FP_NORMAL) || (valueClass == FP_ZERO)) && (
cMinValue <= mParametricValue)
399 spdlog::info(
"ensureValid(::ad::physics::ParametricValue)>> {} value out of range", *
this);
400 #if (AD_PHYSICS_PARAMETRICVALUE_THROWS_EXCEPTION == 1)
401 throw std::out_of_range(
"ParametricValue value out of range");
417 spdlog::info(
"ensureValid(::ad::physics::ParametricValue)>> {} value is zero", *
this);
418 #if (AD_PHYSICS_PARAMETRICVALUE_THROWS_EXCEPTION == 1)
419 throw std::out_of_range(
"ParametricValue value is zero");
452 double mParametricValue;
470 return value.operator*(other);
481 inline ::ad::physics::ParametricValue
fabs(const ::ad::physics::ParametricValue other)
501 static inline ::ad::physics::ParametricValue
lowest()
503 return ::ad::physics::ParametricValue::getMin();
508 static inline ::ad::physics::ParametricValue
max()
510 return ::ad::physics::ParametricValue::getMax();
516 static inline ::ad::physics::ParametricValue
epsilon()
518 return ::ad::physics::ParametricValue::getPrecision();
527 #ifndef GEN_GUARD_AD_PHYSICS_PARAMETRICVALUE
528 #define GEN_GUARD_AD_PHYSICS_PARAMETRICVALUE
549 return os << double(_value);
561 return to_string(
static_cast<double>(value));
564 #endif // GEN_GUARD_AD_PHYSICS_PARAMETRICVALUE
namespace ad
Definition: Acceleration.hpp:30
static const double cMinValue
constant defining the minimum valid ParametricValue value (used in isValid())
Definition: ParametricValue.hpp:65
double operator/(const ParametricValue &other) const
standard arithmetic operator
Definition: ParametricValue.hpp:340
ParametricValue operator-=(const ParametricValue &other)
standard arithmetic operator
Definition: ParametricValue.hpp:284
static ParametricValue getPrecision()
get assumed accuracy of ParametricValue (i.e. cPrecisionValue)
Definition: ParametricValue.hpp:443
bool operator>(const ParametricValue &other) const
standard comparison operator
Definition: ParametricValue.hpp:162
static const double cPrecisionValue
constant defining the assumed ParametricValue value accuracy (used in comparison operator==(),...
Definition: ParametricValue.hpp:76
bool operator>=(const ParametricValue &other) const
standard comparison operator
Definition: ParametricValue.hpp:194
ParametricValue operator/(const double &scalar) const
standard arithmetic operator
Definition: ParametricValue.hpp:321
bool operator==(const ParametricValue &other) const
standard comparison operator
Definition: ParametricValue.hpp:134
bool operator!=(const ParametricValue &other) const
standard comparison operator
Definition: ParametricValue.hpp:148
_AD_PHYSICS_PARAMETRICVALUE_EXPLICIT_CONVERSION_ ParametricValue(double const iParametricValue)
standard constructor
Definition: ParametricValue.hpp:94
static inline ::ad::physics::ParametricValue max()
Definition: ParametricValue.hpp:508
static ParametricValue getMin()
get minimum valid ParametricValue (i.e. cMinValue)
Definition: ParametricValue.hpp:427
ParametricValue operator+(const ParametricValue &other) const
standard arithmetic operator
Definition: ParametricValue.hpp:227
inline ::ad::physics::ParametricValue operator*(const double &other, ::ad::physics::ParametricValue const &value)
standard arithmetic operator
Definition: ParametricValue.hpp:468
static inline ::ad::physics::ParametricValue lowest()
Definition: ParametricValue.hpp:501
static ParametricValue getMax()
get maximum valid ParametricValue (i.e. cMaxValue)
Definition: ParametricValue.hpp:435
ParametricValue operator-(const ParametricValue &other) const
standard arithmetic operator
Definition: ParametricValue.hpp:265
DataType ParametricValue.
Definition: ParametricValue.hpp:59
ParametricValue operator-() const
standard arithmetic operator
Definition: ParametricValue.hpp:356
static inline ::ad::physics::ParametricValue epsilon()
Definition: ParametricValue.hpp:516
ParametricValue & operator+=(const ParametricValue &other)
standard arithmetic operator
Definition: ParametricValue.hpp:246
ParametricValue & operator=(const ParametricValue &other)=default
standard assignment operator
inline ::ad::physics::Weight fabs(const ::ad::physics::Weight other)
overload of the std::fabs for Weight
Definition: Weight.hpp:480
inline ::ad::physics::Acceleration fabs(const ::ad::physics::Acceleration other)
overload of the std::fabs for Acceleration
Definition: Acceleration.hpp:481
std::string to_string(::ad::physics::Acceleration const &value)
overload of the std::to_string for Acceleration
Definition: Acceleration.hpp:559
bool isValid() const
Definition: ParametricValue.hpp:382
void ensureValidNonZero() const
ensure that the ParametricValue is valid and non zero
Definition: ParametricValue.hpp:412
void ensureValid() const
ensure that the ParametricValue is valid
Definition: ParametricValue.hpp:395
#define _AD_PHYSICS_PARAMETRICVALUE_EXPLICIT_CONVERSION_
Enable/Disable explicit conversion. Currently set to "implicit conversion allowed".
Definition: ParametricValue.hpp:50
ParametricValue()
default constructor
Definition: ParametricValue.hpp:84
std::ostream & operator<<(std::ostream &os, Acceleration const &_value)
standard ostream operator
Definition: Acceleration.hpp:547
static const double cMaxValue
constant defining the maximum valid ParametricValue value (used in isValid())
Definition: ParametricValue.hpp:70
bool operator<(const ParametricValue &other) const
standard comparison operator
Definition: ParametricValue.hpp:178
ParametricValue operator*(const double &scalar) const
standard arithmetic operator
Definition: ParametricValue.hpp:303
bool operator<=(const ParametricValue &other) const
standard comparison operator
Definition: ParametricValue.hpp:210