|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.jhu.cs.cisst.algorithms.optimize.fmg.grid.Grid
public abstract class Grid
A 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. Dependent on the boundary strategy of the subclass, accessing the boundary elements may or may not be allowed.
Field Summary | |
---|---|
protected double[][][] |
g
|
protected int |
level
|
protected int |
sx
|
protected int |
sy
|
protected int |
sz
|
Constructor Summary | |
---|---|
protected |
Grid(int sx,
int sy,
int sz,
int level,
double value)
construct from size and initial value for all elements. |
Method Summary | |
---|---|
Grid |
add(ConstGrid grid)
implements method from ConstGrid. |
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. |
ConstGrid |
clone()
implements method from ConstGrid. |
double |
get(int x,
int y,
int z)
implements method from ConstGrid. |
protected abstract double |
getBoundary(int x,
int y,
int z)
get an element from the boundary of the grid. |
int |
getCols()
implements method from ConstGrid. |
int |
getLevel()
Get the resolution level. |
int |
getRows()
implements method from ConstGrid. |
int |
getSlices()
implements method from ConstGrid. |
boolean |
isBoundary(int x,
int y,
int z)
implements method from ConstGrid. |
boolean |
isInterior(int x,
int y,
int z)
implements method from ConstGrid. |
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. |
void |
setLevel(int level)
Set the resolution level. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface edu.jhu.cs.cisst.algorithms.optimize.fmg.grid.ConstGrid |
---|
newInstance |
Field Detail |
---|
protected int sx
protected int sy
protected int sz
protected int level
protected double[][][] g
Constructor Detail |
---|
protected Grid(int sx, int sy, int sz, int level, double value)
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.
size
- the size of the grid ( > 0)value
- the initial value to which all grid element will be setMethod Detail |
---|
public final double get(int x, int y, int z)
get
in interface ConstGrid
x
- the x index of the element (0 <= x < size())y
- the y index of the element (0 <= y < size())z
- the z index of the element (0 <= z < size())
ConstGrid.get(int, int, int)
public void set(int x, int y, int z, double v)
set
in interface ConstGrid
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 setpublic final void add(int x, int y, int z, double v)
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 elementpublic final int getRows()
getRows
in interface ConstGrid
ConstGrid#size
public final int getCols()
getCols
in interface ConstGrid
ConstGrid#size
public final int getSlices()
getSlices
in interface ConstGrid
ConstGrid#size
public final int getLevel()
ConstGrid
getLevel
in interface ConstGrid
public final boolean isInterior(int x, int y, int z)
isInterior
in interface ConstGrid
x
- the x index of the elementy
- the y index of the elementz
- the z index of the element
ConstGrid.isInterior(int, int, int)
public final boolean isBoundary(int x, int y, int z)
isBoundary
in interface ConstGrid
x
- the x index of the elementy
- the y index of the elementz
- the z index of the element
ConstGrid.isBoundary(int, int, int)
public ConstGrid clone()
clone
in interface ConstGrid
clone
in class java.lang.Object
ConstGrid.clone()
public final Grid add(ConstGrid grid)
add
in interface ConstGrid
grid
- the grid to add to this grid
ConstGrid.add(edu.jhu.cs.cisst.algorithms.optimize.fmg.grid.ConstGrid)
protected abstract double getBoundary(int x, int y, int z)
x
- the x index of the boundary elementy
- the y index of the boundary elementz
- the z index of the boundary element
java.lang.IndexOutOfBoundsException
- if read access to the boundary is not allowedpublic void setLevel(int level)
ConstGrid
setLevel
in interface ConstGrid
level
- the level
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |