AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
Utilities.hpp File Reference

Header file containing utility functions. More...

#include "axom/config.hpp"
#include "axom/core/Types.hpp"
#include "axom/core/Macros.hpp"
#include <cassert>
#include <cmath>
#include <random>
#include <type_traits>

Classes

class  axom::utilities::LexiComparator< T >
 Compares std::vector< T > in lexicographic order. More...
 

Namespaces

 axom
 
 axom::utilities
 

Functions

void axom::utilities::processAbort ()
 Gracefully aborts the application. More...
 
template<typename T >
AXOM_HOST_DEVICEaxom::utilities::abs (const T &x)
 Returns the absolute value of x. More...
 
template<typename T >
AXOM_HOST_DEVICEaxom::utilities::floor (const T &x)
 Returns the largest integer less than or equal to x. More...
 
template<typename T >
AXOM_HOST_DEVICEaxom::utilities::ceil (const T &x)
 Returns the smallest integer greater than or equal to x. More...
 
template<typename T >
AXOM_HOST_DEVICE const T & axom::utilities::max (const T &x, const T &y)
 Returns the max value of x and y. More...
 
template<typename T >
AXOM_HOST_DEVICE const T & axom::utilities::min (const T &x, const T &y)
 Returns the min value of x and y. More...
 
template<typename T >
AXOM_HOST_DEVICE void axom::utilities::swap (T &a, T &b)
 Swaps the values of a, b. More...
 
template<typename T >
AXOM_HOST_DEVICEaxom::utilities::lerp (T A, T B, T t)
 returns the linear interpolation of A and B at t. i.e. (1-t)A+tB More...
 
template<typename T >
axom::utilities::log2 (T val)
 Returns the base 2 logarithm of the input. More...
 
template<typename T >
AXOM_HOST_DEVICEaxom::utilities::clampVal (T val, T lower, T upper)
 Clamps an input value to a given range. More...
 
template<typename T >
AXOM_HOST_DEVICEaxom::utilities::clampUpper (T val, T upper)
 Clamps the upper range on an input value. More...
 
template<typename T >
AXOM_HOST_DEVICEaxom::utilities::clampLower (T val, T lower)
 Clamps the lower range on an input value. More...
 
int axom::utilities::binomialCoefficient (int n, int k)
 Computes the binomial coefficient n choose k More...
 
template<typename T >
axom::utilities::random_real (const T &a, const T &b)
 Returns a random real number within the specified interval. More...
 
template<typename T >
axom::utilities::random_real (const T &a, const T &b, unsigned int seed)
 Returns a random real number within the specified interval given the bounds of the interval and a seed value for the underlying random number generator. More...
 
bool axom::utilities::isLittleEndian ()
 Tests the endianness of the system. More...
 
template<typename T >
constexpr T axom::utilities::byteswap (T val) noexcept
 Reverses the bytes of the input value. More...
 
template<typename RealType >
AXOM_HOST_DEVICE bool axom::utilities::isNearlyEqual (RealType a, RealType b, RealType thresh=1.0e-8)
 Fuzzy comparison of two real valued quantities. More...
 
template<typename RealType >
AXOM_HOST_DEVICE bool axom::utilities::isNearlyEqualRelative (RealType a, RealType b, RealType relThresh=1.0e-6, RealType absThresh=1.0e-8)
 Fuzzy comparison of two real valued quantities. More...
 
template<typename DataType , typename Predicate = std::less<DataType>>
AXOM_HOST_DEVICE void axom::utilities::insertionSort (DataType *array, IndexType n, Predicate cmp={})
 Insertion sort of an array. More...
 

Detailed Description

Header file containing utility functions.