Struct TypedResidual
pub struct TypedResidual<I> { /* private fields */ }Description
A fully inferred residual DAG.
Node types can only be produced by Self::infer, so operator lowerings can
consume this value without trusting shape information supplied by their caller.
Implementations§
§impl<I> TypedResidual<I>
impl<I> TypedResidual<I>
pub fn verify_uniform_ale_transport(
&self,
map: ExprId,
stored: ExprId,
flux: ExprId,
field: Id<Field>,
) -> Result<[ExprId; 2], TimeDerivativeProofError>
pub fn verify_uniform_ale_transport( &self, map: ExprId, stored: ExprId, flux: ExprId, field: Id<Field>, ) -> Result<[ExprId; 2], TimeDerivativeProofError>
Prove the advective projection c*u*lambda*(v-d(chi)/dt) of a planar Law.
stored must equal c*u*J for the supplied volume map, and c may contain
only constants and Parameters. The map must be a polynomial uniform scaling plus
translation, with axes selected by coordinate identity. Every advective axis must
keep an explicit v - mesh_rate subtraction whose rate equals the derivative of
that map row. Returns the real scalar material-velocity expressions (m/s) in
physical axis order. A subtraction whose operands have different dimensions is
rejected even if the normalized numbers match.
Only the advective projection is checked; gradients of field are not. The
caller must separately admit the diffusive flux, types, supports, positive map,
and prescribed scalar velocity expressions. Other vector forms and nonlinear
coordinate maps are rejected. Limits and exact arithmetic are shared with
ExprDag::verify_time_derivative; the correspondence is proved symbolically,
not by sampling or executable differentiation.
§impl<I> TypedResidual<I>where
I: Clone + Eq,
impl<I> TypedResidual<I>where
I: Clone + Eq,
pub fn validate_trace_regularity(
&self,
symbol_regularity: impl FnMut(SymbolRef) -> SpatialRegularity,
) -> Result<(), Vec<TypedResidualError<I, Infallible>>>
pub fn validate_trace_regularity( &self, symbol_regularity: impl FnMut(SymbolRef) -> SpatialRegularity, ) -> Result<(), Vec<TypedResidualError<I, Infallible>>>
Check from the authored regularity of each symbol whether a boundary trace exists.
Sums and smooth scalar multipliers preserve regularity. Full traces of H1, normal traces of H(div), and tangential traces of H(curl) are allowed; traces of derivatives require smooth operands. No numerical basis, shared interface value, or general product of distributions is inferred.
A tangential trace is written as the skew lift followed by normal contraction. The check recognizes that closed calculus definition by content, not by name, so other component maps cannot gain this trace theorem.
§impl<I> TypedResidual<I>
impl<I> TypedResidual<I>
pub const fn expression(&self) -> &ExprDag
pub const fn expression(&self) -> &ExprDag
Structurally validated expression DAG.
pub const fn node_types(&self) -> &[ExpressionType<I>]
pub const fn node_types(&self) -> &[ExpressionType<I>]
Inferred type of every DAG node, in arena order.
pub fn node_type(&self, id: ExprId) -> Option<&ExpressionType<I>>
pub fn node_type(&self, id: ExprId) -> Option<&ExpressionType<I>>
Inferred type of one DAG node.
§impl<I> TypedResidual<I>where
I: Clone + Eq,
impl<I> TypedResidual<I>where
I: Clone + Eq,
pub fn infer<E>(
expression: ExprDag,
relation_support: Option<SpatialSupport<I>>,
boundary_support: impl FnMut(Id<Domain>) -> Option<SpatialSupport<I>>,
root_contract: RootContract,
symbol_type: impl FnMut(SymbolRef) -> Result<ExpressionType<I>, E>,
) -> Result<TypedResidual<I>, Vec<TypedResidualError<I, E>>>
pub fn infer<E>( expression: ExprDag, relation_support: Option<SpatialSupport<I>>, boundary_support: impl FnMut(Id<Domain>) -> Option<SpatialSupport<I>>, root_contract: RootContract, symbol_type: impl FnMut(SymbolRef) -> Result<ExpressionType<I>, E>, ) -> Result<TypedResidual<I>, Vec<TypedResidualError<I, E>>>
Infer types for a whole DAG using a semantic symbol resolver.
Independent errors are collected in arena and root order. A node whose operands failed does not report a further error. A value is returned only when every node and root satisfies the selected contract.
Trait Implementations§
§impl<I> Clone for TypedResidual<I>where
I: Clone,
impl<I> Clone for TypedResidual<I>where
I: Clone,
§impl<I> Debug for TypedResidual<I>where
I: Debug,
impl<I> Debug for TypedResidual<I>where
I: Debug,
§impl<I> PartialEq for TypedResidual<I>where
I: PartialEq,
impl<I> PartialEq for TypedResidual<I>where
I: PartialEq,
§fn eq(&self, other: &TypedResidual<I>) -> bool
fn eq(&self, other: &TypedResidual<I>) -> bool
self and other values to be equal, and is used by ==.impl<I> StructuralPartialEq for TypedResidual<I>
Auto Trait Implementations§
impl<I> Freeze for TypedResidual<I>
impl<I> RefUnwindSafe for TypedResidual<I>where
I: RefUnwindSafe,
impl<I> Send for TypedResidual<I>where
I: Send,
impl<I> Sync for TypedResidual<I>where
I: Sync,
impl<I> Unpin for TypedResidual<I>
impl<I> UnsafeUnpin for TypedResidual<I>
impl<I> UnwindSafe for TypedResidual<I>where
I: UnwindSafe,
Blanket Implementations§
Source§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Source§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
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,
§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
§fn approx(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
§impl<T> ConvUtil for T
impl<T> ConvUtil for T
§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
§fn into_as<Dst>(self) -> Dstwhere
Self: Sized + Into<Dst>,
fn into_as<Dst>(self) -> Dstwhere
Self: Sized + Into<Dst>,
§fn try_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + TryInto<Dst>,
fn try_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + TryInto<Dst>,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
Source§impl<T> From<T> for T
impl<T> From<T> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
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>where
F: FnOnce(&Self) -> bool,
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where
F: FnOnce(&Self) -> bool,
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§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Same for T
impl<T> Same for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.