1 |
mojays |
2 |
package appl.parallel.spmd.split; |
2 |
|
|
|
3 |
|
|
import java.awt.Rectangle; |
4 |
|
|
import java.io.Serializable; |
5 |
|
|
|
6 |
|
|
import appl.parallel.spmd.split.AbstractSplitMap.NeighborhoodBoxingMode; |
7 |
|
|
|
8 |
|
|
/** |
9 |
|
|
* Defines a split map over a {@link SplittableResource}. A split map is a |
10 |
|
|
* layout of an actual partitioning. Each partition is associated with a number, |
11 |
|
|
* ranging from 0 to noOfPartitions-1. |
12 |
|
|
* <br> |
13 |
|
|
* The partitions are layouted as rectangles, where each rectangle represents a partition |
14 |
|
|
* or a neighborhood around a partition. Every partition or neighborhood can be queried. |
15 |
|
|
* IP-Addresses can be associated with partitions to identify the server on which a partition is located. |
16 |
|
|
* <br> |
17 |
|
|
* The interface is largely implementation independent. Multiple implementations exist. |
18 |
|
|
* |
19 |
|
|
* You can query the SplitMap for neighbors of a partition. |
20 |
|
|
* |
21 |
|
|
* @see SplitMap1DHorizontal |
22 |
|
|
* @see SplitMap1DVertical |
23 |
|
|
* @see SplitMap2D |
24 |
|
|
* @see AbstractSplitMap |
25 |
|
|
* |
26 |
|
|
* @author Dominik Appl |
27 |
|
|
*/ |
28 |
|
|
public interface SplitMap extends Serializable{ |
29 |
|
|
|
30 |
|
|
/** |
31 |
|
|
* returns an Array of neighbors for that position in the splitmap. |
32 |
|
|
* |
33 |
|
|
* @param pos position in splitmap |
34 |
|
|
* @return the array |
35 |
|
|
* |
36 |
|
|
*/ |
37 |
|
|
int[] getNeighborsForPosition(int pos); |
38 |
|
|
|
39 |
|
|
|
40 |
|
|
/** |
41 |
|
|
* With this setter, you can assign each partition a weight, so that |
42 |
|
|
* the data you split is not splitted equally, but arcording to |
43 |
|
|
* these values. A value of weights specifies how big the share of the |
44 |
|
|
* partition with this position is. The sum of all values |
45 |
|
|
* should be 1 or near to 1. |
46 |
|
|
* |
47 |
|
|
* @param weights |
48 |
|
|
* @throws UnsupportedOperationException if the number of weights does |
49 |
|
|
* not match the number of partitions |
50 |
|
|
*/ |
51 |
|
|
public void setWeights(double... weights); |
52 |
|
|
|
53 |
|
|
/** |
54 |
|
|
* @return a short description of the type of the Splitting |
55 |
|
|
*/ |
56 |
|
|
public String getDescription(); |
57 |
|
|
|
58 |
|
|
/** |
59 |
|
|
* @param pos the partition number |
60 |
|
|
* @return the bounds of the partiton calculation area in global coordinates |
61 |
|
|
*/ |
62 |
|
|
public Rectangle getPartitionCalculationBounds(int pos); |
63 |
|
|
|
64 |
|
|
/** |
65 |
|
|
* @param pos the partition number |
66 |
|
|
* @return the bounds of the partiton neighborhood area in global coordinates |
67 |
|
|
*/ |
68 |
|
|
public Rectangle getPartitionNeighborhoodBounds(int pos); |
69 |
|
|
|
70 |
|
|
/** |
71 |
|
|
* @param pos the partition number |
72 |
|
|
* @return the bounds of the partiton in global coordinates, |
73 |
|
|
* which should be the same as {@link #getPartitionNeighborhoodBounds(int)} |
74 |
|
|
* |
75 |
|
|
*/ |
76 |
|
|
public Rectangle getPartitionBounds(int pos); |
77 |
|
|
|
78 |
|
|
|
79 |
|
|
/** |
80 |
|
|
* @return {@link #getGlobalBounds()} |
81 |
|
|
*/ |
82 |
|
|
public Rectangle getGlobalCalculationBounds(); |
83 |
|
|
|
84 |
|
|
/** |
85 |
|
|
* @return the bounds of the whole area starting with 0,0 in the topleft corner |
86 |
|
|
*/ |
87 |
|
|
public Rectangle getGlobalBounds(); |
88 |
|
|
|
89 |
|
|
/** |
90 |
|
|
* Gets the whole partition bounds (including available neighborhood) |
91 |
|
|
* @param pos the partition number |
92 |
|
|
* @return the bounds of the partition using local coordinates. (0,0) is the topleft corner. |
93 |
|
|
*/ |
94 |
|
|
public Rectangle getLocalBounds(int pos); |
95 |
|
|
/** |
96 |
|
|
* @param pos the partition number |
97 |
|
|
* @return the calculation bounds of the partition using local coordinates. |
98 |
|
|
*/ |
99 |
|
|
public Rectangle getLocalCalculationBounds(int pos); |
100 |
|
|
/** |
101 |
|
|
* @param pos the partition number |
102 |
|
|
* @return the bounds of the partition using local coordinates. (0,0) is the topleft corner. |
103 |
|
|
*/ |
104 |
|
|
public Rectangle getLocalNeighborhoodBounds(int pos); |
105 |
|
|
|
106 |
|
|
|
107 |
|
|
/** |
108 |
|
|
* Sets the given values. Call makeMap() for this changes to take effekt. |
109 |
|
|
* |
110 |
|
|
* @param splittable the resource on which the splitmap is calculated |
111 |
|
|
* @param neighborhoodRange the neighborhoodrange |
112 |
|
|
* @param noOfPartitions the number of partitions to be generated |
113 |
|
|
* @param boxingMode the boxing mode |
114 |
|
|
* |
115 |
|
|
*/ |
116 |
|
|
public void setParameters(SplittableResource splittable, int neighborhoodRange, |
117 |
|
|
int noOfPartitions, |
118 |
|
|
NeighborhoodBoxingMode boxingMode); |
119 |
|
|
|
120 |
|
|
/** |
121 |
|
|
* @param IPs a String Array of IPs which are mapped to the partition in the given order. |
122 |
|
|
* |
123 |
|
|
*/ |
124 |
|
|
public void setIPs(String IPs[]); |
125 |
|
|
/** |
126 |
|
|
* @param pos position for this splitmap |
127 |
|
|
* @return the IP associated with this position |
128 |
|
|
*/ |
129 |
|
|
public String getIP(int pos); |
130 |
|
|
|
131 |
|
|
/** |
132 |
|
|
* @return the neighborhoodRange |
133 |
|
|
*/ |
134 |
|
|
public int getNeighborhoodRange(); |
135 |
|
|
|
136 |
|
|
/** |
137 |
|
|
* Creates the map |
138 |
|
|
*/ |
139 |
|
|
public void makeMap(); |
140 |
|
|
|
141 |
|
|
/** |
142 |
|
|
* @return the number of partitions |
143 |
|
|
*/ |
144 |
|
|
public int getCount(); |
145 |
|
|
} |