diff --git a/committed.toml b/committed.toml index 598e8dc..012ce5e 100644 --- a/committed.toml +++ b/committed.toml @@ -28,8 +28,8 @@ allowed_scopes = [ "autorouter/invoker", "autorouter/measure_length", "autorouter/multilayer_autoroute", - "autorouter/planar_permutator", - "autorouter/planar_permuter", + "autorouter/planar_reconfigurator", + "autorouter/planar_reconfigurer", "autorouter/place_via", "autorouter/planar_autoroute", "autorouter/planner", diff --git a/src/autorouter/multilayer_autoroute.rs b/src/autorouter/multilayer_autoroute.rs index 557bed8..22641ca 100644 --- a/src/autorouter/multilayer_autoroute.rs +++ b/src/autorouter/multilayer_autoroute.rs @@ -20,7 +20,7 @@ use crate::{ drawing::graph::PrimitiveIndex, geometry::{edit::Edit, primitive::PrimitiveShape}, router::{navcord::Navcord, navmesh::Navmesh, thetastar::ThetastarStepper}, - stepper::{Abort, EstimateProgress, Step}, + stepper::{Abort, EstimateProgress, ReconfiguratorStatus, Step}, }; #[derive(Clone, Copy, Debug, Deserialize, Serialize)] @@ -56,7 +56,8 @@ impl MultilayerAutorouteExecutionStepper { } } -impl Step, Option, PlanarAutorouteContinueStatus> +impl + Step, Option, ReconfiguratorStatus<(), PlanarAutorouteContinueStatus>> for MultilayerAutorouteExecutionStepper { type Error = AutorouterError; @@ -64,8 +65,10 @@ impl Step, Option, PlanarAutorouteCo fn step( &mut self, autorouter: &mut Autorouter, - ) -> Result, PlanarAutorouteContinueStatus>, AutorouterError> - { + ) -> Result< + ControlFlow, ReconfiguratorStatus<(), PlanarAutorouteContinueStatus>>, + AutorouterError, + > { match self.planar.step(autorouter) { Ok(ControlFlow::Break(Some(edit))) => { self.anteroute_edit.merge(edit); diff --git a/src/autorouter/planar_autoroute.rs b/src/autorouter/planar_autoroute.rs index 2c3d19f..f762424 100644 --- a/src/autorouter/planar_autoroute.rs +++ b/src/autorouter/planar_autoroute.rs @@ -33,9 +33,9 @@ use super::{ pub enum PlanarAutorouteContinueStatus { /// The autoroute is currently running and in progress. Running, - /// A specific segment has been successfully routed. + /// A band has been successfully routed. Routed(BandTermsegIndex), - /// A specific segment had been already routed and has been skipped. + /// A band had been already routed and has been skipped. Skipped(BandTermsegIndex), } diff --git a/src/autorouter/planar_reconfigurator.rs b/src/autorouter/planar_reconfigurator.rs index 498680a..111f270 100644 --- a/src/autorouter/planar_reconfigurator.rs +++ b/src/autorouter/planar_reconfigurator.rs @@ -19,7 +19,7 @@ use crate::{ drawing::graph::PrimitiveIndex, geometry::primitive::PrimitiveShape, router::{navcord::Navcord, navmesh::Navmesh, thetastar::ThetastarStepper}, - stepper::{Abort, EstimateProgress, Reconfigure, Step}, + stepper::{Abort, EstimateProgress, ReconfiguratorStatus, Reconfigure, Step}, }; pub struct PlanarAutorouteExecutionReconfigurator { @@ -62,7 +62,8 @@ impl PlanarAutorouteExecutionReconfigurator { } } -impl Step, Option, PlanarAutorouteContinueStatus> +impl + Step, Option, ReconfiguratorStatus<(), PlanarAutorouteContinueStatus>> for PlanarAutorouteExecutionReconfigurator { type Error = AutorouterError; @@ -70,10 +71,15 @@ impl Step, Option, PlanarAutorouteCo fn step( &mut self, autorouter: &mut Autorouter, - ) -> Result, PlanarAutorouteContinueStatus>, AutorouterError> - { + ) -> Result< + ControlFlow, ReconfiguratorStatus<(), PlanarAutorouteContinueStatus>>, + AutorouterError, + > { match self.stepper.step(autorouter) { - Ok(ok) => Ok(ok), + Ok(ControlFlow::Break(maybe_edit)) => Ok(ControlFlow::Break(maybe_edit)), + Ok(ControlFlow::Continue(status)) => { + Ok(ControlFlow::Continue(ReconfiguratorStatus::Running(status))) + } Err(err) => { if !self.options.permutate { return Err(err); @@ -94,7 +100,9 @@ impl Step, Option, PlanarAutorouteCo } } - self.stepper.step(autorouter) + Ok(ControlFlow::Continue( + ReconfiguratorStatus::Reconfigured(()), + )) } } } diff --git a/src/stepper.rs b/src/stepper.rs index d7d0f77..3f836b9 100644 --- a/src/stepper.rs +++ b/src/stepper.rs @@ -65,6 +65,11 @@ pub trait Reconfigure { ) -> Self::Output; } +pub enum ReconfiguratorStatus { + Running(Ru), + Reconfigured(Re), +} + /// Steppers that can receive discrete events and act on them implement this /// trait. // XXX: Doesn't this violate the rule that stepper's future states are