SPH
Functions
Generic.h File Reference

Function for generic manipulation with geometric types. More...

#include "math/MathUtils.h"
#include "objects/containers/StaticArray.h"

Go to the source code of this file.

Functions

template<typename T >
NAMESPACE_SPH_BEGIN INLINE Float norm (const T &value)
 Returns a norm, absolute value by default. More...
 
template<typename T >
INLINE Float normSqr (const T &value)
 Squared value of the norm. More...
 
template<typename T >
INLINE Float maxElement (const T &value)
 Returns maximum element, simply the value iself by default. More...
 
template<typename T >
INLINE Float minElement (const T &value)
 Returns minimum element, simply the value iself by default. More...
 
template<typename T >
INLINE bool isReal (const T &value)
 Checks for nans and infs. More...
 
template<typename T >
constexpr INLINE auto less (const T &v1, const T &v2)
 Compares two objects of the same time component-wise. More...
 
template<typename T >
INLINE StaticArray< Float, 6 > getComponents (const T &value)
 Returns the components of the object in array. More...
 

Detailed Description

Function for generic manipulation with geometric types.

Author
Pavel Sevecek (sevecek at sirrah.troja.mff.cuni)
Date
2016-2021

Definition in file Generic.h.

Function Documentation

◆ getComponents()

template<typename T >
INLINE StaticArray<Float, 6> getComponents ( const T &  value)

Returns the components of the object in array.

Definition at line 59 of file Generic.h.

◆ isReal()

template<typename T >
INLINE bool isReal ( const T &  value)

Checks for nans and infs.

Definition at line 43 of file Generic.h.

◆ less()

template<typename T >
constexpr INLINE auto less ( const T &  v1,
const T &  v2 
)
constexpr

Compares two objects of the same time component-wise.

Returns object containing components 0 or 1, depending whether components of the first objects are smaller than components of the second object.

Note
The return type can be generally different if the mask cannot be represented using type T.

Definition at line 53 of file Generic.h.

◆ maxElement()

template<typename T >
INLINE Float maxElement ( const T &  value)

Returns maximum element, simply the value iself by default.

This function is intended for vectors and tensors, function for float is only for writing generic code.

Definition at line 29 of file Generic.h.

◆ minElement()

template<typename T >
INLINE Float minElement ( const T &  value)

Returns minimum element, simply the value iself by default.

This function is intended for vectors and tensors, function for float is only for writing generic code.

Definition at line 37 of file Generic.h.

◆ norm()

template<typename T >
NAMESPACE_SPH_BEGIN INLINE Float norm ( const T &  value)

Returns a norm, absolute value by default.

Definition at line 15 of file Generic.h.

◆ normSqr()

template<typename T >
INLINE Float normSqr ( const T &  value)

Squared value of the norm.

Definition at line 21 of file Generic.h.