pub struct SolverState {
pub flows: Vec<f64>,
pub heads: Vec<f64>,
pub demands: Vec<f64>,
pub emitter_flows: Vec<f64>,
pub demand_flows: Vec<f64>,
pub statuses: Vec<LinkStatus>,
pub settings: Vec<f64>,
pub resistances: Vec<f64>,
pub topology_version: u32,
pub properties_version: u32,
}Expand description
The solver state is the initial/final state of the solver for a single step
Fields§
§flows: Vec<f64>§heads: Vec<f64>§demands: Vec<f64>§emitter_flows: Vec<f64>§demand_flows: Vec<f64>§statuses: Vec<LinkStatus>§settings: Vec<f64>§resistances: Vec<f64>§topology_version: u32version of the topology of the network on which the state was created
properties_version: u32version of the properties of the network on which the state was created
Implementations§
Source§impl SolverState
impl SolverState
Sourcepub fn new_with_initial_values(network: &Network) -> Self
pub fn new_with_initial_values(network: &Network) -> Self
Create a new solver state with the initial values for the flows, heads, demands and statuses and calculate resistances
Sourcepub fn apply_patterns(&mut self, network: &Network, time: usize)
pub fn apply_patterns(&mut self, network: &Network, time: usize)
Applies demand and head patterns to the state at the given time. TODO: Add support for multiple patterns
Sourcepub fn apply_controls(&mut self, network: &Network, time: usize)
pub fn apply_controls(&mut self, network: &Network, time: usize)
Applies controls to the state at the given time.
Sourcepub fn update_tanks(&mut self, network: &Network, timestep: usize)
pub fn update_tanks(&mut self, network: &Network, timestep: usize)
Updates the tank levels for the given time step.
Sourcepub fn update_with_network_changes(&mut self, network: &mut Network)
pub fn update_with_network_changes(&mut self, network: &mut Network)
Updates the state with the changes to the network.
Trait Implementations§
Source§impl Clone for SolverState
impl Clone for SolverState
Source§fn clone(&self) -> SolverState
fn clone(&self) -> SolverState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SolverState
impl RefUnwindSafe for SolverState
impl Send for SolverState
impl Sync for SolverState
impl Unpin for SolverState
impl UnsafeUnpin for SolverState
impl UnwindSafe for SolverState
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
Mutably borrows from an owned value. Read more
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,
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>
Converts
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>
Converts
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