Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_Algorithm.H File Reference
#include <AMReX_Config.H>
#include <AMReX_GpuQualifiers.H>
#include <AMReX_Extension.H>
#include <AMReX_Dim3.H>
#include <AMReX_BLassert.H>
#include <AMReX_Math.H>
#include <algorithm>
#include <concepts>
#include <limits>
#include <type_traits>
#include <cstdint>
#include <climits>

Go to the source code of this file.

Namespaces

namespace  amrex
 

Functions

template<class T >
__host__ __device__ constexpr const T & amrex::min (const T &a, const T &b) noexcept
 
template<class T , class ... Ts>
__host__ __device__ constexpr const T & amrex::min (const T &a, const T &b, const Ts &... c) noexcept
 
template<class T >
__host__ __device__ constexpr const T & amrex::max (const T &a, const T &b) noexcept
 
template<class T , class ... Ts>
__host__ __device__ constexpr const T & amrex::max (const T &a, const T &b, const Ts &... c) noexcept
 
template<class T >
__host__ __device__ constexpr T amrex::elemwiseMin (T const &a, T const &b) noexcept
 Return the element-wise minimum of the given values for types like XDim3.
 
template<class T , class ... Ts>
__host__ __device__ constexpr T amrex::elemwiseMin (const T &a, const T &b, const Ts &... c) noexcept
 Return the element-wise minimum of the given values for types like XDim3.
 
template<class T >
__host__ __device__ constexpr T amrex::elemwiseMax (T const &a, T const &b) noexcept
 Return the element-wise maximum of the given values for types like XDim3.
 
template<class T , class ... Ts>
__host__ __device__ constexpr T amrex::elemwiseMax (const T &a, const T &b, const Ts &... c) noexcept
 Return the element-wise maximum of the given values for types like XDim3.
 
template<typename T >
__host__ __device__ void amrex::Swap (T &t1, T &t2) noexcept
 
template<typename T >
__host__ __device__ constexpr const T & amrex::Clamp (const T &v, const T &lo, const T &hi)
 
template<std::floating_point T>
__host__ __device__ bool amrex::almostEqual (T x, T y, int ulp=2)
 
template<std::floating_point T, class F >
__host__ __device__ T amrex::bisect (T lo, T hi, F f, T tol=1e-12, int max_iter=100)
 Find a root of a scalar function on a bracketing interval using bisection.
 
template<typename T , std::integral I>
__host__ __device__ I amrex::bisect (T const *d, I lo, I hi, T const &v)
 Find the index of the interval containing a value in a sorted array.
 
template<typename ItType , typename ValType >
__host__ __device__ ItType amrex::upper_bound (ItType first, ItType last, const ValType &val)
 Return an iterator to the first element greater than a given value.
 
template<typename ItType , typename ValType >
__host__ __device__ ItType amrex::lower_bound (ItType first, ItType last, const ValType &val)
 Return an iterator to the first element not less than a given value.
 
template<typename ItType , std::floating_point ValType>
requires (std::floating_point<typename std::iterator_traits<ItType>::value_type>)
__host__ __device__ void amrex::linspace (ItType first, const ItType &last, const ValType &start, const ValType &stop)
 Fill a range with linearly spaced values over a closed interval.
 
template<typename ItType , std::floating_point ValType>
requires (std::floating_point<typename std::iterator_traits<ItType>::value_type>)
__host__ __device__ void amrex::logspace (ItType first, const ItType &last, const ValType &start, const ValType &stop, const ValType &base)
 Fill a range with logarithmically spaced values over a closed interval.
 
template<class T >
requires (std::same_as<std::remove_cvref_t<T>,std::uint8_t> || std::same_as<std::remove_cvref_t<T>,std::uint16_t> || std::same_as<std::remove_cvref_t<T>,std::uint32_t> || std::same_as<std::remove_cvref_t<T>,std::uint64_t>)
__host__ __device__ int amrex::clz (T x) noexcept
 Return the number of leading zeros of the given integer.