Commit 66612d42 authored by Björn Richerzhagen's avatar Björn Richerzhagen
Browse files

Enable a GridPositionDistribution with larger grids than actual nodes

(used for #cloudlet-evaluation)
parent ba6730d6
......@@ -47,6 +47,12 @@ public class GridPositionDistribution implements PlacementModel {
private PositionVector worldDimensions = null;
/**
* Allows us to create a "larger" grid, even if we only have a smaller number of nodes.
* Eg., create a 3*3 grid for only 2 nodes
*/
private int fakeNumberOfComponents = -1;
private Random random = Randoms
.getRandom(GridPositionDistribution.class);
......@@ -74,7 +80,14 @@ public class GridPositionDistribution implements PlacementModel {
this.randInCell = randInCell;
}
public void setFakeNumberOfComponents(int fakeNumberOfComponents) {
this.fakeNumberOfComponents = fakeNumberOfComponents;
}
private void calcPositions2D() {
if (fakeNumberOfComponents != -1) {
numberOfComponents = fakeNumberOfComponents;
}
float ratio = (float) (worldDimensions.getX() / worldDimensions.getY());
float ratio_1 = 1 / ratio;
int anz_x = (int) Math.ceil(Math.sqrt(ratio * numberOfComponents));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment