mantaflow  0.10
A framework for fluid simulation
Classes | Typedefs | Functions | Variables
randomstream.h File Reference
#include <iostream>
#include <stdio.h>
#include <time.h>
#include "vectorbase.h"

Go to the source code of this file.

Classes

class  Manta::Manta::Error
 
struct  Manta::Manta::remove_pointers< T >
 
struct  Manta::Manta::remove_pointers< T * >
 
struct  Manta::Manta::remove_pointers< T & >
 
struct  Manta::Manta::MuTime
 Timing class for preformance measuring. More...
 
class  Manta::Manta::Vector3D< S >
 Basic inlined vector class. More...
 
class  Manta::MTRand
 
class  Manta::RandomStream
 

Typedefs

typedef long long Manta::Manta::IndexInt
 
typedef float Manta::Real
 
typedef Vector3D< Real > Manta::Manta::Vec3
 3D vector class of type Real (typically float)
 
typedef Vector3D< int > Manta::Manta::Vec3i
 3D vector class of type int
 

Functions

void Manta::Manta::updateQtGui (bool full, int frame, float time, const std::string &curPlugin)
 
bool Manta::Manta::_chklevel (int level=0)
 
std::ostream & Manta::Manta::operator<< (std::ostream &os, const MuTime &t)
 
std::string Manta::Manta::buildInfoString ()
 generate a string with infos about the current mantaflow build More...
 
template<class T >
Manta::Manta::square (T a)
 
template<class T >
Manta::Manta::cubed (T a)
 
template<class T >
Manta::Manta::clamp (const T &val, const T &vmin, const T &vmax)
 
template<class T >
Manta::Manta::nmod (const T &a, const T &b)
 
template<>
int Manta::Manta::nmod (const int &a, const int &b)
 
template<>
float Manta::Manta::nmod (const float &a, const float &b)
 
template<>
double Manta::Manta::nmod (const double &a, const double &b)
 
template<class T >
Manta::Manta::safeDivide (const T &a, const T &b)
 
template<>
int Manta::Manta::safeDivide< int > (const int &a, const int &b)
 
template<>
float Manta::Manta::safeDivide< float > (const float &a, const float &b)
 
template<>
double Manta::Manta::safeDivide< double > (const double &a, const double &b)
 
bool Manta::Manta::c_isnan (float c)
 
template<class S >
Vector3D< S > Manta::Manta::operator+ (const Vector3D< S > &v1, const Vector3D< S > &v2)
 Addition operator.
 
template<class S , class S2 >
Vector3D< S > Manta::Manta::operator+ (const Vector3D< S > &v, S2 s)
 Addition operator.
 
template<class S , class S2 >
Vector3D< S > Manta::Manta::operator+ (S2 s, const Vector3D< S > &v)
 Addition operator.
 
template<class S >
Vector3D< S > Manta::Manta::operator- (const Vector3D< S > &v1, const Vector3D< S > &v2)
 Subtraction operator.
 
template<class S , class S2 >
Vector3D< S > Manta::Manta::operator- (const Vector3D< S > &v, S2 s)
 Subtraction operator.
 
template<class S , class S2 >
Vector3D< S > Manta::Manta::operator- (S2 s, const Vector3D< S > &v)
 Subtraction operator.
 
template<class S >
Vector3D< S > Manta::Manta::operator* (const Vector3D< S > &v1, const Vector3D< S > &v2)
 Multiplication operator.
 
template<class S , class S2 >
Vector3D< S > Manta::Manta::operator* (const Vector3D< S > &v, S2 s)
 Multiplication operator.
 
template<class S , class S2 >
Vector3D< S > Manta::Manta::operator* (S2 s, const Vector3D< S > &v)
 Multiplication operator.
 
template<class S >
Vector3D< S > Manta::Manta::operator/ (const Vector3D< S > &v1, const Vector3D< S > &v2)
 Division operator.
 
template<class S , class S2 >
Vector3D< S > Manta::Manta::operator/ (const Vector3D< S > &v, S2 s)
 Division operator.
 
template<class S , class S2 >
Vector3D< S > Manta::Manta::operator/ (S2 s, const Vector3D< S > &v)
 Division operator.
 
template<class S >
bool Manta::Manta::operator== (const Vector3D< S > &s1, const Vector3D< S > &s2)
 Comparison operator.
 
template<class S >
bool Manta::Manta::operator!= (const Vector3D< S > &s1, const Vector3D< S > &s2)
 Comparison operator.
 
template<class S >
Vector3D< S > Manta::Manta::vmin (const Vector3D< S > &s1, const Vector3D< S > &s2)
 Min operator.
 
template<class S , class S2 >
Vector3D< S > Manta::Manta::vmin (const Vector3D< S > &s1, S2 s2)
 Min operator.
 
template<class S1 , class S >
Vector3D< S > Manta::Manta::vmin (S1 s1, const Vector3D< S > &s2)
 Min operator.
 
template<class S >
Vector3D< S > Manta::Manta::vmax (const Vector3D< S > &s1, const Vector3D< S > &s2)
 Max operator.
 
template<class S , class S2 >
Vector3D< S > Manta::Manta::vmax (const Vector3D< S > &s1, S2 s2)
 Max operator.
 
template<class S1 , class S >
Vector3D< S > Manta::Manta::vmax (S1 s1, const Vector3D< S > &s2)
 Max operator.
 
template<class S >
Manta::Manta::dot (const Vector3D< S > &t, const Vector3D< S > &v)
 Dot product.
 
template<class S >
Vector3D< S > Manta::Manta::cross (const Vector3D< S > &t, const Vector3D< S > &v)
 Cross product.
 
template<class S >
const Vector3D< S > & Manta::Manta::projectNormalTo (const Vector3D< S > &v, const Vector3D< S > &n)
 Project a vector into a plane, defined by its normal. More...
 
template<class S >
Manta::Manta::norm (const Vector3D< S > &v)
 
template<class S >
Manta::Manta::normSquare (const Vector3D< S > &v)
 Compute squared magnitude.
 
Real Manta::Manta::norm (const Real v)
 compatibility, allow use of int, Real and Vec inputs with norm/normSquare
 
Real Manta::Manta::normSquare (const Real v)
 
Real Manta::Manta::norm (const int v)
 
Real Manta::Manta::normSquare (const int v)
 
template<class S >
Vector3D< S > Manta::Manta::getNormalized (const Vector3D< S > &v)
 Returns a normalized vector.
 
template<class S >
Manta::Manta::normalize (Vector3D< S > &v)
 Compute the norm of the vector and normalize it. More...
 
template<class S >
Vector3D< S > Manta::Manta::getOrthogonalVector (const Vector3D< S > &v)
 Obtain an orthogonal vector. More...
 
template<class S >
void Manta::Manta::vecToAngle (const Vector3D< S > &v, S &phi, S &theta)
 Convert vector to polar coordinates. More...
 
template<class S >
Vector3D< S > Manta::Manta::reflectVector (const Vector3D< S > &t, const Vector3D< S > &n)
 Compute vector reflected at a surface. More...
 
template<class S >
Vector3D< S > Manta::Manta::refractVector (const Vector3D< S > &t, const Vector3D< S > &normal, S nt, S nair, int &refRefl)
 Compute vector refracted at a surface. More...
 
template<class S >
std::ostream & Manta::Manta::operator<< (std::ostream &os, const Vector3D< S > &i)
 Outputs the object in human readable form to stream. More...
 
template<class S >
std::istream & Manta::Manta::operator>> (std::istream &is, Vector3D< S > &i)
 Reads the contents of the object from a stream. More...
 
template<class T >
Vec3 Manta::Manta::toVec3 (T v)
 convert to Real Vector
 
template<class T >
Vec3i Manta::Manta::toVec3i (T v)
 convert to int Vector
 
