Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

OpenTissue::swe::ShallowWaterEquations< real_type_ > Class Template Reference

#include <swe_shallow_water_equation.h>

List of all members.

Public Types

typedef real_type_ real_type
typedef boost::multi_array
< real_type, 2 > 
array_type
typedef unsigned int index_type
typedef
ublas::compressed_matrix
< real_type
matrix_type
typedef ublas::vector< real_typevector_type

Public Member Functions

 ShallowWaterEquations ()
 ~ShallowWaterEquations ()
void init (const unsigned int M, const unsigned int N, const real_type width, const real_type height)
void clear ()
void draw (const bool debugMode) const
void run (const real_type time_step, bool statistics=false)
void setSeaVelocity (const unsigned int i, const unsigned int j, const real_type vx, const real_type vy)
void setSeaHeight (const unsigned int i, const unsigned int j, const real_type height)
void setSeaBottom (const unsigned int i, const unsigned int j, const real_type bottom)
void setShore (const unsigned int i, const unsigned int j, const bool shore)

Protected Member Functions

void set_height (vector_type &h_new)
void assemble (matrix_type &A, vector_type &rhs) const
void compute_depth ()
void compute_departure_points ()
void compute_value_at_departure_points (array_type &value, array_type &value_tilde)
void update_u ()
void update_v ()
void apply_velocity_constraints ()
void nullify ()

Protected Attributes

real_type g
 Gravitation constant.
real_type timestep
 The current timestep size used.
unsigned int X
 Number of grid nodes along the x-direction.
unsigned int Y
 Number of grid nodes along the y-direction.
real_type dx
 Step size between two neighboring nodes in the x-direction.
real_type dy
 Step size between two neighboring nodes in the y-direction.
array_type water
 Boolean flag indicating which grid nodes are water and which ones are solid ``earth''.
array_type b
 Bottom height.
array_type h
 Water height.
array_type u
 Water velocity in x-direction.
array_type v
 Water velocity in y-direction.
array_type d
 Water Depth Grid, defined as: d = h - b.
array_type h_tilde
 Water height at departure points.
array_type u_tilde
 Water velocity in x-direction at departure points.
array_type v_tilde
 Water velocity in y-direction at departure points.
array_type x_tilde
 The x-coordinate of the departure points.
array_type y_tilde
 The y-coordinate of the departure points.
matrix_type A
vector_type hnew
vector_type rhs

Detailed Description

template<typename real_type_ = double>
class OpenTissue::swe::ShallowWaterEquations< real_type_ >

Shallow Water Equations.

Implementation is based on the paper:

Anita T. Layton and Michiel van de Panne, `` A Numerically Efficient and Stable Algorithm for Animating Water Waves ,'' the Visual Computer, Vol. 18, No. 1, pp. 41-53, 2002

http://www.amath.unc.edu/Faculty/layton/research/water/index.html


Member Typedef Documentation

template<typename real_type_ = double>
typedef boost::multi_array<real_type, 2> OpenTissue::swe::ShallowWaterEquations< real_type_ >::array_type
template<typename real_type_ = double>
typedef unsigned int OpenTissue::swe::ShallowWaterEquations< real_type_ >::index_type
template<typename real_type_ = double>
typedef ublas::compressed_matrix<real_type> OpenTissue::swe::ShallowWaterEquations< real_type_ >::matrix_type
template<typename real_type_ = double>
typedef real_type_ OpenTissue::swe::ShallowWaterEquations< real_type_ >::real_type
template<typename real_type_ = double>
typedef ublas::vector<real_type> OpenTissue::swe::ShallowWaterEquations< real_type_ >::vector_type

Constructor & Destructor Documentation

template<typename real_type_ = double>
OpenTissue::swe::ShallowWaterEquations< real_type_ >::ShallowWaterEquations (  )  [inline]
template<typename real_type_ = double>
OpenTissue::swe::ShallowWaterEquations< real_type_ >::~ShallowWaterEquations (  )  [inline]

Member Function Documentation

template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::apply_velocity_constraints (  )  [inline, protected]

Constaint velocities along wall's to have zero normal component

template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::assemble ( matrix_type A,
vector_type rhs 
) const [inline, protected]
template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::clear ( void   )  [inline]
template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::compute_departure_points (  )  [inline, protected]

Computes departure points, implicitly assumes that velocities have been computed prior to invocation

template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::compute_depth (  )  [inline, protected]

