Vector3.h File Reference

Detailed Description

Header file for the implementation of a 3D vector.

Author
Klaus Iglberger
Christian Godenschwager chris.nosp@m.tian.nosp@m..gode.nosp@m.nsch.nosp@m.wager.nosp@m.@fau.nosp@m..de
Martin Bauer marti.nosp@m.n.ba.nosp@m.uer@f.nosp@m.au.d.nosp@m.e
Florian Schornbaum flori.nosp@m.an.s.nosp@m.chorn.nosp@m.baum.nosp@m.@fau..nosp@m.de
#include "FPClassify.h"
#include "MathTrait.h"
#include "SqrtTrait.h"
#include "Utility.h"
#include "core/DataTypes.h"
#include "core/VectorTrait.h"
#include "core/debug/Debug.h"
#include "core/mpi/Datatype.h"
#include "core/mpi/RecvBuffer.h"
#include "core/mpi/SendBuffer.h"
#include "core/debug/CheckFunctions.h"
#include <cmath>
#include <cstddef>
#include <iostream>
#include <limits>
#include <type_traits>

Classes

class  walberla::math::Vector3< Type >
 Efficient, generic implementation of a 3-dimensional vector. More...
 
struct  walberla::math::Vector3LexicographicalyLess< T >
 Functor providing a lexicographical ordering for Vector3. More...
 
struct  walberla::mpi::BufferSizeTrait< walberla::math::Vector3< VT > >
 
struct  walberla::MPITrait< Vector3< T > >
 
struct  walberla::VectorTrait< Vector3< T > >
 
struct  std::hash< walberla::Vector3< T > >
 

Namespaces

 walberla
 \file TimestepTracker.h \ingroup lbm \author Frederik Hennig frede.nosp@m.rik..nosp@m.henni.nosp@m.g@fa.nosp@m.u.de
 
 walberla::math
 
 walberla::mpi
 
 walberla::debug
 
 walberla::debug::check_functions_detail
 

Macros

#define HIGH   typename MathTrait<Type,Other>::High
 High-order return value. More...
 

Functions

template<typename Type >
Vector3< Type > walberla::math::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 > walberla::math::operator/ (Other lhs, const Vector3< Type > &rhs)
 
template<typename T , typename G , typename VT >
mpi::GenericSendBuffer< T, G > & walberla::mpi::operator<< (mpi::GenericSendBuffer< T, G > &buf, const Vector3< VT > &vec)
 
template<typename T , typename VT >
mpi::GenericRecvBuffer< T > & walberla::mpi::operator>> (mpi::GenericRecvBuffer< T > &buf, Vector3< VT > &vec)
 
template<>
bool walberla::debug::check_functions_detail::check_float_equal (const math::Vector3< real_t > &lhs, const math::Vector3< real_t > &rhs)
 
template<>
bool walberla::debug::check_functions_detail::check_float_equal_eps (const math::Vector3< real_t > &lhs, const math::Vector3< real_t > &rhs, const real_t epsilon)
 
Vector3 operators
template<typename T >
Vector3< T > & walberla::math::normalize (Vector3< T > &v)
 Normalization of the vector ( \(|\vec{a}|=1\)). More...
 
