pub struct MultiDomainState { /* private fields */ }Expand description
Multi-domain physical state container.
Maps (DomainId, PhysicalQuantity) composite keys to ContextValue
fields. Used by CouplingOperator to exchange state
between physical domains without implicit ordering conventions (DD-010,
DD-011, INV-3).
§Examples
use oxiflow::context::state::MultiDomainState;
use oxiflow::context::quantity::PhysicalQuantity;
use oxiflow::context::value::ContextValue;
use oxiflow::solver::scenario::DomainId;
use nalgebra::DVector;
let mut state = MultiDomainState::new();
state.set(
DomainId::new("column"),
PhysicalQuantity::concentration(),
ContextValue::ScalarField(DVector::from_vec(vec![0.0, 1.0, 2.0])),
);
let field = state.get(&DomainId::new("column"), &PhysicalQuantity::concentration());
assert!(field.is_some());Implementations§
Source§impl MultiDomainState
impl MultiDomainState
Sourcepub fn get(
&self,
domain: &DomainId,
quantity: &PhysicalQuantity,
) -> Option<&ContextValue>
pub fn get( &self, domain: &DomainId, quantity: &PhysicalQuantity, ) -> Option<&ContextValue>
Returns a reference to the field for (domain, quantity), if present.
Sourcepub fn get_mut(
&mut self,
domain: &DomainId,
quantity: &PhysicalQuantity,
) -> Option<&mut ContextValue>
pub fn get_mut( &mut self, domain: &DomainId, quantity: &PhysicalQuantity, ) -> Option<&mut ContextValue>
Returns a mutable reference to the field for (domain, quantity), if present.
Sourcepub fn set(
&mut self,
domain: DomainId,
quantity: PhysicalQuantity,
value: ContextValue,
)
pub fn set( &mut self, domain: DomainId, quantity: PhysicalQuantity, value: ContextValue, )
Inserts or replaces the field for (domain, quantity).
Sourcepub fn remove(
&mut self,
domain: &DomainId,
quantity: &PhysicalQuantity,
) -> Option<ContextValue>
pub fn remove( &mut self, domain: &DomainId, quantity: &PhysicalQuantity, ) -> Option<ContextValue>
Removes the field for (domain, quantity), returning it if present.
Sourcepub fn iter(
&self,
) -> impl Iterator<Item = (&DomainId, &PhysicalQuantity, &ContextValue)>
pub fn iter( &self, ) -> impl Iterator<Item = (&DomainId, &PhysicalQuantity, &ContextValue)>
Returns an iterator over all ((domain, quantity), value) entries.
Sourcepub fn domain_fields<'a>(
&'a self,
domain: &'a DomainId,
) -> impl Iterator<Item = (&'a PhysicalQuantity, &'a ContextValue)> + 'a
pub fn domain_fields<'a>( &'a self, domain: &'a DomainId, ) -> impl Iterator<Item = (&'a PhysicalQuantity, &'a ContextValue)> + 'a
Returns all fields belonging to domain.
Sourcepub fn contains_domain(&self, domain: &DomainId) -> bool
pub fn contains_domain(&self, domain: &DomainId) -> bool
Returns true if domain has at least one field stored.
Sourcepub fn validate_domain_consistency(
&self,
domain: &DomainId,
) -> Result<(), OxiflowError>
pub fn validate_domain_consistency( &self, domain: &DomainId, ) -> Result<(), OxiflowError>
Verifies that all fields for a domain have the same number of DOFs.
Returns OxiflowError::InvalidDomain if inconsistent field lengths are
detected for domain.
Trait Implementations§
Source§impl Clone for MultiDomainState
impl Clone for MultiDomainState
Source§fn clone(&self) -> MultiDomainState
fn clone(&self) -> MultiDomainState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MultiDomainState
impl Debug for MultiDomainState
Auto Trait Implementations§
impl Freeze for MultiDomainState
impl RefUnwindSafe for MultiDomainState
impl Send for MultiDomainState
impl Sync for MultiDomainState
impl Unpin for MultiDomainState
impl UnsafeUnpin for MultiDomainState
impl UnwindSafe for MultiDomainState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.