org.javaseis.parallel
Class DistributedGrid

java.lang.Object
  extended by org.javaseis.parallel.DistributedGrid
All Implemented Interfaces:
java.io.Serializable

public class DistributedGrid
extends java.lang.Object
implements java.io.Serializable

Define a Distributed Grid that represents the "memory resident" portion of a full JavaSeis GridDefinition. The resident portion is a subset of the full grid that will be stored in memory. This class can then be used to construct an instance of org.javaseis.parallel.DistributedArray that conforms to the resident portion. Dimension ordering is in "Fortran" order, where the first dimension has unit stride in memory. The resident portion consists of "leading" dimensions, and must be less than or equal to the number of dimensions of the full grid. The last resident dimension of the DistributedArray is decomposed across tasks using a BLOCK parallel Decomposition. Methods are provided to construct a DistributedArray with appropriate padding based on the sizes of the associated GridDefinition and parallel Decomposition.

Author:
Chuck Mosher for JavaSeis.org
See Also:
Serialized Form

Constructor Summary
DistributedGrid(GridDefinition fullGrid, int residentDimensions, IParallelContext parallelContext)
          Define a DistributedGrid from a GridDefinition and the number of leading dimensions that will be stored in memory.
 
Method Summary
 DistributedArray allocateArray(java.lang.Class classType, int elementCount)
          Allocate a distributed array based on the sizes of the resident axes of the DistributedGrid.
 DistributedArray allocateArray(java.lang.Class classType, int elementCount, int[] paddedLengths, int[] decompTypes)
          Allocate a distributed array based on the sizes of the resident axes of the DistributedGrid.
 DistributedArray getDistributedArray()
          Return the DistributedArray associated with this DistributedGrid
 GridDefinition getFullGrid()
          Return the full GridDefinition for the DistributedGrid
 GridDefinition getSubGrid()
          Return a GridDefinition for the resident portion of the DistributedGrid
 void setParallelContext(IParallelContext parallelContext)
          Set the ParallelContext to be used for the DistributedArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistributedGrid

public DistributedGrid(GridDefinition fullGrid,
                       int residentDimensions,
                       IParallelContext parallelContext)
Define a DistributedGrid from a GridDefinition and the number of leading dimensions that will be stored in memory.

Parameters:
fullGrid - the full grid from which the DistributedGrid is constructed
residentDimensions - the number of dimensions of the resident portion
parallelContext - parallel context for the distributed grid
Method Detail

allocateArray

public DistributedArray allocateArray(java.lang.Class classType,
                                      int elementCount)
Allocate a distributed array based on the sizes of the resident axes of the DistributedGrid.

Parameters:
classType - Class type of the elements of the DistributedArray
elementCount - Number of elements per sample for the DistributedArray
Returns:
DistributedArray with appropriate padding

allocateArray

public DistributedArray allocateArray(java.lang.Class classType,
                                      int elementCount,
                                      int[] paddedLengths,
                                      int[] decompTypes)
Allocate a distributed array based on the sizes of the resident axes of the DistributedGrid. This method allows for specification of padded lengths for each axis (i.e. FFT padding) and the decomposition type of each axis.

Parameters:
classType - class type for the elements of the array
elementCount - number of elements per sample for the array
paddedLengths - padded length for each axis of the array
decompTypes - decomposition type (from Decomposition) for each axis
Returns:
DistributedArray for the resident portion of the DistributedGrid

getDistributedArray

public DistributedArray getDistributedArray()
Return the DistributedArray associated with this DistributedGrid

Returns:
distributed array

getFullGrid

public GridDefinition getFullGrid()
Return the full GridDefinition for the DistributedGrid

Returns:
grid definition

getSubGrid

public GridDefinition getSubGrid()
Return a GridDefinition for the resident portion of the DistributedGrid

Returns:
grid definition

setParallelContext

public void setParallelContext(IParallelContext parallelContext)
Set the ParallelContext to be used for the DistributedArray

Parameters:
parallelContext -