template<typename Type >
bool walberla::math::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 walberla::math::operator== (char scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a char scalar and a vector. More...
 
template<typename Type >
bool walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::operator== (short scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a short scalar and a vector. More...
 
template<typename Type >
bool walberla::math::operator== (unsigned int scalar, const Vector3< Type > &vec)
 
template<typename Type >
bool walberla::math::operator== (int scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of an int scalar and a vector. More...
 
template<typename Type >
bool walberla::math::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 walberla::math::operator== (long scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a long scalar and a vector. More...
 
template<typename Type >
bool walberla::math::operator== (float scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a float scalar and a vector. More...
 
template<typename Type >
bool walberla::math::operator== (double scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a double scalar and a vector. More...
 
template<typename Type >
bool walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::operator!= (unsigned int scalar, const Vector3< Type > &vec)
 
template<typename Type >
bool walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 & walberla::math::operator<< (std::ostream &os, const Vector3< Type > &v)
 Global output operator for 3-dimensional vectors. More...
 
template<typename Type >
std::istream & walberla::math::operator>> (std::istream &is, Vector3< Type > &v)
 Global input operator for 3-dimensional vectors. More...
 
template<typename Type >
bool walberla::math::isnan (const Vector3< Type > &v)
 Checks the given vector for not-a-number elements. More...
 
template<typename Type >
bool walberla::math::isinf (const Vector3< Type > &v)
 Checks the given vector for infinite elements. More...
 
template<typename Type >
bool walberla::math::finite (const Vector3< Type > &v)
 Checks if the given vector has only finite elements. More...
 
template<typename Type >
const Vector3< Type > walberla::math::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 > walberla::math::fabs (const Vector3< Type > &v)
 Returns a vector containing the absolute values of each single element of v. More...
 
template<typename Type , typename Other >
std::enable_if< std::is_fundamental< Other >::value, Vector3< typename MathTrait< Type, Other >::High > >::type walberla::math::operator* (Other scalar, const Vector3< Type > &vec)
 Multiplication operator for the multiplication of a scalar value and a vector. More...
 
template<>
std::istream & walberla::math::operator>> (std::istream &is, Vector3< bool > &v)
 Specialization for input operator for 3-dimensional vectors of bool. More...
 
template<typename Type >
void walberla::math::normals (const Vector3< Type > &v, Vector3< Type > &defNor, Vector3< Type > &comNor)
 
template<typename T >
real_t walberla::math::length (const Vector3< T > &v)
 Length of the vector. More...
 
template<typename T >
real_t walberla::math::sqrLength (const Vector3< T > &v)
 Length of the vector squared. More...
 
template<typename T >
real_t walberla::math::dot (const Vector3< T > &v1, const Vector3< T > &v2)
 Dot product of two vectors. More...
 
template<typename T , typename Enable = std::enable_if_t<std::is_integral<T>::value>>
std::size_t walberla::math::hash_value (const Vector3< T > &v)
 Function providing a hash value for Vector3. More...
 
Vector3 operators
template<typename T >
Vector3< T > & walberla::math::normalize (Vector3< T > &v)
 Normalization of the vector ( \(|\vec{a}|=1\)). More...
 
template<typename Type >
bool walberla::math::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 walberla::math::operator== (char scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a char scalar and a vector. More...
 
template<typename Type >
bool walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::operator== (short scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a short scalar and a vector. More...
 
template<typename Type >
bool walberla::math::operator== (unsigned int scalar, const Vector3< Type > &vec)
 
template<typename Type >
bool walberla::math::operator== (int scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of an int scalar and a vector. More...
 
template<typename Type >
bool walberla::math::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 walberla::math::operator== (long scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a long scalar and a vector. More...
 
template<typename Type >
bool walberla::math::operator== (float scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a float scalar and a vector. More...
 
template<typename Type >
bool walberla::math::operator== (double scalar, const Vector3< Type > &vec)
 Equality operator for the comparison of a double scalar and a vector. More...
 
template<typename Type >
bool walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::operator!= (unsigned int scalar, const Vector3< Type > &vec)
 
template<typename Type >
bool walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 walberla::math::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 & walberla::math::operator<< (std::ostream &os, const Vector3< Type > &v)
 Global output operator for 3-dimensional vectors. More...
 
template<typename Type >
std::istream & walberla::math::operator>> (std::istream &is, Vector3< Type > &v)
 Global input operator for 3-dimensional vectors. More...
 
template<typename Type >
bool walberla::math::isnan (const Vector3< Type > &v)
 Checks the given vector for not-a-number elements. More...
 
template<typename Type >
bool walberla::math::isinf (const Vector3< Type > &v)
 Checks the given vector for infinite elements. More...
 
template<typename Type >
bool walberla::math::finite (const Vector3< Type > &v)
 Checks if the given vector has only finite elements. More...
 
template<typename Type >
const Vector3< Type > walberla::math::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 > walberla::math::fabs (const Vector3< Type > &v)
 Returns a vector containing the absolute values of each single element of v. More...
 
template<typename Type , typename Other >
std::enable_if< std::is_fundamental< Other >::value, Vector3< typename MathTrait< Type, Other >::High > >::type walberla::math::operator* (Other scalar, const Vector3< Type > &vec)
 Multiplication operator for the multiplication of a scalar value and a vector. More...
 
template<>
std::istream & walberla::math::operator>> (std::istream &is, Vector3< bool > &v)
 Specialization for input operator for 3-dimensional vectors of bool. More...
 
template<typename Type >
void walberla::math::normals (const Vector3< Type > &v, Vector3< Type > &defNor, Vector3< Type > &comNor)
 
template<typename T >
real_t walberla::math::length (const Vector3< T > &v)
 Length of the vector. More...
 
template<typename T >
real_t walberla::math::sqrLength (const Vector3< T > &v)
 Length of the vector squared. More...
 
template<typename T >
real_t walberla::math::dot (const Vector3< T > &v1, const Vector3< T > &v2)
 Dot product of two vectors. More...
 
template<typename T , typename Enable = std::enable_if_t<std::is_integral<T>::value>>
std::size_t walberla::math::hash_value (const Vector3< T > &v)
 Function providing a hash value for Vector3. More...
 

Macro Definition Documentation

◆ HIGH

#define HIGH   typename MathTrait<Type,Other>::High

High-order return value.

Abbreviation for the evaluation of the higher-order data type in a numerical operation.