walberla::math Namespace Reference

Namespaces

 internal
 

Classes

class  BoolRandom
 
class  DistributedSample
 Class describing a distributed statistical sample. More...
 
union  DoubleAndLongLong
 
class  Equation
 
class  EquationParser
 
class  EquationSystem
 Wrapper class to handle and solve an equation system, e.g. More...
 
union  FloatAndLong
 
class  FunctionParser
 Function parser, for parsing and evaluating functions. More...
 
class  FunctionParserOMP
 
class  GenericAABB
 GenericAABB represents an axis-aligned bounding box. More...
 
class  IntRandom
 
class  KahanAccumulator
 
struct  Limits
 Numerical limits of built-in data types. More...
 
class  MathTrait
 Base template for the MathTrait class. More...
 
struct  MathTrait< T, T >
 
class  Matrix2
 Efficient, generic implementation of a 2x2 matrix. More...
 
class  Matrix3
 Efficient, generic implementation of a 3x3 matrix. More...
 
class  MatrixMxN
 Efficient implementation of a \( M \times N \) matrix. More...
 
class  Node
 
class  OpDiv
 
class  OpLog
 
class  OpMinus
 
class  OpMult
 
class  OpNo
 
class  OpPlus
 
class  OpProd
 
class  OpRoot
 
class  OpType
 
class  PhysicalCheck
 Wrapper class to check for physical properties and correctness of given input parameters. More...
 
class  Plane
 
class  Quaternion
 Efficient implementation of a quaternion. More...
 
class  RealRandom
 
class  Rot3
 Rotation class which merges quaternion and matrix representation. More...
 
class  Sample
 Class describing a statistical sample. More...
 
struct  SqrtTrait
 Base template for the SqrtTrait class. More...
 
class  Var
 
class  Vector2
 Efficient, generic implementation of a 2-dimensional vector. More...
 
struct  Vector2LexicographicalyLess
 Functor providing a lexicographical ordering for Vector2. More...
 
class  Vector3
 Efficient, generic implementation of a 3-dimensional vector. More...
 
struct  Vector3LexicographicalyLess
 Functor providing a lexicographical ordering for Vector3. More...
 

Typedefs

typedef GenericAABB< real_tAABB
 
typedef shared_ptr< EquationSystemEquationSystemPtr
 
typedef std::shared_ptr< NodeNodePtr
 
typedef std::shared_ptr< EquationEquationPtr
 
typedef std::shared_ptr< VarVarPtr
 
typedef std::map< std::string, VarPtrVarMap
 
typedef std::map< std::string, VarPtr >::const_iterator VarMapIt
 

Enumerations

enum  NodeType { NT_OPERATOR, NT_CONSTANT, NT_VARIABLE }
 
enum  NodeDir { ND_LEFT, ND_RIGHT }
 

Functions

std::ostream & operator<< (std::ostream &os, const Node &node)
 
std::ostream & operator<< (std::ostream &os, const Equation &eq)
 
OpNo OP_NO ( 'n',"no op", 0u)
 
OpNo OP_EQUAL ( '=',"equal", 0u)
 
OpPlus OP_PLUS ( '+',"plus", 10u)
 
OpMinus OP_MINUS ( '-',"minus", 10u)
 
OpMult OP_MULT ( '*',"mult", 30u)
 
OpDiv OP_DIV ( '/',"div", 30u)
 
OpProd OP_PROD ( '^',"prod", 40u)
 
OpLog OP_LOG ( '$',"log", 50u)
 
int isop (const char c)
 
OpTypegetOp (const char c)
 
std::ostream & operator<< (std::ostream &os, const OpType &type)
 
std::ostream & operator<< (std::ostream &os, const Var &var)
 
template<unsigned int numIter>
double fastInvSqrt (double y)
 Computes 1.0 / sqrt(x) with limited accuracy. More...
 
template<unsigned int numIter>
float fastInvSqrt (float y)
 Float version, for documentation see above. More...
 
template<typename T >
bool isnan (T x)
 Query if 'x' is NaN. More...
 
template<typename T >
bool isinf (T x)
 Query if 'x' is infinite. More...
 
template<typename T >
bool finite (T x)
 Query if 'x' is finite. More...
 
template<typename T , typename U >
bool operator== (const GenericAABB< T > &lhs, const GenericAABB< U > &rhs)
 Compares two GenericeAABBs for equality. More...
 
template<typename T , typename U >
bool operator!= (const GenericAABB< T > &lhs, const GenericAABB< U > &rhs)
 Compares two GenericeAABBs for inequality. More...
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const GenericAABB< T > &aabb)
 Writes a GenericAABB to a std::ostream. More...
 
template<typename T >
std::istream & operator>> (std::istream &is, GenericAABB< T > &aabb)
 Reads an GenericAABB from a std::istream. More...
 
template<typename T , typename G , typename VT >
mpi::GenericSendBuffer< T, G > & operator<< (mpi::GenericSendBuffer< T, G > &buf, const GenericAABB< VT > &aabb)
 Serializes an GenericAABB into a mpi::GenericSendBuffer. More...
 
std::vector< uint_tgetFactors (const uint_t number, const uint_t numberOfFactors)
 Computes and returns an integer factorization of any arbitrary integer. More...
 
std::vector< uint_tgetFactors (const uint_t number, const uint_t numberOfFactors, const std::vector< real_t > &weight)
 
Vector3< uint_tgetFactors3D (const uint_t number)
 
Vector3< uint_tgetFactors3D (const uint_t number, const Vector3< real_t > &weights)
 
template<typename Iterator >
std::iterator_traits< Iterator >::value_type kahanSummation (const Iterator &begin, const Iterator &end)
 
template<typename T0 , typename T1 >
Matrix2< typename MathTrait< T0, T1 >::High > tensorProduct (Vector2< T0 > v0, Vector2< T1 > v1)
 
template<typename T , typename G , typename MT >
mpi::GenericSendBuffer< T, G > & operator<< (mpi::GenericSendBuffer< T, G > &buf, const Matrix2< MT > &m)
 
template<typename T , typename MT >
mpi::GenericRecvBuffer< T > & operator>> (mpi::GenericRecvBuffer< T > &buf, Matrix2< MT > &m)
 
template<typename Type >
const Matrix3< Type > operator- (const Matrix3< Type > &rhs)
 Negation operator for the negation of one matrix. More...
 
template<typename Type >
const Matrix3< Type > skewSymCrossProduct (const Matrix3< Type > &mat, const Vector3< Type > &vec)
 Cross product (outer product) between a matrix and a vector ( \( R = M \cdot r^{\times} \)). More...
 
template<typename Type >
const Matrix3< Type > skewSymCrossProduct (const Vector3< Type > &vec, const Matrix3< Type > &mat)
 Cross product (outer product) between a vector and a matrix ( \( R = r^{\times} \cdot M \)). More...
 
template<typename Type >
const Matrix3< Type > dyadicProduct (const Vector3< Type > &vec1, const Vector3< Type > &vec2)
 Dyadic product of two vectors ( \( M = u \otimes v \)). More...
 
template<typename Type >
bool isinf (const Matrix3< Type > &m)
 Checks the given matrix for infinite elements. More...
 
template<typename T0 , typename T1 >
Matrix3< typename MathTrait< T0, T1 >::High > tensorProduct (Vector3< T0 > v0, Vector3< T1 > v1)
 
template<typename Type >
Matrix3< Type > transformMatrixRART (const Matrix3< Type > &R, const Matrix3< Type > &A)
 Equivalent to R*A*R.getTranspose(). More...
 
std::ostream & operator<< (std::ostream &os, const Plane &plane)
 
std::istream & operator>> (std::istream &is, Plane &plane)
 
bool isPrime (const uint_t n)
 Query if n is prime. More...
 
std::vector< uint_tgetPrimes (const uint_t n)
 Determine prime numbers up to an upper bound. More...
 
std::vector< uint_tgetPrimeFactors (const uint_t n)
 Gets all prime factors of a number. More...
 
std::set< uint_tgetDevisors (const uint_t n)
 Gets all devisors of a number n. More...
 
void seedRandomGenerator (const std::mt19937::result_type &seed)
 
template<typename INT >
INT intRandom (const INT min, const INT max, std::mt19937 &generator)
 Returns a random integral number of type INT in the range [min,max] (max included!) More...
 
template<>
char intRandom< char > (const char min, const char max, std::mt19937 &generator)
 
template<>
unsigned char intRandom< unsigned char > (const unsigned char min, const unsigned char max, std::mt19937 &generator)
 
template<>
signed char intRandom< signed char > (const signed char min, const signed char max, std::mt19937 &generator)
 
template<typename INT >
INT intRandom (const INT min)
 
template<typename INT >
INT intRandom (const INT min, const INT max)
 
template<typename INT >
INT intRandom ()
 
template<typename REAL = real_t>
REAL realRandom (const REAL min=REAL(0), const REAL max=REAL(1), std::mt19937 &generator=internal::getGenerator())
 Returns a random floating point number of type REAL in the range [min,max) (max excluded!) More...
 
bool boolRandom ()
 
template<typename Type >
std::ostream & operator<< (std::ostream &os, const Rot3< Type > &r)
 
template<typename Type >
void rotateAroundPoint (Vector3< Type > &pos, Rot3< Type > &rot, const Vector3< Type > &rotateAround, const Rot3< Type > &dRot)
 
std::ostream & operator<< (std::ostream &os, const Sample &statReal)
 Stream output operator for class Sample. More...
 
template<typename T , typename G >
mpi::GenericSendBuffer< T, G > & operator<< (mpi::GenericSendBuffer< T, G > &buf, const Sample &statReal)
 
template<typename T >
mpi::GenericRecvBuffer< T > & operator>> (mpi::GenericRecvBuffer< T > &buf, Sample &statReal)
 
template<typename Type >
void clear (Type &clearable)
 Clearing the given value/object to the default state. More...
 
float inv (float a)
 Inverting the given single precision value. More...
 
double inv (double a)
 Inverting the given double precision value. More...
 
long double inv (long double a)
 Inverting the given long double value. More...
 
template<typename Type >
bool isDefault (const Type &v)
 Returns whether the given value/object is in default state. More...
 
template<typename Type >
void reset (Type &resettable)
 Resetting the given value/object to the default value. More...
 
template<typename T >
const T sq (const T &a)
 Squaring the given value/object. More...
 
template<>
uint_t uintMSBPosition< uint64_t > (uint64_t value)
 
template<typename UINT >
bool uintIsEven (const UINT value)
 Returns true only if 'value' is an even number. More...
 
template<typename UINT >
bool uintIsPowerOfTwo (const UINT value)
 Returns true only if 'value' (must be an unsigned integer) is a power of 2 (http://graphics.stanford.edu/~seander/bithacks.html) More...
 
template<typename UINT >
UINT uintPow2 (const UINT exp)
 Returns the result of 2^exp. More...
 
template<typename UINT >
UINT uintPow4 (UINT exp)
 Returns the result of 4^exp. More...
 
template<typename UINT >
UINT uintPow8 (UINT exp)
 Returns the result of 8^exp. More...
 
template<typename UINT >
UINT uintPow16 (UINT exp)
 Returns the result of 16^exp. More...
 
template<typename UINT >
uint_t uintMSBPosition (UINT value)
 Calculation of the position of the most significant bit of a variable of type UINT. More...
 
template<>
uint_t uintMSBPosition< uint32_t > (uint32_t value)
 
template<>
uint_t uintMSBPosition< uint16_t > (uint16_t value)
 
template<>
uint_t uintMSBPosition< uint8_t > (uint8_t value)
 
template<typename T >
Vector2< T > & normalize (Vector2< T > &v)
 Normalization of the vector ( \(|\vec{a}|=1\)). More...
 
template<typename Type , typename Other >
std::enable_if< std::is_fundamental< Other >::value, Vector2< typename MathTrait< Type, Other >::High > >::type operator* (Other scalar, const Vector2< Type > &vec)
 Multiplication operator for the multiplication of a scalar value and a vector. More...
 
template<>
std::istream & operator>> (std::istream &is, Vector2< bool > &v)
 Specialization for input operator for 2-dimensional vectors of bool. More...
 
template<typename T >
size_t hash_value (const Vector2< T > &v)
 Function providing a hash value for Vector2. More...
 
template<typename T >
Vector3< T > & normalize (Vector3< T > &v)
 Normalization of the vector ( \(|\vec{a}|=1\)). More...
 
template<typename Type >
Vector3< Type > cross (const Vector3< Type > &lhs, const Vector3< Type > &rhs)
 Cross product (outer product) of two vectors ( \( \vec{a}=\vec{b}\times\vec{c} \)). More...
 
template<typename Type , typename Other >
Vector3< typename MathTrait< Type, Other >::High > operator/ (Other lhs, const Vector3< Type > &rhs)
 
template<typename Type , typename Other >
std::enable_if< std::is_fundamental< Other >::value, Vector3< typename MathTrait< Type, Other >::High > >::type operator* (Other scalar, const Vector3< Type > &vec)
 Multiplication operator for the multiplication of a scalar value and a vector. More...
 
template<>
std::istream & operator>> (std::istream &is, Vector3< bool > &v)
 Specialization for input operator for 3-dimensional vectors of bool. More...
 
template<typename Type >
void normals (const Vector3< Type > &v, Vector3< Type > &defNor, Vector3< Type > &comNor)
 
template<typename T >
real_t length (const Vector3< T > &v)
 Length of the vector. More...
 
template<typename T >
real_t sqrLength (const Vector3< T > &v)
 Length of the vector squared. More...
 
template<typename T >
real_t dot (const Vector3< T > &v1, const Vector3< T > &v2)
 Dot product of two vectors. More...
 
template<typename T >
size_t hash_value (const Vector3< T > &v)
 Function providing a hash value for Vector3. More...
 
Matrix2 operators
template<typename Type >
std::ostream & operator<< (std::ostream &os, const Matrix2< Type > &m)
 Global output operator for 2x2 matrices. More...
 
template<typename Type >
bool isnan (const Matrix2< Type > &m)
 Checks the given matrix for not-a-number elements. More...
 
template<typename Type >
const Matrix2< Type > abs (const Matrix2< Type > &m)
 Returns a matrix containing the absolute values of each single element of m. More...
 
template<typename Type >
const Matrix2< Type > fabs (const Matrix2< Type > &m)
 Returns a matrix containing the absolute values of each single element of m. More...
 
Matrix3 operators
template<typename Type >
std::ostream & operator<< (std::ostream &os, const Matrix3< Type > &m)
 Global output operator for 3x3 matrices. More...
 
template<typename Type >
bool isnan (const Matrix3< Type > &m)
 Checks the given matrix for not-a-number elements. More...
 
template<typename Type >
const Matrix3< Type > abs (const Matrix3< Type > &m)
 Returns a matrix containing the absolute values of each single element of m. More...
 
template<typename Type >
const Matrix3< Type > fabs (const Matrix3< Type > &m)
 Returns a matrix containing the absolute values of each single element of m. More...
 
MatrixMxN operators
template<typename Type >
bool isnan (const MatrixMxN< Type > &m)
 Checks the given matrix for not-a-number elements. More...
 
template<typename Type >
void reset (MatrixMxN< Type > &m)
 Resetting the given dense matrix. More...
 
template<typename Type >
void clear (MatrixMxN< Type > &m)
 Clearing the given dense matrix. More...
 
template<typename Type >
bool isDefault (const MatrixMxN< Type > &m)
 Returns whether the given dense matrix is in default state. More...
 
template<typename Type >
const MatrixMxN< Type > inv (const MatrixMxN< Type > &m)
 Inverting the given dense matrix. More...
 
template<typename Type >
void swap (MatrixMxN< Type > &a, MatrixMxN< Type > &b)
 Swapping the contents of two matrices. More...
 
Quaternion operators
template<typename T1 , typename T2 >
bool operator== (const Quaternion< T1 > &lhs, const Quaternion< T2 > &rhs)
 Equality operator for the comparison of two quaternions. More...
 
template<typename T1 , typename T2 >
bool operator!= (const Quaternion< T1 > &lhs, const Quaternion< T2 > &rhs)
 Inequality operator for the comparison of two quaternions. More...
 
template<typename Type >
std::ostream & operator<< (std::ostream &os, const Quaternion< Type > &q)
 Global output operator for quaternions. More...
 
template<typename Type >
std::istream & operator>> (std::istream &is, Quaternion< Type > &q)
 Global input operator for quaternions. More...
 
template<typename Type >
bool isnan (const Quaternion< Type > &q)
 Checks the given quaternion for not-a-number elements. More...
 
template<typename Type >
void reset (Quaternion< Type > &q)
 Resetting the given quaternion. More...
 
template<typename Type >
void clear (Quaternion< Type > &q)
 Clearing the given quaternion. More...
 
template<typename Type >
bool isDefault (const Quaternion< Type > &q)
 Returns whether the given quaternion is in default state. More...
 
template<typename Type >
const Quaternion< Type > inv (const Quaternion< Type > &q)
 Inverting the given quaternion. More...
 
template<typename Type >
const Quaternion< Type > sq (const Quaternion< Type > &q)
 Squaring the given quaternion. More...
 
template<typename Type >
void swap (Quaternion< Type > &a, Quaternion< Type > &b)
 Swapping the contents of two quaternions. More...
 
Quaternion arithmetic operators

These operators support operations between quaternions of different element types.

They work for all element types supported by the MathTrait class template.

template<typename T1 , typename T2 >
const Quaternion< typename MathTrait< T1, T2 >::MultType > operator* (const Quaternion< T1 > &lhs, const Quaternion< T2 > &rhs)
 Multiplication operator for the multiplication of two quaternions ( \( \hat{q}=\hat{p}*\hat{r} \)). More...
 
Mathematical utility functions
template<typename T >
const T sign (T a)
 Sign function. More...
 
template<typename T >
const std::enable_if< std::is_unsigned< T >::value, T >::type abs (T a)
 Absolute value function. More...
 
template<typename T >
const std::enable_if< !std::is_unsigned< T >::value, T >::type abs (T a)
 
template<typename T1 , typename T2 >
const MathTrait< T1, T2 >::High min (const T1 &a, const T2 &b)
 Minimum function for two arguments. More...
 
template<typename T1 , typename T2 , typename T3 >
const MathTrait< typename MathTrait< T1, T2 >::High, T3 >::High min (const T1 &a, const T2 &b, const T3 &c)
 Minimum function for three arguments. More...
 
template<typename T1 , typename T2 >
const MathTrait< T1, T2 >::High max (const T1 &a, const T2 &b)
 Maximum function for two arguments. More...
 
template<typename T1 , typename T2 , typename T3 >
const MathTrait< typename MathTrait< T1, T2 >::High, T3 >::High max (const T1 &a, const T2 &b, const T3 &c)
 Maximum function for three arguments. More...
 
template<typename T >
const T sqr (const T &a)
 Square function. More...
 
template<typename T1 , typename T2 >
bool equal (T1 a, T2 b)
 Generic equality check. More...
 
real_t round (real_t a)
 Rounding function. More...
 
Vector2 operators
template<typename Type >
bool operator== (unsigned char scalar, const Vector2< Type > &vec)
 Equality operator for the comparison of an unsigned char scalar and a vector. More...
 
template<typename Type >
bool operator== (char scalar, const Vector2< Type > &vec)
 Equality operator for the comparison of a char scalar and a vector. More...
 
template<typename Type >
bool operator== (signed char scalar, const Vector2< Type > &vec)
 Equality operator for the comparison of a signed char scalar and a vector. More...
 
template<typename Type >
bool operator== (wchar_t scalar, const Vector2< Type > &vec)
 Equality operator for the comparison of a wchar_t scalar and a vector. More...
 
template<typename Type >
bool operator== (unsigned short scalar, const Vector2< Type > &vec)
 Equality operator for the comparison of an unsigned short scalar and a vector. More...
 
template<typename Type >
bool operator== (short scalar, const Vector2< Type > &vec)
 Equality operator for the comparison of a short scalar and a vector. More...
 
template<typename Type >
bool operator== (unsigned int scalar, const Vector2< Type > &vec)
 
template<typename Type >
bool operator== (int scalar, const Vector2< Type > &vec)
 Equality operator for the comparison of an int scalar and a vector. More...
 
template<typename Type >
bool operator== (unsigned long scalar, const Vector2< Type > &vec)
 Equality operator for the comparison of an unsigned long scalar and a vector. More...
 
template<typename Type >
bool operator== (long scalar, const Vector2< Type > &vec)
 Equality operator for the comparison of a long scalar and a vector. More...
 
template<typename Type >
bool operator== (float scalar, const Vector2< Type > &vec)
 Equality operator for the comparison of a float scalar and a vector. More...
 
template<typename Type >
bool operator== (double scalar, const Vector2< Type > &vec)
 Equality operator for the comparison of a double scalar and a vector. More...
 
template<typename Type >
bool operator== (long double scalar, const Vector2< Type > &vec)
 Equality operator for the comparison of a long double scalar and a vector. More...
 
template<typename Type >
bool operator!= (unsigned char scalar, const Vector2< Type > &vec)
 Inequality operator for the comparison of an unsigned char scalar value and a vector. More...
 
template<typename Type >
bool operator!= (char scalar, const Vector2< Type > &vec)
 Inequality operator for the comparison of a char scalar value and a vector. More...
 
template<typename Type >
bool operator!= (signed char scalar, const Vector2< Type > &vec)
 Inequality operator for the comparison of a signed char scalar value and a vector. More...
 
template<typename Type >
bool operator!= (wchar_t scalar, const Vector2< Type > &vec)
 Inequality operator for the comparison of a wchar_t scalar value and a vector. More...
 
template<typename Type >
bool operator!= (unsigned short scalar, const Vector2< Type > &vec)
 Inequality operator for the comparison of an unsigned short scalar value and a vector. More...
 
template<typename Type >
bool operator!= (short scalar, const Vector2< Type > &vec)
 Inequality operator for the comparison of a short scalar value and a vector. More...
 
template<typename Type >
bool operator!= (unsigned int scalar, const Vector2< Type > &vec)
 
template<typename Type >
bool operator!= (int scalar, const Vector2< Type > &vec)
 Inequality operator for the comparison of an int scalar value and a vector. More...
 
template<typename Type >
bool operator!= (unsigned long scalar, const Vector2< Type > &vec)
 Inequality operator for the comparison of an unsigned long scalar value and a vector. More...
 
template<typename Type >
bool operator!= (long scalar, const Vector2< Type > &vec)
 Inequality operator for the comparison of a long scalar value and a vector. More...
 
template<typename Type >
bool operator!= (float scalar, const Vector2< Type > &vec)
 Inequality operator for the comparison of a float scalar value and a vector. More...
 
template<typename Type >
bool operator!= (double scalar, const Vector2< Type > &vec)
 Inequality operator for the comparison of a double scalar value and a vector. More...
 
template<typename Type >
bool operator!= (long double scalar, const Vector2< Type > &vec)
 Inequality operator for the comparison of a long double scalar value and a vector. More...
 
template<typename Type >
std::ostream & operator<< (std::ostream &os, const Vector2< Type > &v)
 Global output operator for 2-dimensional vectors. More...
 
template<typename Type >
std::istream & operator>> (std::istream &is, Vector2< Type > &v)
 Global input operator for 2-dimensional vectors. More...
 
template<typename Type >
bool isnan (const Vector2< Type > &v)
 Checks the given vector for not-a-number elements. More...
 
template<typename Type >
const Vector2< Type > abs (const Vector2< Type > &v)
 Returns a vector containing the absolute values of each single element of v. More...
 
template<typename Type >
const Vector2< Type > fabs (const Vector2< Type > &v)
 Returns a vector containing the absolute values of each single element of v. More...
 
Vector3 operators
template<typename Type >
bool operator== (unsigned char scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of an unsigned char scalar and a vector. More...
 
template<typename Type >
bool operator== (char scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a char scalar and a vector. More...
 
template<typename Type >
bool operator== (signed char scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a signed char scalar and a vector. More...
 
template<typename Type >
bool operator== (wchar_t scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a wchar_t scalar and a vector. More...
 
template<typename Type >
bool operator== (unsigned short scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of an unsigned short scalar and a vector. More...
 
template<typename Type >
bool operator== (short scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a short scalar and a vector. More...
 
template<typename Type >
bool operator== (unsigned int scalar, const Vector3< Type > &vec)
 
template<typename Type >
bool operator== (int scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of an int scalar and a vector. More...
 
template<typename Type >
bool operator== (unsigned long scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of an unsigned long scalar and a vector. More...
 
template<typename Type >
bool operator== (long scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a long scalar and a vector. More...
 
template<typename Type >
bool operator== (float scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a float scalar and a vector. More...
 
template<typename Type >
bool operator== (double scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a double scalar and a vector. More...
 
template<typename Type >
bool operator== (long double scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a long double scalar and a vector. More...
 
template<typename Type >
bool operator!= (unsigned char scalar, const Vector3< Type > &vec)
 Inequality operator for the comparison of an unsigned char scalar value and a vector. More...
 
template<typename Type >
bool operator!= (char scalar, const Vector3< Type > &vec)
 Inequality operator for the comparison of a char scalar value and a vector. More...
 
template<typename Type >
bool operator!= (signed char scalar, const Vector3< Type > &vec)
 Inequality operator for the comparison of a signed char scalar value and a vector. More...
 
template<typename Type >
bool operator!= (wchar_t scalar, const Vector3< Type > &vec)
 Inequality operator for the comparison of a wchar_t scalar value and a vector. More...
 
template<typename Type >
bool operator!= (unsigned short scalar, const Vector3< Type > &vec)
 Inequality operator for the comparison of an unsigned short scalar value and a vector. More...
 
template<typename Type >
bool operator!= (short scalar, const Vector3< Type > &vec)
 Inequality operator for the comparison of a short scalar value and a vector. More...
 
template<typename Type >
bool operator!= (unsigned int scalar, const Vector3< Type > &vec)
 
template<typename Type >
bool operator!= (int scalar, const Vector3< Type > &vec)
 Inequality operator for the comparison of an int scalar value and a vector. More...
 
template<typename Type >
bool operator!= (unsigned long scalar, const Vector3< Type > &vec)
 Inequality operator for the comparison of an unsigned long scalar value and a vector. More...
 
template<typename Type >
bool operator!= (long scalar, const Vector3< Type > &vec)
 Inequality operator for the comparison of a long scalar value and a vector. More...
 
template<typename Type >
bool operator!= (float scalar, const Vector3< Type > &vec)
 Inequality operator for the comparison of a float scalar value and a vector. More...
 
template<typename Type >
bool operator!= (double scalar, const Vector3< Type > &vec)
 Inequality operator for the comparison of a double scalar value and a vector. More...
 
template<typename Type >
bool operator!= (long double scalar, const Vector3< Type > &vec)
 Inequality operator for the comparison of a long double scalar value and a vector. More...
 
template<typename Type >
std::ostream & operator<< (std::ostream &os, const Vector3< Type > &v)
 Global output operator for 3-dimensional vectors. More...
 
template<typename Type >
std::istream & operator>> (std::istream &is, Vector3< Type > &v)
 Global input operator for 3-dimensional vectors. More...
 
template<typename Type >
bool isnan (const Vector3< Type > &v)
 Checks the given vector for not-a-number elements. More...
 
template<typename Type >
bool isinf (const Vector3< Type > &v)
 Checks the given vector for infinite elements. More...
 
template<typename Type >
bool finite (const Vector3< Type > &v)
 Checks if the given vector has only finite elements. More...
 
template<typename Type >
const Vector3< Type > abs (const Vector3< Type > &v)
 Returns a vector containing the absolute values of each single element of v. More...
 
template<typename Type >
const Vector3< Type > fabs (const Vector3< Type > &v)
 Returns a vector containing the absolute values of each single element of v. More...
 

Variables

constexpr real_t e = real_t(2.7182818284590452354)
 
constexpr real_t log2_e = real_t(1.4426950408889634074)
 
constexpr real_t log10_e = real_t(0.43429448190325182765)
 
constexpr real_t ln_two = real_t(0.69314718055994530942)
 
constexpr real_t ln_ten = real_t(2.30258509299404568402)
 
constexpr real_t pi = real_t(3.14159265358979323846)
 
constexpr real_t half_pi = real_t(1.57079632679489661923)
 
constexpr real_t fourth_pi = real_t(0.78539816339744830962)
 
constexpr real_t one_div_pi = real_t(0.31830988618379067154)
 
constexpr real_t two_div_pi = real_t(0.63661977236758134308)
 
constexpr real_t two_div_root_pi = real_t(1.12837916709551257390)
 
constexpr real_t root_two = real_t(1.41421356237309504880)
 
constexpr real_t one_div_root_two = real_t(0.70710678118654752440)
 
OpNo OP_NO
 
OpNo OP_EQUAL
 
OpPlus OP_PLUS
 
OpMinus OP_MINUS
 
OpMult OP_MULT
 
OpDiv OP_DIV
 
OpProd OP_PROD
 
OpLog OP_LOG
 
OpRoot OP_ROOT
 
double NAN_VAL
 
static const uint8_t msbLookupTable [256]
 

Typedef Documentation

typedef std::shared_ptr< Equation > walberla::math::EquationPtr
typedef std::shared_ptr<Node> walberla::math::NodePtr
typedef std::map<std::string, VarPtr> walberla::math::VarMap
typedef std::map<std::string, VarPtr>::const_iterator walberla::math::VarMapIt
typedef std::shared_ptr<Var> walberla::math::VarPtr

Enumeration Type Documentation

Enumerator
ND_LEFT 
ND_RIGHT 
Enumerator
NT_OPERATOR 
NT_CONSTANT 
NT_VARIABLE 

Function Documentation

template<typename T >
const std::enable_if< std::is_unsigned< T >::value, T >::type walberla::math::abs ( a)
inline

Absolute value function.

Parameters
aThe value.
Returns
The value if it is greater than or equal to zero, -1 times the value if the value is smaller than zero.
template<typename T >
const std::enable_if< !std::is_unsigned< T >::value, T >::type walberla::math::abs ( a)
inline
template<typename Type >
const Vector2< Type > walberla::math::abs ( const Vector2< Type > &  v)
inline

Returns a vector containing the absolute values of each single element of v.

Parameters
vThe integral input vector.
Returns
The absolute value of each single element of v.

The abs function calculates the absolute value of each element of the input vector v. This function can only be applied to vectors of integral data type. For floating point vectors, the pe::fabs( const Vector2& ) function can be used.

template<typename Type >
const Matrix2< Type > walberla::math::abs ( const Matrix2< Type > &  m)
inline

Returns a matrix containing the absolute values of each single element of m.

Parameters
mThe integral input matrix.
Returns
The absolute value of each single element of m.

The abs function calculates the absolute value of each element of the input matrix m. This function can only be applied to matrices of integral data type. For floating point matrices, the pe::fabs( const Matrix2& ) function can be used.

template<typename Type >
const Vector3< Type > walberla::math::abs ( const Vector3< Type > &  v)
inline

Returns a vector containing the absolute values of each single element of v.

Parameters
vThe integral input vector.
Returns
The absolute value of each single element of v.

The abs function calculates the absolute value of each element of the input vector v. This function can only be applied to vectors of integral data type. For floating point vectors, the pe::fabs( const Vector3& ) function can be used.

template<typename Type >
const Matrix3< Type > walberla::math::abs ( const Matrix3< Type > &  m)
inline

Returns a matrix containing the absolute values of each single element of m.

Parameters
mThe integral input matrix.
Returns
The absolute value of each single element of m.

The abs function calculates the absolute value of each element of the input matrix m. This function can only be applied to matrices of integral data type. For floating point matrices, the pe::fabs( const Matrix3& ) function can be used.

bool walberla::math::boolRandom ( )
inline

< Randomly returns 'true' or 'false'

template<typename Type >
void walberla::math::clear ( Type &  clearable)
inline

Clearing the given value/object to the default state.

Parameters
clearableThe value/object to be cleared.
Returns
void

The clear shim represents an abstract interface for clearing a value/object of any given data type to its default state. Values of built-in data type are reset to zero.

template<typename Type >
void walberla::math::clear ( Quaternion< Type > &  q)
inline

Clearing the given quaternion.

Parameters
qThe quaternion to be cleared.
Returns
void

Clearing a quaternion is equivalent to resetting it via the reset() function.

template<typename Type >
void walberla::math::clear ( MatrixMxN< Type > &  m)
inline

Clearing the given dense matrix.

Parameters
mThe dense matrix to be cleared.
Returns
void
template<typename Type >
Vector3<Type> walberla::math::cross ( const Vector3< Type > &  lhs,
const Vector3< Type > &  rhs 
)
inline

Cross product (outer product) of two vectors ( \( \vec{a}=\vec{b}\times\vec{c} \)).

Parameters
lhsThe left-hand-side vector for the cross product.
rhsThe right-hand-side vector for the cross product.
Returns
The cross product.
template<typename T >
real_t walberla::math::dot ( const Vector3< T > &  v1,
const Vector3< T > &  v2 
)

Dot product of two vectors.

template<typename Type >
const Matrix3<Type> walberla::math::dyadicProduct ( const Vector3< Type > &  vec1,
const Vector3< Type > &  vec2 
)
inline

Dyadic product of two vectors ( \( M = u \otimes v \)).

Parameters
vec1The first vector argument.
vec2The second vector argument.
Returns
The matrix \( u \otimes v \).
template<typename T1 , typename T2 >
bool walberla::math::equal ( T1  a,
T2  b 
)
inline

Generic equality check.

Parameters
aFirst value.
bSecond value.
Returns
true if the two values are equal, false if not.

Generic equal function for the comparison of two numeric values. Depending on the types of the two arguments, a special comparison for floating point values is selected that takes the limited machine accuracy into account.

template<typename Type >
const Vector2< Type > walberla::math::fabs ( const Vector2< Type > &  v)
inline

Returns a vector containing the absolute values of each single element of v.

Parameters
vThe floating point input vector.
Returns
The absolute value of each single element of v.

The fabs function calculates the absolute value of each element of the input vector v. This function can only be applied to floating point vectors. For vectors of integral data type, the pe::abs( const Vector2& ) function can be used.

template<typename Type >
const Matrix2< Type > walberla::math::fabs ( const Matrix2< Type > &  m)
inline

Returns a matrix containing the absolute values of each single element of m.

Parameters
mThe floating point input matrix.
Returns
The absolute value of each single element of m.

The fabs function calculates the absolute value of each element of the input matrix m. This function can only be applied to floating point matrices. For matrices of integral data type, the pe::abs( const Matrix2& ) function can be used.

template<typename Type >
const Vector3< Type > walberla::math::fabs ( const Vector3< Type > &  v)
inline

Returns a vector containing the absolute values of each single element of v.

Parameters
vThe floating point input vector.
Returns
The absolute value of each single element of v.

The fabs function calculates the absolute value of each element of the input vector v. This function can only be applied to floating point vectors. For vectors of integral data type, the pe::abs( const Vector3& ) function can be used.

template<typename Type >
const Matrix3< Type > walberla::math::fabs ( const Matrix3< Type > &  m)
inline

Returns a matrix containing the absolute values of each single element of m.

Parameters
mThe floating point input matrix.
Returns
The absolute value of each single element of m.

The fabs function calculates the absolute value of each element of the input matrix m. This function can only be applied to floating point matrices. For matrices of integral data type, the pe::abs( const Matrix3& ) function can be used.

template<unsigned int numIter>
double walberla::math::fastInvSqrt ( double  y)
inline

Computes 1.0 / sqrt(x) with limited accuracy.

The bigger y is ( relative to 1 ) the better the approximation

Template Parameters
numIternumber of iterations higher numbers make the function slower but result more accurate
template<unsigned int numIter>
float walberla::math::fastInvSqrt ( float  y)
inline

Float version, for documentation see above.

template<typename T >
bool walberla::math::finite ( x)

Query if 'x' is finite.

Parameters
xValue to be checked.
Returns
true if x is not NaN and not infinite, else false.
template<typename Type >
bool walberla::math::finite ( const Vector3< Type > &  v)
inline

Checks if the given vector has only finite elements.

Parameters
vThe vector to be checked for only having finite elements.
Returns
true if all elements of the vector are finite, false otherwise.
std::set< uint_t > walberla::math::getDevisors ( const uint_t  n)

Gets all devisors of a number n.

Computes all unique products of n's prime factors.

Parameters
nThe number the devisors are computed for.
Precondition
n > 0
Returns
A set of the devisors including 1 and n
std::vector< uint_t > walberla::math::getFactors ( const uint_t  number,
const uint_t  numberOfFactors 
)

Computes and returns an integer factorization of any arbitrary integer.

Goal: returned factors should roughly be of equal size Typical use case: uniform process distribution

Parameters
numberinteger to factorize
numberOfFactorsnumber of factors to create (= size of returned vector)
std::vector< uint_t > walberla::math::getFactors ( const uint_t  number,
const uint_t  numberOfFactors,
const std::vector< real_t > &  weight 
)
Vector3< uint_t > walberla::math::getFactors3D ( const uint_t  number)
Vector3< uint_t > walberla::math::getFactors3D ( const uint_t  number,
const Vector3< real_t > &  weights 
)
OpType & walberla::math::getOp ( const char  c)
std::vector< uint_t > walberla::math::getPrimeFactors ( const uint_t  n)

Gets all prime factors of a number.

Uses trial division algorithm. See http://en.wikipedia.org/w/index.php?title=Trial_division&oldid=518625973.

Parameters
nThe number to be factorized.
Precondition
n > 0
Returns
The prime factors in ascending order.
std::vector< uint_t > walberla::math::getPrimes ( const uint_t  n)

Determine prime numbers up to an upper bound.

Uses the 'Sieve of Eratosthenes' algorithm. See http://en.wikipedia.org/w/index.php?title=Sieve_of_Eratosthenes&oldid=527676398.

Parameters
nThe maximum prime number.
Returns
All prime numbers <= n in ascending order.
template<typename T >
size_t walberla::math::hash_value ( const Vector2< T > &  v)

Function providing a hash value for Vector2.

Template Parameters
TDatatype of the Vector2's elements.
Parameters
vThe vector the hash is computed for.
Returns
A hash for the entire Vector2.
template<typename T >
size_t walberla::math::hash_value ( const Vector3< T > &  v)

Function providing a hash value for Vector3.

Template Parameters
TDatatype of the Vector3's elements.
Parameters
vThe vector the hash is computed for.
Returns
A hash for the entire Vector3.
template<typename INT >
INT walberla::math::intRandom ( const INT  min,
const INT  max,
std::mt19937 &  generator 
)

Returns a random integral number of type INT in the range [min,max] (max included!)

template<typename INT >
INT walberla::math::intRandom ( const INT  min)
template<typename INT >
INT walberla::math::intRandom ( const INT  min,
const INT  max 
)
template<typename INT >
INT walberla::math::intRandom ( )
template<>
char walberla::math::intRandom< char > ( const char  min,
const char  max,
std::mt19937 &  generator 
)
inline
template<>
signed char walberla::math::intRandom< signed char > ( const signed char  min,
const signed char  max,
std::mt19937 &  generator 
)
inline
template<>
unsigned char walberla::math::intRandom< unsigned char > ( const unsigned char  min,
const unsigned char  max,
std::mt19937 &  generator 
)
inline
float walberla::math::inv ( float  a)
inline

Inverting the given single precision value.

Parameters
aThe single precision value to be inverted.
Returns
The inverse of the given value.

The invert shim represents an abstract interface for inverting a value/object of any given data type. For single precision floating point values this results in \( \frac{1}{a} \).

double walberla::math::inv ( double  a)
inline

Inverting the given double precision value.

Parameters
aThe double precision value to be inverted.
Returns
The inverse of the given value.

The invert shim represents an abstract interface for inverting a value/object of any given data type. For double precision floating point values this results in \( \frac{1}{a} \).

long double walberla::math::inv ( long double  a)
inline

Inverting the given long double value.

Parameters
aThe long double value to be inverted.
Returns
The inverse of the given value.

The invert shim represents an abstract interface for inverting a value/object of any given data type. For long double floating point values this results in \( \frac{1}{a} \).

template<typename Type >
const Quaternion< Type > walberla::math::inv ( const Quaternion< Type > &  q)
inline

Inverting the given quaternion.

Parameters
qThe quaternion to be inverted.
Returns
The inverse quaternion.

This function returns the inverse of the given quaternion. It has the same effect as calling the getInverse() member function of the quaternion.

template<typename Type >
const MatrixMxN< Type > walberla::math::inv ( const MatrixMxN< Type > &  m)
inline

Inverting the given dense matrix.

Parameters
mThe dense matrix to be inverted.
Returns
The inverse of the matrix.

This function returns the inverse of the given dense matrix. It has the same effect as calling the getInverse() member function of the matrix.

template<typename Type >
bool walberla::math::isDefault ( const Type &  v)
inline

Returns whether the given value/object is in default state.

Parameters
vThe value/object to be tested for its default state.
Returns
true in case the given value/object is in its default state, false otherwise.

The isDefault shim represents an abstract interface for testing a value/object whether it is in its default state or not. In case the value/object is in its default state, the function returns true, otherwise it returns false. For built-in data types, the function returns true in case the current value is zero.

const int i = 0; // isDefault( i ) returns true
double d = 2.0; // isDefault( d ) returns false
Vec3 v1; // isDefault( v1 ) returns true
Vec3 v2( 0, 0, 0 ); // isDefault( v2 ) returns true since (0,0,0) is the default state
Vec3 v3( 1, 2, 3 ); // isDefault( v3 ) returns false
template<typename Type >
bool walberla::math::isDefault ( const Quaternion< Type > &  q)
inline

Returns whether the given quaternion is in default state.

Parameters
qThe quaternion to be tested for its default state.
Returns
true in case the given quaternion is in default state, false otherwise.

The function returns true in case the real part of the quaternion is 1 and the imaginary parts are 0, otherwise it returns false.

\[\left(\begin{array}{*{4}{c}} 1 & 0 & 0 & 0 \\ \end{array}\right)\]

template<typename Type >
bool walberla::math::isDefault ( const MatrixMxN< Type > &  m)
inline

Returns whether the given dense matrix is in default state.

Parameters
mThe dense matrix to be tested for its default state.
Returns
true in case the given matrix is component-wise zero, false otherwise.
template<typename T >
bool walberla::math::isinf ( x)
inline

Query if 'x' is infinite.

Parameters
xValue to be checked.
Returns
true if x is infinite, else false.
template<typename Type >
bool walberla::math::isinf ( const Vector3< Type > &  v)
inline

Checks the given vector for infinite elements.

Parameters
vThe vector to be checked for infinite elements.
Returns
true if at least one element of the vector is infinite, false otherwise.
template<typename Type >
bool walberla::math::isinf ( const Matrix3< Type > &  m)
inline

Checks the given matrix for infinite elements.

Parameters
mThe matrix to be checked for infinite elements.
Returns
true if at least one element of the matrix is infinite, false otherwise.
template<typename T >
bool walberla::math::isnan ( x)
inline

Query if 'x' is NaN.

Parameters
xValue to be checked.
Returns
true if x is NaN, else false.
template<typename Type >
bool walberla::math::isnan ( const Quaternion< Type > &  q)
inline

Checks the given quaternion for not-a-number elements.

Parameters
qThe quaternion to be checked for not-a-number elements.
Returns
true if at least one element of the quaternion is not-a-number, false otherwise.
template<typename Type >
bool walberla::math::isnan ( const Vector2< Type > &  v)
inline

Checks the given vector for not-a-number elements.

Parameters
vThe vector to be checked for not-a-number elements.
Returns
true if at least one element of the vector is not-a-number, false otherwise.
template<typename Type >
bool walberla::math::isnan ( const Matrix2< Type > &  m)
inline

Checks the given matrix for not-a-number elements.

Parameters
mThe matrix to be checked for not-a-number elements.
Returns
true if at least one element of the matrix is not-a-number, false otherwise.
template<typename Type >
bool walberla::math::isnan ( const MatrixMxN< Type > &  m)
inline

Checks the given matrix for not-a-number elements.

Parameters
mThe matrix to be checked for not-a-number elements.
Returns
true if at least one element of the matrix is not-a-number, false otherwise.
template<typename Type >
bool walberla::math::isnan ( const Vector3< Type > &  v)
inline

Checks the given vector for not-a-number elements.

Parameters
vThe vector to be checked for not-a-number elements.
Returns
true if at least one element of the vector is not-a-number, false otherwise.
template<typename Type >
bool walberla::math::isnan ( const Matrix3< Type > &  m)
inline

Checks the given matrix for not-a-number elements.

Parameters
mThe matrix to be checked for not-a-number elements.
Returns
true if at least one element of the matrix is not-a-number, false otherwise.
int walberla::math::isop ( const char  c)
bool walberla::math::isPrime ( const uint_t  n)

Query if n is prime.

Parameters
nThe number to be checked.
Returns
true if n is prime, false if not.
template<typename Iterator >
std::iterator_traits< Iterator >::value_type walberla::math::kahanSummation ( const Iterator &  begin,
const Iterator &  end 
)
template<typename T >
real_t walberla::math::length ( const Vector3< T > &  v)

Length of the vector.

Returns
Length of the vector.
template<typename T1 , typename T2 >
const MathTrait< T1, T2 >::High walberla::math::max ( const T1 &  a,
const T2 &  b 
)
inline

Maximum function for two arguments.

Parameters
aFirst value.
bSecond value.
Returns
The maximum of the two values.

This function returns the maximum of the two given data values. The return type of the function is determined by the data types of the given arguments (for further detail see the MathTrait class description).

template<typename T1 , typename T2 , typename T3 >
const MathTrait< typename MathTrait< T1, T2 >::High, T3 >::High walberla::math::max ( const T1 &  a,
const T2 &  b,
const T3 &  c 
)
inline

Maximum function for three arguments.

Parameters
aFirst value.
bSecond value.
cThird value.
Returns
The maximum of the three values.

This function returns the maximum of the three given data values. The return type of the function is determined by the data types of the given arguments (for further detail see the MathTrait class description).

template<typename T1 , typename T2 >
const MathTrait< T1, T2 >::High walberla::math::min ( const T1 &  a,
const T2 &  b 
)
inline

Minimum function for two arguments.

Parameters
aFirst value.
bSecond value.
Returns
The minimum of the two values.

This function returns the minimum of the two given data values. The return type of the function is determined by the data types of the given arguments (for further detail see the MathTrait class description).

template<typename T1 , typename T2 , typename T3 >
const MathTrait< typename MathTrait< T1, T2 >::High, T3 >::High walberla::math::min ( const T1 &  a,
const T2 &  b,
const T3 &  c 
)
inline

Minimum function for three arguments.

Parameters
aFirst value.
bSecond value.
cThird value
Returns
The minimum of the three values.

This function returns the minimum of the three given data values. The return type of the function is determined by the data types of the given arguments (for further detail see the MathTrait class description).

template<typename T >
Vector2< T > & walberla::math::normalize ( Vector2< T > &  v)

Normalization of the vector ( \(|\vec{a}|=1\)).

Precondition
\(|\vec{a}|\neq0\)
Returns
Reference to the normalized vector.

Normalization of the vector to a length of 1. If you want to normalize a vector of integral T use member function getNormalized() instead

template<typename T >
Vector3< T > & walberla::math::normalize ( Vector3< T > &  v)

Normalization of the vector ( \(|\vec{a}|=1\)).

Precondition
\(|\vec{a}|\neq0\)
Returns
Reference to the normalized vector.

Normalization of the vector to a length of 1. If you want to normalize a vector of integral T use member function getNormalized() instead

template<typename Type >
void walberla::math::normals ( const Vector3< Type > &  v,
Vector3< Type > &  defNor,
Vector3< Type > &  comNor 
)
inline
OpDiv walberla::math::OP_DIV ( '/'  ,
"div"  ,
30u   
)
OpNo walberla::math::OP_EQUAL ( = ',
"equal"  ,
0u   
)
OpLog walberla::math::OP_LOG ( '$'  ,
"log"  ,
50u   
)
OpMinus walberla::math::OP_MINUS ( '-'  ,
"minus"  ,
10u   
)
OpMult walberla::math::OP_MULT ( '*'  ,
"mult"  ,
30u   
)
OpNo walberla::math::OP_NO ( 'n'  ,
"no op"  ,
0u   
)
OpPlus walberla::math::OP_PLUS ( '+'  ,
"plus"  ,
10u   
)
OpProd walberla::math::OP_PROD ( '^'  ,
"prod"  ,
40u   
)
template<typename T , typename U >
bool walberla::math::operator!= ( const GenericAABB< T > &  lhs,
const GenericAABB< U > &  rhs 
)
inline

Compares two GenericeAABBs for inequality.

see isEqual

ATTENTION: Does not check for non-identity! If you need to check for non-identity, use member function isIdentical of class GenericAABB

Parameters
lhsAn arbitrary GenericAABB
rhsAn arbitrary GenericAABB
Returns
false, if lhs is equal to rhs, true else
template<typename T1 , typename T2 >
bool walberla::math::operator!= ( const Quaternion< T1 > &  lhs,
const Quaternion< T2 > &  rhs 
)
inline

Inequality operator for the comparison of two quaternions.

Parameters
lhsThe left-hand side quaternion for the comparison.
rhsThe right-hand side quaternion for the comparison.
Returns
true if the two quaternions are not equal, false if they are equal.
template<typename Type >
bool walberla::math::operator!= ( unsigned char  scalar,
const Vector2< Type > &  vec 
)
inline

Inequality operator for the comparison of an unsigned char scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( char  scalar,
const Vector2< Type > &  vec 
)
inline

Inequality operator for the comparison of a char scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( signed char  scalar,
const Vector2< Type > &  vec 
)
inline

Inequality operator for the comparison of a signed char scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( wchar_t  scalar,
const Vector2< Type > &  vec 
)
inline

Inequality operator for the comparison of a wchar_t scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( unsigned short  scalar,
const Vector2< Type > &  vec 
)
inline

Inequality operator for the comparison of an unsigned short scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( short  scalar,
const Vector2< Type > &  vec 
)
inline

Inequality operator for the comparison of a short scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( unsigned int  scalar,
const Vector2< Type > &  vec 
)
inline
template<typename Type >
bool walberla::math::operator!= ( int  scalar,
const Vector2< Type > &  vec 
)
inline

Inequality operator for the comparison of an int scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( unsigned long  scalar,
const Vector2< Type > &  vec 
)
inline

Inequality operator for the comparison of an unsigned long scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( long  scalar,
const Vector2< Type > &  vec 
)
inline

Inequality operator for the comparison of a long scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( float  scalar,
const Vector2< Type > &  vec 
)
inline

Inequality operator for the comparison of a float scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( double  scalar,
const Vector2< Type > &  vec 
)
inline

Inequality operator for the comparison of a double scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( long double  scalar,
const Vector2< Type > &  vec 
)
inline

Inequality operator for the comparison of a long double scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( unsigned char  scalar,
const Vector3< Type > &  vec 
)
inline

Inequality operator for the comparison of an unsigned char scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( char  scalar,
const Vector3< Type > &  vec 
)
inline

Inequality operator for the comparison of a char scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( signed char  scalar,
const Vector3< Type > &  vec 
)
inline

Inequality operator for the comparison of a signed char scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( wchar_t  scalar,
const Vector3< Type > &  vec 
)
inline

Inequality operator for the comparison of a wchar_t scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( unsigned short  scalar,
const Vector3< Type > &  vec 
)
inline

Inequality operator for the comparison of an unsigned short scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( short  scalar,
const Vector3< Type > &  vec 
)
inline

Inequality operator for the comparison of a short scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( unsigned int  scalar,
const Vector3< Type > &  vec 
)
inline
template<typename Type >
bool walberla::math::operator!= ( int  scalar,
const Vector3< Type > &  vec 
)
inline

Inequality operator for the comparison of an int scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( unsigned long  scalar,
const Vector3< Type > &  vec 
)
inline

Inequality operator for the comparison of an unsigned long scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( long  scalar,
const Vector3< Type > &  vec 
)
inline

Inequality operator for the comparison of a long scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( float  scalar,
const Vector3< Type > &  vec 
)
inline

Inequality operator for the comparison of a float scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( double  scalar,
const Vector3< Type > &  vec 
)
inline

Inequality operator for the comparison of a double scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator!= ( long double  scalar,
const Vector3< Type > &  vec 
)
inline

Inequality operator for the comparison of a long double scalar value and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparision.
Returns
bool

If one value of the vector is inequal to the scalar value, the inequality test returns true, otherwise false.

template<typename T1 , typename T2 >
const Quaternion< typename MathTrait< T1, T2 >::MultType > walberla::math::operator* ( const Quaternion< T1 > &  lhs,
const Quaternion< T2 > &  rhs 
)
inline

Multiplication operator for the multiplication of two quaternions ( \( \hat{q}=\hat{p}*\hat{r} \)).

Parameters
lhsThe left-hand side quaternion for the multiplication.
rhsThe right-hand side quaternion for the multiplication.
Returns
The resulting quaternion.
template<typename Type , typename Other >
Vector2< HIGH > walberla::math::operator* ( Other  scalar,
const Vector2< Type > &  vec 
)
inline

Multiplication operator for the multiplication of a scalar value and a vector.

( \( \vec{a}=s*\vec{b} \)).

Parameters
scalarThe left-hand-side scalar value for the multiplication.
vecThe right-hand-side vector for the multiplication.
Returns
The scaled result vector.
template<typename Type , typename Other >
Vector3< HIGH > walberla::math::operator* ( Other  scalar,
const Vector3< Type > &  vec 
)
inline

Multiplication operator for the multiplication of a scalar value and a vector.

( \( \vec{a}=s*\vec{b} \)).

Parameters
scalarThe left-hand-side scalar value for the multiplication.
vecThe right-hand-side vector for the multiplication.
Returns
The scaled result vector.
template<typename Type >
const Matrix3< Type > walberla::math::operator- ( const Matrix3< Type > &  rhs)
inline

Negation operator for the negation of one matrix.

Parameters
rhsThe right-hand-side matrix of the operator.
Returns
The negative matrix.
template<typename Type , typename Other >
Vector3< typename MathTrait<Type,Other>::High > walberla::math::operator/ ( Other  lhs,
const Vector3< Type > &  rhs 
)
inline
std::ostream& walberla::math::operator<< ( std::ostream &  os,
const Var var 
)
std::ostream& walberla::math::operator<< ( std::ostream &  os,
const OpType type 
)
template<typename T , typename G >
mpi::GenericSendBuffer<T,G>& walberla::math::operator<< ( mpi::GenericSendBuffer< T, G > &  buf,
const Sample statReal 
)
template<typename Type >
std::ostream& walberla::math::operator<< ( std::ostream &  os,
const Rot3< Type > &  r 
)
inline
std::ostream& walberla::math::operator<< ( std::ostream &  os,
const Plane plane 
)
template<typename T >
std::ostream & walberla::math::operator<< ( std::ostream &  os,
const GenericAABB< T > &  aabb 
)
inline

Writes a GenericAABB to a std::ostream.

The format is [ <0,0,0>, <1,1,1> ]

Parameters
osThe std::ostream written to
aabbThe GenericAABB written
Returns
A reference to os
std::ostream& walberla::math::operator<< ( std::ostream &  os,
const Node node 
)
template<typename T , typename G , typename VT >
mpi::GenericSendBuffer< T, G > & walberla::math::operator<< ( mpi::GenericSendBuffer< T, G > &  buf,
const GenericAABB< VT > &  aabb 
)
inline

Serializes an GenericAABB into a mpi::GenericSendBuffer.

Parameters
bufThe mpi::GenericSendBuffer written to
aabbThe GenericAABB the be serialized
Returns
A reference to buf
std::ostream& walberla::math::operator<< ( std::ostream &  os,
const Equation eq 
)
std::ostream & walberla::math::operator<< ( std::ostream &  os,
const Sample statReal 
)

Stream output operator for class Sample.

template<typename Type >
std::ostream & walberla::math::operator<< ( std::ostream &  os,
const Quaternion< Type > &  q 
)

Global output operator for quaternions.

Parameters
osReference to the output stream.
qReference to a constant quaternion object.
Returns
Reference to the output stream.
template<typename Type >
std::ostream & walberla::math::operator<< ( std::ostream &  os,
const Vector2< Type > &  v 
)

Global output operator for 2-dimensional vectors.

Parameters
osReference to the output stream.
vReference to a constant vector object.
Returns
Reference to the output stream.
template<typename Type >
std::ostream & walberla::math::operator<< ( std::ostream &  os,
const Matrix2< Type > &  m 
)

Global output operator for 2x2 matrices.

Parameters
osReference to the output stream.
mReference to a constant matrix object.
Returns
Reference to the output stream.
template<typename T , typename G , typename MT >
mpi::GenericSendBuffer<T,G>& walberla::math::operator<< ( mpi::GenericSendBuffer< T, G > &  buf,
const Matrix2< MT > &  m 
)
template<typename Type >
std::ostream & walberla::math::operator<< ( std::ostream &  os,
const Vector3< Type > &  v 
)

Global output operator for 3-dimensional vectors.

Parameters
osReference to the output stream.
vReference to a constant vector object.
Returns
Reference to the output stream.
template<typename Type >
std::ostream & walberla::math::operator<< ( std::ostream &  os,
const Matrix3< Type > &  m 
)

Global output operator for 3x3 matrices.

Parameters
osReference to the output stream.
mReference to a constant matrix object.
Returns
Reference to the output stream.
template<typename T , typename U >
bool walberla::math::operator== ( const GenericAABB< T > &  lhs,
const GenericAABB< U > &  rhs 
)
inline

Compares two GenericeAABBs for equality.

see isEqual

ATTENTION: Does not check for identity! If you need to check for identity, use member function isIdentical of class GenericAABB

Parameters
lhsAn arbitrary GenericAABB
rhsAn arbitrary GenericAABB
Returns
true, if lhs is equal to rhs, false else
template<typename T1 , typename T2 >
bool walberla::math::operator== ( const Quaternion< T1 > &  lhs,
const Quaternion< T2 > &  rhs 
)
inline

Equality operator for the comparison of two quaternions.

Parameters
lhsThe left-hand side quaternion for the comparison.
rhsThe right-hand side quaternion for the comparison.
Returns
true if the two quaternions are equal, false if not.
template<typename Type >
bool walberla::math::operator== ( unsigned char  scalar,
const Vector2< Type > &  vec 
)
inline

Equality operator for the comparison of an unsigned char scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( char  scalar,
const Vector2< Type > &  vec 
)
inline

Equality operator for the comparison of a char scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( signed char  scalar,
const Vector2< Type > &  vec 
)
inline

Equality operator for the comparison of a signed char scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( wchar_t  scalar,
const Vector2< Type > &  vec 
)
inline

Equality operator for the comparison of a wchar_t scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( unsigned short  scalar,
const Vector2< Type > &  vec 
)
inline

Equality operator for the comparison of an unsigned short scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( short  scalar,
const Vector2< Type > &  vec 
)
inline

Equality operator for the comparison of a short scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( unsigned int  scalar,
const Vector2< Type > &  vec 
)
inline
template<typename Type >
bool walberla::math::operator== ( int  scalar,
const Vector2< Type > &  vec 
)
inline

Equality operator for the comparison of an int scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( unsigned long  scalar,
const Vector2< Type > &  vec 
)
inline

Equality operator for the comparison of an unsigned long scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( long  scalar,
const Vector2< Type > &  vec 
)
inline

Equality operator for the comparison of a long scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( float  scalar,
const Vector2< Type > &  vec 
)
inline

Equality operator for the comparison of a float scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( double  scalar,
const Vector2< Type > &  vec 
)
inline

Equality operator for the comparison of a double scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( long double  scalar,
const Vector2< Type > &  vec 
)
inline

Equality operator for the comparison of a long double scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( unsigned char  scalar,
const Vector3< Type > &  vec 
)
inline

Equality operator for the comparison of an unsigned char scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( char  scalar,
const Vector3< Type > &  vec 
)
inline

Equality operator for the comparison of a char scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( signed char  scalar,
const Vector3< Type > &  vec 
)
inline

Equality operator for the comparison of a signed char scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( wchar_t  scalar,
const Vector3< Type > &  vec 
)
inline

Equality operator for the comparison of a wchar_t scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( unsigned short  scalar,
const Vector3< Type > &  vec 
)
inline

Equality operator for the comparison of an unsigned short scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( short  scalar,
const Vector3< Type > &  vec 
)
inline

Equality operator for the comparison of a short scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( unsigned int  scalar,
const Vector3< Type > &  vec 
)
inline
template<typename Type >
bool walberla::math::operator== ( int  scalar,
const Vector3< Type > &  vec 
)
inline

Equality operator for the comparison of an int scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( unsigned long  scalar,
const Vector3< Type > &  vec 
)
inline

Equality operator for the comparison of an unsigned long scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( long  scalar,
const Vector3< Type > &  vec 
)
inline

Equality operator for the comparison of a long scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( float  scalar,
const Vector3< Type > &  vec 
)
inline

Equality operator for the comparison of a float scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( double  scalar,
const Vector3< Type > &  vec 
)
inline

Equality operator for the comparison of a double scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename Type >
bool walberla::math::operator== ( long double  scalar,
const Vector3< Type > &  vec 
)
inline

Equality operator for the comparison of a long double scalar and a vector.

Parameters
scalarThe left-hand-side scalar value for the comparison.
vecThe right-hand-side vector for the comparison.
Returns
bool

If all values of the vector are equal to the scalar value, the equality test returns true, otherwise false.

template<typename T >
mpi::GenericRecvBuffer<T>& walberla::math::operator>> ( mpi::GenericRecvBuffer< T > &  buf,
Sample statReal 
)
std::istream& walberla::math::operator>> ( std::istream &  is,
Plane plane 
)
template<typename T >
std::istream & walberla::math::operator>> ( std::istream &  is,
GenericAABB< T > &  aabb 
)
inline

Reads an GenericAABB from a std::istream.

The format is [ <0,0,0>, <1,1,1> ]

Parameters
isThe std::istream read from
aabbThe GenericAABB the read values are to be stored in
Returns
A reference to is
template<typename Type >
std::istream & walberla::math::operator>> ( std::istream &  is,
Quaternion< Type > &  q 
)

Global input operator for quaternions.

Parameters
isReference to the input stream.
qReference to a quaternion object.
Returns
The input stream.
template<typename Type >
std::istream & walberla::math::operator>> ( std::istream &  is,
Vector2< Type > &  v 
)

Global input operator for 2-dimensional vectors.

Parameters
isReference to the input stream.
vReference to a vector object.
Returns
The input stream.
template<typename Type >
std::istream & walberla::math::operator>> ( std::istream &  is,
Vector3< Type > &  v 
)

Global input operator for 3-dimensional vectors.

Parameters
isReference to the input stream.
vReference to a vector object.
Returns
The input stream.
template<typename T , typename MT >
mpi::GenericRecvBuffer<T>& walberla::math::operator>> ( mpi::GenericRecvBuffer< T > &  buf,
Matrix2< MT > &  m 
)
template<>
std::istream & walberla::math::operator>> ( std::istream &  is,
Vector2< bool > &  v 
)
inline

Specialization for input operator for 2-dimensional vectors of bool.

The operator can parse e.g. <1, 0, 1> and <true, false, true> from the istream

Parameters
isReference to the input stream.
vReference to a bool vector object.
Returns
The input stream.
template<>
std::istream & walberla::math::operator>> ( std::istream &  is,
Vector3< bool > &  v 
)
inline

Specialization for input operator for 3-dimensional vectors of bool.

The operator can parse e.g. <1, 0, 1> and <true, false, true> from the istream

Parameters
isReference to the input stream.
vReference to a bool vector object.
Returns
The input stream.
template<typename REAL = real_t>
REAL walberla::math::realRandom ( const REAL  min = REAL(0),
const REAL  max = REAL(1),
std::mt19937 &  generator = internal::getGenerator() 
)

Returns a random floating point number of type REAL in the range [min,max) (max excluded!)

template<typename Type >
void walberla::math::reset ( Type &  resettable)
inline

Resetting the given value/object to the default value.

Parameters
resettableThe value/object to be resetted.
Returns
void

The reset shim represents an abstract interface for the resetting of a value/object of any given data type to its default value. Values of built-in data type are reset to zero.

template<typename Type >
void walberla::math::reset ( Quaternion< Type > &  q)
inline

Resetting the given quaternion.

Parameters
qThe quaternion to be resetted.
Returns
void
template<typename Type >
void walberla::math::reset ( MatrixMxN< Type > &  m)
inline

Resetting the given dense matrix.

Parameters
mThe dense matrix to be resetted.
Returns
void
template<typename Type >
void walberla::math::rotateAroundPoint ( Vector3< Type > &  pos,
Rot3< Type > &  rot,
const Vector3< Type > &  rotateAround,
const Rot3< Type > &  dRot 
)
inline
real_t walberla::math::round ( real_t  a)
inline

Rounding function.

Parameters
aFloating point value.
Returns
The floating point value rounded towards the next whole number.
void walberla::math::seedRandomGenerator ( const std::mt19937::result_type &  seed)
template<typename T >
const T walberla::math::sign ( a)
inline

Sign function.

Parameters
aThe signed value.
Returns
1 if the value is greater than or equal to zero, -1 if the value is smaller than zero.

The sign function only works for signed built-in data types. The attempt to use unsigned data types or user-defined class types will result in a compile time error.

http://stackoverflow.com/questions/1903954/is-there-a-standard-sign-function-signum-sgn-in-c-c

template<typename Type >
const Matrix3< Type > walberla::math::skewSymCrossProduct ( const Matrix3< Type > &  mat,
const Vector3< Type > &  vec 
)
inline

Cross product (outer product) between a matrix and a vector ( \( R = M \cdot r^{\times} \)).

Parameters
matThe left-hand side matrix for the skew-symmetric cross product.
vecThe right-hand side vector for the skew-symmetric cross product.
Returns
The matrix \( M \cdot r^{\times} \).

This operator multiplies the matrix with the skew-symmetric matrix resulting from the vector, which corresponds to a cross product between the columns vectors of the matrix and the right-hand side vector:

\[ M \cdot r^{\times} = \left(\begin{array}{*{3}{c}} m_{00} & m_{01} & m_{02} \\ m_{10} & m_{11} & m_{12} \\ m_{20} & m_{21} & m_{22} \\ \end{array}\right) \cdot \left(\begin{array}{*{1}{c}} r_0 \\ r_1 \\ r_2 \\ \end{array}\right)^{\times} = \left(\begin{array}{*{3}{c}} m_{00} & m_{01} & m_{02} \\ m_{10} & m_{11} & m_{12} \\ m_{20} & m_{21} & m_{22} \\ \end{array}\right) \cdot \left(\begin{array}{*{3}{c}} 0 & -r_2 & r_1 \\ r_2 & 0 & -r_0 \\ -r_1 & r_0 & 0 \\ \end{array}\right) \]

The operator returns a matrix of the higher-order data type of the two involved data types T1 and T2. In case T1 and T2 match, the operator works for any data type as long as the data type has a multiplication and subtraction operator. In case T1 and T2 differ, the operator only works for data types supported by the MathTrait class template.

template<typename Type >
const Matrix3<Type> walberla::math::skewSymCrossProduct ( const Vector3< Type > &  vec,
const Matrix3< Type > &  mat 
)
inline

Cross product (outer product) between a vector and a matrix ( \( R = r^{\times} \cdot M \)).

Parameters
vecThe left-hand side vector for the skew-symmetric product.
matThe right-hand side matrix for the skew-symmetric product.
Returns
The matrix \( r^{\times} \cdot M \).

This operator multiplies the skew-symmetric matrix resulting from the vector with the right-hand side matrix, which corresponds to a cross product between the vector and the columns vectors of the matrix:

\[ r^{\times} \cdot M = \left(\begin{array}{*{1}{c}} r_0 \\ r_1 \\ r_2 \\ \end{array}\right)^{\times} \cdot \left(\begin{array}{*{3}{c}} m_{00} & m_{01} & m_{02} \\ m_{10} & m_{11} & m_{12} \\ m_{20} & m_{21} & m_{22} \\ \end{array}\right) = \left(\begin{array}{*{3}{c}} 0 & -r_2 & r_1 \\ r_2 & 0 & -r_0 \\ -r_1 & r_0 & 0 \\ \end{array}\right) \cdot \left(\begin{array}{*{3}{c}} m_{00} & m_{01} & m_{02} \\ m_{10} & m_{11} & m_{12} \\ m_{20} & m_{21} & m_{22} \\ \end{array}\right) \]

The operator returns a matrix of the higher-order data type of the two involved data types T1 and T2. In case T1 and T2 match, the operator works for any data type as long as the data type has a multiplication and subtraction operator. In case T1 and T2 differ, the operator only works for data types supported by the MathTrait class template.

template<typename T >
const T walberla::math::sq ( const T &  a)
inline

Squaring the given value/object.

Parameters
aThe value/object to be squared.
Returns
The result of the square operation.

The square shim represents an abstract interface for squaring a value/object of any given data type. For values of built-in data type this results in a plain multiplication.

template<typename Type >
const Quaternion< Type > walberla::math::sq ( const Quaternion< Type > &  q)
inline

Squaring the given quaternion.

Parameters
qThe quaternion to be squared.
Returns
The result of the square operation.

This function squares the given quaternion q. This function has the same effect as multiplying the quaternion with itself ( \( q * q \)).

template<typename T >
const T walberla::math::sqr ( const T &  a)
inline

Square function.

Parameters
aValue to be squared.
Returns
The square of the input value.
template<typename T >
real_t walberla::math::sqrLength ( const Vector3< T > &  v)

Length of the vector squared.

Returns
Length of the vector squared.
template<typename Type >
void walberla::math::swap ( Quaternion< Type > &  a,
Quaternion< Type > &  b 
)
inline

Swapping the contents of two quaternions.

Parameters
aThe first quaternion to be swapped.
bThe second quaternion to be swapped.
Returns
void
Exceptions
no-throwguarantee.
template<typename Type >
void walberla::math::swap ( MatrixMxN< Type > &  a,
MatrixMxN< Type > &  b 
)
inline

Swapping the contents of two matrices.

Parameters
aThe first matrix to be swapped.
bThe second matrix to be swapped.
Returns
void
Exceptions
no-throwguarantee.
template<typename T0 , typename T1 >
Matrix2< typename MathTrait<T0,T1>::High > walberla::math::tensorProduct ( Vector2< T0 >  v0,
Vector2< T1 >  v1 
)
template<typename T0 , typename T1 >
Matrix3< typename MathTrait<T0,T1>::High > walberla::math::tensorProduct ( Vector3< T0 >  v0,
Vector3< T1 >  v1 
)
template<typename Type >
Matrix3< Type > walberla::math::transformMatrixRART ( const Matrix3< Type > &  R,
const Matrix3< Type > &  A 
)
inline

Equivalent to R*A*R.getTranspose().

template<typename UINT >
bool walberla::math::uintIsEven ( const UINT  value)
inline

Returns true only if 'value' is an even number.

template<typename UINT >
bool walberla::math::uintIsPowerOfTwo ( const UINT  value)
inline

Returns true only if 'value' (must be an unsigned integer) is a power of 2 (http://graphics.stanford.edu/~seander/bithacks.html)

template<typename UINT >
uint_t walberla::math::uintMSBPosition ( UINT  value)

Calculation of the position of the most significant bit of a variable of type UINT.

Examples: "[...] 1001" -> 4, "[...] 0011" -> 2, "[...] 0110" -> 3, "[...] 0001" -> 1, "[...] 0000" -> 0, etc.

template<>
uint_t walberla::math::uintMSBPosition< uint16_t > ( uint16_t  value)
inline
template<>
uint_t walberla::math::uintMSBPosition< uint32_t > ( uint32_t  value)
inline
template<>
uint_t walberla::math::uintMSBPosition< uint8_t > ( uint8_t  value)
inline
template<typename UINT >
UINT walberla::math::uintPow16 ( UINT  exp)
inline

Returns the result of 16^exp.

template<typename UINT >
UINT walberla::math::uintPow2 ( const UINT  exp)
inline

Returns the result of 2^exp.

template<typename UINT >
UINT walberla::math::uintPow4 ( UINT  exp)
inline

Returns the result of 4^exp.

template<typename UINT >
UINT walberla::math::uintPow8 ( UINT  exp)
inline

Returns the result of 8^exp.

Variable Documentation

constexpr real_t walberla::math::e = real_t(2.7182818284590452354)
constexpr real_t walberla::math::fourth_pi = real_t(0.78539816339744830962)
constexpr real_t walberla::math::half_pi = real_t(1.57079632679489661923)
constexpr real_t walberla::math::ln_ten = real_t(2.30258509299404568402)
constexpr real_t walberla::math::ln_two = real_t(0.69314718055994530942)
constexpr real_t walberla::math::log10_e = real_t(0.43429448190325182765)
constexpr real_t walberla::math::log2_e = real_t(1.4426950408889634074)
const uint8_t walberla::math::msbLookupTable[256]
static
Initial value:
=
{
#define msbLT(n)
0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 ,
8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8
}
double walberla::math::NAN_VAL
constexpr real_t walberla::math::one_div_pi = real_t(0.31830988618379067154)
constexpr real_t walberla::math::one_div_root_two = real_t(0.70710678118654752440)
OpDiv walberla::math::OP_DIV( '/',"div", 30u)
OpNo walberla::math::OP_EQUAL
OpLog walberla::math::OP_LOG( '$',"log", 50u)
OpMinus walberla::math::OP_MINUS( '-',"minus", 10u)
OpMult walberla::math::OP_MULT( '*',"mult", 30u)
OpNo walberla::math::OP_NO( 'n',"no op", 0u)
OpPlus walberla::math::OP_PLUS( '+',"plus", 10u)
OpProd walberla::math::OP_PROD( '^',"prod", 40u)
OpRoot walberla::math::OP_ROOT
constexpr real_t walberla::math::pi = real_t(3.14159265358979323846)
constexpr real_t walberla::math::root_two = real_t(1.41421356237309504880)
constexpr real_t walberla::math::two_div_pi = real_t(0.63661977236758134308)
constexpr real_t walberla::math::two_div_root_pi = real_t(1.12837916709551257390)