Fast Methods for Cosmological Simulations
FastSim serves as a tool for quick N-body simulations in modified gravity.
Catch::Detail::Approx Class Reference

#include <catch.hpp>

Public Member Functions

 Approx (double value)
 
Approx operator- () const
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx operator() (T const &value)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
 Approx (T const &value)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approxepsilon (T const &newEpsilon)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approxmargin (T const &newMargin)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approxscale (T const &newScale)
 
std::string toString () const
 

Static Public Member Functions

static Approx custom ()
 

Private Member Functions

bool equalityComparisonImpl (double other) const
 
void setMargin (double margin)
 
void setEpsilon (double epsilon)
 

Private Attributes

double m_epsilon
 
double m_margin
 
double m_scale
 
double m_value
 

Friends

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator== (const T &lhs, Approx const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator== (Approx const &lhs, const T &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator!= (T const &lhs, Approx const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator!= (Approx const &lhs, T const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator<= (T const &lhs, Approx const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator<= (Approx const &lhs, T const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator>= (T const &lhs, Approx const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator>= (Approx const &lhs, T const &rhs)
 

Detailed Description

Definition at line 2276 of file catch.hpp.

Constructor & Destructor Documentation

Catch::Detail::Approx::Approx ( double  value)
explicit
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Catch::Detail::Approx::Approx ( T const &  value)
inlineexplicit

Definition at line 2303 of file catch.hpp.

References Catch::Generators::value().

2303  : Approx(static_cast<double>(value))
2304  {}
Approx(double value)
auto value(T const &val) -> Generator< T >
Definition: catch.hpp:3177

Member Function Documentation

static Approx Catch::Detail::Approx::custom ( )
static
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx& Catch::Detail::Approx::epsilon ( T const &  newEpsilon)
inline

Definition at line 2348 of file catch.hpp.

References Catch::Generators::value().

2348  {
2349  double epsilonAsDouble = static_cast<double>(newEpsilon);
2350  setEpsilon(epsilonAsDouble);
2351  return *this;
2352  }
void setEpsilon(double epsilon)
bool Catch::Detail::Approx::equalityComparisonImpl ( double  other) const
private
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx& Catch::Detail::Approx::margin ( T const &  newMargin)
inline

Definition at line 2355 of file catch.hpp.

References Catch::Generators::value().

2355  {
2356  double marginAsDouble = static_cast<double>(newMargin);
2357  setMargin(marginAsDouble);
2358  return *this;
2359  }
void setMargin(double margin)
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx Catch::Detail::Approx::operator() ( T const &  value)
inline

Definition at line 2294 of file catch.hpp.

References m_epsilon, m_margin, m_scale, and Catch::Generators::value().

2294  {
2295  Approx approx( static_cast<double>(value) );
2296  approx.m_epsilon = m_epsilon;
2297  approx.m_margin = m_margin;
2298  approx.m_scale = m_scale;
2299  return approx;
2300  }
auto value(T const &val) -> Generator< T >
Definition: catch.hpp:3177
Approx Catch::Detail::Approx::operator- ( ) const
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx& Catch::Detail::Approx::scale ( T const &  newScale)
inline

Definition at line 2362 of file catch.hpp.

2362  {
2363  m_scale = static_cast<double>(newScale);
2364  return *this;
2365  }
void Catch::Detail::Approx::setEpsilon ( double  epsilon)
private
void Catch::Detail::Approx::setMargin ( double  margin)
private
std::string Catch::Detail::Approx::toString ( ) const

Friends And Related Function Documentation

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator!= ( T const &  lhs,
Approx const &  rhs 
)
friend

Definition at line 2318 of file catch.hpp.

2318  {
2319  return !operator==( lhs, rhs );
2320  }
friend bool operator==(const T &lhs, Approx const &rhs)
Definition: catch.hpp:2307
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator!= ( Approx const &  lhs,
T const &  rhs 
)
friend

Definition at line 2323 of file catch.hpp.

2323  {
2324  return !operator==( rhs, lhs );
2325  }
friend bool operator==(const T &lhs, Approx const &rhs)
Definition: catch.hpp:2307
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator<= ( T const &  lhs,
Approx const &  rhs 
)
friend

Definition at line 2328 of file catch.hpp.

2328  {
2329  return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;
2330  }
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator<= ( Approx const &  lhs,
T const &  rhs 
)
friend

Definition at line 2333 of file catch.hpp.

2333  {
2334  return lhs.m_value < static_cast<double>(rhs) || lhs == rhs;
2335  }
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator== ( const T &  lhs,
Approx const &  rhs 
)
friend

Definition at line 2307 of file catch.hpp.

2307  {
2308  auto lhs_v = static_cast<double>(lhs);
2309  return rhs.equalityComparisonImpl(lhs_v);
2310  }
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator== ( Approx const &  lhs,
const T &  rhs 
)
friend

Definition at line 2313 of file catch.hpp.

2313  {
2314  return operator==( rhs, lhs );
2315  }
friend bool operator==(const T &lhs, Approx const &rhs)
Definition: catch.hpp:2307
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator>= ( T const &  lhs,
Approx const &  rhs 
)
friend

Definition at line 2338 of file catch.hpp.

2338  {
2339  return static_cast<double>(lhs) > rhs.m_value || lhs == rhs;
2340  }
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator>= ( Approx const &  lhs,
T const &  rhs 
)
friend

Definition at line 2343 of file catch.hpp.

2343  {
2344  return lhs.m_value > static_cast<double>(rhs) || lhs == rhs;
2345  }

Member Data Documentation

double Catch::Detail::Approx::m_epsilon
private

Definition at line 2370 of file catch.hpp.

Referenced by operator()().

double Catch::Detail::Approx::m_margin
private

Definition at line 2371 of file catch.hpp.

Referenced by operator()().

double Catch::Detail::Approx::m_scale
private

Definition at line 2372 of file catch.hpp.

Referenced by operator()().

double Catch::Detail::Approx::m_value
private

Definition at line 2373 of file catch.hpp.


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