Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
856b9ea5
Commit
856b9ea5
authored
Dec 01, 2017
by
Peter W. Draper
Browse files
Protect against zero range of the repartitioning weights
parent
26af1f95
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/partition.c
View file @
856b9ea5
...
...
@@ -703,7 +703,10 @@ static void repart_edge_metis(int partweights, int bothweights, int timebins,
/* Make range the same in both weights systems. */
if
((
wmaxv
-
wminv
)
>
(
wmaxe
-
wmine
))
{
double
wscale
=
(
wmaxv
-
wminv
)
/
(
wmaxe
-
wmine
);
double
wscale
=
1
.
0
;
if
((
wmaxe
-
wmine
)
>
0
.
0
)
{
wscale
=
(
wmaxv
-
wminv
)
/
(
wmaxe
-
wmine
);
}
for
(
int
k
=
0
;
k
<
26
*
nr_cells
;
k
++
)
{
weights_e
[
k
]
=
(
weights_e
[
k
]
-
wmine
)
*
wscale
+
wminv
;
}
...
...
@@ -711,7 +714,10 @@ static void repart_edge_metis(int partweights, int bothweights, int timebins,
wmaxe
=
wmaxv
;
}
else
{
double
wscale
=
(
wmaxe
-
wmine
)
/
(
wmaxv
-
wminv
);
double
wscale
=
1
.
0
;
if
((
wmaxv
-
wminv
)
>
0
.
0
)
{
wscale
=
(
wmaxe
-
wmine
)
/
(
wmaxv
-
wminv
);
}
for
(
int
k
=
0
;
k
<
nr_cells
;
k
++
)
{
weights_v
[
k
]
=
(
weights_v
[
k
]
-
wminv
)
*
wscale
+
wmine
;
}
...
...
@@ -720,14 +726,20 @@ static void repart_edge_metis(int partweights, int bothweights, int timebins,
}
/* Scale to the METIS range. */
double
wscale
=
(
metis_maxweight
-
1
.
0
)
/
(
wmaxv
-
wminv
);
double
wscale
=
1
.
0
;
if
((
wmaxv
-
wminv
)
>
0
.
0
)
{
wscale
=
(
metis_maxweight
-
1
.
0
)
/
(
wmaxv
-
wminv
);
}
for
(
int
k
=
0
;
k
<
nr_cells
;
k
++
)
{
weights_v
[
k
]
=
(
weights_v
[
k
]
-
wminv
)
*
wscale
+
1
.
0
;
}
}
/* Scale to the METIS range. */
double
wscale
=
(
metis_maxweight
-
1
.
0
)
/
(
wmaxe
-
wmine
);
double
wscale
=
1
.
0
;
if
((
wmaxe
-
wmine
)
>
0
.
0
)
{
wscale
=
(
metis_maxweight
-
1
.
0
)
/
(
wmaxe
-
wmine
);
}
for
(
int
k
=
0
;
k
<
26
*
nr_cells
;
k
++
)
{
weights_e
[
k
]
=
(
weights_e
[
k
]
-
wmine
)
*
wscale
+
1
.
0
;
}
...
...
Peter W. Draper
@pdraper
mentioned in merge request
!433 (merged)
·
Dec 01, 2017
mentioned in merge request
!433 (merged)
mentioned in merge request !433
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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