Simplify inflated_from logic

This commit is contained in:
Eren Dogan
2023-07-21 08:26:54 -07:00
parent 5ce193c2dd
commit 7ee1dcef54
2 changed files with 13 additions and 4 deletions
+2 -4
View File
@@ -57,8 +57,7 @@ class graph:
# Probe is blocked if the shape isn't routable
if not self.is_routable(blockage):
return True
if blockage.inflated_from is not None:
blockage = blockage.inflated_from
blockage = blockage.get_inflated_from()
if blockage.overlaps(probe_shape):
continue
return True
@@ -83,8 +82,7 @@ class graph:
if not self.is_routable(blockage):
blocked = True
continue
if blockage.inflated_from is not None:
blockage = blockage.inflated_from
blockage = blockage.get_inflated_from()
if self.inside_shape(node.center, blockage):
offset = self.router.offset
p = node.center
+11
View File
@@ -21,6 +21,17 @@ class graph_shape(pin_layout):
self.inflated_from = inflated_from
def get_inflated_from(self):
"""
Return `self` if `self.inflated_from` is None. Otherwise, return
`self.inflated_from`.
"""
if self.inflated_from is None:
return self
return self.inflated_from
def inflated_pin(self, spacing=None, multiple=0.5, extra_spacing=0, keep_link=False):
""" Override the default inflated_pin behavior. """