Refactor routing internals and archive retry benchmarks
This commit is contained in:
parent
a8720ac8c9
commit
ea5cfe7f31
1 changed files with 3481 additions and 2583 deletions
|
|
@ -2,12 +2,15 @@ from __future__ import annotations
|
|||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from inire.model import SearchOptions, resolve_bend_geometry
|
||||
from inire.seeds import Bend90Seed, PathSeed, SBendSeed, StraightSeed
|
||||
from inire.geometry.components import build_component
|
||||
from inire.model import resolve_bend_geometry
|
||||
from inire.seeds import Bend90Seed, SBendSeed, StraightSeed
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from inire.geometry.components import ComponentResult
|
||||
from inire.geometry.primitives import Port
|
||||
from inire.model import SearchOptions
|
||||
from inire.seeds import PathSeed
|
||||
|
||||
|
||||
def materialize_path_seed(
|
||||
|
|
@ -18,8 +21,6 @@ def materialize_path_seed(
|
|||
search: SearchOptions,
|
||||
clearance: float,
|
||||
) -> tuple[ComponentResult, ...]:
|
||||
from inire.geometry.components import Bend90, SBend, Straight
|
||||
|
||||
path: list[ComponentResult] = []
|
||||
current = start
|
||||
dilation = clearance / 2.0
|
||||
|
|
@ -28,31 +29,23 @@ def materialize_path_seed(
|
|||
|
||||
for segment in seed.segments:
|
||||
if isinstance(segment, StraightSeed):
|
||||
component = Straight.generate(current, segment.length, net_width, dilation=dilation)
|
||||
kind, parameters = "straight", (segment.length,)
|
||||
elif isinstance(segment, Bend90Seed):
|
||||
component = Bend90.generate(
|
||||
current,
|
||||
segment.radius,
|
||||
net_width,
|
||||
segment.direction,
|
||||
collision_type=bend_collision_type,
|
||||
physical_geometry_type=bend_physical_geometry,
|
||||
clip_margin=bend_clip_margin,
|
||||
dilation=dilation,
|
||||
)
|
||||
kind, parameters = "bend90", (segment.radius, segment.direction)
|
||||
elif isinstance(segment, SBendSeed):
|
||||
component = SBend.generate(
|
||||
current,
|
||||
segment.offset,
|
||||
segment.radius,
|
||||
net_width,
|
||||
collision_type=bend_collision_type,
|
||||
physical_geometry_type=bend_physical_geometry,
|
||||
clip_margin=bend_clip_margin,
|
||||
dilation=dilation,
|
||||
)
|
||||
kind, parameters = "sbend", (segment.offset, segment.radius)
|
||||
else:
|
||||
raise TypeError(f"Unsupported seed segment: {type(segment)!r}")
|
||||
component = build_component(
|
||||
current,
|
||||
net_width,
|
||||
kind,
|
||||
parameters,
|
||||
collision_type=bend_collision_type,
|
||||
physical_geometry_type=bend_physical_geometry,
|
||||
clip_margin=bend_clip_margin,
|
||||
dilation=dilation,
|
||||
)
|
||||
path.append(component)
|
||||
current = component.end_port
|
||||
return tuple(path)
|
||||
|
|
|
|||
Loading…
Reference in a new issue