template<class T >
Vec3i Manta::Manta::toVec3i (T v0, T v1, T v2)
 convert to int Vector
 
template<class T >
Vec3i Manta::Manta::toVec3iRound (T v)
 round, and convert to int Vector
 
template<class T >
Vec3i Manta::Manta::toVec3iChecked (T v)
 convert to int Vector if values are close enough to an int
 
template<class T >
Vector3D< double > Manta::Manta::toVec3d (T v)
 convert to double Vector
 
template<class T >
Vector3D< float > Manta::Manta::toVec3f (T v)
 convert to float Vector
 
template<>
Vec3 Manta::Manta::clamp< Vec3 > (const Vec3 &a, const Vec3 &b, const Vec3 &c)
 
template<>
Vec3 Manta::Manta::safeDivide< Vec3 > (const Vec3 &a, const Vec3 &b)
 
template<>
Vec3 Manta::Manta::nmod< Vec3 > (const Vec3 &a, const Vec3 &b)
 
std::ostream & Manta::operator<< (std::ostream &os, const MTRand &mtrand)
 
std::istream & Manta::operator>> (std::istream &is, MTRand &mtrand)
 

Variables

int Manta::Manta::gDebugLevel
 

Function Documentation

◆ buildInfoString()

std::string Manta::Manta::buildInfoString ( )

generate a string with infos about the current mantaflow build

generate a string with infos about the current mantaflow build

◆ getOrthogonalVector()

template<class S >
Vector3D<S> Manta::Manta::getOrthogonalVector ( const Vector3D< S > &  v)

Obtain an orthogonal vector.

Compute a vector that is orthonormal to the given vector. Nothing else can be assumed for the direction of the new vector.

Returns
The orthonormal vector

◆ norm()

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

Compute the magnitude (length) of the vector (clamps to 0 and 1 with VECTOR_EPSILON)

◆ normalize()

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

Compute the norm of the vector and normalize it.

Returns
The value of the norm

◆ operator<<()

template<class S >
std::ostream& Manta::Manta::operator<< ( std::ostream &  os,
const Vector3D< S > &  i 
)

Outputs the object in human readable form to stream.

Output format [x,y,z]

◆ operator>>()

template<class S >
std::istream& Manta::Manta::operator>> ( std::istream &  is,
Vector3D< S > &  i 
)

Reads the contents of the object from a stream.

Input format [x,y,z]

◆ projectNormalTo()

template<class S >
const Vector3D<S>& Manta::Manta::projectNormalTo ( const Vector3D< S > &  v,
const Vector3D< S > &  n 
)
inline

Project a vector into a plane, defined by its normal.

Projects a vector into a plane normal to the given vector, which must have unit length. Self is modified.

Parameters
vThe vector to project
nThe plane normal
Returns
The projected vector

◆ reflectVector()

template<class S >
Vector3D<S> Manta::Manta::reflectVector ( const Vector3D< S > &  t,
const Vector3D< S > &  n 
)
inline

Compute vector reflected at a surface.

Compute a vector, that is self (as an incoming vector) reflected at a surface with a distinct normal vector. Note that the normal is reversed, if the scalar product with it is positive.

Parameters
tThe incoming vector
nThe surface normal
Returns
The new reflected vector

◆ refractVector()

template<class S >
Vector3D<S> Manta::Manta::refractVector ( const Vector3D< S > &  t,
const Vector3D< S > &  normal,
nt,
nair,
int &  refRefl 
)
inline

Compute vector refracted at a surface.

Parameters
tThe incoming vector
nThe surface normal
ntThe "inside" refraction index
nairThe "outside" refraction index
refReflSet to 1 on total reflection
Returns
The refracted vector

◆ vecToAngle()

template<class S >
void Manta::Manta::vecToAngle ( const Vector3D< S > &  v,
S &  phi,
S &  theta 
)
inline

Convert vector to polar coordinates.

Stable vector to angle conversion

Parameters
vvector to convert
phiunique angle [0,2PI]
thetaunique angle [0,PI]