org.PingOO.DLAI.lib.graph
Class IsoCurve

java.lang.Object
  |
  +--org.PingOO.DLAI.lib.graph.IsoCurve

public class IsoCurve
extends java.lang.Object

This class will calculate the constant curve of a given value passing through a grid of values.

Version:
$Revision: 1.6 $, $Date: 1996/07/30 04:52:40 $.
Author:
Leigh Brookshaw

Field Summary
(package private) static int ARRAYSIZE
          Initial size of the array that will hold a contour.
(package private) static int BOTTOM
          Flag a cell as having the curve coming through its Bottom face
protected  java.util.Vector cells
          Vector of cells that the contour passes through.
protected  double[] curve
          Array that holds the points of the contour
protected  double[] grid
          Array holding the data grid.
(package private) static int LEFT
          Flag a cell as having the curve coming through its Left face
(package private) static int MAXARRAYSIZE
          Maximum size of the array that will hold a contour.
protected  int nx
          X Dimension of data grid
protected  int ny
          Y Dimension of data grid
(package private) static int RIGHT
          Flag a cell as having the curve coming through its Right face
protected  int size
          Number of points in the contour
(package private) static int TERMINAL
          Flag a cell face as a terminal face ie the curve terminates here.
(package private) static int TOP
          Flag a cell as having the curve coming through its Top face
protected  double value
          Contour value to be found
 
Constructor Summary
IsoCurve()
          Instantiate the class and initialize all the variables
IsoCurve(double[] grid, int nx, int ny)
          Instantiate the class and initialize all the variables.
 
Method Summary
protected  void addDataPoint(double x, double y)
          Add a data point to the contour curve.
protected  void addDataPoint(int wall, int icell, int jcell)
          Add a data point to the contour curve.
protected  void createCells()
          Create the vector of all cells that contain the contour.
protected  void getcurve()
          Traverse the cells and find One connect countour.
 double[] getCurve()
          Return a contour curve.
protected  double[] getPoint(int wall, int icell, int jcell)
          Return the (x,y) position where the contour cross the cell wall.
protected  Cell search(int icell, int jcell)
          Search for a cell in the contour cell list
 void setGrid(double[] grid, int nx, int ny)
          Set the grid to be contoured
 void setValue(double value)
          Set the value to contour
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

TERMINAL

static final int TERMINAL
Flag a cell face as a terminal face ie the curve terminates here.

LEFT

static final int LEFT
Flag a cell as having the curve coming through its Left face

RIGHT

static final int RIGHT
Flag a cell as having the curve coming through its Right face

TOP

static final int TOP
Flag a cell as having the curve coming through its Top face

BOTTOM

static final int BOTTOM
Flag a cell as having the curve coming through its Bottom face

ARRAYSIZE

static final int ARRAYSIZE
Initial size of the array that will hold a contour.

MAXARRAYSIZE

static final int MAXARRAYSIZE
Maximum size of the array that will hold a contour.

cells

protected java.util.Vector cells
Vector of cells that the contour passes through.

grid

protected double[] grid
Array holding the data grid.

nx

protected int nx
X Dimension of data grid

ny

protected int ny
Y Dimension of data grid

curve

protected double[] curve
Array that holds the points of the contour

size

protected int size
Number of points in the contour

value

protected double value
Contour value to be found
Constructor Detail

IsoCurve

public IsoCurve()
Instantiate the class and initialize all the variables

IsoCurve

public IsoCurve(double[] grid,
                int nx,
                int ny)
Instantiate the class and initialize all the variables.
Parameters:
grid - An nx by ny Array containing the grid to contour
nx - X dimension of the grid.
ny - Y dimension of the grid.
Method Detail

setGrid

public void setGrid(double[] grid,
                    int nx,
                    int ny)
Set the grid to be contoured
Parameters:
nx - X dimension of the grid.
ny - Y dimension of the grid.

setValue

public void setValue(double value)
Set the value to contour
Parameters:
value - the contour level

getCurve

public double[] getCurve()
Return a contour curve. If null is returned it means that all the contour curves have been found.
Returns:
The array containing the (x,y) pairs of the contour curve.

createCells

protected void createCells()
Create the vector of all cells that contain the contour.

getcurve

protected void getcurve()
Traverse the cells and find One connect countour.

getPoint

protected double[] getPoint(int wall,
                            int icell,
                            int jcell)
Return the (x,y) position where the contour cross the cell wall.
Parameters:
wall - The cell wall the contour crosses.
icell - The x index of the cell position.
jcell - The y index of the cell position.

addDataPoint

protected void addDataPoint(int wall,
                            int icell,
                            int jcell)
Add a data point to the contour curve.
Parameters:
wall - The cell wall the contour crosses.
icell - The x index of the cell position.
jcell - The y index of the cell position.

addDataPoint

protected void addDataPoint(double x,
                            double y)
Add a data point to the contour curve.
Parameters:
x - The x position of the point.
y - The y position of the point.

search

protected Cell search(int icell,
                      int jcell)
Search for a cell in the contour cell list
Parameters:
icell - the x index of the cell
jcell - the y index of the cell