OpenLB 1.7
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions | Variables
olb::util Namespace Reference

Namespaces

namespace  tensorIndices2D
 
namespace  tensorIndices3D
 

Classes

class  ADf
 Definition of a description of a algoritmic differentiation data type using the forward method. More...
 
struct  BaseTypeHelper
 
struct  BaseTypeHelper< double >
 
struct  BaseTypeHelper< float >
 
struct  BaseTypeHelper< int >
 
struct  BaseTypeHelper< long double >
 
class  BisectStepper
 Propose successive test values of a scalar (e.g. Re) to check stability of a system. More...
 
class  CircularBuffer
 Simple circular buffer to compute average and other quantities over pre-defined temporal windows. More...
 
struct  ContainerCreator
 Creates a container of type C. More...
 
struct  ContainerCreator< std::array< T, SIZE > >
 
struct  ContainerCreator< std::vector< T > >
 
struct  ContainerCreator< Vector< T, SIZE > >
 
struct  divides
 Wrapper of function object std::divides. More...
 
class  ExponentialMovingAverage
 Exponential moving average. More...
 
struct  has_identity_functor
 Indicates existence of F::identity_functor_type typedef. More...
 
struct  has_identity_functor< F, std::void_t< typename F::identity_functor_type > >
 Indicates existence of F::identity_functor_type typedef. More...
 
struct  is_adf
 
struct  is_adf< ADf< S, DIM > >
 
class  KahanSummator
 Accurate summation of floating point numbers with the Kahan algorithm Reduces round-off effects which arise if the total sum is significantly larger than the single summands. More...
 
struct  maxOp
 Wrapper function object for util::max. More...
 
struct  maxOp< void >
 
struct  minOp
 Wrapper function object for util::min. More...
 
struct  minOp< void >
 
struct  minus
 Wrapper of function object std::minus with special handling for bool. More...
 
struct  multiplies
 Wrapper of function object std::multiplies. More...
 
class  Newton1D
 1D Newton simple scheme More...
 
struct  plus
 Wrapper of function object std::plus. More...
 
struct  power
 Power function object. More...
 
class  Randomizer
 
struct  TensorVal
 Compute number of elements of a symmetric d-dimensional tensor. More...
 
class  TimeIntegrator
 Integration with the trapezoid rule. More...
 
class  TimeIntegratorsArray
 Helper class that manages an array of time integrators. More...
 
class  Timer
 How to use in Code: More...
 
class  TrapezRuleInt1D
 Trapezoidal rule. More...
 
class  ValueTracer
 Check time-convergence of a scalar. More...
 

Typedefs

template<typename S >
using StdVector = std::vector<S,std::allocator<S>>
 

Functions

template<typename T >
cpu::simd::Pack< T > sqrt (cpu::simd::Pack< T > value)
 
template<typename T >
cpu::simd::Pack< T > fabs (cpu::simd::Pack< T > value)
 
