diff --git a/src/autorouter/autorouter.rs b/src/autorouter/autorouter.rs index 1420f87..32ea0a0 100644 --- a/src/autorouter/autorouter.rs +++ b/src/autorouter/autorouter.rs @@ -13,7 +13,7 @@ use thiserror::Error; use crate::{ autorouter::{ multilayer_autoroute::{MultilayerAutorouteExecutionStepper, MultilayerAutorouteOptions}, - planar_permutator::PlanarAutorouteExecutionPermutator, + planar_reconfigurator::PlanarAutorouteExecutionReconfigurator, planner::Planner, ratsnests::Ratsnests, }, @@ -69,7 +69,7 @@ pub enum AutorouterError { #[error("need exactly two ratlines")] NeedExactlyTwoRatlines, #[error("nothing to undo for permutation")] - NothingToUndoForPermutation, + NothingToUndoForReconfiguration, } #[derive(Getters)] @@ -137,8 +137,8 @@ impl Autorouter { &mut self, selection: &PinSelection, options: PlanarAutorouteOptions, - ) -> Result { - PlanarAutorouteExecutionPermutator::new( + ) -> Result { + PlanarAutorouteExecutionReconfigurator::new( self, self.selected_planar_ratlines(selection, options.principal_layer), options, diff --git a/src/autorouter/execution.rs b/src/autorouter/execution.rs index 25f2fa8..aa4a133 100644 --- a/src/autorouter/execution.rs +++ b/src/autorouter/execution.rs @@ -10,7 +10,7 @@ use serde::{Deserialize, Serialize}; use crate::{ autorouter::{ multilayer_autoroute::{MultilayerAutorouteExecutionStepper, MultilayerAutorouteOptions}, - planar_permutator::PlanarAutorouteExecutionPermutator, + planar_reconfigurator::PlanarAutorouteExecutionReconfigurator, }, board::{edit::BoardEdit, AccessMesadata}, layout::via::ViaWeight, @@ -50,7 +50,7 @@ pub enum Command { #[enum_dispatch(GetDebugOverlayData)] pub enum ExecutionStepper { MultilayerAutoroute(MultilayerAutorouteExecutionStepper), - PlanarAutoroute(PlanarAutorouteExecutionPermutator), + PlanarAutoroute(PlanarAutorouteExecutionReconfigurator), TopoAutoroute(ng::AutorouteExecutionStepper), PlaceVia(PlaceViaExecutionStepper), RemoveBands(RemoveBandsExecutionStepper), diff --git a/src/autorouter/invoker.rs b/src/autorouter/invoker.rs index 6ad2e18..e51bd7f 100644 --- a/src/autorouter/invoker.rs +++ b/src/autorouter/invoker.rs @@ -34,7 +34,7 @@ use super::{ measure_length::MeasureLengthExecutionStepper, multilayer_autoroute::MultilayerAutorouteExecutionStepper, place_via::PlaceViaExecutionStepper, - planar_permutator::PlanarAutorouteExecutionPermutator, + planar_reconfigurator::PlanarAutorouteExecutionReconfigurator, remove_bands::RemoveBandsExecutionStepper, Autorouter, AutorouterError, }; diff --git a/src/autorouter/mod.rs b/src/autorouter/mod.rs index 897f270..7b037de 100644 --- a/src/autorouter/mod.rs +++ b/src/autorouter/mod.rs @@ -14,8 +14,8 @@ pub mod measure_length; pub mod multilayer_autoroute; pub mod place_via; pub mod planar_autoroute; -pub mod planar_permutator; -pub mod planar_permuter; +pub mod planar_reconfigurator; +pub mod planar_reconfigurer; pub mod planner; pub mod pointroute; pub mod presorter; diff --git a/src/autorouter/multilayer_autoroute.rs b/src/autorouter/multilayer_autoroute.rs index 4a637c1..557bed8 100644 --- a/src/autorouter/multilayer_autoroute.rs +++ b/src/autorouter/multilayer_autoroute.rs @@ -12,7 +12,7 @@ use crate::{ anterouter::{Anterouter, AnterouterOptions, AnterouterPlan}, invoker::GetDebugOverlayData, planar_autoroute::PlanarAutorouteContinueStatus, - planar_permutator::PlanarAutorouteExecutionPermutator, + planar_reconfigurator::PlanarAutorouteExecutionReconfigurator, ratline::RatlineUid, Autorouter, AutorouterError, PlanarAutorouteOptions, }, @@ -30,7 +30,7 @@ pub struct MultilayerAutorouteOptions { } pub struct MultilayerAutorouteExecutionStepper { - planar: PlanarAutorouteExecutionPermutator, + planar: PlanarAutorouteExecutionReconfigurator, anteroute_edit: BoardEdit, } @@ -46,7 +46,11 @@ impl MultilayerAutorouteExecutionStepper { assigner.anteroute(autorouter, &mut anteroute_edit, &options.anterouter); Ok(Self { - planar: PlanarAutorouteExecutionPermutator::new(autorouter, ratlines, options.planar)?, + planar: PlanarAutorouteExecutionReconfigurator::new( + autorouter, + ratlines, + options.planar, + )?, anteroute_edit, }) } diff --git a/src/autorouter/planar_autoroute.rs b/src/autorouter/planar_autoroute.rs index c383489..f8c39a2 100644 --- a/src/autorouter/planar_autoroute.rs +++ b/src/autorouter/planar_autoroute.rs @@ -21,7 +21,7 @@ use crate::{ router::{ navcord::Navcord, navmesh::Navmesh, thetastar::ThetastarStepper, RouteStepper, Router, }, - stepper::{Abort, EstimateProgress, Permutate, Step}, + stepper::{Abort, EstimateProgress, Reconfigure, Step}, }; use super::{ @@ -95,7 +95,7 @@ impl PlanarAutorouteExecutionStepper { index: usize, ) -> Result<(), AutorouterError> { if index >= self.board_data_edits.len() { - return Err(AutorouterError::NothingToUndoForPermutation); + return Err(AutorouterError::NothingToUndoForReconfiguration); } self.dissolve_route_stepper_and_push_layout_edit(); @@ -235,11 +235,11 @@ impl Abort> for PlanarAutorouteExecutionStepper } } -impl Permutate> for PlanarAutorouteExecutionStepper { +impl Reconfigure> for PlanarAutorouteExecutionStepper { type Index = RatlineUid; type Output = Result<(), AutorouterError>; - fn permutate( + fn reconfigure( &mut self, autorouter: &mut Autorouter, permutation: Vec, @@ -249,7 +249,7 @@ impl Permutate> for PlanarAutorouteExecutionSte .zip(self.ratlines.iter()) .position(|(permuted, original)| *permuted != *original) else { - return Err(AutorouterError::NothingToUndoForPermutation); + return Err(AutorouterError::NothingToUndoForReconfiguration); }; self.ratlines = permutation; diff --git a/src/autorouter/planar_permutator.rs b/src/autorouter/planar_reconfigurator.rs similarity index 79% rename from src/autorouter/planar_permutator.rs rename to src/autorouter/planar_reconfigurator.rs index 7b21907..498680a 100644 --- a/src/autorouter/planar_permutator.rs +++ b/src/autorouter/planar_reconfigurator.rs @@ -10,7 +10,7 @@ use crate::{ autorouter::{ invoker::GetDebugOverlayData, planar_autoroute::{PlanarAutorouteContinueStatus, PlanarAutorouteExecutionStepper}, - planar_permuter::{PermuteRatlines, RatlinePermuter}, + planar_reconfigurer::{PermuteRatlines, PlanarReconfigurer}, presorter::{PresortParams, PresortRatlines, SccIntersectionsAndLengthPresorter}, ratline::RatlineUid, Autorouter, AutorouterError, PlanarAutorouteOptions, @@ -19,16 +19,16 @@ use crate::{ drawing::graph::PrimitiveIndex, geometry::primitive::PrimitiveShape, router::{navcord::Navcord, navmesh::Navmesh, thetastar::ThetastarStepper}, - stepper::{Abort, EstimateProgress, Permutate, Step}, + stepper::{Abort, EstimateProgress, Reconfigure, Step}, }; -pub struct PlanarAutorouteExecutionPermutator { +pub struct PlanarAutorouteExecutionReconfigurator { stepper: PlanarAutorouteExecutionStepper, - permuter: RatlinePermuter, + reconfigurer: PlanarReconfigurer, options: PlanarAutorouteOptions, } -impl PlanarAutorouteExecutionPermutator { +impl PlanarAutorouteExecutionReconfigurator { pub fn new( autorouter: &mut Autorouter, ratlines: Vec, @@ -47,7 +47,7 @@ impl PlanarAutorouteExecutionPermutator { /*let permuter = RatlinesPermuter::SccPermutations(SccPermutationsRatlinePermuter::new( autorouter, ratlines, presorter, &options, ));*/ - let permuter = RatlinePermuter::new(autorouter, ratlines, presorter, &options); + let reconfigurer = PlanarReconfigurer::new(autorouter, ratlines, presorter, &options); Ok(Self { stepper: PlanarAutorouteExecutionStepper::new( @@ -56,14 +56,14 @@ impl PlanarAutorouteExecutionPermutator { options, )?, // Note: I assume here that the first permutation is the same as the original order. - permuter, + reconfigurer, options, }) } } impl Step, Option, PlanarAutorouteContinueStatus> - for PlanarAutorouteExecutionPermutator + for PlanarAutorouteExecutionReconfigurator { type Error = AutorouterError; @@ -80,15 +80,16 @@ impl Step, Option, PlanarAutorouteCo } loop { - let Some(permutation) = - self.permuter.permute_ratlines(autorouter, &self.stepper) + let Some(permutation) = self + .reconfigurer + .permute_ratlines(autorouter, &self.stepper) else { return Ok(ControlFlow::Break(None)); }; - match self.stepper.permutate(autorouter, permutation) { + match self.stepper.reconfigure(autorouter, permutation) { Ok(()) => break, - Err(AutorouterError::NothingToUndoForPermutation) => continue, + Err(AutorouterError::NothingToUndoForReconfiguration) => continue, Err(err) => return Err(err), } } @@ -99,14 +100,14 @@ impl Step, Option, PlanarAutorouteCo } } -impl Abort> for PlanarAutorouteExecutionPermutator { +impl Abort> for PlanarAutorouteExecutionReconfigurator { fn abort(&mut self, autorouter: &mut Autorouter) { //self.permutations_iter.all(|_| true); // Why did I add this code here??? self.stepper.abort(autorouter); } } -impl EstimateProgress for PlanarAutorouteExecutionPermutator { +impl EstimateProgress for PlanarAutorouteExecutionReconfigurator { type Value = f64; fn estimate_progress_value(&self) -> f64 { @@ -120,7 +121,7 @@ impl EstimateProgress for PlanarAutorouteExecutionPermutator { } } -impl GetDebugOverlayData for PlanarAutorouteExecutionPermutator { +impl GetDebugOverlayData for PlanarAutorouteExecutionReconfigurator { fn maybe_thetastar(&self) -> Option<&ThetastarStepper> { self.stepper.maybe_thetastar() } diff --git a/src/autorouter/planar_permuter.rs b/src/autorouter/planar_reconfigurer.rs similarity index 90% rename from src/autorouter/planar_permuter.rs rename to src/autorouter/planar_reconfigurer.rs index 544b3de..64f7939 100644 --- a/src/autorouter/planar_permuter.rs +++ b/src/autorouter/planar_reconfigurer.rs @@ -29,19 +29,19 @@ pub trait PermuteRatlines { } #[enum_dispatch(PermuteRatlines)] -pub enum RatlinePermuter { - RatlineCuts(RatlineCutsRatlinePermuter), - SccPermutations(SccPermutationsRatlinePermuter), +pub enum PlanarReconfigurer { + RatlineCuts(RatlineCutsPlanarReconfigurer), + SccPermutations(SccPermutationsPlanarReconfigurer), } -impl RatlinePermuter { +impl PlanarReconfigurer { pub fn new( autorouter: &mut Autorouter, ratlines: Vec, presorter: SccIntersectionsAndLengthPresorter, options: &PlanarAutorouteOptions, ) -> Self { - RatlinePermuter::SccPermutations(SccPermutationsRatlinePermuter::new( + PlanarReconfigurer::SccPermutations(SccPermutationsPlanarReconfigurer::new( autorouter, ratlines, presorter, options, )) /*RatlinesPermuter::RatlineCuts(RatlineCutsRatlinePermuter::new( @@ -50,12 +50,12 @@ impl RatlinePermuter { } } -pub struct SccPermutationsRatlinePermuter { +pub struct SccPermutationsPlanarReconfigurer { sccs_permutations_iter: Skip>>, original_ratlines: Vec, } -impl SccPermutationsRatlinePermuter { +impl SccPermutationsPlanarReconfigurer { pub fn new( _autorouter: &mut Autorouter, ratlines: Vec, @@ -74,7 +74,7 @@ impl SccPermutationsRatlinePermuter { } } -impl PermuteRatlines for SccPermutationsRatlinePermuter { +impl PermuteRatlines for SccPermutationsPlanarReconfigurer { fn permute_ratlines( &mut self, autorouter: &mut Autorouter, @@ -111,11 +111,11 @@ impl PermuteRatlines for SccPermutationsRatlinePermuter { } } -pub struct RatlineCutsRatlinePermuter { +pub struct RatlineCutsPlanarReconfigurer { //sccs: Vec>>, } -impl RatlineCutsRatlinePermuter { +impl RatlineCutsPlanarReconfigurer { pub fn new( _autorouter: &mut Autorouter, _ratlines: Vec, @@ -129,7 +129,7 @@ impl RatlineCutsRatlinePermuter { } } -impl PermuteRatlines for RatlineCutsRatlinePermuter { +impl PermuteRatlines for RatlineCutsPlanarReconfigurer { fn permute_ratlines( &mut self, autorouter: &mut Autorouter, diff --git a/src/stepper.rs b/src/stepper.rs index f3e4abf..3f9545f 100644 --- a/src/stepper.rs +++ b/src/stepper.rs @@ -54,11 +54,11 @@ pub trait Abort { } /// Some steppers may be permuted from their initial order. -pub trait Permutate { +pub trait Reconfigure { type Index; type Output; - fn permutate(&mut self, context: &mut Ctx, ordering: Vec) -> Self::Output; + fn reconfigure(&mut self, context: &mut Ctx, ordering: Vec) -> Self::Output; } /// Steppers that can receive discrete events and act on them implement this