Fluid Dynamics Library
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
fdl::MACBase< scalar_t > Class Template Reference

MAC grid a la Bridson "FSCG" section 2.4. More...

#include <macbase.hpp>

Inheritance diagram for fdl::MACBase< scalar_t >:
fdl::Drawable fdl::MACSmoke< scalar_t >

List of all members.

Public Types

typedef void(* Field_t )(unsigned, const scalar_t *, scalar_t *)
 Public type for passing pointer to interpField to ODEStepper.

Public Member Functions

 MACBase (int nx=1, int ny=1, int nz=1, scalar_t dx=0.1, interp_T rule=LINEAR)
 Legacy constructor.
 MACBase (TiXmlNode *node)
 Constructor using XML data.
int xdim () const
int ydim () const
int zdim () const
scalar_t dx () const
virtual void draw () const
size_t psize () const
size_t usize () const
size_t vsize () const
size_t wsize () const
medium_T & operator() (int x, int y, int z)
scalar_t & p (int x, int y, int z)
scalar_t & u (int x, int y, int z)
scalar_t & v (int x, int y, int z)
scalar_t & w (int x, int y, int z)
void coordsP (int x, int y, int z, scalar_t X[])
void coordsU (int x, int y, int z, scalar_t X[])
void coordsV (int x, int y, int z, scalar_t X[])
void coordsW (int x, int y, int z, scalar_t X[])
scalar_t interpP (const scalar_t X[])
scalar_t interpU (const scalar_t X[])
scalar_t interpV (const scalar_t X[])
scalar_t interpW (const scalar_t X[])
void interpField (unsigned npts, const scalar_t X[], scalar_t uvec[])
 Computes velocity field at contiguous vector of points in 3-space.
scalar_t supP ()
scalar_t supU ()
scalar_t supV ()
scalar_t supW ()
int LAindex (int x, int y, int z) const

Protected Types

typedef std::vector< scalar_t >
::iterator 
iterator_type

Protected Member Functions

void initMACBase (int nx, int ny, int nz, scalar_t dx, interp_T rule)
 Initialization member called by all constructors.
virtual void drawBounds () const
virtual void drawVelocity () const
virtual void drawSolid () const
virtual void drawPressure () const

Protected Attributes

scalar_t dx_
 Grid discretization.
scalar_t dx_half
std::vector< medium_T > m_
 Cell descriptor (FLUID, SOLID, etc.)
std::vector< scalar_t > p_
 Cell pressure values.
std::vector< scalar_t > u_
 Velocity field x-components.
std::vector< scalar_t > v_
 Velocity field y-components.
std::vector< scalar_t > w_
 Velocity field z-components.
int n_ [3]
 Grid dimensions in each coordinate.
interp_T rule_
 Method for interpoolation routines.
int doVelocity_
int doSolid_
int doBounds_
int doPressure_
float velocityRGB [3]
float solidRGB [3]

Detailed Description

template<typename scalar_t>
class fdl::MACBase< scalar_t >

MAC grid a la Bridson "FSCG" section 2.4.

The "lattice coordinate" indexing of all quantities (cells, pressure, velocity components) is 1-based, i.e., (1,1,1) indexes the cell at the origin.

Definition at line 44 of file macbase.hpp.


Constructor & Destructor Documentation

template<typename scalar_t>
fdl::MACBase< scalar_t >::MACBase ( TiXmlNode *  node)

Constructor using XML data.

The XML node should have tags in the following format.

 <MACGrid>
   <Dimensions x="50" y="50" z="50">
   <CellWidth> 0.1 </CellWidth> 	
   <InterpMethod> 0 </InterpMethod>
   <Drawable>
      <Velocity draw="true" r="0.0" g="1.0" b="0.0">
      <Solid etc. />
      <Pressure etc. />
   </Drawable>
 </MACGrid>
 

All entities in the Drawable field are turned off by default. Turning them on is accomplished by including the "draw" attribute in the tag, and setting their RGB colors.

Definition at line 184 of file macbase.hpp.


Member Function Documentation

template<typename scalar_t>
void fdl::MACBase< scalar_t >::interpField ( unsigned  npts,
const scalar_t  X[],
scalar_t  uvec[] 
)

Computes velocity field at contiguous vector of points in 3-space.

Parameters:
xcontiguous array of coordinates (size 3*npts for ODE stepper.
Returns:
uvec corresponding velocity vectors for ODE stepper.

Definition at line 488 of file macbase.hpp.

template<typename scalar_t>
scalar_t fdl::MACBase< scalar_t >::interpP ( const scalar_t  X[])

Any point x that lies off the grid will be "interpolated" by the as the pressure in the closest lying cell.

Definition at line 326 of file macbase.hpp.

template<typename scalar_t>
scalar_t fdl::MACBase< scalar_t >::interpU ( const scalar_t  X[])

Any point x that lies off the grid will be reinterpreted as the center of the closest lying cell before interpolation.

Definition at line 377 of file macbase.hpp.

template<typename scalar_t>
scalar_t fdl::MACBase< scalar_t >::interpV ( const scalar_t  X[])

Any point x that lies off the grid will be reinterpreted as the center of the closest lying cell before interpolation.

Definition at line 414 of file macbase.hpp.

template<typename scalar_t>
scalar_t fdl::MACBase< scalar_t >::interpW ( const scalar_t  X[])

Any point x that lies off the grid will be reinterpreted as the center of the closest lying cell before interpolation.

Definition at line 451 of file macbase.hpp.


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