RootEvent
Defined in: root.rs:148
pub trait RootEvent\<Y\>A boundary the state decides, as the zero of a signed function.
Required Methods
Section titled “Required Methods”value()
Section titled “value()”fn value(&self, t: f64, y: &Y) -> f64
The signed value at (t, y). Continuous in both, and finite wherever
the walk can reach: a non-finite value stops the walk with
IntegrationError::NonFiniteRootValue rather than being guessed
about, since its sign says nothing about where a crossing is.
One step may hold at most one change of sign of this value, whichever direction each change is in — see the module documentation for what the search reports when a step holds more, and why it cannot detect the case itself.
Provided Methods
Section titled “Provided Methods”crossing()
Section titled “crossing()”fn crossing(&self) -> Crossing
Which direction across zero counts. Crossing::Either, unless
overridden.
terminal()
Section titled “terminal()”fn terminal(&self) -> bool
Whether reaching this boundary ends the walk. Terminal, unless overridden: a non-terminal root hands control back at the boundary and the caller resumes from there.
priority()
Section titled “priority()”fn priority(&self) -> i32
Order among events that cross within the same bracket. Lower is reported first, and events of equal priority keep the order they were registered in.
leaves_zero_towards()
Section titled “leaves_zero_towards()”fn leaves_zero_towards(&self, _t: f64, _y: &Y) -> Option<f64>
Which way this value leaves zero at (t, y), where it is exactly zero
there.
Only Crossing::Reversal reads this, and only where the step’s own
start value is zero. Such a step’s two ends are the same pair a value
falling straight from zero gives, so they cannot say whether anything
turned around. The sign returned here stands in for the start’s, which
makes a later crossing a reversal. The rate of the value is what
answers: a motor at zero torque with a command to follow has
dτ/dt = τ_cmd / T, a number the event holds.
None where the direction is unknown — the rate is zero as well, or the
event does not track it — and a step starting at that zero then reports
nothing, as it did before. Return the rate itself or anything with its
sign; zero and non-finite answers count as unknown.
boundary_tolerance()
Section titled “boundary_tolerance()”fn boundary_tolerance(&self) -> f64
Width of |value| within which the state still counts as being on this
boundary, in the value’s own units.
Zero, unless overridden, and it has to be finite and not negative:
RootSet::new refuses the rest, since a negative width re-arms the
guard at once and a non-finite one never re-arms it.
What this settles is a constraint the state moves along — a wheel held
at its saturation torque — where value stays at a jitter around zero
for many steps rather than at zero, and each change of sign in that
jitter would otherwise be a fresh crossing. The step that leaves a root
behind is a separate matter, suppressed exactly, by time; see
RootGuard. The width cannot be derived from
RootSearch::t_tolerance, which is a time.