3D graphics eBook - Course Materials Repository

3D graphics eBook - Course Materials Repository 3D graphics eBook - Course Materials Repository

courses.essex.ac.uk
from courses.essex.ac.uk More from this publisher
07.01.2013 Views

Stencil codes 197 topologies: This may be useful for achieving perpetual boundary conditions, which simplifys certain physical models. Example: 2D Jacobi Iteration To illustrate the formal definition, we'll have a look at how a two dimensional Jacobi iteration can be defined. The update function computes the arithmetic mean of a cell's four neighbors. In this case we set off with an initial solution of 0. The left and right boundary are fixed at 1, while the upper and lower boundaries are set to 0. After a sufficient number of iterations, the system converges against a saddle-shape. Data dependencies of a selected cell in the 2D array.

Stencil codes 198 Stencils The shape of the neighborhood used during the updates depends on the application itself. The most common stencils are the 2D or 3D versions of the Von Neumann neighborhood and Moore neighborhood. The example above uses a 2D von Neumann stencil while LBM codes generally use its 3D variant. Conway's Game of Life uses the 2D Moore neighborhood. That said, other stencils such as a 25-point stencil for seismic wave propagation [5] can be found, too. 9-point 2D stencil 5-point 2D stencil 6-point 3D stencil 25-point 3D stencil

Stencil codes 197<br />

topologies:<br />

This may be useful for achieving perpetual boundary conditions, which simplifys certain physical models.<br />

Example: 2D Jacobi Iteration<br />

To illustrate the formal definition, we'll have a look at how a two<br />

dimensional Jacobi iteration can be defined. The update function<br />

computes the arithmetic mean of a cell's four neighbors. In this case we<br />

set off with an initial solution of 0. The left and right boundary are<br />

fixed at 1, while the upper and lower boundaries are set to 0. After a<br />

sufficient number of iterations, the system converges against a<br />

saddle-shape.<br />

Data dependencies of a selected cell in the 2D<br />

array.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!