mantaflow  0.10
A framework for fluid simulation
Classes | Macros | Typedefs | Functions
vector4d.h File Reference
#include "vectorbase.h"

Go to the source code of this file.

Classes

class  Manta::Vector4D< S >
 Basic inlined vector class. More...
 

Macros

#define BUILD_INDEX_4D
 

Typedefs

typedef Vector4D< Real > Manta::Vec4
 3D vector class of type Real (typically float)
 
typedef Vector4D< int > Manta::Vec4i
 3D vector class of type int
 

Functions

template<class S >
Vector4D< S > Manta::operator+ (const Vector4D< S > &v1, const Vector4D< S > &v2)
 Addition operator.
 
template<class S , class S2 >
Vector4D< S > Manta::operator+ (const Vector4D< S > &v, S2 s)
 Addition operator.
 
template<class S , class S2 >
Vector4D< S > Manta::operator+ (S2 s, const Vector4D< S > &v)
 Addition operator.
 
template<class S >
Vector4D< S > Manta::operator- (const Vector4D< S > &v1, const Vector4D< S > &v2)
 Subtraction operator.
 
template<class S , class S2 >
Vector4D< S > Manta::operator- (const Vector4D< S > &v, S2 s)
 Subtraction operator.
 
template<class S , class S2 >
Vector4D< S > Manta::operator- (S2 s, const Vector4D< S > &v)
 Subtraction operator.
 
template<class S >
Vector4D< S > Manta::operator* (const Vector4D< S > &v1, const Vector4D< S > &v2)
 Multiplication operator.
 
template<class S , class S2 >
Vector4D< S > Manta::operator* (const Vector4D< S > &v, S2 s)
 Multiplication operator.
 
template<class S , class S2 >
Vector4D< S > Manta::operator* (S2 s, const Vector4D< S > &v)
 Multiplication operator.
 
template<class S >
Vector4D< S > Manta::operator/ (const Vector4D< S > &v1, const Vector4D< S > &v2)
 Division operator.
 
template<class S , class S2 >
Vector4D< S > Manta::operator/ (const Vector4D< S > &v, S2 s)
 Division operator.
 
template<class S , class S2 >
Vector4D< S > Manta::operator/ (S2 s, const Vector4D< S > &v)
 Division operator.
 
template<class S >
bool Manta::operator== (const Vector4D< S > &s1, const Vector4D< S > &s2)
 Comparison operator.
 
template<class S >
bool Manta::operator!= (const Vector4D< S > &s1, const Vector4D< S > &s2)
 Comparison operator.
 
template<class S >
Manta::dot (const Vector4D< S > &t, const Vector4D< S > &v)
 Dot product.
 
template<class S >
Manta::norm (const Vector4D< S > &v)
 Cross product. More...
 
template<class S >
Manta::normSquare (const Vector4D< S > &v)
 Compute squared magnitude.
 
template<class S >
Vector4D< S > Manta::getNormalized (const Vector4D< S > &v)
 Returns a normalized vector.
 
template<class S >
Manta::normalize (Vector4D< S > &v)
 Compute the norm of the vector and normalize it. More...
 
template<class S >
std::ostream & Manta::operator<< (std::ostream &os, const Vector4D< S > &i)
 Outputs the object in human readable form to stream.
 
template<class S >
std::istream & Manta::operator>> (std::istream &is, Vector4D< S > &i)
 Reads the contents of the object from a stream.
 
template<class T >
Vec4 Manta::toVec4 (T v)
 convert to Real Vector
 
template<class T >
Vec4i Manta::toVec4i (T v)
 
template<>
Vec4 Manta::clamp< Vec4 > (const Vec4 &a, const Vec4 &b, const Vec4 &c)
 
template<>
Vec4 Manta::safeDivide< Vec4 > (const Vec4 &a, const Vec4 &b)
 
template<>
Vec4 Manta::nmod< Vec4 > (const Vec4 &a, const Vec4 &b)
 
template<class T >
Manta::interpol4d (const T *data, const Vec4i &size, const IndexInt sZ, const IndexInt sT, const Vec4 &pos)
 

Macro Definition Documentation

◆ BUILD_INDEX_4D

#define BUILD_INDEX_4D
Value:
Real px=pos.x-0.5f, py=pos.y-0.5f, pz=pos.z-0.5f, pt=pos.t-0.5f; \
int xi = (int)px; \
int yi = (int)py; \
int zi = (int)pz; \
int ti = (int)pt; \
Real s1 = px-(Real)xi, s0 = 1.-s1; \
Real t1 = py-(Real)yi, t0 = 1.-t1; \
Real f1 = pz-(Real)zi, f0 = 1.-f1; \
Real g1 = pt-(Real)ti, g0 = 1.-g1; \
/* clamp to border */ \
if (px < 0.) { xi = 0; s0 = 1.0; s1 = 0.0; } \
if (py < 0.) { yi = 0; t0 = 1.0; t1 = 0.0; } \
if (pz < 0.) { zi = 0; f0 = 1.0; f1 = 0.0; } \
if (pt < 0.) { ti = 0; g0 = 1.0; g1 = 0.0; } \
if (xi >= size.x-1) { xi = size.x-2; s0 = 0.0; s1 = 1.0; } \
if (yi >= size.y-1) { yi = size.y-2; t0 = 0.0; t1 = 1.0; } \
if (zi >= size.z-1) { zi = size.z-2; f0 = 0.0; f1 = 1.0; } \
if (ti >= size.t-1) { ti = size.t-2; g0 = 0.0; g1 = 1.0; } \
const int sX = 1; \
const int sY = size.x;

Function Documentation

◆ norm()

template<class S >
S Manta::norm ( const Vector4D< S > &  v)
inline

Cross product.

Compute the magnitude (length) of the vector

◆ normalize()

template<class S >
S Manta::normalize ( Vector4D< S > &  v)
inline

Compute the norm of the vector and normalize it.

Returns
The value of the norm