public class AxisOrdering
extends java.lang.Object
implements java.lang.Cloneable
(plane 0) 0 1 2 3 4 5 6 7 (plane 1) 8 9 10 11 12 13 14 15 (plane 2) 16 17 18 19 20 21 22 23The other important use for AxisOrderings is to specify the mapping between the 1D space of an array or data file, and the n-D space of a DataSource or DataBlock. This is closely related to the way AxisOrderings work with traversals in that populating an n-D space with data from a 1D source can conceptually be done by traversing the space and placing each consecutive value from the 1D source into each position of the n-D index space as it is visited. For example, if a file containing the integers 0 through 23 in sorted order were read into a 3x2x4 array using a {0,1,2} axisOrdering, the diagram above would correspond to the result.
Modifier and Type | Field and Description |
---|---|
protected int[] |
ordering |
Constructor and Description |
---|
AxisOrdering(int size)
Creates an AxisOrdering of the specified size
and populates it with the default axisOrdering: 0..size-1
|
AxisOrdering(int[] ordering)
Creates an AxisOrdering from the array of integers.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a copy of this AxisOrdering.
|
void |
computeCoords(long offset,
int[] coords,
int[] axisWeights)
Deprecated.
in favor of the version with long axisWeights
|
void |
computeCoords(long offset,
int[] coords,
long[] axisWeights)
Compute the coordinates corresponding to the offset using the given axisWeights.
|
static long |
computeOffset(IndexSpaceID dsid,
long[] axisWeights)
Map the IndexSpaceID to a single integer that serves as
as an offset into the physical file or network source.
|
static long |
computeOffset(int[] coords,
long[] axisWeights)
Map the coordinates array to a single integer that serves as
as an offset into the physical file or network source.
|
AxisOrdering |
copy()
Returns a copy of this AxisOrdering.
|
int |
dim()
Returns the length (number of dimensions) of the axisOrdering.
|
int |
getAxis(int index)
Return the axis number stored at the given index.
|
int |
getLeastSignificantAxis()
Returns the least significant axis for this axisOrdering.
|
int |
getMostSignificantAxis()
Returns the most significant axis for this axisOrdering.
|
int |
getNthLeastSignificantAxis(int n)
Returns the Nth least significant axis for this axisOrdering, counting
from zero.
|
static void |
main(java.lang.String[] args) |
long[] |
makeAxisWeights(IndexSpaceID dimensionsID)
Returns an array of axis weights corresponding to the axisOrdering and
thedimensions parameter.
|
long[] |
makeAxisWeights(int[] dimensions)
Returns an array of axis weights corresponding to the axisOrdering and
the dimensions parameter.
|
long[] |
makeAxisWeights(ISBounds bounds)
Returns an array of axis weights corresponding to the axisOrdering and
bounds parameter.
|
long[] |
makeAxisWeights(long[] dimensions)
Returns an array of axis weights corresponding to the axisOrdering and
the dimensions parameter.
|
void |
setLeastSignificantAxis(int axis)
Sets the Least Significant Axis to the given value by swapping the prior
position of the argument axis with the prior Least Significant Axis.
|
void |
setMostSignificantAxis(int axis)
Chnages this axisOrdering so that the Most Significant Axis is the
axis specified by the argument by swapping the prior
position of the argument axis with the prior Most Significant Axis.
|
java.lang.String |
toString()
Return a String representing the object.
|
java.lang.String |
toString(java.lang.String indent)
Return a String representing the object indented by the argument string.
|
public AxisOrdering(int size)
public AxisOrdering(int[] ordering)
public void setLeastSignificantAxis(int axis)
public void setMostSignificantAxis(int axis)
public long[] makeAxisWeights(ISBounds bounds)
public long[] makeAxisWeights(IndexSpaceID dimensionsID)
public long[] makeAxisWeights(int[] dimensions)
public long[] makeAxisWeights(long[] dimensions)
public static final long computeOffset(IndexSpaceID dsid, long[] axisWeights)
public static final long computeOffset(int[] coords, long[] axisWeights)
public final void computeCoords(long offset, int[] coords, int[] axisWeights)
public final void computeCoords(long offset, int[] coords, long[] axisWeights)
public final int getAxis(int index)
public final int dim()
public final int getLeastSignificantAxis()
public final int getMostSignificantAxis()
public final int getNthLeastSignificantAxis(int n)
public final AxisOrdering copy()
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String indent)
public static void main(java.lang.String[] args)