mirror of https://codeberg.org/topola/topola.git
fix(autorouter/conncomps): Take into account vias when computing connected components
This commit is contained in:
parent
10dc1a86aa
commit
dd8a4c5808
|
|
@ -37,20 +37,9 @@ impl ConncompsWithPrincipalLayer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*for layer in 0..board.layout().drawing().layer_count() {
|
// Pins can have padstacks that span multiple layers. To account for
|
||||||
if layer != principal_layer {
|
// that, we have another loop to go over all the pins and connect all
|
||||||
for primitive in board.layout().drawing().layer_primitive_nodes(layer) {
|
// their primitives.
|
||||||
if let Some(pinname) = board.node_pinname(&GenericNode::Primitive(primitive)) {
|
|
||||||
if !principally_visited_pins.contains(pinname) {
|
|
||||||
Self::unionize_by_primitive(board, &mut unionfind, primitive);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
//TODO for pinname in board.pins() if !principally_visited_pins.contains(pinname) for node in board.pinname_nodes() unionize to first found element
|
|
||||||
|
|
||||||
for pinname in board.pinnames() {
|
for pinname in board.pinnames() {
|
||||||
if principally_visited_pins.contains(pinname) {
|
if principally_visited_pins.contains(pinname) {
|
||||||
let mut iter = board.pinname_nodes(pinname);
|
let mut iter = board.pinname_nodes(pinname);
|
||||||
|
|
@ -85,6 +74,8 @@ impl ConncompsWithPrincipalLayer {
|
||||||
PrimitiveIndex::FixedSeg(seg) => {
|
PrimitiveIndex::FixedSeg(seg) => {
|
||||||
let joints = board.layout().drawing().primitive(seg).joints();
|
let joints = board.layout().drawing().primitive(seg).joints();
|
||||||
unionfind.union(joints.0.index(), joints.1.index());
|
unionfind.union(joints.0.index(), joints.1.index());
|
||||||
|
Self::unionize_fixed_dot_via(board, unionfind, joints.0);
|
||||||
|
Self::unionize_fixed_dot_via(board, unionfind, joints.1);
|
||||||
}
|
}
|
||||||
PrimitiveIndex::LoneLooseSeg(seg) => {
|
PrimitiveIndex::LoneLooseSeg(seg) => {
|
||||||
let joints = board.layout().drawing().primitive(seg).joints();
|
let joints = board.layout().drawing().primitive(seg).joints();
|
||||||
|
|
@ -97,6 +88,8 @@ impl ConncompsWithPrincipalLayer {
|
||||||
PrimitiveIndex::FixedBend(bend) => {
|
PrimitiveIndex::FixedBend(bend) => {
|
||||||
let joints = board.layout().drawing().primitive(bend).joints();
|
let joints = board.layout().drawing().primitive(bend).joints();
|
||||||
unionfind.union(joints.0.index(), joints.1.index());
|
unionfind.union(joints.0.index(), joints.1.index());
|
||||||
|
Self::unionize_fixed_dot_via(board, unionfind, joints.0);
|
||||||
|
Self::unionize_fixed_dot_via(board, unionfind, joints.1);
|
||||||
}
|
}
|
||||||
PrimitiveIndex::LooseBend(bend) => {
|
PrimitiveIndex::LooseBend(bend) => {
|
||||||
let joints = board.layout().drawing().primitive(bend).joints();
|
let joints = board.layout().drawing().primitive(bend).joints();
|
||||||
|
|
@ -115,6 +108,7 @@ impl ConncompsWithPrincipalLayer {
|
||||||
match primitive {
|
match primitive {
|
||||||
PrimitiveIndex::FixedDot(dot) => {
|
PrimitiveIndex::FixedDot(dot) => {
|
||||||
unionfind.union(common.index(), dot.index());
|
unionfind.union(common.index(), dot.index());
|
||||||
|
Self::unionize_fixed_dot_via(board, unionfind, dot);
|
||||||
}
|
}
|
||||||
PrimitiveIndex::LooseDot(dot) => {
|
PrimitiveIndex::LooseDot(dot) => {
|
||||||
unionfind.union(common.index(), dot.index());
|
unionfind.union(common.index(), dot.index());
|
||||||
|
|
@ -122,7 +116,9 @@ impl ConncompsWithPrincipalLayer {
|
||||||
PrimitiveIndex::FixedSeg(seg) => {
|
PrimitiveIndex::FixedSeg(seg) => {
|
||||||
let joints = board.layout().drawing().primitive(seg).joints();
|
let joints = board.layout().drawing().primitive(seg).joints();
|
||||||
unionfind.union(common.index(), joints.0.index());
|
unionfind.union(common.index(), joints.0.index());
|
||||||
|
Self::unionize_fixed_dot_via(board, unionfind, joints.0);
|
||||||
unionfind.union(common.index(), joints.1.index());
|
unionfind.union(common.index(), joints.1.index());
|
||||||
|
Self::unionize_fixed_dot_via(board, unionfind, joints.1);
|
||||||
}
|
}
|
||||||
PrimitiveIndex::LoneLooseSeg(seg) => {
|
PrimitiveIndex::LoneLooseSeg(seg) => {
|
||||||
let joints = board.layout().drawing().primitive(seg).joints();
|
let joints = board.layout().drawing().primitive(seg).joints();
|
||||||
|
|
@ -137,7 +133,9 @@ impl ConncompsWithPrincipalLayer {
|
||||||
PrimitiveIndex::FixedBend(bend) => {
|
PrimitiveIndex::FixedBend(bend) => {
|
||||||
let joints = board.layout().drawing().primitive(bend).joints();
|
let joints = board.layout().drawing().primitive(bend).joints();
|
||||||
unionfind.union(common.index(), joints.0.index());
|
unionfind.union(common.index(), joints.0.index());
|
||||||
|
Self::unionize_fixed_dot_via(board, unionfind, joints.0);
|
||||||
unionfind.union(common.index(), joints.1.index());
|
unionfind.union(common.index(), joints.1.index());
|
||||||
|
Self::unionize_fixed_dot_via(board, unionfind, joints.1);
|
||||||
}
|
}
|
||||||
PrimitiveIndex::LooseBend(bend) => {
|
PrimitiveIndex::LooseBend(bend) => {
|
||||||
let joints = board.layout().drawing().primitive(bend).joints();
|
let joints = board.layout().drawing().primitive(bend).joints();
|
||||||
|
|
@ -147,4 +145,16 @@ impl ConncompsWithPrincipalLayer {
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn unionize_fixed_dot_via(
|
||||||
|
board: &Board<impl AccessMesadata>,
|
||||||
|
unionfind: &mut UnionFind<usize>,
|
||||||
|
dot: FixedDotIndex,
|
||||||
|
) {
|
||||||
|
if let Some(via) = board.layout().fixed_dot_via(dot) {
|
||||||
|
for via_dot in board.layout().via(via).dots() {
|
||||||
|
unionfind.union(dot.index(), via_dot.index());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,16 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
drawing::{
|
drawing::{
|
||||||
|
dot::FixedDotIndex,
|
||||||
graph::{GetMaybeNet, IsInLayer},
|
graph::{GetMaybeNet, IsInLayer},
|
||||||
primitive::MakePrimitiveShape,
|
primitive::MakePrimitiveShape,
|
||||||
rules::AccessRules,
|
rules::AccessRules,
|
||||||
Drawing,
|
Drawing,
|
||||||
},
|
},
|
||||||
geometry::primitive::{DotShape, PrimitiveShape},
|
geometry::{
|
||||||
|
compound::ManageCompounds,
|
||||||
|
primitive::{DotShape, PrimitiveShape},
|
||||||
|
},
|
||||||
graph::{GenericIndex, GetIndex},
|
graph::{GenericIndex, GetIndex},
|
||||||
layout::{CompoundEntryLabel, CompoundWeight},
|
layout::{CompoundEntryLabel, CompoundWeight},
|
||||||
math::Circle,
|
math::Circle,
|
||||||
|
|
@ -32,6 +36,13 @@ impl<'a, R> Via<'a, R> {
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self { index, drawing }
|
Self { index, drawing }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn dots(&self) -> impl Iterator<Item = FixedDotIndex> + '_ {
|
||||||
|
self.drawing
|
||||||
|
.geometry()
|
||||||
|
.compound_members(self.index.into())
|
||||||
|
.map(|(_, index)| FixedDotIndex::new(index.index()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<R: AccessRules> GetMaybeNet for Via<'_, R> {
|
impl<R: AccessRules> GetMaybeNet for Via<'_, R> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue