13#ifndef EBGEOMETRY_BLEND_HPP
14#define EBGEOMETRY_BLEND_HPP
40 static_assert(std::is_floating_point_v<T>,
"ExpMinOp requires a floating-point type T");
51 operator()(
const T& a,
const T& b,
const T& s)
const noexcept
55 return Math::min(a, b) - s * std::log1p(std::exp(-std::abs(a - b) / s));
70 static_assert(std::is_floating_point_v<T>,
"ExpMaxOp requires a floating-point type T");
81 operator()(
const T& a,
const T& b,
const T& s)
const noexcept
85 return Math::max(a, b) + s * std::log1p(std::exp(-std::abs(a - b) / s));
100 static_assert(std::is_floating_point_v<T>,
"SmoothMinOp requires a floating-point type T");
111 operator()(
const T& a,
const T& b,
const T& s)
const noexcept
115 const T h =
Math::max(s - std::abs(a - b), T(0)) / s;
117 return Math::min(a, b) - T(0.25) * h * h * s;
131 static_assert(std::is_floating_point_v<T>,
"SmoothMaxOp requires a floating-point type T");
142 operator()(
const T& a,
const T& b,
const T& s)
const noexcept
146 const T h =
Math::max(s - std::abs(a - b), T(0)) / s;
148 return Math::max(a, b) + T(0.25) * h * h * s;
GPU portability layer: host/device decoration macros and backend detection.
#define EBGEOMETRY_HOST_DEVICE
Mark a function as callable from both host and device code (no-op on host compilers).
Definition EBGeometry_GPU.hpp:80
Utility macros for EBGeometry.
#define EBGEOMETRY_EXPECT(cond)
Runtime precondition assertion for EBGeometry.
Definition EBGeometry_Macros.hpp:155
Scalar helpers and numeric limits that compile for both host and device.
constexpr T max(const T &a_a, const T &a_b) noexcept
The larger of two values.
Definition EBGeometry_Math.hpp:61
constexpr T min(const T &a_a, const T &a_b) noexcept
The smaller of two values.
Definition EBGeometry_Math.hpp:44
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26
constexpr ExpMaxOp< T > ExpMax
The exponential smooth maximum, as a ready-made function object: ExpMax<T>(a, b, s).
Definition EBGeometry_Blend.hpp:166
constexpr ExpMinOp< T > ExpMin
The exponential smooth minimum, as a ready-made function object: ExpMin<T>(a, b, s).
Definition EBGeometry_Blend.hpp:158
constexpr SmoothMaxOp< T > SmoothMax
The polynomial smooth maximum, as a ready-made function object: SmoothMax<T>(a, b,...
Definition EBGeometry_Blend.hpp:182
constexpr SmoothMinOp< T > SmoothMin
The polynomial smooth minimum, as a ready-made function object: SmoothMin<T>(a, b,...
Definition EBGeometry_Blend.hpp:174
Exponential smooth maximum for blending two signed-distance values.
Definition EBGeometry_Blend.hpp:69
T operator()(const T &a, const T &b, const T &s) const noexcept
Evaluate the exponential smooth maximum.
Definition EBGeometry_Blend.hpp:81
Exponential smooth minimum for blending two signed-distance values.
Definition EBGeometry_Blend.hpp:39
T operator()(const T &a, const T &b, const T &s) const noexcept
Evaluate the exponential smooth minimum.
Definition EBGeometry_Blend.hpp:51
Quadratic polynomial smooth maximum for blending two signed-distance values.
Definition EBGeometry_Blend.hpp:130
T operator()(const T &a, const T &b, const T &s) const noexcept
Evaluate the polynomial smooth maximum.
Definition EBGeometry_Blend.hpp:142
Quadratic polynomial smooth minimum for blending two signed-distance values.
Definition EBGeometry_Blend.hpp:99
T operator()(const T &a, const T &b, const T &s) const noexcept
Evaluate the polynomial smooth minimum.
Definition EBGeometry_Blend.hpp:111