AbstractLattice<T>
, FiniteLattice
CellLattice
public class RectangularLattice extends java.lang.Object implements FiniteLattice
RectangularLatticeNbrIterator defines a configurable neighbor iterator that returns the sites it defines as neighbors of a given site.
RectangularLatticeNbrIterator
Modifier and Type | Class | Description |
---|---|---|
static class |
RectangularLattice.Iterator |
Iterates over all sites of the lattice.
|
Modifier and Type | Field | Description |
---|---|---|
protected int |
d |
|
protected int[] |
jumpCount |
|
protected SiteFactory |
siteFactory |
|
protected java.lang.Object[] |
sites |
|
protected int[] |
size |
Constructor | Description |
---|---|
RectangularLattice(int D,
SiteFactory siteFactory) |
Constructs a lattice of the given dimension (D) with sites
made from the given factory.
|
Modifier and Type | Method | Description |
---|---|---|
int |
arrayIndex(int[] index) |
Returns the index in the 1-d array for the site corresponding
to the given lattice index.
|
int |
D() |
Dimension of the lattice.
|
int[][] |
getDownNeighbors() |
|
int[] |
getSize() |
Returns an array with elements giving the maximum number of
index values in each dimension.
|
int[][] |
getUpNeighbors() |
|
protected void |
increment(int[] idx) |
|
int[] |
latticeIndex(int index) |
Returns the lattice index given the 1-d array index; reverses
the effect of arrayIndex method.
|
void |
latticeIndex(int index,
int[] latticeIndex) |
|
void |
setNeighborRange(double neighborRange) |
|
void |
setPeriodicity(boolean[] periodicity) |
|
void |
setSize(int[] newSize) |
Sets the number lattice size (specified via the largest index in each dimension), and
rebuilds the all sites using the site factory.
|
java.lang.Object |
site(int[] index) |
Returns the instance of the object associated with the given index.
|
java.lang.Object[] |
sites() |
Returns an array containing all the sites in the lattice.
|
protected final int[] size
protected final int[] jumpCount
protected final int d
protected java.lang.Object[] sites
protected SiteFactory siteFactory
public RectangularLattice(int D, SiteFactory siteFactory)
public void setPeriodicity(boolean[] periodicity)
public int[][] getUpNeighbors()
public int[][] getDownNeighbors()
public final int D()
AbstractLattice
D
in interface AbstractLattice<T>
public java.lang.Object[] sites()
FiniteLattice
sites
in interface FiniteLattice
public java.lang.Object site(int[] index)
site
in interface AbstractLattice<T>
public final int arrayIndex(int[] index)
public int[] latticeIndex(int index)
public void latticeIndex(int index, int[] latticeIndex)
public final int[] getSize()
FiniteLattice
getSize
in interface FiniteLattice
public void setSize(int[] newSize)
setSize
in interface FiniteLattice
newSize
- array giving the number of index values in each dimensionjava.lang.IllegalArgumentException
- if length of given array is not equal to Dprotected void increment(int[] idx)
public void setNeighborRange(double neighborRange)