public class Grid
extends java.lang.Object
implements java.io.Serializable
Represents a regular grid in three dimensions. Grid resolution may vary in each dimension, however, no uneven mesh spacing is permitted. Consequently, operations on this grid are less general but faster.
This class was originally meant to be used in a multi-particle probe for multi-particle simulations. I don't believe it is being used for anything right now.
Constructor and Description |
---|
Grid(int n1,
int n2,
int n3)
Allocate a new Grid
|
Grid(int n1,
int n2,
int n3,
ClosedBox boxDom)
Allocate a new instance of GridR3 and set the domain.
|
Modifier and Type | Method and Description |
---|---|
protected xal.tools.math.r3.Grid.GridCell[][][] |
allocateCells(int n1,
int n2,
int n3)
Allocates the array of grid cell objects.
|
protected xal.tools.math.r3.Grid.GridPt[][][] |
allocatePts(int n1,
int n2,
int n3)
Allocates the array of grid point objects.
|
xal.tools.math.r3.Grid.GridCell |
compCellContaining(R3 pt)
Return the grid cell containing this point.
|
Z3 |
compCellIndex(R3 pt)
Compute the base vertex index of grid cell containing this point.
|
R3 |
compPtCoords(int i,
int j,
int k)
Return the coordinates in R3 of the grid point at index (i,j,k)
|
R3 |
compPtCoords(Z3 vecIndex)
Return the coordinates in R3 of the grid point at index (i,j,k)
|
protected xal.tools.math.r3.Grid.GridCell |
getGridCell(int i,
int j,
int k)
Return the grid cell object located at grid point index.
|
protected xal.tools.math.r3.Grid.GridCell |
getGridCell(Z3 vecInd)
Return the grid cell object located at grid cell index.
|
ClosedBox |
getGridDomain()
Get the domain of the grid in R3.
|
R3 |
getGridOrigin()
Get the coordinates of the grid origin, i.e., the first grid vertex.
|
protected xal.tools.math.r3.Grid.GridPt |
getGridPt(int i,
int j,
int k)
Return the grid point object located at grid point index.
|
protected xal.tools.math.r3.Grid.GridPt |
getGridPt(Z3 vecInd)
Return the grid point object located at grid point index.
|
R3 |
getGridResolution()
Get grid resolution.
|
Z3 |
getGridSize()
Get the size of the supporting object array.
|
double |
getPtValue(int i,
int j,
int k)
Get the function value at the grid point indexed by (i,j,k)
|
R3 |
interpolateGradient(R3 pt)
Compute and return the interpolated function gradient at the point pt.
|
double |
interpolateValue(R3 pt)
Compute and return the interpolated function value at the point pt
|
static void |
main(java.lang.String[] args)
Testing engine
|
boolean |
membershipGrid(R3 pt)
Determine whether a point is an element of the domain of definition for this grid.
|
void |
print(java.io.PrintWriter os)
Print out grid parameters on an output stream
|
void |
setGridDomain(ClosedBox boxDom)
Set the domain in R3 which the grid occupies.
|
void |
setPtValue(int i,
int j,
int k,
double dblVal)
Set the function value at grid point given by index
|
public Grid(int n1, int n2, int n3) throws GridException
n1
- number of grid points in first dimensionn2
- number of grid points in second dimensionn3
- number of grid points in third dimensionGridException
- unable to allocate grid objectspublic Grid(int n1, int n2, int n3, ClosedBox boxDom) throws GridException
n1
- number of grid points in first dimensionn2
- number of grid points in second dimensionn3
- number of grid points in third dimensionboxDom
- descriptor of grid domain in R3GridException
- invalid size vector encounteredpublic void setGridDomain(ClosedBox boxDom) throws GridException
boxDom
- description of the grid position and size in R3GridException
public void setPtValue(int i, int j, int k, double dblVal)
i
- first dimension index of grid pointj
- second dimension index of grid pointk
- third dimension index of grid pointdblVal
- value of the function at grid point (i,j,k)public Z3 getGridSize()
public ClosedBox getGridDomain()
public R3 getGridResolution()
public R3 getGridOrigin()
public double getPtValue(int i, int j, int k)
i
- index of the first grid dimentionj
- index of the second grid dimensionk
- index of the third grid dimensionpublic boolean membershipGrid(R3 pt)
pt
- point in R3 to check membershippublic Z3 compCellIndex(R3 pt)
pt
- pt in R3 (within the grid's domain of definition)public R3 compPtCoords(int i, int j, int k)
i
- x-dimension index of grid pointj
- y-dimension index of grid pointk
- k-dimension index of grid pointpublic R3 compPtCoords(Z3 vecIndex)
vecIndex
- (i,j,k) index vector of grid pointpublic xal.tools.math.r3.Grid.GridCell compCellContaining(R3 pt)
pt
- pt in R3 (within the grid's domain of definition)public double interpolateValue(R3 pt)
pt
- interpolation pointpublic R3 interpolateGradient(R3 pt)
pt
- interpolation pointpublic void print(java.io.PrintWriter os)
os
- output stream to receive text description of gridpublic static void main(java.lang.String[] args)
protected xal.tools.math.r3.Grid.GridPt getGridPt(int i, int j, int k)
i
- 1st dimension grid point indexj
- 2nd dimension grid point indexk
- 3rd dimension grid point indexprotected xal.tools.math.r3.Grid.GridPt getGridPt(Z3 vecInd)
vecInd
- vector index (i,j,k) of grid pointprotected xal.tools.math.r3.Grid.GridCell getGridCell(int i, int j, int k)
i
- 1st dimension grid cell indexj
- 2nd dimension grid cell indexk
- 3rd dimension grid cell indexprotected xal.tools.math.r3.Grid.GridCell getGridCell(Z3 vecInd)
vecInd
- vector index (i,j,k) of grid cellprotected xal.tools.math.r3.Grid.GridPt[][][] allocatePts(int n1, int n2, int n3) throws GridException
n1,
- n2, n3 dimensions of the array (n1, n2, n3)GridException
protected xal.tools.math.r3.Grid.GridCell[][][] allocateCells(int n1, int n2, int n3) throws GridException
n1,
- n2, n3 dimensions of the array (nx, ny, nz)GridException