refactor(autorouter/ratline): Don't store `layer` in ratlines

Translayer ratlines exist, so it makes no sense to assign them a layer.
This commit is contained in:
Mikolaj Wielgus 2025-10-24 15:26:53 +02:00
parent 4ad58f1654
commit 91fb18b166
2 changed files with 26 additions and 19 deletions

View File

@ -11,7 +11,6 @@ use specctra_core::mesadata::AccessMesadata;
use crate::autorouter::{ use crate::autorouter::{
planar_autoroute::{PlanarAutorouteConfiguration, PlanarAutorouteExecutionStepper}, planar_autoroute::{PlanarAutorouteConfiguration, PlanarAutorouteExecutionStepper},
planar_preconfigurer::SccIntersectionsAndLengthRatlinePlanarAutoroutePreconfigurer, planar_preconfigurer::SccIntersectionsAndLengthRatlinePlanarAutoroutePreconfigurer,
ratline::RatlineUid,
scc::Scc, scc::Scc,
Autorouter, PlanarAutorouteOptions, Autorouter, PlanarAutorouteOptions,
}; };

View File

@ -13,7 +13,7 @@ use crate::{
dot::FixedDotIndex, dot::FixedDotIndex,
graph::{GetMaybeNet, MakePrimitiveRef, PrimitiveIndex}, graph::{GetMaybeNet, MakePrimitiveRef, PrimitiveIndex},
}, },
geometry::shape::MeasureLength, geometry::{shape::MeasureLength, GetLayer},
graph::MakeRef, graph::MakeRef,
triangulation::GetTrianvertexNodeIndex, triangulation::GetTrianvertexNodeIndex,
}; };
@ -26,7 +26,6 @@ pub struct RatlineUid {
#[derive(Debug, Default, Clone, Copy)] #[derive(Debug, Default, Clone, Copy)]
pub struct RatlineWeight { pub struct RatlineWeight {
pub layer: usize,
pub band_termseg: Option<BandTermsegIndex>, pub band_termseg: Option<BandTermsegIndex>,
} }
@ -99,16 +98,6 @@ impl<'a, M: AccessMesadata> RatlineRef<'a, M> {
(source_dot, target_dot) (source_dot, target_dot)
} }
pub fn layer(&self) -> usize {
self.autorouter
.ratsnests()
.on_principal_layer(self.uid.principal_layer)
.graph()
.edge_weight(self.uid.index)
.unwrap()
.layer
}
pub fn net(&self) -> usize { pub fn net(&self) -> usize {
self.endpoint_dots() self.endpoint_dots()
.0 .0
@ -117,12 +106,31 @@ impl<'a, M: AccessMesadata> RatlineRef<'a, M> {
.unwrap() .unwrap()
} }
fn cut_primitives(&self) -> impl Iterator<Item = PrimitiveIndex> + '_ { fn cut_primitives(&self) -> Box<dyn Iterator<Item = PrimitiveIndex> + '_> {
self.autorouter let endpoint_dots = self.endpoint_dots();
.board()
.layout() if endpoint_dots
.drawing() .0
.cut(self.line_segment(), 0.0, self.layer()) .primitive_ref(self.autorouter.board().layout().drawing())
.layer()
== endpoint_dots
.1
.primitive_ref(self.autorouter.board().layout().drawing())
.layer()
{
let layer = endpoint_dots
.0
.primitive_ref(self.autorouter.board().layout().drawing())
.layer();
Box::new(self.autorouter.board().layout().drawing().cut(
self.line_segment(),
0.0,
layer,
))
} else {
Box::new(std::iter::empty())
}
} }
pub fn cut_other_net_primitives(&self) -> impl Iterator<Item = PrimitiveIndex> + '_ { pub fn cut_other_net_primitives(&self) -> impl Iterator<Item = PrimitiveIndex> + '_ {