mantaflow  0.10
A framework for fluid simulation
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
Manta::Grid< T > Class Template Referenceabstract

#include <grid.h>

Inheritance diagram for Manta::Grid< T >:
Manta::GridBase

Public Types

typedef T BASETYPE
 
typedef GridBase BASETYPE_GRID
 
- Public Types inherited from Manta::GridBase
enum  GridType {
  TypeNone = 0, TypeReal = 1, TypeInt = 2, TypeVec3 = 4,
  TypeMAC = 8, TypeLevelset = 16, TypeFlags = 32
}
 

Public Member Functions

 PYTHON () Grid(FluidSolver *parent
 init new grid, values are set to zero More...
 
 Grid (const Grid< T > &a)
 create new & copy content from another grid
 
virtual ~Grid ()
 return memory to solver
 
get (int i, int j, int k) const
 
T & get (int i, int j, int k)
 access data
 
get (IndexInt idx) const
 access data
 
get (const Vec3i &pos) const
 access data
 
T & operator() (int i, int j, int k)
 access data
 
operator() (int i, int j, int k) const
 access data
 
T & operator() (IndexInt idx)
 access data
 
operator() (IndexInt idx) const
 access data
 
T & operator() (const Vec3i &pos)
 access data
 
operator() (const Vec3i &pos) const
 access data
 
T & operator[] (IndexInt idx)
 access data
 
const T operator[] (IndexInt idx) const
 access data
 
getInterpolated (const Vec3 &pos) const
 
void setInterpolated (const Vec3 &pos, const T &val, Grid< Real > &sumBuffer) const
 
getInterpolatedHi (const Vec3 &pos, int order) const
 
 PYTHON () Grid< T > &copyFrom(const Grid< T > &a
 warning - do not use "=" for grids in python, this copies the reference! not the grid content... More...
 
 PYTHON () void add(const Grid< T > &a)
 add/subtract other grid
 
 PYTHON () void sub(const Grid< T > &a)
 
 PYTHON () void setConst(T s)
 set all cells to constant value
 
 PYTHON () void addConst(T s)
 add constant to all grid cells
 
 PYTHON () void addScaled(const Grid< T > &a
 add scaled other grid to current one (note, only "Real" factor, "T" type not supported here!)
 
 PYTHON () void mult(const Grid< T > &a)
 multiply contents of grid
 
 PYTHON () void multConst(T s)
 multiply each cell by a constant scalar value
 
 PYTHON () void clamp(Real min
 clamp content to range (for vec3, clamps each component separately)
 
 PYTHON () void stomp(const T &threshold)
 reduce small values to zero
 
 PYTHON () Real getMaxAbs()
 get absolute max value in grid
 
 PYTHON () Real getMax()
 get max value in grid
 
 PYTHON () Real getMin()
 get min value in grid
 
 PYTHON () Real getL1(int bnd=0)
 calculate L1 norm of grid content
 
 PYTHON () Real getL2(int bnd=0)
 calculate L2 norm of grid content
 
 PYTHON () void setBound(T value
 set all boundary cells to constant value (Dirichlet)
 
 PYTHON () void setBoundNeumann(int boundaryWidth
 set all boundary cells to last inner value (Neumann)
 
PYTHON() std PYTHON () void printGrid(int zSlice
 get data pointer of grid More...
 
template<class S >
Grid< T > & operator+= (const Grid< S > &a)
 
template<class S >
Grid< T > & operator+= (const S &a)
 
template<class S >
Grid< T > & operator-= (const Grid< S > &a)
 
template<class S >
Grid< T > & operator-= (const S &a)
 
template<class S >
Grid< T > & operator*= (const Grid< S > &a)
 
template<class S >
Grid< T > & operator*= (const S &a)
 
template<class S >
Grid< T > & operator/= (const Grid< S > &a)
 
template<class S >
Grid< T > & operator/= (const S &a)
 
Grid< T > & safeDivide (const Grid< T > &a)
 
void swap (Grid< T > &other)
 Swap data with another grid (no actual data is moved)
 
T & operator() (int i, int j, int k, int unused)
 grid4d compatibility functions
 
operator() (int i, int j, int k, int unused) const
 
template<>
Real getMax ()
 
template<>
Real getMax ()
 
template<>
Real getMax ()
 
- Public Member Functions inherited from Manta::GridBase
 PYTHON () GridBase(FluidSolver *parent)
 
int getSizeX () const
 Get the grids X dimension.
 
int getSizeY () const
 Get the grids Y dimension.
 
int getSizeZ () const
 Get the grids Z dimension.
 
Vec3i getSize () const
 Get the grids dimensions.
 
IndexInt getStrideX () const
 Get Stride in X dimension.
 
IndexInt getStrideY () const
 Get Stride in Y dimension.
 
IndexInt getStrideZ () const
 Get Stride in Z dimension.
 
Real getDx ()
 
void checkIndex (int i, int j, int k) const
 Check if indices are within bounds, otherwise error (should only be called when debugging)
 
void checkIndex (IndexInt idx) const
 Check if indices are within bounds, otherwise error (should only be called when debugging)
 
bool isInBounds (const Vec3i &p, int bnd) const
 Check if index is within given boundaries.
 
bool isInBounds (const Vec3i &p) const
 Check if index is within given boundaries.
 
bool isInBounds (const Vec3 &p, int bnd=0) const
 Check if index is within given boundaries.
 
bool isInBounds (IndexInt idx) const
 Check if linear index is in the range of the array.
 
GridType getType () const
 Get the type of grid.
 
bool is3D () const
 Check dimensionality.
 
IndexInt index (int i, int j, int k) const
 Get index into the data.
 
IndexInt index (const Vec3i &pos) const
 Get index into the data.
 
bool is4D () const
 grid4d compatibility functions
 
int getSizeT () const
 
int getStrideT () const
 
int index (int i, int j, int k, int unused) const
 
bool isInBounds (int i, int j, int k, int t, int bnd) const
 

Public Attributes

bool show = true)
 
bool copyType =true )
 
const T & factor
 
Real max
 
int boundaryWidth =1)
 
PYTHON() std bool printIndex =false)
 

Protected Attributes

T * mData
 
- Protected Attributes inherited from Manta::GridBase
GridType mType
 
Vec3i mSize
 
Real mDx
 
bool m3D
 
IndexInt mStrideZ
 

Detailed Description

template<class T>
class Manta::Grid< T >

Grid class

Member Function Documentation

◆ get()

template<class T>
T Manta::Grid< T >::get ( int  i,
int  j,
int  k 
) const
inline

all kinds of access functions, use grid(), grid[] or grid.get() access data

◆ PYTHON() [1/3]

template<class T>
Manta::Grid< T >::PYTHON ( )

init new grid, values are set to zero

set all cells to zero

◆ PYTHON() [2/3]

template<class T>
Manta::Grid< T >::PYTHON ( ) const &

warning - do not use "=" for grids in python, this copies the reference! not the grid content...

copy content from other grid (use this one instead of operator= !)

◆ PYTHON() [3/3]

template<class T>
PYTHON () std Manta::Grid< T >::PYTHON ( )

get data pointer of grid

debugging helper, print grid from python


The documentation for this class was generated from the following files: