pub trait TimeIntegrator {
// Required methods
fn advance(
&mut self,
repr: &mut dyn PhaseSpaceRepr,
solver: &dyn PoissonSolver,
advector: &dyn Advector,
dt: f64,
) -> Result<StepProducts, CausticError>;
fn max_dt(&self, repr: &dyn PhaseSpaceRepr, cfl_factor: f64) -> f64;
// Provided methods
fn last_step_timings(&self) -> Option<&StepTimings> { ... }
fn set_progress(&mut self, _progress: Arc<StepProgress>) { ... }
fn suggested_dt(&self) -> Option<f64> { ... }
}Expand description
Trait for all time integration / operator splitting strategies.
§Examples
use caustic::{StrangSplitting, YoshidaSplitting, TimeIntegrator};
// 2nd-order symplectic (drift-kick-drift)
let strang = StrangSplitting::new(1.0); // G = 1.0
// 4th-order symplectic (7 sub-steps)
let yoshida = YoshidaSplitting::new(1.0);Required Methods§
Sourcefn advance(
&mut self,
repr: &mut dyn PhaseSpaceRepr,
solver: &dyn PoissonSolver,
advector: &dyn Advector,
dt: f64,
) -> Result<StepProducts, CausticError>
fn advance( &mut self, repr: &mut dyn PhaseSpaceRepr, solver: &dyn PoissonSolver, advector: &dyn Advector, dt: f64, ) -> Result<StepProducts, CausticError>
Advance the simulation by one timestep Δt.
Calls advector drift/kick sub-steps in the correct order for this splitting scheme, then computes and returns the end-of-step density, potential, and acceleration. The caller uses these products for diagnostics and conservation projections, avoiding redundant Poisson solves.
Returns Err if the representation does not support operations required by
this integrator (e.g. to_snapshot/load_snapshot for unsplit methods).
Sourcefn max_dt(&self, repr: &dyn PhaseSpaceRepr, cfl_factor: f64) -> f64
fn max_dt(&self, repr: &dyn PhaseSpaceRepr, cfl_factor: f64) -> f64
Compute the maximum stable Δt given current state and CFL constraints.
Provided Methods§
Sourcefn last_step_timings(&self) -> Option<&StepTimings>
fn last_step_timings(&self) -> Option<&StepTimings>
Return timing breakdown from the most recent advance() call.
Default returns None; instrumented integrators override this.
Sourcefn set_progress(&mut self, _progress: Arc<StepProgress>)
fn set_progress(&mut self, _progress: Arc<StepProgress>)
Attach shared progress state for intra-step TUI visibility. Default is a no-op; integrators that support progress override this.
Sourcefn suggested_dt(&self) -> Option<f64>
fn suggested_dt(&self) -> Option<f64>
Return a suggested Δt from the adaptive controller (if any).
Default returns None; adaptive integrators override this.