Skip to main content

Module t_eval

Module t_eval 

Source
Expand description

Output-grid emission for SolverOptions::t_eval.

When the caller supplies an explicit output grid, the solver must return (t, y) pairs at exactly those times — not at the natural step grid the adaptive controller picked. This module provides a small per-step helper that all solvers wire into their accept branch:

  1. Before integration starts, build a TEvalEmitter from the requested grid and the integration direction.
  2. After each accepted step, call TEvalEmitter::emit_step with the step endpoints (t_old, y_old, dy_old) and (t_new, y_new, dy_new). Any requested grid points in [t_old, t_new] are flushed to the solver’s t_out / y_out buffers via Hermite cubic interpolation.

The Hermite cubic basis reproduces the endpoints exactly (theta=0 → y_old, theta=1 → y_new), so requested points that coincide with step boundaries come back bit-exact. For points strictly inside a step the interpolation is third-order accurate in h, which is well below the working tolerance of every solver in this crate at the step sizes the controller picks.

Why Hermite and not each solver’s native dense interpolant? Only DoPri5 and Verner currently expose dedicated dense-output coefficients, while Tsit5 / BDF / Radau5 / ESDIRK don’t. A single Hermite path keeps the contract identical across solvers and makes the wiring auditable in one place. If a higher-order interpolant is needed for a specific solver later, that’s a localised optimisation — not a correctness change.

Structs§

TEvalEmitter
Per-step emitter that flushes requested-grid points covered by the step.

Functions§

validate_grid
Validate that a requested output grid is monotonic in the integration direction and stays within [t0, tf].