EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Classes | Functions
EBGeometry::Math Namespace Reference

Scalar helpers and numeric limits usable in host and device code. More...

Classes

struct  IntegerLimits
 Numeric limits of an integer type, from its climits constants. More...
 
struct  Limits
 Numeric limits, with the meanings of the std::numeric_limits members of the same names. More...
 
struct  Limits< double >
 Numeric limits of double. More...
 
struct  Limits< float >
 Numeric limits of float. More...
 
struct  Limits< int >
 Numeric limits of int. More...
 
struct  Limits< long >
 Numeric limits of long. More...
 
struct  Limits< long long >
 Numeric limits of long long. More...
 
struct  Limits< unsigned int >
 Numeric limits of unsigned int. More...
 
struct  Limits< unsigned long >
 Numeric limits of unsigned long. More...
 
struct  Limits< unsigned long long >
 Numeric limits of unsigned long long. More...
 

Functions

template<class T >
constexpr T min (const T &a_a, const T &a_b) noexcept
 The smaller of two values.
 
template<class T >
constexpr T max (const T &a_a, const T &a_b) noexcept
 The larger of two values.
 
template<class T >
constexpr T clamp (const T &a_value, const T &a_lo, const T &a_hi) noexcept
 A value limited to [lo, hi].
 

Detailed Description

Scalar helpers and numeric limits usable in host and device code.

Function Documentation

◆ clamp()

template<class T >
constexpr T EBGeometry::Math::clamp ( const T &  a_value,
const T &  a_lo,
const T &  a_hi 
)
constexprnoexcept

A value limited to [lo, hi].

The caller must ensure lo <= hi. A NaN value is returned unchanged, like std::clamp.

Template Parameters
TType with operator<.
Parameters
[in]a_valueValue to limit.
[in]a_loLower bound.
[in]a_hiUpper bound.
Returns
a_lo if the value is below it, a_hi if it is above it, else the value.

◆ max()

template<class T >
constexpr T EBGeometry::Math::max ( const T &  a_a,
const T &  a_b 
)
constexprnoexcept

The larger of two values.

Returns a_a when the two compare equal, and when either is NaN returns a_a, like std::max.

Template Parameters
TType with operator<.
Parameters
[in]a_aFirst value.
[in]a_bSecond value.
Returns
The larger value.

◆ min()

template<class T >
constexpr T EBGeometry::Math::min ( const T &  a_a,
const T &  a_b 
)
constexprnoexcept

The smaller of two values.

Returns a_a when the two compare equal, and when either is NaN returns a_a, like std::min.

Template Parameters
TType with operator<.
Parameters
[in]a_aFirst value.
[in]a_bSecond value.
Returns
The smaller value.