Go to the documentation of this file.
25 #include "spdlog/fmt/ostr.h"
26 #include "spdlog/spdlog.h"
39 #define AD_PHYSICS_SPEEDSQUARED_THROWS_EXCEPTION 1
41 #if SAFE_DATATYPES_EXPLICIT_CONVERSION
45 #define _AD_PHYSICS_SPEEDSQUARED_EXPLICIT_CONVERSION_ explicit
50 #define _AD_PHYSICS_SPEEDSQUARED_EXPLICIT_CONVERSION_
93 : mSpeedSquared(std::numeric_limits<double>::quiet_NaN())
103 : mSpeedSquared(iSpeedSquared)
146 return std::fabs(mSpeedSquared - other.mSpeedSquared) <
cPrecisionValue;
174 return (mSpeedSquared > other.mSpeedSquared) &&
operator!=(other);
190 return (mSpeedSquared < other.mSpeedSquared) &&
operator!=(other);
206 return ((mSpeedSquared > other.mSpeedSquared) ||
operator==(other));
222 return ((mSpeedSquared < other.mSpeedSquared) ||
operator==(other));
239 SpeedSquared const result(mSpeedSquared + other.mSpeedSquared);
258 mSpeedSquared += other.mSpeedSquared;
277 SpeedSquared const result(mSpeedSquared - other.mSpeedSquared);
296 mSpeedSquared -= other.mSpeedSquared;
332 SpeedSquared const result(
operator/(scalarSpeedSquared));
352 double const result = mSpeedSquared / other.mSpeedSquared;
380 return mSpeedSquared;
392 auto const valueClass = std::fpclassify(mSpeedSquared);
393 return ((valueClass == FP_NORMAL) || (valueClass == FP_ZERO)) && (
cMinValue <= mSpeedSquared)
407 spdlog::info(
"ensureValid(::ad::physics::SpeedSquared)>> {} value out of range", *
this);
408 #if (AD_PHYSICS_SPEEDSQUARED_THROWS_EXCEPTION == 1)
409 throw std::out_of_range(
"SpeedSquared value out of range");
425 spdlog::info(
"ensureValid(::ad::physics::SpeedSquared)>> {} value is zero", *
this);
426 #if (AD_PHYSICS_SPEEDSQUARED_THROWS_EXCEPTION == 1)
427 throw std::out_of_range(
"SpeedSquared value is zero");
460 double mSpeedSquared;
478 return value.operator*(other);
489 inline ::ad::physics::SpeedSquared
fabs(const ::ad::physics::SpeedSquared other)
509 static inline ::ad::physics::SpeedSquared
lowest()
511 return ::ad::physics::SpeedSquared::getMin();
516 static inline ::ad::physics::SpeedSquared
max()
518 return ::ad::physics::SpeedSquared::getMax();
524 static inline ::ad::physics::SpeedSquared
epsilon()
526 return ::ad::physics::SpeedSquared::getPrecision();
542 #ifndef GEN_GUARD_AD_PHYSICS_SPEEDSQUARED
543 #define GEN_GUARD_AD_PHYSICS_SPEEDSQUARED
564 return os << double(_value);
576 return to_string(
static_cast<double>(value));
579 #endif // GEN_GUARD_AD_PHYSICS_SPEEDSQUARED
bool operator>(const SpeedSquared &other) const
standard comparison operator
Definition: SpeedSquared.hpp:170
SpeedSquared operator*(const double &scalar) const
standard arithmetic operator
Definition: SpeedSquared.hpp:311
namespace ad
Definition: Acceleration.hpp:30
bool operator>=(const SpeedSquared &other) const
standard comparison operator
Definition: SpeedSquared.hpp:202
static SpeedSquared getMin()
get minimum valid SpeedSquared (i.e. cMinValue)
Definition: SpeedSquared.hpp:435
DataType Speed.
Definition: Speed.hpp:68
bool isValid() const
Definition: SpeedSquared.hpp:390
static const double cMinValue
constant defining the minimum valid SpeedSquared value (used in isValid())
Definition: SpeedSquared.hpp:73
double operator/(const SpeedSquared &other) const
standard arithmetic operator
Definition: SpeedSquared.hpp:348
static const double cPrecisionValue
constant defining the assumed SpeedSquared value accuracy (used in comparison operator==(),...
Definition: SpeedSquared.hpp:84
SpeedSquared operator-() const
standard arithmetic operator
Definition: SpeedSquared.hpp:364
void ensureValidNonZero() const
ensure that the SpeedSquared is valid and non zero
Definition: SpeedSquared.hpp:420
SpeedSquared & operator+=(const SpeedSquared &other)
standard arithmetic operator
Definition: SpeedSquared.hpp:254
static inline ::ad::physics::SpeedSquared max()
Definition: SpeedSquared.hpp:516
static SpeedSquared getMax()
get maximum valid SpeedSquared (i.e. cMaxValue)
Definition: SpeedSquared.hpp:443
static SpeedSquared getPrecision()
get assumed accuracy of SpeedSquared (i.e. cPrecisionValue)
Definition: SpeedSquared.hpp:451
bool operator<(const SpeedSquared &other) const
standard comparison operator
Definition: SpeedSquared.hpp:186
static const double cMaxValue
constant defining the maximum valid SpeedSquared value (used in isValid())
Definition: SpeedSquared.hpp:78
bool operator<=(const SpeedSquared &other) const
standard comparison operator
Definition: SpeedSquared.hpp:218
void ensureValid() const
ensure that the SpeedSquared is valid
Definition: SpeedSquared.hpp:403
SpeedSquared operator-=(const SpeedSquared &other)
standard arithmetic operator
Definition: SpeedSquared.hpp:292
SpeedSquared operator-(const SpeedSquared &other) const
standard arithmetic operator
Definition: SpeedSquared.hpp:273
DataType SpeedSquared.
Definition: SpeedSquared.hpp:67
inline ::ad::physics::Weight fabs(const ::ad::physics::Weight other)
overload of the std::fabs for Weight
Definition: Weight.hpp:480
SpeedSquared operator/(const double &scalar) const
standard arithmetic operator
Definition: SpeedSquared.hpp:329
inline ::ad::physics::Acceleration fabs(const ::ad::physics::Acceleration other)
overload of the std::fabs for Acceleration
Definition: Acceleration.hpp:481
SpeedSquared()
default constructor
Definition: SpeedSquared.hpp:92
SpeedSquared operator+(const SpeedSquared &other) const
standard arithmetic operator
Definition: SpeedSquared.hpp:235
static inline ::ad::physics::SpeedSquared lowest()
Definition: SpeedSquared.hpp:509
std::string to_string(::ad::physics::Acceleration const &value)
overload of the std::to_string for Acceleration
Definition: Acceleration.hpp:559
SpeedSquared & operator=(const SpeedSquared &other)=default
standard assignment operator
#define _AD_PHYSICS_SPEEDSQUARED_EXPLICIT_CONVERSION_
Enable/Disable explicit conversion. Currently set to "implicit conversion allowed".
Definition: SpeedSquared.hpp:50
inline ::ad::physics::SpeedSquared operator*(const double &other, ::ad::physics::SpeedSquared const &value)
standard arithmetic operator
Definition: SpeedSquared.hpp:476
_AD_PHYSICS_SPEEDSQUARED_EXPLICIT_CONVERSION_ SpeedSquared(double const iSpeedSquared)
standard constructor
Definition: SpeedSquared.hpp:102
bool operator==(const SpeedSquared &other) const
standard comparison operator
Definition: SpeedSquared.hpp:142
std::ostream & operator<<(std::ostream &os, Acceleration const &_value)
standard ostream operator
Definition: Acceleration.hpp:547
bool operator!=(const SpeedSquared &other) const
standard comparison operator
Definition: SpeedSquared.hpp:156
static inline ::ad::physics::SpeedSquared epsilon()
Definition: SpeedSquared.hpp:524