differential_equations/solout/
mod.rs

1//! Solout trait and common implementations for controlling the output of differential equation solvers.
2//!
3//! ## Includes
4//! * `DefaultSolout` for capturing all solver steps
5//! * `EvenSolout` for capturing evenly spaced solution points
6//! * `DenseSolout` for capturing a dense set of interpolated points
7//! * `TEvalSolout` for capturing points based on a user-defined function
8//! * `CrossingSolout` for capturing points when crossing a specified value
9//! * `HyperplaneCrossingSolout` for capturing points when crossing a hyperplane
10//!
11
12use crate::{
13    control::ControlFlag,
14    interpolate::Interpolation,
15    solution::Solution,
16    traits::{Real, State},
17};
18
19mod crossing;
20mod default;
21mod dense;
22mod even;
23mod event;
24mod hyperplane;
25mod solout;
26mod t_eval;
27
28pub use crossing::CrossingSolout;
29pub use default::DefaultSolout;
30pub use dense::DenseSolout;
31pub use even::EvenSolout;
32pub use event::{Event, EventConfig, EventSolout, EventWrappedSolout};
33pub use hyperplane::HyperplaneCrossingSolout;
34pub use solout::Solout;
35pub use t_eval::TEvalSolout;
36
37/// Defines the direction of threshold crossing to detect.
38#[derive(Debug, Clone, Copy, PartialEq, Eq)]
39pub enum CrossingDirection {
40    /// Detect crossings in both directions
41    Both,
42    /// Detect only crossings from below to above the threshold (positive direction)
43    Positive,
44    /// Detect only crossings from above to below the threshold (negative direction)
45    Negative,
46}
47
48impl From<i8> for CrossingDirection {
49    fn from(value: i8) -> Self {
50        match value {
51            1 => CrossingDirection::Positive,
52            -1 => CrossingDirection::Negative,
53            _ => CrossingDirection::Both,
54        }
55    }
56}