appl.parallel.spmd.split
Class AbstractSplitMap

java.lang.Object
  extended by appl.parallel.spmd.split.AbstractSplitMap
All Implemented Interfaces:
SplitMap, Serializable
Direct Known Subclasses:
SplitMap1DHorizontal, SplitMap1DVertical, SplitMap2D

public abstract class AbstractSplitMap
extends Object
implements SplitMap

This class can be used for the implementation of SplitMaps. It already provides most of the functions. Normally subclasses only have to implement the methods SplitMap.makeMap() and SplitMap.getNeighborsForPosition(int).

Author:
Dominik Appl
See Also:
SplitMap, Serialized Form

Nested Class Summary
static class AbstractSplitMap.NeighborhoodBoxingMode
           
 
Field Summary
protected  AbstractSplitMap.NeighborhoodBoxingMode boxingMode
           
protected  Rectangle globalBounds
          the Rectangle of the whole Grid
protected  int globalHeight
           
protected  int globalWidth
           
protected  String[] IPs
           
protected  int neighborhoodRange
           
protected  int noOfPartitions
           
protected  Rectangle[] partitionCalculationBounds
          the calculation area of each partition
protected  Rectangle[] partitionNeighborhoodBounds
          the bounds of the neighborhood data of the partition
protected  double[] weights
          a value of weights determines how big the share of the partition with this position is.
 
Constructor Summary
AbstractSplitMap()
           
AbstractSplitMap(int width, int height, int neighborhoodRange, int noOfPartitions, AbstractSplitMap.NeighborhoodBoxingMode boxingMode)
           
AbstractSplitMap(SplittableResource splittable, int neighborhoodRange, int noOfPartitions, AbstractSplitMap.NeighborhoodBoxingMode boxingMode)
           
 
Method Summary
 int getCount()
           
abstract  String getDescription()
           
 Rectangle getGlobalBounds()
           
 Rectangle getGlobalCalculationBounds()
           
 String getIP(int pos)
           
 Rectangle getLocalBounds(int pos)
          Gets the whole partition bounds (including available neighborhood)
 Rectangle getLocalCalculationBounds(int pos)
           
 Rectangle getLocalNeighborhoodBounds(int pos)
           
 int getNeighborhoodRange()
           
abstract  int[] getNeighborsForPosition(int pos)
          returns an Array of neighbors for that position in the splitmap.
 Rectangle getPartitionBounds(int pos)
           
 Rectangle getPartitionCalculationBounds(int pos)
           
 Rectangle getPartitionNeighborhoodBounds(int pos)
           
protected  void init()
          Initializes the bounds of the partitions
abstract  void makeMap()
          Creates the map
 void setIPs(String[] IPs)
           
 void setParameters(SplittableResource splittable, int neighborhoodRange, int noOfPartitions, AbstractSplitMap.NeighborhoodBoxingMode boxingMode)
          Sets the given values.
 void setWeights(double... weights)
          With this setter, you can assign each partition a weight, so that the data you split is not splitted equally, but arcording to these values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

boxingMode

protected AbstractSplitMap.NeighborhoodBoxingMode boxingMode

noOfPartitions

protected int noOfPartitions

globalHeight

protected int globalHeight

globalWidth

protected int globalWidth

weights

protected double[] weights
a value of weights determines how big the share of the partition with this position is. The sum of all values should be 1 or near to 1.


neighborhoodRange

protected int neighborhoodRange

globalBounds

protected Rectangle globalBounds
the Rectangle of the whole Grid


partitionCalculationBounds

protected Rectangle[] partitionCalculationBounds
the calculation area of each partition


partitionNeighborhoodBounds

protected Rectangle[] partitionNeighborhoodBounds
the bounds of the neighborhood data of the partition


IPs

protected String[] IPs
Constructor Detail

AbstractSplitMap

public AbstractSplitMap(SplittableResource splittable,
                        int neighborhoodRange,
                        int noOfPartitions,
                        AbstractSplitMap.NeighborhoodBoxingMode boxingMode)

AbstractSplitMap

public AbstractSplitMap()

AbstractSplitMap

public AbstractSplitMap(int width,
                        int height,
                        int neighborhoodRange,
                        int noOfPartitions,
                        AbstractSplitMap.NeighborhoodBoxingMode boxingMode)
