All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class AT.Ac.univie.imp.loeffler.pde.threeD.fd.Grid

java.lang.Object
   |
   +----AT.Ac.univie.imp.loeffler.pde.threeD.fd.Grid

public abstract class Grid
extends Object
implements ConstGrid
A cubic grid in 3D whose elements are alterable doubles. Each element of the grid is a double value and is uniquely identified by three non-negative integer indices. The grid knows about the concept of a boundary, but the actual handling of the boundary elements is deferred to subclasses. The allowed indices rande from 0 to (size - 1) in each dimension, where 0 and (size - 1) themselves characterise the boundary of the grid. Dependent on the boundary strategy of the subclass, accessing the boundary elements may or may not be allowed.

Author:
Gerald Loeffler (Gerald.Loeffler@univie.ac.at)

Variable Index

 o g
 o s

Constructor Index

 o Grid(int, double)
construct from size and initial value for all elements.

Method Index

 o add(ConstGrid)
implements method from ConstGrid.
 o add(int, int, int, double)
add to the element at the specified position, which must be in the interior of the grid.
 o clone()
implements method from ConstGrid.
 o get(int, int, int)
implements method from ConstGrid.
 o getBoundary(int, int, int)
get an element from the boundary of the grid.
 o isBoundary(int, int, int)
implements method from ConstGrid.
 o isInterior(int, int, int)
implements method from ConstGrid.
 o newInstance(int, double)
create a new grid with exactly the same handling of the boundary (i.e.
 o set(int, int, int, double)
set the element at the specified position, which must be in the interior of the grid.
 o size()
implements method from ConstGrid.

Variables

 o s
 protected int s
 o g
 protected double g[][][]

Constructors

 o Grid
 protected Grid(int size,
                double value)
construct from size and initial value for all elements.

The constructor allocates memory for the interior and the boundary of the grid, riscing that the space for the boundary is wasted if a subclass decides to handle boundary elements differently.

Parameters:
size - the size of the grid ( > 0)
value - the initial value to which all grid element will be set

Methods

 o get
 public final double get(int x,
                         int y,
                         int z)
implements method from ConstGrid.

See Also:
get
 o set
 public final void set(int x,
                       int y,
                       int z,
                       double v)
set the element at the specified position, which must be in the interior of the grid.

Parameters:
x - the x index of the element (1 <= x < (size() - 1))
y - the y index of the element (1 <= y < (size() - 1))
z - the z index of the element (1 <= z < (size() - 1))
v - the value to which the element is to be set
 o add
 public final void add(int x,
                       int y,
                       int z,
                       double v)
add to the element at the specified position, which must be in the interior of the grid.

Parameters:
x - the x index of the element (1 <= x < (size() - 1))
y - the y index of the element (1 <= y < (size() - 1))
z - the z index of the element (1 <= z < (size() - 1))
v - the value which is to be added to the element
 o size
 public final int size()
implements method from ConstGrid.

See Also:
size
 o isInterior
 public final boolean isInterior(int x,
                                 int y,
                                 int z)
implements method from ConstGrid.

See Also:
isInterior
 o isBoundary
 public final boolean isBoundary(int x,
                                 int y,
                                 int z)
implements method from ConstGrid.

Parameters:
x - the x index of the element
y - the y index of the element
z - the z index of the element
Returns:
true if the element is at the boundary of the grid, false otherwise
See Also:
isBoundary
 o clone
 public synchronized Object clone()
implements method from ConstGrid.

Overrides:
clone in class Object
See Also:
clone
 o add
 public final synchronized Grid add(ConstGrid grid)
implements method from ConstGrid.

See Also:
add
 o getBoundary
 protected abstract double getBoundary(int x,
                                       int y,
                                       int z)
get an element from the boundary of the grid.

Parameters:
x - the x index of the boundary element
y - the y index of the boundary element
z - the z index of the boundary element
Returns:
the element (a double value) at the specified position
Throws: IndexOutOfBoundsException
if read access to the boundary is not allowed

All Packages  Class Hierarchy  This Package  Previous  Next  Index