edu.unh.sdb.datasource
Class RegularISPartitioning

java.lang.Object
  extended by edu.unh.sdb.datasource.ISPartitioning
      extended by edu.unh.sdb.datasource.RegularISPartitioning

public class RegularISPartitioning
extends ISPartitioning

This class implements a regular partitioning of a bounded index space. A partitioning divides the space into some number of partitions. For regular partitionings, these partitions are all the same size and shape, except for those that span an edge of the index space. (That is, it is possible that partitions near the edge may be clipped by the index space bounds.) A regular partitioning can be specified either by giving the dimensions of a partition to the constructor, or by specifying how many partitions each axis should be divided into.


Field Summary
protected  long[] axisWeights
           
protected  AxisOrdering ordering
           
protected  int[] partitionDimensions
           
protected  int[] tempCoords
           
 
Fields inherited from class edu.unh.sdb.datasource.ISPartitioning
dimensionality
 
Constructor Summary
RegularISPartitioning(IndexSpaceID partitionDimensions, ISBounds spaceBounds)
          The first argument specifies the shape of each partition, not the dimensions of the partSpace.
RegularISPartitioning(IndexSpaceID partitionDimensions, ISBounds spaceBounds, AxisOrdering ordering)
          The first argument specifies the shape of each partition, not the dimensions of the partSpace.
RegularISPartitioning(ISBounds partitioningBounds, ISBounds spaceBounds)
          Deprecated.  
RegularISPartitioning(ISBounds partitioningBounds, ISBounds spaceBounds, AxisOrdering ordering)
           
 
Method Summary
 long containingOffset(IndexSpaceID id)
          Map the index space id onto the partitioning space and return the 1D offset of the containing partition.
 long elementOffset(IndexSpaceID id)
          Return the 1D offset of the element specified by the id.
 int getContainingPartitionBoundary(IndexSpaceID id, int axis, boolean upper)
          If upper is true, return the upper value of the specified axis of the partition containing the id, otherwise, return the lower value.
 ISBounds getContainingPartitionBounds(IndexSpaceID id)
          Return the bounds of the partition that contains the given id.
 ISBounds getContainingPartitionBounds(IndexSpaceID id, ISBounds bounds)
          Sets the ISBounds argument to the bounds of the partition that contains the given id.
 ISBounds getGeometricBounds()
          add by xuan
 ISBounds getIndexedBounds(ISBounds bounds, IndexSpaceID partitioningIndex)
          Sets the argument ISBounds to the bounds corresponding to the partitioning ID.
 ISBounds getOffsetBounds(ISBounds bounds, long offset)
          Sets the argument ISBounds to the bounds corresponding to the partition offset.
 IndexSpaceID getOffsetID(IndexSpaceID id, long offset)
          Sets the argument ISID to the value corresponding to the 1D partition offset.
 IndexSpaceID getOffsetID(long offset)
          Returns a new ISID corresponding to the 1D partition offset.
 int getPartitionBoundary(IndexSpaceID partitionID, int axis, boolean upper)
          If upper is true, return the upper value of the specified axis of the partition specified by the partition id, otherwise, return the lower value.
 ISBoundsIterator getPartitionIterator(ISBounds subSpace)
           
 ISBoundsIterator getPartitionIterator(ISBounds subSpace, ISBoundsIterator iter)
           
static void main(java.lang.String argv)
           
 IndexSpaceID map(IndexSpaceID p)
          Map the id onto the partitioning.
 IndexSpaceID map(IndexSpaceID s, IndexSpaceID d)
          Map the first argument onto the partitioning, placing the result in the second argument.
 ISBounds map(ISBounds bounds)
          Map the bounds onto the partitioning, returning a new ISBounds.
 ISBounds mapToSpace(IndexSpaceID partitionID)
          map partition ID to space ISBounds
 ISBounds mapToSpace(ISBounds partitionBounds)
          map a partition ISBounds to space ISBounds
 long partitionOffset(IndexSpaceID id)
          Map the partition space id to its 1D offset.
 long partitionVolume()
          Return the volume of a single partition.
 RegularISPartitioning project(int 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.
 long volume()
          Return the total number of partitions.
 
Methods inherited from class edu.unh.sdb.datasource.ISPartitioning
dim, getISIterator, getPartitioningBounds, getPartitioningDimensions, getSpaceBounds, inBounds, inBounds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

partitionDimensions

protected int[] partitionDimensions

axisWeights

protected long[] axisWeights

tempCoords

protected int[] tempCoords

ordering

protected AxisOrdering ordering
Constructor Detail

RegularISPartitioning

public RegularISPartitioning(ISBounds partitioningBounds,
                             ISBounds spaceBounds)
Deprecated. 


RegularISPartitioning

public RegularISPartitioning(ISBounds partitioningBounds,
                             ISBounds spaceBounds,
                             AxisOrdering ordering)

RegularISPartitioning

public RegularISPartitioning(IndexSpaceID partitionDimensions,
                             ISBounds spaceBounds)
The first argument specifies the shape of each partition, not the dimensions of the partSpace.


RegularISPartitioning

public RegularISPartitioning(IndexSpaceID partitionDimensions,
                             ISBounds spaceBounds,
                             AxisOrdering ordering)
The first argument specifies the shape of each partition, not the dimensions of the partSpace.

Method Detail

project

public RegularISPartitioning project(int axis)

map

public final IndexSpaceID map(IndexSpaceID p)
Map the id onto the partitioning.

Specified by:
map in class ISPartitioning

map

public final IndexSpaceID map(IndexSpaceID s,
                              IndexSpaceID d)
Map the first argument onto the partitioning, placing the result in the second argument. A reference to the second id is returned as a convenience.


map

public final ISBounds map(ISBounds bounds)
Map the bounds onto the partitioning, returning a new ISBounds.

Specified by:
map in class ISPartitioning

containingOffset

public final long containingOffset(IndexSpaceID id)
Map the index space id onto the partitioning space and return the 1D offset of the containing partition. Currently, the default axis ordering is assumed.


elementOffset

public final long elementOffset(IndexSpaceID id)
Return the 1D offset of the element specified by the id. The id should refer to the partitioning space, not the underlying index space.


getGeometricBounds

public ISBounds getGeometricBounds()
add by xuan


volume

public long volume()
Return the total number of partitions.


partitionVolume

public long partitionVolume()
Return the volume of a single partition.


mapToSpace

public ISBounds mapToSpace(ISBounds partitionBounds)
map a partition ISBounds to space ISBounds


mapToSpace

public ISBounds mapToSpace(IndexSpaceID partitionID)
map partition ID to space ISBounds


getPartitionBoundary

public final int getPartitionBoundary(IndexSpaceID partitionID,
                                      int axis,
                                      boolean upper)
If upper is true, return the upper value of the specified axis of the partition specified by the partition id, otherwise, return the lower value.


getContainingPartitionBoundary

public final int getContainingPartitionBoundary(IndexSpaceID id,
                                                int axis,
                                                boolean upper)
If upper is true, return the upper value of the specified axis of the partition containing the id, otherwise, return the lower value.


getContainingPartitionBounds

public final ISBounds getContainingPartitionBounds(IndexSpaceID id)
Return the bounds of the partition that contains the given id.


getContainingPartitionBounds

public final ISBounds getContainingPartitionBounds(IndexSpaceID id,
                                                   ISBounds bounds)
Sets the ISBounds argument to the bounds of the partition that contains the given id.


getPartitionIterator

public ISBoundsIterator getPartitionIterator(ISBounds subSpace)
Specified by:
getPartitionIterator in class ISPartitioning

getPartitionIterator

public ISBoundsIterator getPartitionIterator(ISBounds subSpace,
                                             ISBoundsIterator iter)

getIndexedBounds

public ISBounds getIndexedBounds(ISBounds bounds,
                                 IndexSpaceID partitioningIndex)
Sets the argument ISBounds to the bounds corresponding to the partitioning ID.

Specified by:
getIndexedBounds in class ISPartitioning

getOffsetBounds

public ISBounds getOffsetBounds(ISBounds bounds,
                                long offset)
Sets the argument ISBounds to the bounds corresponding to the partition offset.


getOffsetID

public IndexSpaceID getOffsetID(long offset)
Returns a new ISID corresponding to the 1D partition offset. The ISID refers to the partitioning space, not the index space.


getOffsetID

public IndexSpaceID getOffsetID(IndexSpaceID id,
                                long offset)
Sets the argument ISID to the value corresponding to the 1D partition offset. The ISID refers to the partitioning space, not the index space.


partitionOffset

public final long partitionOffset(IndexSpaceID id)
Map the partition space id to its 1D offset. Currently, the default axis ordering is assumed.


toString

public java.lang.String toString()
Return a String representing the object.

Overrides:
toString in class ISPartitioning

toString

public java.lang.String toString(java.lang.String indent)
Return a String representing the object indented by the argument string.

Overrides:
toString in class ISPartitioning

main

public static void main(java.lang.String argv)