Computes water depth, assumes that water height have been computed prior to invocation.

template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::compute_value_at_departure_points ( array_type value,
array_type value_tilde 
) [inline, protected]

Implicitly assumes that departure points have been computed prior to invocation

template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::draw ( const bool  debugMode  )  const [inline]

Draw water height field

Parameters:
debugMode Boolean variable indicating wheter the water simulation is drawn in debug mode or not.
template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::init ( const unsigned int  M,
const unsigned int  N,
const real_type  width,
const real_type  height 
) [inline]
Parameters:
M 
N 
width 
height 
template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::nullify (  )  [inline, protected]
template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::run ( const real_type  time_step,
bool  statistics = false 
) [inline]
Parameters:
time_step 
template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::set_height ( vector_type h_new  )  [inline, protected]
template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::setSeaBottom ( const unsigned int  i,
const unsigned int  j,
const real_type  bottom 
) [inline]

Set Bottom Height

Parameters:
i The index of water node grid along x-axe direction
j The index of water node grid along x-axe direction
height The new bottom height value of the (i,j) water grid node.
template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::setSeaHeight ( const unsigned int  i,
const unsigned int  j,
const real_type  height 
) [inline]

Set Water Height

Parameters:
i The index of water node grid along x-axe direction
j The index of water node grid along x-axe direction
height The new height value of the (i,j) water grid node.
template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::setSeaVelocity ( const unsigned int  i,
const unsigned int  j,
const real_type  vx,
const real_type  vy 
) [inline]

Set Water Velocity

Parameters:
i The index of water node grid along x-axe direction
j The index of water node grid along x-axe direction
vx The new x-direction velocity of the (i,j) water grid node.
vy The new x-direction velocity of the (i,j) water grid node.
template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::setShore ( const unsigned int  i,
const unsigned int  j,
const bool  shore 
) [inline]

Set Shore

Parameters:
i The index of water node grid along x-axe direction
j The index of water node grid along x-axe direction
shore If true the (i,j) grid node is set to be shore if false the node is water.
template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::update_u (  )  [inline, protected]

Implicitly assumes that new height field have been stored.

template<typename real_type_ = double>
void OpenTissue::swe::ShallowWaterEquations< real_type_ >::update_v (  )  [inline, protected]

Implicitly assumes that new height field have been stored.


Member Data Documentation

template<typename real_type_ = double>
matrix_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::A [protected]
template<typename real_type_ = double>
array_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::b [protected]

Bottom height.

template<typename real_type_ = double>
array_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::d [protected]

Water Depth Grid, defined as: d = h - b.

template<typename real_type_ = double>
real_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::dx [protected]

Step size between two neighboring nodes in the x-direction.

template<typename real_type_ = double>
real_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::dy [protected]

Step size between two neighboring nodes in the y-direction.

template<typename real_type_ = double>
real_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::g [protected]

Gravitation constant.

template<typename real_type_ = double>
array_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::h [protected]

Water height.

template<typename real_type_ = double>
array_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::h_tilde [protected]

Water height at departure points.

template<typename real_type_ = double>
vector_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::hnew [protected]
template<typename real_type_ = double>
vector_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::rhs [protected]
template<typename real_type_ = double>
real_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::timestep [protected]

The current timestep size used.

template<typename real_type_ = double>
array_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::u [protected]

Water velocity in x-direction.

template<typename real_type_ = double>
array_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::u_tilde [protected]

Water velocity in x-direction at departure points.

template<typename real_type_ = double>
array_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::v [protected]

Water velocity in y-direction.

template<typename real_type_ = double>
array_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::v_tilde [protected]

Water velocity in y-direction at departure points.

template<typename real_type_ = double>
array_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::water [protected]

Boolean flag indicating which grid nodes are water and which ones are solid ``earth''.

template<typename real_type_ = double>
unsigned int OpenTissue::swe::ShallowWaterEquations< real_type_ >::X [protected]

Number of grid nodes along the x-direction.

template<typename real_type_ = double>
array_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::x_tilde [protected]

The x-coordinate of the departure points.

template<typename real_type_ = double>
unsigned int OpenTissue::swe::ShallowWaterEquations< real_type_ >::Y [protected]

Number of grid nodes along the y-direction.

template<typename real_type_ = double>
array_type OpenTissue::swe::ShallowWaterEquations< real_type_ >::y_tilde [protected]

The y-coordinate of the departure points.


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