Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
TOPFARM
TopFarm2
Commits
7b6fcddb
Commit
7b6fcddb
authored
May 03, 2019
by
Mikkel Friis-Møller
Committed by
Mads M. Pedersen
May 03, 2019
Browse files
Floris2
parent
36b1d6cc
Pipeline
#8073
passed with stages
in 7 minutes and 7 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
topfarm/constraint_components/spacing.py
View file @
7b6fcddb
...
...
@@ -119,7 +119,15 @@ class SpacingComp(ConstraintComponent):
from
matplotlib.pyplot
import
Circle
import
matplotlib.pyplot
as
plt
ax
=
ax
or
plt
.
gca
()
for
x
,
y
in
zip
(
self
.
x
,
self
.
y
):
if
isinstance
(
self
.
x
,
tuple
):
x_plot
=
self
.
x
[
0
]
else
:
x_plot
=
self
.
x
if
isinstance
(
self
.
y
,
tuple
):
y_plot
=
self
.
y
[
0
]
else
:
y_plot
=
self
.
y
for
x
,
y
in
zip
(
x_plot
,
y_plot
):
circle
=
Circle
((
x
,
y
),
self
.
min_spacing
/
2
,
color
=
'k'
,
ls
=
'--'
,
fill
=
False
)
ax
.
add_artist
(
circle
)
...
...
topfarm/plotting.py
View file @
7b6fcddb
...
...
@@ -88,12 +88,10 @@ class XYPlotComp(NoPlot):
def
setup
(
self
):
NoPlot
.
setup
(
self
)
if
topfarm
.
x_key
in
self
.
problem
.
design_vars
:
self
.
min_x
,
self
.
max_x
=
self
.
problem
.
design_vars
[
topfarm
.
x_key
][
1
:
-
1
]
units_x
=
self
.
problem
.
design_vars
[
topfarm
.
x_key
][
-
1
]
else
:
units_x
=
None
if
topfarm
.
y_key
in
self
.
problem
.
design_vars
:
self
.
min_y
,
self
.
max_y
=
self
.
problem
.
design_vars
[
topfarm
.
y_key
][
1
:
-
1
]
units_y
=
self
.
problem
.
design_vars
[
topfarm
.
y_key
][
-
1
]
else
:
units_y
=
None
...
...
@@ -192,13 +190,15 @@ class XYPlotComp(NoPlot):
# find limits
if
(
topfarm
.
x_key
in
self
.
problem
.
design_vars
and
isinstance
(
self
.
problem
.
design_vars
[
topfarm
.
x_key
],
tuple
)):
min_x
,
max_x
=
self
.
min_x
,
self
.
max_x
isinstance
(
self
.
problem
.
design_vars
[
topfarm
.
x_key
],
tuple
)
and
len
(
self
.
problem
.
design_vars
[
topfarm
.
x_key
])
==
4
):
min_x
,
max_x
=
self
.
problem
.
design_vars
[
topfarm
.
x_key
][
1
:
-
1
]
else
:
min_x
,
max_x
=
min
(
inputs
[
topfarm
.
x_key
]),
max
(
inputs
[
topfarm
.
x_key
])
if
(
topfarm
.
y_key
in
self
.
problem
.
design_vars
and
isinstance
(
self
.
problem
.
design_vars
[
topfarm
.
y_key
],
tuple
)):
min_y
,
max_y
=
self
.
min_y
,
self
.
max_y
isinstance
(
self
.
problem
.
design_vars
[
topfarm
.
y_key
],
tuple
)
and
len
(
self
.
problem
.
design_vars
[
topfarm
.
y_key
])
==
4
):
min_y
,
max_y
=
self
.
problem
.
design_vars
[
topfarm
.
y_key
][
1
:
-
1
]
else
:
min_y
,
max_y
=
min
(
inputs
[
topfarm
.
y_key
]),
max
(
inputs
[
topfarm
.
y_key
])
...
...
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