Parameters:
width -
height -
neighborhoodRange -
noOfPartitions -
boxingMode -
Method Detail

setParameters

public void setParameters(SplittableResource splittable,
                          int neighborhoodRange,
                          int noOfPartitions,
                          AbstractSplitMap.NeighborhoodBoxingMode boxingMode)
Description copied from interface: SplitMap
Sets the given values. Call makeMap() for this changes to take effekt.

Specified by:
setParameters in interface SplitMap
Parameters:
splittable - the resource on which the splitmap is calculated
neighborhoodRange - the neighborhoodrange
noOfPartitions - the number of partitions to be generated
boxingMode - the boxing mode

init

protected void init()
Initializes the bounds of the partitions


setWeights

public void setWeights(double... weights)
Description copied from interface: SplitMap
With this setter, you can assign each partition a weight, so that the data you split is not splitted equally, but arcording to these values. A value of weights specifies how big the share of the partition with this position is. The sum of all values should be 1 or near to 1.

Specified by:
setWeights in interface SplitMap

getDescription

public abstract String getDescription()
Specified by:
getDescription in interface SplitMap
Returns:
a short description of the type of the Splitting

getNeighborsForPosition

public abstract int[] getNeighborsForPosition(int pos)
Description copied from interface: SplitMap
returns an Array of neighbors for that position in the splitmap.

Specified by:
getNeighborsForPosition in interface SplitMap
Parameters:
pos - position in splitmap
Returns:
the array

makeMap

public abstract void makeMap()
Description copied from interface: SplitMap
Creates the map

Specified by:
makeMap in interface SplitMap

getGlobalCalculationBounds

public Rectangle getGlobalCalculationBounds()
Specified by:
getGlobalCalculationBounds in interface SplitMap
Returns:
SplitMap.getGlobalBounds()

getLocalCalculationBounds

public Rectangle getLocalCalculationBounds(int pos)
Specified by:
getLocalCalculationBounds in interface SplitMap
Parameters:
pos - the partition number
Returns:
the calculation bounds of the partition using local coordinates.

getLocalNeighborhoodBounds

public Rectangle getLocalNeighborhoodBounds(int pos)
Specified by:
getLocalNeighborhoodBounds in interface SplitMap
Parameters:
pos - the partition number
Returns:
the bounds of the partition using local coordinates. (0,0) is the topleft corner.

getPartitionCalculationBounds

public Rectangle getPartitionCalculationBounds(int pos)
Specified by:
getPartitionCalculationBounds in interface SplitMap
Parameters:
pos - the partition number
Returns:
the bounds of the partiton calculation area in global coordinates

getPartitionNeighborhoodBounds

public Rectangle getPartitionNeighborhoodBounds(int pos)
Specified by:
getPartitionNeighborhoodBounds in interface SplitMap
Parameters:
pos - the partition number
Returns:
the bounds of the partiton neighborhood area in global coordinates

getGlobalBounds

public Rectangle getGlobalBounds()
Specified by:
getGlobalBounds in interface SplitMap
Returns:
the bounds of the whole area starting with 0,0 in the topleft corner

getPartitionBounds

public Rectangle getPartitionBounds(int pos)
Specified by:
getPartitionBounds in interface SplitMap
Parameters:
pos - the partition number
Returns:
the bounds of the partiton in global coordinates, which should be the same as SplitMap.getPartitionNeighborhoodBounds(int)

getLocalBounds

public Rectangle getLocalBounds(int pos)
Description copied from interface: SplitMap
Gets the whole partition bounds (including available neighborhood)

Specified by:
getLocalBounds in interface SplitMap
Parameters:
pos - the partition number
Returns:
the bounds of the partition using local coordinates. (0,0) is the topleft corner.

getIP

public String getIP(int pos)
Specified by:
getIP in interface SplitMap
Parameters:
pos - position for this splitmap
Returns:
the IP associated with this position

setIPs

public void setIPs(String[] IPs)
Specified by:
setIPs in interface SplitMap
Parameters:
IPs - a String Array of IPs which are mapped to the partition in the given order.

getNeighborhoodRange

public int getNeighborhoodRange()
Specified by:
getNeighborhoodRange in interface SplitMap
Returns:
the neighborhoodRange

getCount

public int getCount()
Specified by:
getCount in interface SplitMap
Returns:
the number of partitions