jabble.stencils
Class Average2DStencils

java.lang.Object
  extended by jabble.stencils.Average2DStencils

public class Average2DStencils
extends java.lang.Object

Stencil library for averages on Fields in 2D grids.


Method Summary
static double downwindAverage(Field field)
          Calculates (F(x, y) + F(x-1, y) + F(x, y-1) + F(x-1, y-1)) / 4.
static double nearestNeighborAverage(Field field)
          Calculates (F(x+1, y) + F(x-1, y) + F(x, y+1) + F(x, y-1)) / 4.
static double upwindAverage(Field field)
          Calculates (F(x, y) + F(x+1, y) + F(x, y+1) + F(x+1, y+1)) / 4.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

nearestNeighborAverage

public static double nearestNeighborAverage(Field field)
Calculates (F(x+1, y) + F(x-1, y) + F(x, y+1) + F(x, y-1)) / 4.

Parameters:
field - The Field on which to calculate the average
Returns:
The averageof the Field at the point defined by StencilUtils.getPoint()

upwindAverage

public static double upwindAverage(Field field)
Calculates (F(x, y) + F(x+1, y) + F(x, y+1) + F(x+1, y+1)) / 4.

Parameters:
field - The Field on which to calculate the average
Returns:
The averageof the Field at the point defined by StencilUtils.getPoint()

downwindAverage

public static double downwindAverage(Field field)
Calculates (F(x, y) + F(x-1, y) + F(x, y-1) + F(x-1, y-1)) / 4.

Parameters:
field - The Field on which to calculate the average
Returns:
The averageof the Field at the point defined by StencilUtils.getPoint()