Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
66612d42
Commit
66612d42
authored
Dec 16, 2015
by
Björn Richerzhagen
Browse files
Enable a GridPositionDistribution with larger grids than actual nodes
(used for #cloudlet-evaluation)
parent
ba6730d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/placement/GridPositionDistribution.java
View file @
66612d42
...
...
@@ -46,6 +46,12 @@ public class GridPositionDistribution implements PlacementModel {
private
int
placedComponents
=
0
;
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
);
...
...
@@ -73,8 +79,15 @@ public class GridPositionDistribution implements PlacementModel {
public
void
setRandomOffset
(
boolean
randInCell
)
{
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
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment