EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
EBGeometry_Math.hpp File Reference

Scalar helpers and numeric limits that compile for both host and device. More...

#include <cfloat>
#include <climits>
#include <cmath>
#include "EBGeometry_GPU.hpp"
Include dependency graph for EBGeometry_Math.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  EBGeometry::Math::Limits< float >
 Numeric limits of float. More...
 
struct  EBGeometry::Math::Limits< double >
 Numeric limits of double. More...
 
struct  EBGeometry::Math::IntegerLimits< T, Lowest, Max >
 Numeric limits of an integer type, from its climits constants. More...
 
struct  EBGeometry::Math::Limits< int >
 Numeric limits of int. More...
 
struct  EBGeometry::Math::Limits< unsigned int >
 Numeric limits of unsigned int. More...
 
struct  EBGeometry::Math::Limits< long >
 Numeric limits of long. More...
 
struct  EBGeometry::Math::Limits< unsigned long >
 Numeric limits of unsigned long. More...
 
struct  EBGeometry::Math::Limits< long long >
 Numeric limits of long long. More...
 
struct  EBGeometry::Math::Limits< unsigned long long >
 Numeric limits of unsigned long long. More...
 

Namespaces

namespace  EBGeometry
 Namespace containing all of EBGeometry's functionality.
 
namespace  EBGeometry::Math
 Scalar helpers and numeric limits usable in host and device code.
 

Functions

template<class T >
constexpr T EBGeometry::Math::min (const T &a_a, const T &a_b) noexcept
 The smaller of two values.
 
template<class T >
constexpr T EBGeometry::Math::max (const T &a_a, const T &a_b) noexcept
 The larger of two values.
 
template<class T >
constexpr T EBGeometry::Math::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 that compile for both host and device.

std::min, std::max, std::clamp and std::numeric_limits are constexpr host functions. nvcc rejects them in device code unless every translation unit is compiled with –expt-relaxed-constexpr, and a standard library update can make them unusable on a device altogether (libstdc++ 14's std::clamp asserts through a host-only function). The library uses these instead, everywhere under Source/; Scripts/CheckDeviceMath.py enforces that.

Author
Robert Marskar