template<typename T >
cpu::simd::Pack< T > pow (cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
 
template<typename T , typename S >
cpu::simd::Pack< T > pow (cpu::simd::Pack< T > base, S exp)
 
template<typename T >
cpu::simd::Pack< T > min (cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
 
template<typename T >
cpu::simd::Pack< T > max (cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
 
template<typename T >
norm (const std::vector< T > &a)
 l2 norm of a vector of arbitrary length
 
template<typename T >
int sign (T val)
 
template<typename T >
bool aligned_to_x (const std::vector< T > &vec)
 
template<typename T >
bool aligned_to_y (const std::vector< T > &vec)
 
template<typename T >
bool aligned_to_z (const std::vector< T > &vec)
 
template<typename T >
bool aligned_to_grid (const std::vector< T > &vec)
 
bool intersect (int x0, int x1, int y0, int y1, int x0_, int x1_, int y0_, int y1_, int &newX0, int &newX1, int &newY0, int &newY1)
 
bool intersect (int x0, int x1, int y0, int y1, int z0, int z1, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, int &newX0, int &newX1, int &newY0, int &newY1, int &newZ0, int &newZ1)
 
bool contained (int x, int y, int x0, int x1, int y0, int y1)
 
bool contained (int x, int y, int z, int x0, int x1, int y0, int y1, int z0, int z1)
 
template<typename T >
sqr (T arg)
 
template<typename ARRAY_LIKE , unsigned D>
auto normSqr (const ARRAY_LIKE &u) any_platform
 Compute norm square of a d-dimensional vector.
 
template<unsigned D, typename ARRAY_LIKE >
auto norm (const ARRAY_LIKE &u)
 
template<typename T , unsigned D>
normSqr (const T *u) any_platform
 
template<typename T >
normSqr (std::initializer_list< T > data)
 
template<typename T , unsigned D, typename IMPL >
normSqr (const ScalarVector< T, D, IMPL > &u) any_platform
 Compute norm square of a d-dimensional vector.
 
template<typename T , int d>
scalarProduct (const T u1[d], const T u2[d])
 
template<typename T >
scalarProduct (const std::vector< T > &u1, const std::vector< T > &u2)
 
template<typename DESCRIPTOR , unsigned iVel, int value>
constexpr auto populationsContributingToVelocity () any_platform
 Return array of population indices where c[iVel] == value.
 
template<typename DESCRIPTOR , int... NORMAL>
constexpr auto populationsContributingToDirection () any_platform
 Return array of population indices where c[iPop][iD] == NORMAL[iD].
 
template<typename DESCRIPTORBASE >
int findVelocity (const int v[DESCRIPTORBASE::d]) any_platform
 
template<typename DESCRIPTOR , int direction, int orientation>
constexpr auto subIndexOutgoing () any_platform
 Compute opposites of wall-incoming population indices.
 
template<typename DESCRIPTOR , int direction, int orientation>
constexpr auto subIndexOutgoingRemaining () any_platform
 
template<typename DESCRIPTOR , int plane, int normal1, int normal2>
constexpr auto subIndexOutgoing3DonEdges () any_platform
 
template<typename DESCRIPTOR , int normalX, int normalY>
constexpr auto subIndexOutgoing2DonCorners () any_platform
 
template<typename DESCRIPTOR , int normalX, int normalY, int normalZ>
constexpr auto subIndexOutgoing3DonCorners () any_platform
 
template<typename DESCRIPTORBASE >
std::vector< int > remainingIndexes (const std::vector< int > &indices)
 finds all the remaining indexes of a lattice given some other indexes
 
template<typename T , typename DESCRIPTOR >
int get_nearest_link (const std::vector< T > &vec)
 Util Function for Wall Model of Malaspinas get link with smallest angle to a vector.
 
template<typename T , typename DESCRIPTOR >
densityFromPressure (T latticePressure)
 compute lattice density from lattice pressure
 
template<typename T , typename DESCRIPTOR >
pressureFromDensity (T latticeDensity)
 compute lattice pressure from lattice density
 
template<typename S , unsigned D, typename F1 , typename F2 >
bool distance (S &distance, const Vector< S, D > &origin, const Vector< S, D > &direction, S precision, S pitch, F1 isInside, F2 isInsideBoundingBox)
 
template<typename S , unsigned D, typename F1 , typename F2 >
bool distance (S &distance, const Vector< S, D > &origin, const Vector< S, D > &direction, S precision, F1 sdf, F2 isInsideBoundingBox, const unsigned maxIt=1e6)
 
template<typename S , unsigned D, bool normalizeDirection = true>
bool distance (S &distance, const Vector< S, D > &origin, const Vector< S, D > &direction, S precision, std::function< S(const Vector< S, D > &)> sdf, S maxDistance, const unsigned maxIt=1e6)
 
template<typename S , unsigned D, typename F1 , typename F2 >
bool bisectDistance (S &distance, const Vector< S, D > &origin, const Vector< S, D > &direction, S pitch, S precision, F1 isInside, F2 isInsideBoundingBox)
 Using a bisect to find the unsigned distance (false if distance was not found, true if distance was found)
 
template<typename S , unsigned D, typename F1 >
Vector< S, D > surfaceNormal (const Vector< S, D > &pos, const S meshSize, F1 sdf)
 
template<typename SAD >
void iniDiagonal (SAD *a, int dim)
 The variables of an array are set to be the differential variables.
 
template<typename C >
void iniDiagonal (C &a)
 
template<typename T , typename TAD >
void copyDerivatives (T *target, const TAD *source, int length)
 Copy the derivatives from an ADf array into an array.
 
template<typename T , typename S , template< typename > typename C>
C< T > copyAs (const C< S > &input)
 copy vector with specified typecast
 
template<typename S >
ADf< S, 1 > iniAD (const S source)
 copy value and initialize derivative
 
template<unsigned n, typename S >
ADf< S, n > * iniAD (const S *source)
 copy array values and initialize derivatives
 
template<unsigned n, typename S , template< typename > typename C>
C< ADf< S, n > > iniAD (const C< S > &source)
 copy values and initialize derivatives
 
template<typename S , typename F >
auto derivativeFAD (F f, const S input)
 Compute derivatives of a function f: S -> T via forward AD Signature is "V f(U)" so f is expected to accept and return a single value.
 
template<unsigned sourceDIM, typename S , typename F >
auto derivativeFAD (F f, const S *input)
 Compute derivatives of a function f: S^sourceDIM -> T via forward AD Signature is "V f(U*)" so f is expected to return a single value.
 
template<unsigned sourceDIM, typename T , typename S , typename F >
void derivativeFAD (F f, T *output, const S *input, unsigned targetDIM)
 Compute derivatives of a function f: S^sourceDIM -> T^targetDIM via forward AD Signature of f is "void f(V*, U*)", it is expected to modify the first argument in-place.
 
template<class T , unsigned DIM>
std::ostream & operator<< (std::ostream &os, const ADf< T, DIM > &o)
 
template<class T , unsigned DIM>
std::istream & operator>> (std::istream &is, ADf< T, DIM > &in)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr ADf< T, DIM > operator+ (const U &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr ADf< T, DIM > operator+ (const ADf< T, DIM > &a, const U &b)
 
template<class T , unsigned DIM>
constexpr ADf< T, DIM > operator+ (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr ADf< T, DIM > operator- (const U &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr ADf< T, DIM > operator- (const ADf< T, DIM > &a, const U &b)
 
template<class T , unsigned DIM>
constexpr ADf< T, DIM > operator- (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr ADf< T, DIM > operator* (const U &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr ADf< T, DIM > operator* (const ADf< T, DIM > &a, const U &b)
 
template<class T , unsigned DIM>
constexpr ADf< T, DIM > operator* (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr ADf< T, DIM > operator/ (const U &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr ADf< T, DIM > operator/ (const ADf< T, DIM > &a, const U &b)
 
template<class T , unsigned DIM>
constexpr ADf< T, DIM > operator/ (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
constexpr ADf< T, DIM > operator+ (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
constexpr ADf< T, DIM > operator- (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
ADf< T, DIM > pow (const U &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
ADf< T, DIM > pow (const ADf< T, DIM > &a, const U &b)
 
template<class T , unsigned DIM>
ADf< T, DIM > pow (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
ADf< T, DIM > pow (const ADf< T, DIM > &a, int b)
 
template<class T , unsigned DIM>
ADf< T, DIM > sqr (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > exp (const ADf< T, DIM > &a)
 
template<unsigned DIM>
ADf< float, DIM > expf (const ADf< float, DIM > &a)
 
template<unsigned DIM>
ADf< long double, DIM > expl (const ADf< long double, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > log (const ADf< T, DIM > &a)
 
template<unsigned DIM>
ADf< float, DIM > logf (const ADf< float, DIM > &a)
 
template<unsigned DIM>
ADf< long double, DIM > logl (const ADf< long double, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > log10 (const ADf< T, DIM > &a)
 
template<unsigned DIM>
ADf< float, DIM > log10f (const ADf< float, DIM > &a)
 
template<unsigned DIM>
ADf< long double, DIM > log10l (const ADf< long double, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > log2 (const ADf< T, DIM > &a)
 
template<unsigned DIM>
ADf< float, DIM > log2f (const ADf< float, DIM > &a)
 
template<unsigned DIM>
ADf< long double, DIM > log2l (const ADf< long double, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > log1p (const ADf< T, DIM > &a)
 
template<unsigned DIM>
ADf< float, DIM > log1pf (const ADf< float, DIM > &a)
 
template<unsigned DIM>
ADf< long double, DIM > log1pl (const ADf< long double, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > sqrt (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > sin (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > cos (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > tan (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > asin (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > acos (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > atan (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > atan2 (const T &y, const ADf< T, DIM > &x)
 
template<class T , unsigned DIM>
ADf< T, DIM > atan2 (const ADf< T, DIM > &y, const T &x)
 
template<class T , unsigned DIM>
ADf< T, DIM > atan2 (const ADf< T, DIM > &y, const ADf< T, DIM > &x)
 
template<class T , unsigned DIM>
ADf< T, DIM > sinh (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > cosh (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > tanh (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > asinh (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > acosh (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > atanh (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > fmod (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
ADf< T, DIM > fmod (const ADf< T, DIM > &a, const U &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
ADf< T, DIM > fmod (const U &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
constexpr bool operator== (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr bool operator== (const ADf< T, DIM > &a, const U &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr bool operator== (const U &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
constexpr bool operator!= (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr bool operator!= (const ADf< T, DIM > &a, const U &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr bool operator!= (const U &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
constexpr bool operator> (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr bool operator> (const ADf< T, DIM > &a, const U &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr bool operator> (const U &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
constexpr bool operator>= (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr bool operator>= (const ADf< T, DIM > &a, const U &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr bool operator>= (const U &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
constexpr bool operator< (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr bool operator< (const ADf< T, DIM > &a, const U &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr bool operator< (const U &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
constexpr bool operator<= (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr bool operator<= (const ADf< T, DIM > &a, const U &b)
 
template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
constexpr bool operator<= (const U &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
ADf< T, DIM > floor (const ADf< T, DIM > &a)
 
template<unsigned DIM>
ADf< float, DIM > floorf (const ADf< float, DIM > &a)
 
template<unsigned DIM>
ADf< long double, DIM > floorl (const ADf< long double, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > ceil (const ADf< T, DIM > &a)
 
template<unsigned DIM>
ADf< float, DIM > ceilf (const ADf< float, DIM > &a)
 
template<unsigned DIM>
ADf< long double, DIM > ceill (const ADf< long double, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > round (const ADf< T, DIM > &a)
 
template<unsigned DIM>
ADf< float, DIM > roundf (const ADf< float, DIM > &a)
 
template<unsigned DIM>
ADf< long double, DIM > roundl (const ADf< long double, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > lround (const ADf< T, DIM > &a)
 
template<unsigned DIM>
ADf< float, DIM > lroundf (const ADf< float, DIM > &a)
 
template<unsigned DIM>
ADf< long double, DIM > lroundl (const ADf< long double, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > llround (const ADf< T, DIM > &a)
 
template<unsigned DIM>
ADf< float, DIM > llroundf (const ADf< float, DIM > &a)
 
template<unsigned DIM>
ADf< long double, DIM > llroundl (const ADf< long double, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > fabs (const ADf< T, DIM > &a)
 
template<unsigned DIM>
ADf< float, DIM > fabsf (const ADf< float, DIM > &a)
 
template<unsigned DIM>
ADf< long double, DIM > fabsl (const ADf< long double, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > abs (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > labs (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
ADf< T, DIM > llabs (const ADf< T, DIM > &a)
 
template<class T , unsigned DIM>
constexpr ADf< T, DIM > max (const olb::BaseType< ADf< T, DIM > > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
constexpr ADf< T, DIM > max (const ADf< T, DIM > &a, const olb::BaseType< ADf< T, DIM > > &b)
 
template<class T , unsigned DIM>
constexpr ADf< T, DIM > max (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
constexpr ADf< T, DIM > min (const olb::BaseType< ADf< T, DIM > > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
constexpr ADf< T, DIM > min (const ADf< T, DIM > &a, const olb::BaseType< ADf< T, DIM > > &b)
 
template<class T , unsigned DIM>
constexpr ADf< T, DIM > min (const ADf< T, DIM > &a, const ADf< T, DIM > &b)
 
template<class T , unsigned DIM>
bool nearZero (const ADf< T, DIM > &a)
 
template<typename T >
constexpr void throwADfException (T arg)
 
template<typename T , typename S >
auto fmod_pos (T a, S b)
 Variant of fmod (floating point modulo) that always returns positive values.
 
Expr sqrt (Expr x)
 
Expr fabs (Expr x)
 
Expr pow (Expr base, Expr exp)
 
Expr exp (Expr x)
 
template<typename T , unsigned D>
decltype(Vector< decltype(util::sqrt(T())), D >()) degreeToRadian (const Vector< T, D > &angle)
 
template<typename T >
decltype(util::sqrt(T())) degreeToRadian (T angle)
 
template<typename T , unsigned D>
decltype(Vector< decltype(util::sqrt(T())), D >()) radianToDegree (const Vector< T, D > &angle)
 
template<typename T >
decltype(util::sqrt(T())) radianToDegree (T angle)
 
template<typename T , unsigned D>
Vector< T, utilities::dimensions::convert< D >::matrix > calculateRotationMatrix (const Vector< T, utilities::dimensions::convert< D >::rotation > &angle)
 
template<typename T , unsigned D>
Vector< T, utilities::dimensions::convert< D >::matrix > invertRotationMatrix (const Vector< T, utilities::dimensions::convert< D >::matrix > &rotationMatrix)
 
template<typename T , unsigned D>
Vector< T, utilities::dimensions::convert< D >::matrix > calculateInverseRotationMatrix (const Vector< T, utilities::dimensions::convert< D >::rotation > &angle)
 
template<typename T , unsigned D, bool OUTPUT_USES_ROTATION_CENTER_AS_ORIGIN = false>
Vector< T, D > executeRotation (const Vector< T, D > &input, const Vector< T, utilities::dimensions::convert< D >::matrix > &rotationMatrix, const Vector< T, D > &rotationCenter=Vector< T, D >(0.))
 Rotates the input around the rotationCenter with a given rotationMatrix.
 
template<typename T , unsigned D, bool OUTPUT_USES_ROTATION_CENTER_AS_ORIGIN = false>
Vector< T, D > invertRotation (const Vector< T, D > &input, const Vector< T, utilities::dimensions::convert< D >::matrix > &rotationMatrix, const Vector< T, D > &rotationCenter=Vector< T, D >(0.))
 Rotates the input around the rotationCenter with a given rotationMatrix in the opposite direction.
 
template<typename T , unsigned D>
constexpr Vector< T, D > calculateLocalVelocity (const Vector< T, D > &rotationCenter, const Vector< T, D > &velocity, const Vector< T, utilities::dimensions::convert< D >::rotation > &angularVelocity, const Vector< T, D > &position)
 Calculate local velocity.
 
template<typename T >
constexpr Matrix< T, 3, 3 > rotateMofi (const Vector< T, 3 > &mofi, const Vector< T, 9 > &rotationMatrix)
 Rotate moment of inertia (mofi)
 
template<typename T >
int evaluateIntegration (std::vector< T > &testValues, bool print=false)
 
template<typename T >
euklidN2 (const T x[], int dim)
 Squared Euclidean norm of an array.
 
template<typename T >
euklidDistance2 (const T x[], const T y[], int dim)
 Squared Euclidean distance between two arrays.
 
template<typename T >
euklidN (const T x[], int dim)
 Euclidean norm of an array.
 
template<typename T >
euklidDistance (const T x[], const T y[], int dim)
 Euclidean distance between two arrays.
 
template<typename C >
auto euklidN2 (const C &x)
 Squared Euclidean norm for Container-type array.
 
template<typename C >
auto euklidDistance2 (const C &x, const C &y)
 Squared Euclidean distance for Container-type array.
 
template<typename C >
auto euklidN (const C &x)
 Euclidean norm for Container-type array.
 
template<typename C >
auto euklidDistance (const C &x, const C &y)
 Euclidean distance for Container-type array.
 
template<typename T >
constexpr T max (T a, meta::id_t< T > b)
 
template<typename T , class Compare >
constexpr T max (T a, meta::id_t< T > b, Compare comp)
 
template<typename T >
constexpr T max (std::initializer_list< T > ilist)
 
template<typename T , class Compare >
constexpr T max (std::initializer_list< T > ilist, Compare comp)
 
template<>
float max< float > (float x, float y) any_platform
 
template<>
double max< double > (double x, double y) any_platform
 
template<typename T >
constexpr T min (T a, meta::id_t< T > b)
 
template<typename T , class Compare >
constexpr T min (T a, meta::id_t< T > b, Compare comp)
 
template<typename T >
constexpr T min (std::initializer_list< T > ilist)
 
template<typename T , class Compare >
constexpr T min (std::initializer_list< T > ilist, Compare comp)
 
template<>
float min< float > (float x, float y) any_platform
 
template<>
double min< double > (double x, double y) any_platform
 
template<typename T , typename S >
any_platform auto pow (T base, S exp) -> std::enable_if_t< std::is_arithmetic_v< T >, decltype(std::pow(base, exp))>
 
any_platform float powf (float base, float exp)
 
long double powl (long double base, long double exp)
 
float fmod (float x, float y)
 
float fmodf (float x, float y)
 
double fmod (double x, double y)
 
long double fmod (long double x, long double y)
 
long double fmodl (long double x, long double y)
 
float fmod (float x, int y)
 
double fmod (double x, int y)
 
long double fmod (long double x, int y)
 
template<typename T , typename S >
auto fmod (T x, S y)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T >, T > exp (T arg) any_platform
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > exp (T arg) any_platform
 
float expf (float arg)
 
long double expl (long double arg)
 
float log (float arg)
 
float logf (float arg)
 
double log (double arg)
 
long double log (long double arg)
 
long double logl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > log (T arg)
 
float log10 (float arg)
 
float log10f (float arg)
 
double log10 (double arg)
 
long double log10 (long double arg)
 
long double log10l (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > log10 (T arg)
 
float log2 (float arg)
 
float log2f (float arg)
 
double log2 (double arg)
 
long double log2 (long double arg)
 
long double log2l (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > log2 (T arg)
 
float log1p (float arg)
 
float log1pf (float arg)
 
double log1p (double arg)
 
long double log1p (long double arg)
 
long double log1pl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > log1p (T arg)
 
any_platform float sqrtf (float arg)
 
long double sqrtl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T >, T > sqrt (T arg) any_platform
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > sqrt (T arg) any_platform
 
float sin (float arg)
 
float sinf (float arg)
 
double sin (double arg)
 
long double sin (long double arg)
 
long double sinl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > sin (T arg)
 
float sinh (float arg)
 
float sinhf (float arg)
 
double sinh (double arg)
 
long double sinh (long double arg)
 
long double sinhl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > sinh (T arg)
 
float cos (float arg)
 
float cosf (float arg)
 
double cos (double arg)
 
long double cos (long double arg)
 
long double cosl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > cos (T arg)
 
float cosh (float arg)
 
float coshf (float arg)
 
double cosh (double arg)
 
long double cosh (long double arg)
 
long double coshl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > cosh (T arg)
 
float tan (float arg)
 
float tanf (float arg)
 
double tan (double arg)
 
long double tan (long double arg)
 
long double tanl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > tan (T arg)
 
float tanh (float arg)
 
float tanhf (float arg)
 
double tanh (double arg)
 
long double tanh (long double arg)
 
long double tanhl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > tanh (T arg)
 
float asin (float arg)
 
float asinf (float arg)
 
double asin (double arg)
 
long double asin (long double arg)
 
long double asinl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > asin (T arg)
 
float asinh (float arg)
 
float asinhf (float arg)
 
double asinh (double arg)
 
long double asinh (long double arg)
 
long double asinhl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > asinh (T arg)
 
float acos (float arg)
 
float acosf (float arg)
 
double acos (double arg)
 
long double acos (long double arg)
 
long double acosl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > acos (T arg)
 
float acosh (float arg)
 
float acoshf (float arg)
 
double acosh (double arg)
 
long double acosh (long double arg)
 
long double acoshl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > acosh (T arg)
 
float atan (float arg)
 
float atanf (float arg)
 
double atan (double arg)
 
long double atan (long double arg)
 
long double atanl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > atan (T arg)
 
float atan2 (float y, float x)
 
float atan2f (float y, float x)
 
double atan2 (double y, double x)
 
long double atan2 (long double y, long double x)
 
long double atan2l (long double y, long double x)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > atan2 (T y, T x)
 
float atanh (float arg)
 
float atanhf (float arg)
 
double atanh (double arg)
 
long double atanh (long double arg)
 
long double atanhl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > atanh (T arg)
 
float floor (float arg)
 
double floor (double arg)
 
long double floor (long double arg)
 
float floorf (float arg)
 
long double floorl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > floor (T arg)
 
float ceil (float arg)
 
double ceil (double arg)
 
long double ceil (long double arg)
 
float ceilf (float arg)
 
long double ceill (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > ceil (T arg)
 
float trunc (float arg)
 
float truncf (float arg)
 
double trunc (double arg)
 
long double trunc (long double arg)
 
long double truncl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > trunc (T arg)
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > round (T arg)
 
float round (float arg)
 
double round (double arg)
 
long double round (long double arg)
 
float roundf (float arg)
 
double roundf (double arg)
 
long double roundl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, long > lround (T arg)
 
long lroundf (float arg)
 
long lroundl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, long long > llround (T arg)
 
long long llroundf (float arg)
 
long long llroundl (long double arg)
 
template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, T > abs (T arg) any_platform
 
template<typename T >
std::enable_if_t< std::is_floating_point_v< T >, T > fabs (T arg) any_platform
 
template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > fabs (T arg) any_platform
 
long labs (long arg)
 
long long llabs (long long arg)
 
float fabsf (float arg)
 
long double fabs (long double arg)
 
long double fabsl (long double arg)
 
template<typename T , typename DESCRIPTOR >
Timer< T > * createTimer (XMLreader &param, const UnitConverter< T, DESCRIPTOR > &converter, size_t numLatticePoints)
 
template<typename T >
bool nearZero (T a)
 return true if a is close to zero
 
template<typename T >
bool nearZero (T a, T epsilon)
 
template<typename T , typename U = T, typename W = T>
bool approxEqual (T a, U b, W epsilon)
 
template<typename T , typename U = T>
bool approxEqual (T a, U b)
 
template<class T >
void copyN (T c[], const T a[], const unsigned dim) any_platform
 
template<class S , class T >
void copyN (S c[], const T a[], const unsigned dim) any_platform
 
template<class T >
void copy3 (T c[], const T a[])
 
template<typename T >
std::vector< T > fromVector3 (const Vector< T, 3 > &vec)
 
template<typename T >
std::vector< T > fromVector2 (const Vector< T, 2 > &vec)
 
template<typename T >
norm2 (const std::vector< T > &a)
 l2 norm to the power of 2 of a vector of arbitrary length
 
template<typename T >
dotProduct3D (const Vector< T, 3 > &a, const Vector< T, 3 > &b)
 dot product, only valid in 3d
 
template<typename T >
dotProduct2D (const Vector< T, 2 > &a, const Vector< T, 2 > &b)
 dot product, only valid in 2d
 
template<typename T , unsigned D>
dotProduct (const Vector< T, D > &a, const Vector< T, D > &b)
 dot product
 
template<typename T , unsigned D>
Vector< T, D > normalize (const Vector< T, D > &a)
 
template<typename T >
std::vector< T > normalize (const std::vector< T > &a)
 returns a normalized vector, works for arbitrary lengths
 
template<typename T , unsigned Size>
Vector< T, Size > floor (const Vector< T, Size > &a)
 applies floor to each component of a vector
 
template<typename T , unsigned Size>
Vector< T, Size > ceil (const Vector< T, Size > &a)
 applies ceil to each component of a vector
 
template<typename T , typename S , unsigned Size>
Vector< T, Size > fmod (const Vector< T, Size > &a, S b)
 applies fmod to each component of a vector
 
template<typename T , unsigned Size>
average (const Vector< T, Size > &a)
 computes the average of all elements
 
template<typename T , unsigned Size>
max_element (const Vector< T, Size > &a)
 finds maximum element of all elements
 
template<typename T , unsigned Size>
min_element (const Vector< T, Size > &a)
 finds minimum element of all elements
 
template<typename T , unsigned Size>
unsigned maxElementPos (const Vector< T, Size > &a)
 finds position of maximum element of all elements
 
template<typename T , unsigned Size>
unsigned minElementPos (const Vector< T, Size > &a)
 finds position of minimum element of all elements
 
template<typename T , unsigned Size>
maxElementAbs (const Vector< T, Size > &a)
 finds maximum element of all absolute elements
 
template<typename T , unsigned Size>
unsigned maxElementAbsPos (const Vector< T, Size > &a)
 finds position of maximum element of all absolute elements
 
template<typename T , bool ensureAngularBounds = true>
angleBetweenVectors (const Vector< T, 2 > &a, const Vector< T, 2 > &b)
 Calculates angles between two 2D vectors.
 
template<typename T , bool ensureAngularBounds = true>
Vector< T, 3 > angleBetweenVectors (const Vector< T, 3 > &a, const Vector< T, 3 > &b)
 Calculates angles between two 3D vectors.
 
template<typename T >
std::vector< T > assign (T a, T b)
 
template<typename T >
std::vector< T > assign (T a, T b, T c)
 
template<typename U >
void print (U data, const std::string &name="", OstreamManager clout=OstreamManager(std::cout,"print"), const char delimiter=',')
 
template<typename C , typename U >
bool isContained (const C &c, U object)
 Check, if object is contained in iteratable container c.
 

Variables

template<class T >
constexpr bool is_adf_v = is_adf<T>::value
 

Typedef Documentation

◆ StdVector

template<typename S >
using olb::util::StdVector = std::vector<S,std::allocator<S>>

Definition at line 49 of file vectorHelpers.h.

Function Documentation

◆ abs() [1/2]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::abs ( const ADf< T, DIM > & a)
inline

Definition at line 1019 of file aDiff.h.

1020{
1021 return fabs(a);
1022}

References fabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ abs() [2/2]

template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, T > olb::util::abs ( T arg)
inline

Definition at line 881 of file omath.h.

882{
883#ifdef __CUDA_ARCH__
884 return ::fabs(arg);
885#else
886 return std::abs(arg);
887#endif
888}

◆ acos() [1/5]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::acos ( const ADf< T, DIM > & a)
inline

Definition at line 605 of file aDiff.h.

606{
607 ADf<T,DIM> c(std::acos(a._v), a._d);
608 T tmp(-T(1)/std::sqrt(T(1)-(a._v)*(a._v)));
609 c._d*=tmp;
610 return c;
611}
Definition of a description of a algoritmic differentiation data type using the forward method.
Definition aDiff.h:64
T _v
value
Definition aDiff.h:72
Vector< T, DIM > _d
derivatives
Definition aDiff.h:74

References olb::util::ADf< T, DIM >::_d, and olb::util::ADf< T, DIM >::_v.

+ Here is the caller graph for this function:

◆ acos() [2/5]

double olb::util::acos ( double arg)
inline

Definition at line 562 of file omath.h.

563{
564 return std::acos(arg);
565}

◆ acos() [3/5]

float olb::util::acos ( float arg)
inline

Definition at line 552 of file omath.h.

553{
554 return std::acos(arg);
555}

◆ acos() [4/5]

long double olb::util::acos ( long double arg)
inline

Definition at line 567 of file omath.h.

568{
569 return std::acos(arg);
570}

◆ acos() [5/5]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::acos ( T arg)
inline

Definition at line 578 of file omath.h.

579{
580 return std::acos(arg);
581}

◆ acosf()

float olb::util::acosf ( float arg)
inline

Definition at line 557 of file omath.h.

558{
559 return acos(arg);
560}
ADf< T, DIM > acos(const ADf< T, DIM > &a)
Definition aDiff.h:605

References acos().

+ Here is the call graph for this function:

◆ acosh() [1/5]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::acosh ( const ADf< T, DIM > & a)
inline

Definition at line 675 of file aDiff.h.

676{
677 if (a._v >= 1) {
678 return log( a + sqrt(a*a-1) );
679 }
680 else {
681 ADf<T,DIM> c;
682 c._v = std::acosh(a._v);
683 c._d = ( std::numeric_limits<T>::quiet_NaN() );
684 return c;
685 }
686}
ADf< T, DIM > log(const ADf< T, DIM > &a)
Definition aDiff.h:475

References olb::util::ADf< T, DIM >::_v, log(), and sqrt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ acosh() [2/5]

double olb::util::acosh ( double arg)
inline

Definition at line 594 of file omath.h.

595{
596 return std::acosh(arg);
597}

◆ acosh() [3/5]

float olb::util::acosh ( float arg)
inline

Definition at line 584 of file omath.h.

585{
586 return std::acosh(arg);
587}

◆ acosh() [4/5]

long double olb::util::acosh ( long double arg)
inline

Definition at line 599 of file omath.h.

600{
601 return std::acosh(arg);
602}

◆ acosh() [5/5]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::acosh ( T arg)
inline

Definition at line 610 of file omath.h.

611{
612 return std::acosh(arg);
613}

◆ acoshf()

float olb::util::acoshf ( float arg)
inline

Definition at line 589 of file omath.h.

590{
591 return acosh(arg);
592}
ADf< T, DIM > acosh(const ADf< T, DIM > &a)
Definition aDiff.h:675

References acosh().

+ Here is the call graph for this function:

◆ acoshl()

long double olb::util::acoshl ( long double arg)
inline

Definition at line 604 of file omath.h.

605{
606 return acosh(arg);
607}

References acosh().

+ Here is the call graph for this function:

◆ acosl()

long double olb::util::acosl ( long double arg)
inline

Definition at line 572 of file omath.h.

573{
574 return acos(arg);
575}

References acos().

+ Here is the call graph for this function:

◆ aligned_to_grid()

template<typename T >
bool olb::util::aligned_to_grid ( const std::vector< T > & vec)
inline

Definition at line 78 of file util.h.

79{
80 return (aligned_to_x<T>(vec) or
81 aligned_to_y<T>(vec) or
82 aligned_to_z<T>(vec));
83}

◆ aligned_to_x()

template<typename T >
bool olb::util::aligned_to_x ( const std::vector< T > & vec)
inline

Definition at line 60 of file util.h.

61{
62 return (vec[0]!=0 and vec[1]==0 and vec[2]==0);
63}

◆ aligned_to_y()

template<typename T >
bool olb::util::aligned_to_y ( const std::vector< T > & vec)
inline

Definition at line 66 of file util.h.

67{
68 return (vec[0]==0 and vec[1]!=0 and vec[2]==0);
69}

◆ aligned_to_z()

template<typename T >
bool olb::util::aligned_to_z ( const std::vector< T > & vec)
inline

Definition at line 72 of file util.h.

73{
74 return (vec[0]==0 and vec[1]==0 and vec[2]!=0);
75}

◆ angleBetweenVectors() [1/2]

template<typename T , bool ensureAngularBounds = true>
T olb::util::angleBetweenVectors ( const Vector< T, 2 > & a,
const Vector< T, 2 > & b )

Calculates angles between two 2D vectors.

Definition at line 331 of file vectorHelpers.h.

332{
333 if constexpr(ensureAngularBounds){
334 return std::fmod(util::atan2(b[1]*a[0]-b[0]*a[1], a[0]*b[0]+a[1]*b[1]), M_PI);
335 } else {
336 return util::atan2(b[1]*a[0]-b[0]*a[1], a[0]*b[0]+a[1]*b[1]);
337 }
338}
#define M_PI

References atan2(), and M_PI.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ angleBetweenVectors() [2/2]

template<typename T , bool ensureAngularBounds = true>
Vector< T, 3 > olb::util::angleBetweenVectors ( const Vector< T, 3 > & a,
const Vector< T, 3 > & b )

Calculates angles between two 3D vectors.

Definition at line 342 of file vectorHelpers.h.

343{
344 Vector<T,3> angles;
345 angles[0] = angleBetweenVectors<T,ensureAngularBounds>(Vector<T,2>(a[1], a[2]), Vector<T,2>(b[1], b[2]));
346 angles[1] = angleBetweenVectors<T,ensureAngularBounds>(Vector<T,2>(a[0], a[2]), Vector<T,2>(b[0], b[2]));
347 angles[2] = angleBetweenVectors<T,ensureAngularBounds>(Vector<T,2>(a[0], a[1]), Vector<T,2>(b[0], b[1]));
348 return angles;
349}
Plain old scalar vector.
Definition vector.h:47

◆ approxEqual() [1/2]

template<typename T , typename U = T>
bool olb::util::approxEqual ( T a,
U b )
inline

Definition at line 88 of file vectorHelpers.h.

89{
90 if (a==b) {
91 return true;
92 }
93 if (nearZero(a) && nearZero(b)) {
94 return true;
95 }
96 T EPSILON = std::numeric_limits<T>::epsilon()*4.*util::fabs(a);
97 return approxEqual(a,b,EPSILON);
98}

References approxEqual(), fabs(), and nearZero().

+ Here is the call graph for this function:

◆ approxEqual() [2/2]

template<typename T , typename U = T, typename W = T>
bool olb::util::approxEqual ( T a,
U b,
W epsilon )
inline

Definition at line 79 of file vectorHelpers.h.

80{
81 if (a==b) {
82 return true;
83 }
84 return nearZero<T>(a - b, epsilon);
85}
+ Here is the caller graph for this function:

◆ asin() [1/5]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::asin ( const ADf< T, DIM > & a)
inline

Definition at line 596 of file aDiff.h.

597{
598 ADf<T,DIM> c(std::asin(a._v), a._d);
599 T tmp(T(1)/std::sqrt(T(1)-(a._v)*(a._v)));
600 c._d*=tmp;
601 return c;
602}

References olb::util::ADf< T, DIM >::_d, and olb::util::ADf< T, DIM >::_v.

+ Here is the caller graph for this function:

◆ asin() [2/5]

double olb::util::asin ( double arg)
inline

Definition at line 498 of file omath.h.

499{
500 return std::asin(arg);
501}

◆ asin() [3/5]

float olb::util::asin ( float arg)
inline

Definition at line 488 of file omath.h.

489{
490 return std::asin(arg);
491}

◆ asin() [4/5]

long double olb::util::asin ( long double arg)
inline

Definition at line 503 of file omath.h.

504{
505 return std::asin(arg);
506}

◆ asin() [5/5]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::asin ( T arg)
inline

Definition at line 514 of file omath.h.

515{
516 return std::asin(arg);
517}

◆ asinf()

float olb::util::asinf ( float arg)
inline

Definition at line 493 of file omath.h.

494{
495 return asin(arg);
496}
ADf< T, DIM > asin(const ADf< T, DIM > &a)
Definition aDiff.h:596

References asin().

+ Here is the call graph for this function:

◆ asinh() [1/5]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::asinh ( const ADf< T, DIM > & a)
inline

Definition at line 669 of file aDiff.h.

670{
671 return log( a + sqrt(a*a+1) );
672}

References log(), and sqrt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ asinh() [2/5]

double olb::util::asinh ( double arg)
inline

Definition at line 530 of file omath.h.

531{
532 return std::asinh(arg);
533}

◆ asinh() [3/5]

float olb::util::asinh ( float arg)
inline

Definition at line 520 of file omath.h.

521{
522 return std::asinh(arg);
523}

◆ asinh() [4/5]

long double olb::util::asinh ( long double arg)
inline

Definition at line 535 of file omath.h.

536{
537 return std::asinh(arg);
538}

◆ asinh() [5/5]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::asinh ( T arg)
inline

Definition at line 546 of file omath.h.

547{
548 return std::asinh(arg);
549}

◆ asinhf()

float olb::util::asinhf ( float arg)
inline

Definition at line 525 of file omath.h.

526{
527 return asinh(arg);
528}
ADf< T, DIM > asinh(const ADf< T, DIM > &a)
Definition aDiff.h:669

References asinh().

+ Here is the call graph for this function:

◆ asinhl()

long double olb::util::asinhl ( long double arg)
inline

Definition at line 540 of file omath.h.

541{
542 return asinh(arg);
543}

References asinh().

+ Here is the call graph for this function:

◆ asinl()

long double olb::util::asinl ( long double arg)
inline

Definition at line 508 of file omath.h.

509{
510 return asin(arg);
511}

References asin().

+ Here is the call graph for this function:

◆ assign() [1/2]

template<typename T >
std::vector< T > olb::util::assign ( T a,
T b )

Definition at line 399 of file vectorHelpers.h.

400{
401 std::vector<T> v1;
402 v1.push_back(a);
403 v1.push_back(b);
404 return v1;
405}

◆ assign() [2/2]

template<typename T >
std::vector< T > olb::util::assign ( T a,
T b,
T c )

Definition at line 408 of file vectorHelpers.h.

409{
410 std::vector<T> v1;
411 v1.push_back(a);
412 v1.push_back(b);
413 v1.push_back(c);
414 return v1;
415}

◆ atan() [1/5]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::atan ( const ADf< T, DIM > & a)
inline

Definition at line 614 of file aDiff.h.

615{
616 ADf<T,DIM> c(std::atan(a._v), a._d);
617 T tmp(T(1)/(T(1)+(a._v)*(a._v)));
618 c._d*=tmp;
619 return c;
620}

References olb::util::ADf< T, DIM >::_d, and olb::util::ADf< T, DIM >::_v.

+ Here is the caller graph for this function:

◆ atan() [2/5]

double olb::util::atan ( double arg)
inline

Definition at line 626 of file omath.h.

627{
628 return std::atan(arg);
629}

◆ atan() [3/5]

float olb::util::atan ( float arg)
inline

Definition at line 616 of file omath.h.

617{
618 return std::atan(arg);
619}

◆ atan() [4/5]

long double olb::util::atan ( long double arg)
inline

Definition at line 631 of file omath.h.

632{
633 return std::atan(arg);
634}

◆ atan() [5/5]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::atan ( T arg)
inline

Definition at line 642 of file omath.h.

643{
644 return std::atan(arg);
645}

◆ atan2() [1/7]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::atan2 ( const ADf< T, DIM > & y,
const ADf< T, DIM > & x )
inline

Definition at line 641 of file aDiff.h.

642{
643 ADf<T,DIM> c(std::atan2(y._v, x._v));
644 T tmpA(x._v / (x._v*x._v + y._v*y._v));
645 T tmpB(-y._v / (x._v*x._v + y._v*y._v));
646 c._d = tmpA*y._d + tmpB*x._d;
647 return c;
648}

References olb::util::ADf< T, DIM >::_d, and olb::util::ADf< T, DIM >::_v.

◆ atan2() [2/7]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::atan2 ( const ADf< T, DIM > & y,
const T & x )
inline

Definition at line 632 of file aDiff.h.

633{
634 ADf<T,DIM> c(std::atan2(y._v, x));
635 T tmpA(x / (x*x + y._v*y._v));
636 c._d = tmpA*y._d;
637 return c;
638}

References olb::util::ADf< T, DIM >::_d, and olb::util::ADf< T, DIM >::_v.

◆ atan2() [3/7]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::atan2 ( const T & y,
const ADf< T, DIM > & x )
inline

Definition at line 623 of file aDiff.h.

624{
625 ADf<T,DIM> c(std::atan2(y, x._v));
626 T tmpB(-y / (x._v*x._v + y*y));
627 c._d = tmpB*x._d;
628 return c;
629}

References olb::util::ADf< T, DIM >::_d, and olb::util::ADf< T, DIM >::_v.

+ Here is the caller graph for this function:

◆ atan2() [4/7]

double olb::util::atan2 ( double y,
double x )
inline

Definition at line 658 of file omath.h.

659{
660 return std::atan2(y, x);
661}

◆ atan2() [5/7]

float olb::util::atan2 ( float y,
float x )
inline

Definition at line 648 of file omath.h.

649{
650 return std::atan2(y, x);
651}

◆ atan2() [6/7]

long double olb::util::atan2 ( long double y,
long double x )
inline

Definition at line 663 of file omath.h.

664{
665 return std::atan2(y, x);
666}

◆ atan2() [7/7]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::atan2 ( T y,
T x )
inline

Definition at line 674 of file omath.h.

675{
676 return std::atan2(y, x);
677}

◆ atan2f()

float olb::util::atan2f ( float y,
float x )
inline

Definition at line 653 of file omath.h.

654{
655 return atan2(y, x);
656}
ADf< T, DIM > atan2(const T &y, const ADf< T, DIM > &x)
Definition aDiff.h:623

References atan2().

+ Here is the call graph for this function:

◆ atan2l()

long double olb::util::atan2l ( long double y,
long double x )
inline

Definition at line 668 of file omath.h.

669{
670 return atan2(y, x);
671}

References atan2().

+ Here is the call graph for this function:

◆ atanf()

float olb::util::atanf ( float arg)
inline

Definition at line 621 of file omath.h.

622{
623 return atan(arg);
624}
ADf< T, DIM > atan(const ADf< T, DIM > &a)
Definition aDiff.h:614

References atan().

+ Here is the call graph for this function:

◆ atanh() [1/5]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::atanh ( const ADf< T, DIM > & a)
inline

Definition at line 689 of file aDiff.h.

690{
691 if (std::abs(a._v) < 1) {
692 return 0.5 * log( (1+a) / (1-a) );
693 }
694 else {
695 ADf<T,DIM> c;
696 c._v = std::atanh(a._v);
697 c._d = ( std::numeric_limits<T>::quiet_NaN() );
698 return c;
699 }
700}

References olb::util::ADf< T, DIM >::_v, and log().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ atanh() [2/5]

double olb::util::atanh ( double arg)
inline

Definition at line 690 of file omath.h.

691{
692 return std::atanh(arg);
693}

◆ atanh() [3/5]

float olb::util::atanh ( float arg)
inline

Definition at line 680 of file omath.h.

681{
682 return std::atanh(arg);
683}

◆ atanh() [4/5]

long double olb::util::atanh ( long double arg)
inline

Definition at line 695 of file omath.h.

696{
697 return std::atanh(arg);
698}

◆ atanh() [5/5]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::atanh ( T arg)
inline

Definition at line 706 of file omath.h.

707{
708 return std::atanh(arg);
709}

◆ atanhf()

float olb::util::atanhf ( float arg)
inline

Definition at line 685 of file omath.h.

686{
687 return atanh(arg);
688}
ADf< T, DIM > atanh(const ADf< T, DIM > &a)
Definition aDiff.h:689

References atanh().

+ Here is the call graph for this function:

◆ atanhl()

long double olb::util::atanhl ( long double arg)
inline

Definition at line 700 of file omath.h.

701{
702 return atanh(arg);
703}

References atanh().

+ Here is the call graph for this function:

◆ atanl()

long double olb::util::atanl ( long double arg)
inline

Definition at line 636 of file omath.h.

637{
638 return atan(arg);
639}

References atan().

+ Here is the call graph for this function:

◆ average()

template<typename T , unsigned Size>
T olb::util::average ( const Vector< T, Size > & a)

computes the average of all elements

Definition at line 246 of file vectorHelpers.h.

247{
248 T sum = a[0];
249 for (unsigned int iDim=1; iDim < Size; ++iDim) {
250 sum += a[iDim];
251 }
252 return sum/Size;
253}
+ Here is the caller graph for this function:

◆ bisectDistance()

template<typename S , unsigned D, typename F1 , typename F2 >
bool olb::util::bisectDistance ( S & distance,
const Vector< S, D > & origin,
const Vector< S, D > & direction,
S pitch,
S precision,
F1 isInside,
F2 isInsideBoundingBox )

Using a bisect to find the unsigned distance (false if distance was not found, true if distance was found)

Parameters
distancecomputed distance from origin to surface in direction
directionis saved here
originthe point we want to calculate the distance from
directionthe considered direction
pitcha first guess for the distance, must be > 0 (if origin is inside origin + normalize(direction) * pitch should be outside and if origin is outside origin + normalize(direction) * pitch should be inside)
precisionwhen the change of the found distance reaches the defined precision, the iteration stops
isInsidefunction that defines if a point is inside or outside a geometry (usually the ()-operator of an Indicator)
isInsideBoundingBoxfunction that defines if a point is inside the enclosing bounding box (maybe needs at least one extra layer between geometry surface and bounding box surface)

Definition at line 168 of file indicatorBase.h.

170{
171 distance = S(0);
172 Vector<S,D> dir = normalize(direction);
173
174 // Check if origin is on surface
175 bool isInsideDistance = isInside(origin + 5*precision*dir);
176 bool isInsideOppDistance = isInside(origin - 5*precision*dir);
177 if (isInsideDistance == !isInsideOppDistance) {
178 return true;
179 }
180
181 Vector<S,D> startPoint = origin;
182 S fixedDistance = S(0);
183 S oldDistance = distance;
184 std::function<Vector<S,D>()> calcCurrPoint = [&startPoint, &pitch, &dir]() {
185 return startPoint + pitch * dir;
186 };
187 Vector<S,D> currPoint = calcCurrPoint();
188
189 bool originValue = isInside(startPoint);
190 bool currentValue = isInside(currPoint);
191
192 // if aforementioned requirement for pitch is not given, try to find a proper pitch
193 while (originValue == currentValue) {
194 pitch *= 1.5;
195 currPoint = calcCurrPoint();
196 currentValue = isInside(currPoint);
197
198 // if both points are outside the bounding box return false indicating that no distance was found
199 if (!currentValue && !isInsideBoundingBox(startPoint) && !isInsideBoundingBox(currPoint)) {
200 return false;
201 }
202 }
203
204 for (unsigned iD=0; iD<D; ++iD) {
205 if (!std::isfinite(currPoint[iD])) {
206 return false;
207 }
208 }
209
210 // if we have one point inside and another outside, we can keep halving the line from origin to currPoint until we find the wanted precision
211 distance = norm(startPoint - currPoint);
212 while ( util::abs(distance - oldDistance) > precision ) {
213 pitch *= 0.5;
214 currPoint = calcCurrPoint();
215
216 // set distances
217 oldDistance = distance;
218 distance = norm(startPoint - currPoint);
219
220 // if both points are outside or inside run take result of same function with different start point (= current point)
221 currentValue = isInside(currPoint);
222 if (currentValue == originValue) {
223 startPoint = currPoint;
224 fixedDistance += distance;
225 // convert distances to distance to new start point
226 oldDistance -= distance;
227 distance = S(0);
228 }
229 }
230 distance += fixedDistance;
231
232 return true;
233}
bool distance(S &distance, const Vector< S, D > &origin, const Vector< S, D > &direction, S precision, S pitch, F1 isInside, F2 isInsideBoundingBox)
constexpr T norm(const ScalarVector< T, D, IMPL > &a)
Euclidean vector norm.
constexpr Vector< T, D > normalize(const ScalarVector< T, D, IMPL > &a, T scale=T{1})
Definition vector.h:245

References abs(), distance(), norm(), and normalize().

+ Here is the call graph for this function:

◆ calculateInverseRotationMatrix()

template<typename T , unsigned D>
Vector< T, utilities::dimensions::convert< D >::matrix > olb::util::calculateInverseRotationMatrix ( const Vector< T, utilities::dimensions::convert< D >::rotation > & angle)

Definition at line 137 of file geometricOperations.h.

139{
140 return invertRotationMatrix<T, D>(calculateRotationMatrix<T, D>(angle));
141}

◆ calculateLocalVelocity()

template<typename T , unsigned D>
constexpr Vector< T, D > olb::util::calculateLocalVelocity ( const Vector< T, D > & rotationCenter,
const Vector< T, D > & velocity,
const Vector< T, utilities::dimensions::convert< D >::rotation > & angularVelocity,
const Vector< T, D > & position )
constexpr

Calculate local velocity.

Definition at line 194 of file geometricOperations.h.

199{
200 if constexpr (D == 2) {
201 // two dimensions: u = U + w x r = (Ux, Uy, 0) + (0,0,w) x (X,Y,0) = (Ux, Uy, 0) + (-w*Y, w*X, 0)
202 return Vector<T, 2>(
203 velocity[0] - angularVelocity[0] * (position[1] - rotationCenter[1]),
204 velocity[1] + angularVelocity[0] * (position[0] - rotationCenter[0]));
205 }
206 else {
207 // three dimensions: u = U + w x r = (Ux, Uy, Uz) + (wx,wy,wz) x (X,Y,Z) = (Ux, Uy, Uz) + (wy*Z-wz*Y, wz*X-wx*Z, wx*Y-wy*X)
208 return velocity +
209 crossProduct3D(angularVelocity, position - rotationCenter);
210 }
211 __builtin_unreachable();
212}
constexpr Vector< T, 3 > crossProduct3D(const ScalarVector< T, 3, IMPL > &a, const ScalarVector< T, 3, IMPL_ > &b) any_platform
Definition vector.h:224

References olb::crossProduct3D().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateRotationMatrix()

template<typename T , unsigned D>
Vector< T, utilities::dimensions::convert< D >::matrix > olb::util::calculateRotationMatrix ( const Vector< T, utilities::dimensions::convert< D >::rotation > & angle)

Definition at line 69 of file geometricOperations.h.

71{
73
74 if constexpr (D == 2) {
75 T const cos = util::cos(angle[0]);
76 T const sin = util::sin(angle[0]);
77
78 // row 1
79 rotationMatrix[0] = cos;
80 rotationMatrix[1] = -sin;
81 // row 2
82 rotationMatrix[2] = sin;
83 rotationMatrix[3] = cos;
84 }
85 else {
86 T const cos[3] = {util::cos(angle[0]), util::cos(angle[1]),
87 util::cos(angle[2])};
88 T const sin[3] = {util::sin(angle[0]), util::sin(angle[1]),
89 util::sin(angle[2])};
90
91 // |x0| / 0 1 2 \ |x1|
92 // |y0| | 3 4 5 | = |x1|
93 // |z0| \ 6 7 8 / |x1|
94
95 // row 1
96 rotationMatrix[0] = cos[1] * cos[2];
97 rotationMatrix[1] = sin[0] * sin[1] * cos[2] - cos[0] * sin[2];
98 rotationMatrix[2] = cos[0] * sin[1] * cos[2] + sin[0] * sin[2];
99 // row 2
100 rotationMatrix[3] = cos[1] * sin[2];
101 rotationMatrix[4] = sin[0] * sin[1] * sin[2] + cos[0] * cos[2];
102 rotationMatrix[5] = cos[0] * sin[1] * sin[2] - sin[0] * cos[2];
103 // row 3
104 rotationMatrix[6] = -sin[1];
105 rotationMatrix[7] = sin[0] * cos[1];
106 rotationMatrix[8] = cos[0] * cos[1];
107 }
108
109 return rotationMatrix;
110}
ADf< T, DIM > sin(const ADf< T, DIM > &a)
Definition aDiff.h:569
ADf< T, DIM > cos(const ADf< T, DIM > &a)
Definition aDiff.h:578

References cos(), and sin().

+ Here is the call graph for this function:

◆ ceil() [1/6]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::ceil ( const ADf< T, DIM > & a)
inline

Definition at line 900 of file aDiff.h.

901{
902 // Similar to floor
903 ADf<T,DIM> c (std::ceil(a._v));
904 if (a._v == c._v) {
905#ifdef AdWarnings
906 std::cout << "ADf WARNING: ceil(Adf) - ceil evaluated at non-differentiable point" << std::endl;
907#endif
908 for (unsigned i = 0; i < DIM; ++i) {
909 c._d[i] = (a.d(i) == 0) ? T(0) : std::numeric_limits<T>::quiet_NaN();
910 }
911 }
912 return c;
913}
constexpr T & d(unsigned i)
Definition aDiff.h:252

References olb::util::ADf< T, DIM >::_v, and olb::util::ADf< T, DIM >::d().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ceil() [2/6]

template<typename T , unsigned Size>
Vector< T, Size > olb::util::ceil ( const Vector< T, Size > & a)

applies ceil to each component of a vector

Definition at line 224 of file vectorHelpers.h.

225{
226 Vector<T,Size> out;
227 for (unsigned int iDim=0; iDim < Size; ++iDim) {
228 out[iDim] = util::ceil(a[iDim]);
229 }
230 return out;
231}

References ceil().

+ Here is the call graph for this function:

◆ ceil() [3/6]

double olb::util::ceil ( double arg)
inline

Definition at line 751 of file omath.h.

752{
753 return std::ceil(arg);
754}

◆ ceil() [4/6]

float olb::util::ceil ( float arg)
inline

Definition at line 746 of file omath.h.

747{
748 return std::ceil(arg);
749}

◆ ceil() [5/6]

long double olb::util::ceil ( long double arg)
inline

Definition at line 756 of file omath.h.

757{
758 return std::ceil(arg);
759}

◆ ceil() [6/6]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::ceil ( T arg)
inline

Definition at line 772 of file omath.h.

773{
774 return std::ceil(arg);
775}

◆ ceilf() [1/2]

template<unsigned DIM>
ADf< float, DIM > olb::util::ceilf ( const ADf< float, DIM > & a)
inline

Definition at line 916 of file aDiff.h.

917{
918 return ceil(a);
919}
ADf< T, DIM > ceil(const ADf< T, DIM > &a)
Definition aDiff.h:900

References ceil().

+ Here is the call graph for this function:

◆ ceilf() [2/2]

float olb::util::ceilf ( float arg)
inline

Definition at line 761 of file omath.h.

762{
763 return ceil(arg);
764}

References ceil().

+ Here is the call graph for this function:

◆ ceill() [1/2]

template<unsigned DIM>
ADf< long double, DIM > olb::util::ceill ( const ADf< long double, DIM > & a)
inline

Definition at line 922 of file aDiff.h.

923{
924 return ceil(a);
925}

References ceil().

+ Here is the call graph for this function:

◆ ceill() [2/2]

long double olb::util::ceill ( long double arg)
inline

Definition at line 766 of file omath.h.

767{
768 return ceil(arg);
769}

References ceil().

+ Here is the call graph for this function:

◆ contained() [1/2]

bool olb::util::contained ( int x,
int y,
int x0,
int x1,
int y0,
int y1 )
inline

Definition at line 119 of file util.h.

121{
122 return x>=x0 && x<=x1 &&
123 y>=y0 && y<=y1;
124}
+ Here is the caller graph for this function:

◆ contained() [2/2]

bool olb::util::contained ( int x,
int y,
int z,
int x0,
int x1,
int y0,
int y1,
int z0,
int z1 )
inline

Definition at line 126 of file util.h.

128{
129 return x>=x0 && x<=x1 &&
130 y>=y0 && y<=y1 &&
131 z>=z0 && z<=z1;
132}

◆ copy3()

template<class T >
void olb::util::copy3 ( T c[],
const T a[] )
inline

Definition at line 117 of file vectorHelpers.h.

118{
119 for (unsigned i=0; i<3; i++) {
120 c[i] = a[i];
121 }
122}

◆ copyAs()

template<typename T , typename S , template< typename > typename C>
C< T > olb::util::copyAs ( const C< S > & input)

copy vector with specified typecast

Definition at line 72 of file adHelpers.h.

72 {
73 C<T> result = ContainerCreator<C<T>>::create(input.size());
74
75 for(std::size_t it = 0; it < input.size(); ++it) {
76 result[it] = T(input[it]);
77 }
78 return result;
79}
Creates a container of type C.

◆ copyDerivatives()

template<typename T , typename TAD >
void olb::util::copyDerivatives ( T * target,
const TAD * source,
int length )

Copy the derivatives from an ADf array into an array.

Returns
target[j*dim+i] = source[j].d(i) = d/dx_i (s_j)
Parameters
length= length of the array

Definition at line 61 of file adHelpers.h.

61 {
62 for (int j = 0; j < length; ++j) {
63 for (unsigned i = 0; i < TAD::dim; ++i) {
64 target[j*(TAD::dim)+i] = source[j].d(i);
65 }
66 }
67}
+ Here is the caller graph for this function:

◆ copyN() [1/2]

template<class S , class T >
void olb::util::copyN ( S c[],
const T a[],
const unsigned dim )
inline

Definition at line 109 of file vectorHelpers.h.

110{
111 for (unsigned i=0; i<dim; i++) {
112 c[i] = a[i];
113 }
114}

◆ copyN() [2/2]

template<class T >
void olb::util::copyN ( T c[],
const T a[],
const unsigned dim )
inline

Definition at line 101 of file vectorHelpers.h.

102{
103 for (unsigned i=0; i<dim; i++) {
104 c[i] = a[i];
105 }
106}
+ Here is the caller graph for this function:

◆ cos() [1/5]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::cos ( const ADf< T, DIM > & a)
inline

Definition at line 578 of file aDiff.h.

579{
580 ADf<T,DIM> c(std::cos(a._v), a._d);
581 T tmp(-std::sin(a._v));
582 c._d*=tmp;
583 return c;
584}

References olb::util::ADf< T, DIM >::_d, and olb::util::ADf< T, DIM >::_v.

+ Here is the caller graph for this function:

◆ cos() [2/5]

double olb::util::cos ( double arg)
inline

Definition at line 370 of file omath.h.

371{
372 return std::cos(arg);
373}

◆ cos() [3/5]

float olb::util::cos ( float arg)
inline

Definition at line 360 of file omath.h.

361{
362 return std::cos(arg);
363}

◆ cos() [4/5]

long double olb::util::cos ( long double arg)
inline

Definition at line 375 of file omath.h.

376{
377 return std::cos(arg);
378}

◆ cos() [5/5]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::cos ( T arg)
inline

Definition at line 386 of file omath.h.

387{
388 return std::cos(arg);
389}

◆ cosf()

float olb::util::cosf ( float arg)
inline

Definition at line 365 of file omath.h.

366{
367 return cos(arg);
368}

References cos().

+ Here is the call graph for this function:

◆ cosh() [1/5]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::cosh ( const ADf< T, DIM > & a)
inline

Definition at line 657 of file aDiff.h.

658{
659 return 0.5*(exp(a)+exp(-a));
660}
ADf< T, DIM > exp(const ADf< T, DIM > &a)
Definition aDiff.h:455

References exp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cosh() [2/5]

double olb::util::cosh ( double arg)
inline

Definition at line 402 of file omath.h.

403{
404 return std::cosh(arg);
405}

◆ cosh() [3/5]

float olb::util::cosh ( float arg)
inline

Definition at line 392 of file omath.h.

393{
394 return std::cosh(arg);
395}

◆ cosh() [4/5]

long double olb::util::cosh ( long double arg)
inline

Definition at line 407 of file omath.h.

408{
409 return std::cosh(arg);
410}

◆ cosh() [5/5]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::cosh ( T arg)
inline

Definition at line 418 of file omath.h.

419{
420 return std::cosh(arg);
421}

◆ coshf()

float olb::util::coshf ( float arg)
inline

Definition at line 397 of file omath.h.

398{
399 return cosh(arg);
400}
ADf< T, DIM > cosh(const ADf< T, DIM > &a)
Definition aDiff.h:657

References cosh().

+ Here is the call graph for this function:

◆ coshl()

long double olb::util::coshl ( long double arg)
inline

Definition at line 412 of file omath.h.

413{
414 return cosh(arg);
415}

References cosh().

+ Here is the call graph for this function:

◆ cosl()

long double olb::util::cosl ( long double arg)
inline

Definition at line 380 of file omath.h.

381{
382 return cos(arg);
383}

References cos().

+ Here is the call graph for this function:

◆ createTimer()

template<typename T , typename DESCRIPTOR >
Timer< T > * olb::util::createTimer ( XMLreader & param,
const UnitConverter< T, DESCRIPTOR > & converter,
size_t numLatticePoints )

Definition at line 260 of file timer.hh.

261{
262 OstreamManager clout(std::cout,"createTimer");
263
264 // initialize parameters with some default values
265 T physMaxT = T();
266 T physStartT = T();
267 int printModeSummary = 0;
268
269 // fetch xml Data and error handling
270 if ( ! param["Application"]["PhysParameters"]["PhysMaxTime"].read(physMaxT) ) {
271 if ( ! param["Application"]["PhysParam"]["MaxTime"].read(physStartT) ) {
272 clout << "PhysMaxTime not found" << std::endl;
273 }
274 else {
275 clout << "Application::PhysParam::MaxTime needs to be renamed to Application::PhysParameters::PhysMaxTime" << std::endl;
276 }
277 }
278 // read the variable for the mode of printSummary
279 param.readOrWarn<int>("Output","Timer","PrintModeSummary", printModeSummary,true,false,false);
280
281// if ( ! param["Application"]["PhysParam"]["MaxStartTime"].read(physStartT) ) {
282// clout << "PhysStartTime not found" << std::endl;
283// }
284
285 // variable processing according to the constructor
286 int maxT = converter.getLatticeTime(physMaxT) + converter.getLatticeTime(physStartT);
287
288 //return some default values that produce reasonable output (e.g.
289 // zero); in best case there should be no output at all (TODO)
290 return new Timer<T>(maxT, numLatticePoints, printModeSummary);
291}
class for marking output with some text
constexpr size_t getLatticeTime(T physTime) const
conversion from physical to lattice time
bool readOrWarn(std::string name_parameter_1, std::string name_parameter_2, std::string name_parameter_3, ParameterType &var, bool defaultAvailable=true, bool exitIfMissing=false, bool showWarning=true) const
This wrapper function reads the given parameter from the "type_parameter" and "name_parameter_1" or "...
Definition xmlReader.h:178

References olb::UnitConverter< T, DESCRIPTOR >::getLatticeTime(), and olb::XMLreader::readOrWarn().

+ Here is the call graph for this function:

◆ degreeToRadian() [1/2]

template<typename T , unsigned D>
decltype(Vector< decltype(util::sqrt(T())), D >()) olb::util::degreeToRadian ( const Vector< T, D > & angle)

Definition at line 42 of file geometricOperations.h.

43{
44 constexpr BaseType<decltype(util::sqrt(T()))> conversionFactor = M_PI / 180.;
45 return conversionFactor * angle;
46}
typename util::BaseTypeHelper< T >::type BaseType
Definition baseType.h:59

References M_PI, and sqrt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ degreeToRadian() [2/2]

template<typename T >
decltype(util::sqrt(T())) olb::util::degreeToRadian ( T angle)

Definition at line 49 of file geometricOperations.h.

50{
51 return degreeToRadian(Vector<T, 1>(angle))[0];
52}
decltype(Vector< decltype(util::sqrt(T())), D >()) degreeToRadian(const Vector< T, D > &angle)

References degreeToRadian().

+ Here is the call graph for this function:

◆ densityFromPressure()

template<typename T , typename DESCRIPTOR >
T olb::util::densityFromPressure ( T latticePressure)

compute lattice density from lattice pressure

Definition at line 379 of file util.h.

380{
381 // rho = p / c_s^2 + 1
382 return latticePressure * descriptors::invCs2<T,DESCRIPTOR>() + 1.0;
383}

◆ derivativeFAD() [1/3]

template<unsigned sourceDIM, typename S , typename F >
auto olb::util::derivativeFAD ( F f,
const S * input )

Compute derivatives of a function f: S^sourceDIM -> T via forward AD Signature is "V f(U*)" so f is expected to return a single value.

It must be (captured by) a lambda function that handles arbitrary types, so "auto f(auto x)" is to be written.

Definition at line 128 of file adHelpers.h.

128 {
129 using SAD = ADf<S,sourceDIM>;
130 using T = decltype(f(input));
131 using TAD = ADf<T,sourceDIM>;
132
133 SAD inputAD[sourceDIM];
134 util::copyN(inputAD, input, sourceDIM);
135 util::iniDiagonal(inputAD, sourceDIM);
136
137 TAD resultAD = f(inputAD);
138 T* result = new T[sourceDIM];
139 copyDerivatives(result, &resultAD, 1);
140 return result;
141}
void copyDerivatives(T *target, const TAD *source, int length)
Copy the derivatives from an ADf array into an array.
Definition adHelpers.h:61

References copyDerivatives(), copyN(), and iniDiagonal().

+ Here is the call graph for this function:

◆ derivativeFAD() [2/3]

template<typename S , typename F >
auto olb::util::derivativeFAD ( F f,
const S input )

Compute derivatives of a function f: S -> T via forward AD Signature is "V f(U)" so f is expected to accept and return a single value.

It must be (captured by) a lambda function that handles arbitrary types, so "auto f(auto x)" is to be written.

Definition at line 115 of file adHelpers.h.

115 {
116 ADf<S,1> inputAD = input;
117 inputAD.setDiffVariable(0);
118
119 return f(inputAD).d(0);
120}
constexpr void setDiffVariable(unsigned iD)
Definition aDiff.h:270

References olb::util::ADf< T, DIM >::setDiffVariable().

+ Here is the call graph for this function:

◆ derivativeFAD() [3/3]

template<unsigned sourceDIM, typename T , typename S , typename F >
void olb::util::derivativeFAD ( F f,
T * output,
const S * input,
unsigned targetDIM )

Compute derivatives of a function f: S^sourceDIM -> T^targetDIM via forward AD Signature of f is "void f(V*, U*)", it is expected to modify the first argument in-place.

f must be (captured by) a lambda function that handles arbitrary types, so "void f(auto y, auto x)" is to be written.

Definition at line 150 of file adHelpers.h.

150 {
151 using SAD = ADf<S,sourceDIM>;
152 using TAD = ADf<T,sourceDIM>;
153
154 SAD inputAD[sourceDIM];
155 util::copyN(inputAD, input, sourceDIM);
156 util::iniDiagonal(inputAD, sourceDIM);
157 TAD outputAD[targetDIM];
158
159 f(outputAD, inputAD);
160 copyDerivatives(output, outputAD, targetDIM);
161 return;
162}

References copyDerivatives(), copyN(), and iniDiagonal().

+ Here is the call graph for this function:

◆ distance() [1/3]

template<typename S , unsigned D, typename F1 , typename F2 >
bool olb::util::distance ( S & distance,
const Vector< S, D > & origin,
const Vector< S, D > & direction,
S precision,
F1 sdf,
F2 isInsideBoundingBox,
const unsigned maxIt = 1e6 )

Definition at line 95 of file indicatorBase.h.

97{
98 S signedDistance{sdf(origin)};
99 Vector<S,D> currPos{origin};
100 const Vector<S,D> dir{util::sign(signedDistance) * normalize(direction)};
101
102 if (util::fabs(signedDistance) <= precision) {
103 distance = util::fabs(signedDistance);
104 return true;
105 }
106
107 distance = S{0};
108 for(unsigned i=0; util::fabs(signedDistance) > precision && i<maxIt; ++i) {
109 distance += signedDistance;
110 currPos += signedDistance * dir;
111 signedDistance = sdf(currPos);
112 if (!isInsideBoundingBox(currPos)) {
113 distance = S{0};
114 return false;
115 }
116 }
117
118 distance = util::fabs(distance);
119 return true;
120}

References distance(), fabs(), normalize(), and sign().

+ Here is the call graph for this function:

◆ distance() [2/3]

template<typename S , unsigned D, typename F1 , typename F2 >
bool olb::util::distance ( S & distance,
const Vector< S, D > & origin,
const Vector< S, D > & direction,
S precision,
S pitch,
F1 isInside,
F2 isInsideBoundingBox )

Definition at line 36 of file indicatorBase.h.

38{
39 // Check if point is on surface
40 bool isInsideDistance;
41 bool isInsideOppDistance;
42 Vector<S,D> currentPoint = origin + 10*precision*direction;
43 isInside(&isInsideDistance, currentPoint.data());
44 currentPoint = origin - 10*precision*direction;
45 isInside(&isInsideOppDistance, currentPoint.data());
46 if (isInsideDistance == !isInsideOppDistance) {
47 distance = 0;
48 return true;
49 }
50
51 bool originValue;
52 bool currentValue;
53
54 isInside(&originValue, origin.data());
55
56 // start at origin and move into given direction
57 currentPoint = origin;
58 currentValue = originValue;
59
60 while (currentValue == originValue && isInsideBoundingBox(currentPoint)) {
61 currentPoint += direction;
62 // update currentValue until the first point on the other side (inside/outside) is found
63 isInside(&currentValue, currentPoint.data());
64 }
65
66 // return false if no point was found in given direction
67 if (!isInsideBoundingBox(currentPoint) && !originValue) {
68 return false;
69 }
70
71
72 while (pitch >= precision) {
73 if (!isInsideBoundingBox(currentPoint) && originValue) {
74 currentPoint -= pitch * direction;
75 pitch *= 0.5;
76 }
77 else {
78 isInside(&currentValue, currentPoint.data());
79 if (currentValue == originValue) {
80 currentPoint += pitch * direction;
81 pitch *= 0.5;
82 }
83 else {
84 currentPoint -= pitch * direction;
85 pitch *= 0.5;
86 }
87 }
88 }
89
90 distance = norm(currentPoint - origin);
91 return true;
92}
constexpr const T * data() const any_platform
Definition vector.h:161

References olb::Vector< T, D >::data(), distance(), and norm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ distance() [3/3]

template<typename S , unsigned D, bool normalizeDirection = true>
bool olb::util::distance ( S & distance,
const Vector< S, D > & origin,
const Vector< S, D > & direction,
S precision,
std::function< S(const Vector< S, D > &)> sdf,
S maxDistance,
const unsigned maxIt = 1e6 )

Definition at line 123 of file indicatorBase.h.

125{
126 S signedDistance{sdf(origin)};
127 Vector<S,D> currPos{origin};
128 Vector<S,D> dir;
129 if constexpr(normalizeDirection) {
130 dir = util::sign(signedDistance) * normalize(direction);
131 }
132 else {
133 dir = util::sign(signedDistance) * direction;
134 }
135
136 if (util::fabs(signedDistance) <= precision) {
137 distance = util::fabs(signedDistance);
138 return true;
139 }
140
141 distance = S{0};
142 for(unsigned i=0; util::fabs(signedDistance) > precision && i<maxIt; ++i) {
143 distance += signedDistance;
144 currPos += signedDistance * dir;
145 signedDistance = sdf(currPos);
146 if (signedDistance > maxDistance) {
147 distance = S{0};
148 return false;
149 }
150 }
151
152 distance = util::fabs(distance);
153 return true;
154}

References distance(), fabs(), normalize(), and sign().

+ Here is the call graph for this function:

◆ dotProduct()

template<typename T , unsigned D>
T olb::util::dotProduct ( const Vector< T, D > & a,
const Vector< T, D > & b )

dot product

Definition at line 183 of file vectorHelpers.h.

184{
185 if constexpr (D==2){
186 return dotProduct2D(a, b);
187 } else {
188 return dotProduct3D(a, b);
189 }
190}
T dotProduct2D(const Vector< T, 2 > &a, const Vector< T, 2 > &b)
dot product, only valid in 2d

References dotProduct2D(), and dotProduct3D().

+ Here is the call graph for this function:

◆ dotProduct2D()

template<typename T >
T olb::util::dotProduct2D ( const Vector< T, 2 > & a,
const Vector< T, 2 > & b )

dot product, only valid in 2d

Definition at line 176 of file vectorHelpers.h.

177{
178 return a[0]*b[0] + a[1]*b[1];
179}
+ Here is the caller graph for this function:

◆ dotProduct3D()

template<typename T >
T olb::util::dotProduct3D ( const Vector< T, 3 > & a,
const Vector< T, 3 > & b )

dot product, only valid in 3d

Definition at line 169 of file vectorHelpers.h.

170{
171 return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
172}
+ Here is the caller graph for this function:

◆ euklidDistance() [1/2]

template<typename C >
auto olb::util::euklidDistance ( const C & x,
const C & y )

Euclidean distance for Container-type array.

Definition at line 97 of file norm.h.

98{
99 OLB_ASSERT((x.size() == y.size()), "Arrays must have same dimension");
100 return euklidDistance(x.data(), y.data(), x.size());
101}
T euklidDistance(const T x[], const T y[], int dim)
Euclidean distance between two arrays.
Definition norm.h:67
#define OLB_ASSERT(COND, MESSAGE)
Definition olbDebug.h:45

References euklidDistance(), and OLB_ASSERT.

+ Here is the call graph for this function:

◆ euklidDistance() [2/2]

template<typename T >
T olb::util::euklidDistance ( const T x[],
const T y[],
int dim )

Euclidean distance between two arrays.

Definition at line 67 of file norm.h.

68{
69 return olb::util::sqrt(euklidDistance2(x,y,dim));
70}
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100
T euklidDistance2(const T x[], const T y[], int dim)
Squared Euclidean distance between two arrays.
Definition norm.h:48

References euklidDistance2(), and sqrt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ euklidDistance2() [1/2]

template<typename C >
auto olb::util::euklidDistance2 ( const C & x,
const C & y )

Squared Euclidean distance for Container-type array.

Definition at line 82 of file norm.h.

83{
84 OLB_ASSERT((x.size() == y.size()), "Arrays must have same dimension");
85 return euklidDistance2(x.data(), y.data(), x.size());
86}

References euklidDistance2(), and OLB_ASSERT.

+ Here is the call graph for this function:

◆ euklidDistance2() [2/2]

template<typename T >
T olb::util::euklidDistance2 ( const T x[],
const T y[],
int dim )

Squared Euclidean distance between two arrays.

Definition at line 48 of file norm.h.

49{
50 T euklid = 0;
51 for (int iDim=0; iDim<dim; iDim++) {
52 euklid += (x[iDim]-y[iDim])*(x[iDim]-y[iDim]);
53 }
54 return euklid;
55}
+ Here is the caller graph for this function:

◆ euklidN() [1/2]

template<typename C >
auto olb::util::euklidN ( const C & x)

Euclidean norm for Container-type array.

Definition at line 90 of file norm.h.

91{
92 return euklidN(x.data(), x.size());
93}
T euklidN(const T x[], int dim)
Euclidean norm of an array.
Definition norm.h:60

References euklidN().

+ Here is the call graph for this function:

◆ euklidN() [2/2]

template<typename T >
T olb::util::euklidN ( const T x[],
int dim )

Euclidean norm of an array.

Definition at line 60 of file norm.h.

61{
62 return olb::util::sqrt(euklidN2(x,dim));
63}
T euklidN2(const T x[], int dim)
Squared Euclidean norm of an array.
Definition norm.h:37

References euklidN2(), and sqrt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ euklidN2() [1/2]

template<typename C >
auto olb::util::euklidN2 ( const C & x)

Squared Euclidean norm for Container-type array.

Definition at line 75 of file norm.h.

76{
77 return euklidN2(x.data(), x.size());
78}

References euklidN2().

+ Here is the call graph for this function:

◆ euklidN2() [2/2]

template<typename T >
T olb::util::euklidN2 ( const T x[],
int dim )

Squared Euclidean norm of an array.

Definition at line 37 of file norm.h.

38{
39 T euklid = 0;
40 for (int iDim=0; iDim<dim; iDim++) {
41 euklid += x[iDim]*x[iDim];
42 }
43 return euklid;
44}
+ Here is the caller graph for this function:

◆ evaluateIntegration()

template<typename T >
int olb::util::evaluateIntegration ( std::vector< T > & testValues,
bool print = false )

Definition at line 34 of file integrationTestUtils.h.

34 {
35 OstreamManager clout( std::cout,"Integrationtest" );
36 bool allPassed = true;
37 for (int i=0; i<testValues.size(); i+=3){
38 T val = testValues[i];
39 T ref = testValues[i+1];
40 T maxErr = testValues[i+2];
41 T err = std::abs(ref-val)/ref;
42 bool passed = err <= maxErr;
43 if (print || !passed ){
44 clout << std::setprecision(16);
45 clout << "i:|" << "Value: |"
46 << "Reference: |"
47 << "Error: |"
48 << "MaxError: |"
49 << "Passed:" << std::endl;
50 clout << i << " |" << std::setw(22) << val
51 << " |" << std::setw(22) << ref
52 << " |" << std::setw(22) << err
53 << " |" << std::setw(22) << maxErr
54 << " |" << passed << std::endl;
55 clout << std::setprecision(6);
56 }
57 if (!passed){ allPassed=false; };
58 }
59 if (allPassed){
60 return 0;
61 } else {
62 return 1;
63 }
64}

References print().

+ Here is the call graph for this function:

◆ executeRotation()

template<typename T , unsigned D, bool OUTPUT_USES_ROTATION_CENTER_AS_ORIGIN = false>
Vector< T, D > olb::util::executeRotation ( const Vector< T, D > & input,
const Vector< T, utilities::dimensions::convert< D >::matrix > & rotationMatrix,
const Vector< T, D > & rotationCenter = Vector<T, D>(0.) )

Rotates the input around the rotationCenter with a given rotationMatrix.

Definition at line 146 of file geometricOperations.h.

150{
151 const Vector<T, D> dist = input - rotationCenter;
152 Vector<T, D> rotated;
153
154 if constexpr (D == 2) {
155 rotated =
156 Vector<T, 2>(dist[0] * rotationMatrix[0] + dist[1] * rotationMatrix[1],
157 dist[0] * rotationMatrix[2] + dist[1] * rotationMatrix[3]);
158 }
159 else {
160 rotated =
161 Vector<T, 3>(rotationMatrix[0] * dist[0] + rotationMatrix[1] * dist[1] +
162 rotationMatrix[2] * dist[2],
163 rotationMatrix[3] * dist[0] + rotationMatrix[4] * dist[1] +
164 rotationMatrix[5] * dist[2],
165 rotationMatrix[6] * dist[0] + rotationMatrix[7] * dist[1] +
166 rotationMatrix[8] * dist[2]);
167 }
168
169 if constexpr (!OUTPUT_USES_ROTATION_CENTER_AS_ORIGIN) {
170 return rotationCenter + rotated;
171 }
172 else {
173 return rotated;
174 }
175
176 __builtin_unreachable();
177}
+ Here is the caller graph for this function:

◆ exp() [1/4]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::exp ( const ADf< T, DIM > & a)
inline

Definition at line 455 of file aDiff.h.

456{
457 ADf<T,DIM> c(std::exp(a._v), a._d);
458 c._d*=c._v;
459 return c;
460}

References olb::util::ADf< T, DIM >::_d, and olb::util::ADf< T, DIM >::_v.

+ Here is the caller graph for this function:

◆ exp() [2/4]

Expr olb::util::exp ( Expr x)

Definition at line 192 of file expr.h.

192 {
193 return Expr(Expr::Op::Exp, x);
194}
Basic value-substitute enabling extraction of expression trees for code generation.
Definition expr.h:38

References olb::Expr::Exp.

◆ exp() [3/4]

template<typename T >
std::enable_if_t< std::is_floating_point_v< T >, T > olb::util::exp ( T arg)
inline

Definition at line 111 of file omath.h.

112{
113 return std::exp(arg);
114}

◆ exp() [4/4]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::exp ( T arg)
inline

Definition at line 117 of file omath.h.

118{
119 return std::exp(arg);
120}

◆ expf() [1/2]

template<unsigned DIM>
ADf< float, DIM > olb::util::expf ( const ADf< float, DIM > & a)
inline

Definition at line 463 of file aDiff.h.

464{
465 return exp(a);
466}

References exp().

+ Here is the call graph for this function:

◆ expf() [2/2]

float olb::util::expf ( float arg)
inline

Definition at line 122 of file omath.h.

123{
124 return exp(arg);
125}

References exp().

+ Here is the call graph for this function:

◆ expl() [1/2]

template<unsigned DIM>
ADf< long double, DIM > olb::util::expl ( const ADf< long double, DIM > & a)
inline

Definition at line 469 of file aDiff.h.

470{
471 return exp(a);
472}

References exp().

+ Here is the call graph for this function:

◆ expl() [2/2]

long double olb::util::expl ( long double arg)
inline

Definition at line 127 of file omath.h.

128{
129 return exp(arg);
130}

References exp().

+ Here is the call graph for this function:

◆ fabs() [1/6]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::fabs ( const ADf< T, DIM > & a)
inline

Definition at line 996 of file aDiff.h.

997{
998#ifdef AdWarnings
999 if (a._v == T(0)) {
1000 std::cout << "ADf WARNING: fabs(Adf) - fabs evaluated at non-differentiable point" << std::endl;
1001 }
1002#endif
1003 return ADf<T,DIM>( util::sign(a._v) * a );
1004}

References olb::util::ADf< T, DIM >::_v, and sign().

+ Here is the call graph for this function:

◆ fabs() [2/6]

template<typename T >
cpu::simd::Pack< T > olb::util::fabs ( cpu::simd::Pack< T > value)

Definition at line 106 of file pack.h.

107{
108 return cpu::simd::fabs(value);
109}

References olb::cpu::simd::fabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fabs() [3/6]

Expr olb::util::fabs ( Expr x)

Definition at line 184 of file expr.h.

184 {
185 return Expr(Expr::Op::Abs, x);
186}

References olb::Expr::Abs.

◆ fabs() [4/6]

long double olb::util::fabs ( long double arg)
inline

Definition at line 925 of file omath.h.

926{
927 return std::fabs(arg);
928}

◆ fabs() [5/6]

template<typename T >
std::enable_if_t< std::is_floating_point_v< T >, T > olb::util::fabs ( T arg)
inline

Definition at line 891 of file omath.h.

892{
893#ifdef __CUDA_ARCH__
894 return ::fabs(arg);
895#else
896 return std::fabs(arg);
897#endif
898}

◆ fabs() [6/6]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::fabs ( T arg)
inline

Definition at line 901 of file omath.h.

902{
903#ifdef __CUDA_ARCH__
904 return ::fabs(arg);
905#else
906 return std::fabs(arg);
907#endif
908}

◆ fabsf() [1/2]

template<unsigned DIM>
ADf< float, DIM > olb::util::fabsf ( const ADf< float, DIM > & a)
inline

Definition at line 1007 of file aDiff.h.

1008{
1009 return fabs(a);
1010}

References fabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fabsf() [2/2]

float olb::util::fabsf ( float arg)
inline

Definition at line 920 of file omath.h.

921{
922 return fabs(arg);
923}

References fabs().

+ Here is the call graph for this function:

◆ fabsl() [1/2]

template<unsigned DIM>
ADf< long double, DIM > olb::util::fabsl ( const ADf< long double, DIM > & a)
inline

Definition at line 1013 of file aDiff.h.

1014{
1015 return fabs(a);
1016}

References fabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fabsl() [2/2]

long double olb::util::fabsl ( long double arg)
inline

Definition at line 930 of file omath.h.

931{
932 return fabs(arg);
933}

References fabs().

+ Here is the call graph for this function:

◆ findVelocity()

template<typename DESCRIPTORBASE >
int olb::util::findVelocity ( const int v[DESCRIPTORBASE::d])

Definition at line 237 of file util.h.

238{
239 for (int iPop=0; iPop<DESCRIPTORBASE::q; ++iPop) {
240 bool fit = true;
241 for (int iD=0; iD<DESCRIPTORBASE::d; ++iD) {
242 if (descriptors::c<DESCRIPTORBASE>(iPop,iD) != v[iD]) {
243 fit = false;
244 break;
245 }
246 }
247 if (fit) {
248 return iPop;
249 }
250 }
251 return DESCRIPTORBASE::q;
252}

◆ floor() [1/6]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::floor ( const ADf< T, DIM > & a)
inline

Definition at line 869 of file aDiff.h.

870{
871 ADf<T,DIM> c;
872 if (a._v == std::floor(a._v)) {
873 c._v = a._v;
874#ifdef AdWarnings
875 std::cout << "ADf WARNING: floor(Adf) - floor evaluated at non-differentiable point" << std::endl;
876#endif
877 for (unsigned i = 0; i < DIM; ++i) {
878 c._d[i] = (a.d(i) == 0) ? T(0) : std::numeric_limits<T>::quiet_NaN();
879 }
880 return c;
881 }
882 c._v = std::floor(a._v);
883 c._d = ( T(0) );
884 return c;
885}

References olb::util::ADf< T, DIM >::_v, and olb::util::ADf< T, DIM >::d().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ floor() [2/6]

template<typename T , unsigned Size>
Vector< T, Size > olb::util::floor ( const Vector< T, Size > & a)

applies floor to each component of a vector

Definition at line 213 of file vectorHelpers.h.

214{
215 Vector<T,Size> out;
216 for (unsigned int iDim=0; iDim < Size; ++iDim) {
217 out[iDim] = util::floor(a[iDim]);
218 }
219 return out;
220}

References floor().

+ Here is the call graph for this function:

◆ floor() [3/6]

double olb::util::floor ( double arg)
inline

Definition at line 719 of file omath.h.

720{
721 return std::floor(arg);
722}

◆ floor() [4/6]

float olb::util::floor ( float arg)
inline

Definition at line 714 of file omath.h.

715{
716 return std::floor(arg);
717}

◆ floor() [5/6]

long double olb::util::floor ( long double arg)
inline

Definition at line 724 of file omath.h.

725{
726 return std::floor(arg);
727}

◆ floor() [6/6]

template<typename T >
std::enable_if_t< std::is_integral_v< T >, double > olb::util::floor ( T arg)
inline

Definition at line 740 of file omath.h.

741{
742 return std::floor(arg);
743}

◆ floorf() [1/2]

template<unsigned DIM>
ADf< float, DIM > olb::util::floorf ( const ADf< float, DIM > & a)
inline

Definition at line 888 of file aDiff.h.

889{
890 return floor(a);
891}
ADf< T, DIM > floor(const ADf< T, DIM > &a)
Definition aDiff.h:869

References floor().

+ Here is the call graph for this function:

◆ floorf() [2/2]

float olb::util::floorf ( float arg)
inline

Definition at line 729 of file omath.h.

730{
731 return floor(arg);
732}

References floor().

+ Here is the call graph for this function:

◆ floorl() [1/2]

template<unsigned DIM>
ADf< long double, DIM > olb::util::floorl ( const ADf< long double, DIM > & a)
inline

Definition at line 894 of file aDiff.h.

895{
896 return floor(a);
897}

References floor().

+ Here is the call graph for this function:

◆ floorl() [2/2]

long double olb::util::floorl ( long double arg)
inline

Definition at line 734 of file omath.h.

735{
736 return floor(arg);
737}

References floor().

+ Here is the call graph for this function:

◆ fmod() [1/11]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::fmod ( const ADf< T, DIM > & a,
const ADf< T, DIM > & b )
inline

Definition at line 703 of file aDiff.h.

704{
705 const T k = std::floor(T(a) / T(b));
706 return ADf<T,DIM>(a - k * b);
707}
+ Here is the caller graph for this function:

◆ fmod() [2/11]

template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
ADf< T, DIM > olb::util::fmod ( const ADf< T, DIM > & a,
const U & b )
inline

Definition at line 710 of file aDiff.h.

711{
712 return fmod(a, ADf<T,DIM>(b));
713}
ADf< T, DIM > fmod(const ADf< T, DIM > &a, const ADf< T, DIM > &b)
Definition aDiff.h:703

References fmod().

+ Here is the call graph for this function:

◆ fmod() [3/11]

template<class T , unsigned DIM, typename U , typename std::enable_if< std::is_integral< U >::value|std::is_floating_point< U >::value, int >::type = 0>
ADf< T, DIM > olb::util::fmod ( const U & a,
const ADf< T, DIM > & b )
inline

Definition at line 716 of file aDiff.h.

717{
718 return fmod( ADf<T,DIM>(a),b);
719}

References fmod().

+ Here is the call graph for this function:

◆ fmod() [4/11]

template<typename T , typename S , unsigned Size>
Vector< T, Size > olb::util::fmod ( const Vector< T, Size > & a,
S b )

applies fmod to each component of a vector

Definition at line 235 of file vectorHelpers.h.

236{
237 Vector<T,Size> out;
238 for (unsigned int iDim=0; iDim < Size; ++iDim) {
239 out[iDim] = util::fmod(a[iDim], b);
240 }
241 return out;
242}

References fmod().

+ Here is the call graph for this function:

◆ fmod() [5/11]

double olb::util::fmod ( double x,
double y )
inline

Definition at line 72 of file omath.h.

73{
74 return std::fmod(x, y);
75}

◆ fmod() [6/11]

double olb::util::fmod ( double x,
int y )
inline

Definition at line 92 of file omath.h.

93{
94 return std::fmod(x, y);
95}

◆ fmod() [7/11]

float olb::util::fmod ( float x,
float y )
inline

Definition at line 62 of file omath.h.

63{
64 return std::fmod(x, y);
65}

◆ fmod() [8/11]

float olb::util::fmod ( float x,
int y )
inline

Definition at line 87 of file omath.h.

88{
89 return std::fmod(x, y);
90}

◆ fmod() [9/11]

long double olb::util::fmod ( long double x,
int y )
inline

Definition at line 97 of file omath.h.

98{
99 return std::fmod(x, y);
100}

◆ fmod() [10/11]

long double olb::util::fmod ( long double x,
long double y )
inline

Definition at line 77 of file omath.h.

78{
79 return std::fmod(x, y);
80}

◆ fmod() [11/11]

template<typename T , typename S >
auto olb::util::fmod ( T x,
S y )
inline

Definition at line 103 of file omath.h.

104{
105 return std::fmod(x, y);
106}

◆ fmod_pos()

template<typename T , typename S >
auto olb::util::fmod_pos ( T a,
S b )
inline

Variant of fmod (floating point modulo) that always returns positive values.

Definition at line 39 of file calc.h.

39 {
40 const auto res = util::fmod(a, b);
41 if (res < 0) {
42 return (res + b);
43 } else {
44 return res;
45 }
46}

References fmod().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fmodf()

float olb::util::fmodf ( float x,
float y )
inline

Definition at line 67 of file omath.h.

68{
69 return fmod(x, y);
70}

References fmod().

+ Here is the call graph for this function:

◆ fmodl()

long double olb::util::fmodl ( long double x,
long double y )
inline

Definition at line 82 of file omath.h.

83{
84 return fmod(x, y);
85}

References fmod().

+ Here is the call graph for this function:

◆ fromVector2()

template<typename T >
std::vector< T > olb::util::fromVector2 ( const Vector< T, 2 > & vec)

Definition at line 135 of file vectorHelpers.h.

136{
137 std::vector<T> v;
138 v.push_back(vec[0]);
139 v.push_back(vec[1]);
140 return v;
141}

◆ fromVector3()

template<typename T >
std::vector< T > olb::util::fromVector3 ( const Vector< T, 3 > & vec)

Definition at line 126 of file vectorHelpers.h.

127{
128 std::vector<T> v;
129 v.push_back(vec[0]);
130 v.push_back(vec[1]);
131 v.push_back(vec[2]);
132 return v;
133}
+ Here is the caller graph for this function:

◆ get_nearest_link()

template<typename T , typename DESCRIPTOR >
int olb::util::get_nearest_link ( const std::vector< T > & vec)

Util Function for Wall Model of Malaspinas get link with smallest angle to a vector.

Definition at line 354 of file util.h.

355{
356 T max=-1;
357 int max_index = 0;
358 for (int iQ=1; iQ<DESCRIPTOR::q; ++iQ) {
359 std::vector<T> c_i(DESCRIPTOR::c[iQ], DESCRIPTOR::c[iQ]+3);
360 T tmp = util::scalarProduct<T>(c_i, vec)/util::norm(c_i);
361 if (tmp > max) {
362 max = tmp;
363 max_index = iQ;
364 }
365 }
366 return max_index;
367}

References max(), and norm().

+ Here is the call graph for this function:

◆ iniAD() [1/3]

template<unsigned n, typename S , template< typename > typename C>
C< ADf< S, n > > olb::util::iniAD ( const C< S > & source)

copy values and initialize derivatives

Definition at line 101 of file adHelpers.h.

101 {
102 auto result = copyAs<ADf<S,n>,S,C> (source);
103 util::iniDiagonal (result);
104 return result;
105}

References iniDiagonal().

+ Here is the call graph for this function:

◆ iniAD() [2/3]

template<unsigned n, typename S >
ADf< S, n > * olb::util::iniAD ( const S * source)

copy array values and initialize derivatives

Definition at line 92 of file adHelpers.h.

92 {
93 ADf<S,n>* result = new ADf<S,n>[n];
94 util::copyN (result, source, n);
95 util::iniDiagonal (result, n);
96 return result;
97}

References copyN(), and iniDiagonal().

+ Here is the call graph for this function:

◆ iniAD() [3/3]

template<typename S >
ADf< S, 1 > olb::util::iniAD ( const S source)

copy value and initialize derivative

Definition at line 84 of file adHelpers.h.

84 {
85 ADf<S,1> result(source);
86 result.setDiffVariable(0);
87 return result;
88}

References olb::util::ADf< T, DIM >::setDiffVariable().

+ Here is the call graph for this function:

◆ iniDiagonal() [1/2]

template<typename C >
void olb::util::iniDiagonal ( C & a)

Definition at line 49 of file adHelpers.h.

49 {
50 for (unsigned i = 0; i < a.size(); ++i) {
51 a[i].setDiffVariable(i);
52 }
53}

◆ iniDiagonal() [2/2]

template<typename SAD >
void olb::util::iniDiagonal ( SAD * a,
int dim )

The variables of an array are set to be the differential variables.

--> d/di a_j = 1 if (i==j) else 0.

Definition at line 42 of file adHelpers.h.

42 {
43 for (int i = 0; i < dim; ++i) {
44 a[i].setDiffVariable(i);
45 }
46}
+ Here is the caller graph for this function:

◆ intersect() [1/2]

bool olb::util::intersect ( int x0,
int x1,
int y0,
int y1,
int x0_,
int x1_,
int y0_,
int y1_,
int & newX0,
int & newX1,
int & newY0,
int & newY1 )
inline

Definition at line 89 of file util.h.

93{
94 newX0 = util::max(x0,x0_);
95 newY0 = util::max(y0,y0_);
96
97 newX1 = util::min(x1,x1_);
98 newY1 = util::min(y1,y1_);
99
100 return newX1>=newX0 && newY1>=newY0;
101}

References max(), and min().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ intersect() [2/2]

bool olb::util::intersect ( int x0,
int x1,
int y0,
int y1,
int z0,
int z1,
int x0_,
int x1_,
int y0_,
int y1_,
int z0_,
int z1_,
int & newX0,
int & newX1,
int & newY0,
int & newY1,
int & newZ0,
int & newZ1 )
inline

Definition at line 103 of file util.h.

107{
108 newX0 = util::max(x0,x0_);
109 newY0 = util::max(y0,y0_);
110 newZ0 = util::max(z0,z0_);
111
112 newX1 = util::min(x1,x1_);
113 newY1 = util::min(y1,y1_);
114 newZ1 = util::min(z1,z1_);
115
116 return newX1>=newX0 && newY1>=newY0 && newZ1>=newZ0;
117}

References max(), and min().

+ Here is the call graph for this function:

◆ invertRotation()

template<typename T , unsigned D, bool OUTPUT_USES_ROTATION_CENTER_AS_ORIGIN = false>
Vector< T, D > olb::util::invertRotation ( const Vector< T, D > & input,
const Vector< T, utilities::dimensions::convert< D >::matrix > & rotationMatrix,
const Vector< T, D > & rotationCenter = Vector<T, D>(0.) )

Rotates the input around the rotationCenter with a given rotationMatrix in the opposite direction.

Definition at line 182 of file geometricOperations.h.

186{
188 invertRotationMatrix<T, D>(rotationMatrix);
189 return executeRotation(input, invRotationMatrix, rotationCenter);
190}
Vector< T, D > executeRotation(const Vector< T, D > &input, const Vector< T, utilities::dimensions::convert< D >::matrix > &rotationMatrix, const Vector< T, D > &rotationCenter=Vector< T, D >(0.))
Rotates the input around the rotationCenter with a given rotationMatrix.

References executeRotation().

+ Here is the call graph for this function:

◆ invertRotationMatrix()

template<typename T , unsigned D>
Vector< T, utilities::dimensions::convert< D >::matrix > olb::util::invertRotationMatrix ( const Vector< T, utilities::dimensions::convert< D >::matrix > & rotationMatrix)

Definition at line 113 of file geometricOperations.h.

115{
116 if constexpr (D == 2) {
117 return Vector<T, 4>(rotationMatrix[0], rotationMatrix[2], rotationMatrix[1],
118 rotationMatrix[3]);
119 }
120 else {
121
122 //Individual Entries ( source: https://doi.org/10.1016/j.compfluid.2018.02.027 )
123 // |x0| / 0 3 6 \ |x1|
124 // |y0| | 1 4 7 | = |x1|
125 // |z0| \ 2 5 8 / |x1|
126
127 return Vector<T, 9>(rotationMatrix[0], rotationMatrix[3], rotationMatrix[6],
128 rotationMatrix[1], rotationMatrix[4], rotationMatrix[7],
129 rotationMatrix[2], rotationMatrix[5],
130 rotationMatrix[8]);
131 }
132 __builtin_unreachable();
133}

◆ isContained()

template<typename C , typename U >
bool olb::util::isContained ( const C & c,
U object )

Check, if object is contained in iteratable container c.

Definition at line 435 of file vectorHelpers.h.

435 {
436 return (std::find(c.begin(), c.end(), object) != c.end());
437}
+ Here is the caller graph for this function:

◆ labs() [1/2]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::labs ( const ADf< T, DIM > & a)
inline

Definition at line 1025 of file aDiff.h.

1026{
1027#ifdef AdWarnings
1028 std::cout << "ADf WARNING: ADf is not supporting integer types. Using abs() instead." << std::endl;
1029#endif
1030 return abs(a);
1031}
std::enable_if_t< std::is_arithmetic< T >::type::value, T > abs(T x)
Definition util.h:396

References abs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ labs() [2/2]

long olb::util::labs ( long arg)
inline

Definition at line 910 of file omath.h.

911{
912 return abs(arg);
913}

References abs().

+ Here is the call graph for this function:

◆ llabs() [1/2]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::llabs ( const ADf< T, DIM > & a)
inline

Definition at line 1034 of file aDiff.h.

1035{
1036 return labs(a);
1037}
ADf< T, DIM > labs(const ADf< T, DIM > &a)
Definition aDiff.h:1025

References labs().

+ Here is the call graph for this function:

◆ llabs() [2/2]

long long olb::util::llabs ( long long arg)
inline

Definition at line 915 of file omath.h.

916{
917 return abs(arg);
918}

References abs().

+ Here is the call graph for this function:

◆ llround() [1/2]

template<class T , unsigned DIM>
ADf< T, DIM > olb::util::llround ( const ADf< T, DIM > & a)
inline

Definition at line 978 of file aDiff.h.

979{
980 return lround(a);
981}
ADf< T, DIM > lround(const ADf< T, DIM > &a)
Definition aDiff.h:957

References lround().

+ Here is the call graph for this function: