pub struct BusView { /* private fields */ }Expand description
The mapping from nodes to electrical buses, plus what survived.
Implementations§
Source§impl BusView
impl BusView
pub fn n_buses(&self) -> usize
pub fn n_nodes(&self) -> usize
Sourcepub fn representative(&self, bus: BusIdx) -> NodeIdx
pub fn representative(&self, bus: BusIdx) -> NodeIdx
One node standing for the whole group, for a caller that must collapse per-node records into one per-bus record and has to pick whose.
Arbitrary but deterministic, and deliberately not documented as
the lowest member — it is the union-find root, which depends on the
order switches appear in NodeBreakerTopology::switches. Callers that
need a stable, order-independent choice should use nodes_of(bus)[0]
instead and accept that it may differ from this.
The distinction is not hypothetical. cgmes::merge_closed_switches
clones this node’s Bus record — u_rated, bus_type — into the
merged bus, and its own comment records that the root was chosen over
the first-encountered index to make that extraction “provably
behaviour-preserving rather than merely equivalent-looking”. Exposing
the same choice here is what keeps rerouting through this layer
bit-identical. The fields that matter do agree across a group in
practice, since a conducting switch ties nodes at one nominal voltage —
but “in practice” is not the same as “provably”.
pub fn retained(&self) -> &[RetainedSwitch]
Sourcepub fn bus_of_slice(&self) -> &[BusIdx]
pub fn bus_of_slice(&self) -> &[BusIdx]
The raw node -> bus map, for callers that need to remap a parallel array in one pass.
Sourcepub fn is_degenerate(&self, retained: &RetainedSwitch) -> bool
pub fn is_degenerate(&self, retained: &RetainedSwitch) -> bool
Whether a retained switch’s two endpoints landed on the same bus, so that its position cannot affect connectivity.
Happens when some other conducting path already ties the two ends — a bus-coupler in a ring, or a switch retained in parallel with a merged one. Worth knowing about rather than discovering as a singular constraint row later.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BusView
impl RefUnwindSafe for BusView
impl Send for BusView
impl Sync for BusView
impl Unpin for BusView
impl UnsafeUnpin for BusView
impl UnwindSafe for BusView
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more