33 : u(v[
Z], -v[
Y], v[
X]) {}
122 stream << std::setprecision(6) << std::setw(20) << t.u[
X] << std::setw(20) << t.u[
Y] << std::setw(20)
134 Vector(v1[
X] * v2[
Y] - v1[
Y] * v2[
X], v1[
X] * v2[
Z] - v1[
Z] * v2[
X], v1[
Y] * v2[
Z] - v1[
Z] * v2[
Y]));
INLINE bool isReal(const AntisymmetricTensor &t)
INLINE AntisymmetricTensor clamp(const AntisymmetricTensor &t, const Interval &range)
Clamping all components by range.
INLINE Float normSqr(const AntisymmetricTensor &t)
Arbitrary squared norm of the tensor.
INLINE AntisymmetricTensor max(const AntisymmetricTensor &t1, const AntisymmetricTensor &t2)
Component-wise maximum of two tensors.
INLINE auto abs(const AntisymmetricTensor &t)
Returns the tensor of absolute values. Resulting tensor is necessarily symmetric.
INLINE AntisymmetricTensor antisymmetricOuter(const Vector &v1, const Vector &v2)
INLINE Float norm(const AntisymmetricTensor &t)
INLINE bool almostEqual(const AntisymmetricTensor &t1, const AntisymmetricTensor &t2, const Float eps=EPS)
Checks if two tensors are equal to some given accuracy.
INLINE Float minElement(const AntisymmetricTensor &t)
Returns the minimal element of the tensor.
INLINE Float ddot(const AntisymmetricTensor &t1, const AntisymmetricTensor &t2)
Double-dot product t1 : t2 = sum_ij t1_ij t2_ij.
const PseudoVectorTag PSEUDOVECTOR
INLINE AntisymmetricTensor min(const AntisymmetricTensor &t1, const AntisymmetricTensor &t2)
Component-wise minimum of two tensors.
INLINE auto less(const AntisymmetricTensor &t1, const AntisymmetricTensor &t2)
#define SPH_ASSERT(x,...)
uint32_t Size
Integral type used to index arrays (by default).
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
Basic algebra for symmetric 2nd order tensors.
BasicVector< Float > Vector
INLINE float dot(const BasicVector< float > &v1, const BasicVector< float > &v2)
Make sure the vector is trivially constructible and destructible, needed for fast initialization of a...
AntisymmetricTensor(const PseudoVectorTag, const Vector &v)
INLINE Float operator()(const Size i, const Size j) const
Returns element on given with given indices.
friend AntisymmetricTensor operator+(const AntisymmetricTensor &t1, const AntisymmetricTensor &t2)
Vector pseudovector() const
Returns the associated pseudovector.
INLINE Vector & components()
Returns the components above diagonal as vector.
AntisymmetricTensor()=default
friend AntisymmetricTensor operator*(const Float v, const AntisymmetricTensor &t)
friend bool operator==(const AntisymmetricTensor &t1, const AntisymmetricTensor &t2)
AntisymmetricTensor(const Vector &v)
friend std::ostream & operator<<(std::ostream &stream, const AntisymmetricTensor &t)
friend AntisymmetricTensor operator*(const AntisymmetricTensor &t, const Float v)
INLINE AntisymmetricTensor operator-() const
INLINE Vector operator[](const Size idx) const
Returns a row of the matrix.
INLINE const Vector & components() const
Returns the components above diagonal as vector.
INLINE AntisymmetricTensor operator+=(const AntisymmetricTensor &other)
friend AntisymmetricTensor operator/(const AntisymmetricTensor &t, const Float v)
friend AntisymmetricTensor operator-(const AntisymmetricTensor &t1, const AntisymmetricTensor &t2)
INLINE AntisymmetricTensor operator-=(const AntisymmetricTensor &other)
AntisymmetricTensor(const Float v)
Constructs an antisymmetric tensor by setting all components above the diagonal to the same value.
Object representing a 1D interval of real numbers.
INLINE Float lower() const
Returns lower bound of the interval.
INLINE Float upper() const
Returns upper bound of the interval.
INLINE bool contains(const Float &value) const
Checks whether value is inside the interval.
Symmetric tensor of 2nd order.