Class Integrator

Inheritance Relationships

Derived Types

Class Documentation

class Integrator

Abstract base class for fixed- and adaptive-step ODE integrators used to propagate State/VecX dynamics in time.

Concrete subclasses (RK4, RK8, RKF45, PD45) implement Step; numerical dynamics models (e.g. NumericalOrbitDynamics, ClockDynamics, JointOrbitClockDynamics) own an Integrator instance (selected via SetIntegrator/IntegratorType) and call Propagate/PropagateEx once per Dynamics::Propagate call to advance the state from t0 to tf.

Subclassed by lupnt::IRKF, lupnt::PD45, lupnt::RK4, lupnt::RK8

Public Functions

inline virtual ~Integrator()
State Propagate(const ODE &odefunc, Real t0, Real tf, const State &x0, Real dt)

Propagate a State from t0 to tf under ODE odefunc, taking fixed/limited steps of (at most) size dt.

Called by numerical dynamics models (e.g. NumericalOrbitDynamics::Propagate/ClockDynamics::Propagate) to advance the propagated state by one Dynamics::Propagate interval.

Parameters:
  • odefunc – Right-hand side dx/dt = f(t, x)

  • t0 – Initial time [s]

  • tf – Final time [s] (must be >= t0; steps are clamped so the last step lands exactly on tf)

  • x0 – Initial state

  • dt – Nominal step size [s] (must be positive)

Returns:

Propagated state at tf

State Propagate(const ODE &odefunc, Real t0, Real tf, const State &x0, Real dt, MatXd *J)

Same as Propagate(odefunc, t0, tf, x0, dt), additionally computing the state-transition (sensitivity) matrix d(xf)/d(x0) via parallel finite-difference Jacobians (JacobianParallel) if J is non-null.

Parameters:

J – Output state-transition matrix (size n x n, where n = x0.size()); pass nullptr to skip the Jacobian computation

VecX Propagate(const ODE &odefunc, Real t0, Real tf, const VecX &x0, Real dt)

VecX overload of Propagate(odefunc, t0, tf, x0, dt); internally delegates to PropagateEx and returns just the final state vector.

VecX Propagate(const ODE &odefunc, Real t0, Real tf, const VecX &x0, Real dt, MatXd *J)

VecX overload of the Jacobian-computing Propagate above.

IntegratorResult PropagateEx(const ODE &odefunc, Real t0, Real tf, const VecX &x0, Real dt)

Propagate x0 from t0 to tf under odefunc, stepping by (the magnitude of) dt in the direction implied by sign(tf - t0), and report how/when propagation stopped.

Steps are clamped so the last step lands exactly on tf. If params_.terminate_if(t, x) is set and returns true (checked once before stepping and again after each step), propagation stops early with TerminationReason::UserCondition. Used by NumericalOrbitDynamics::PropagateEx/PropagateWithSTM-style callers that need the actual stop time/step count, not just the final state.

Parameters:
  • odefunc – Right-hand side dx/dt = f(t, x)

  • t0 – Initial time [s]

  • tf – Target final time [s] (may be less than t0 for backward propagation)

  • x0 – Initial state vector

  • dt – Step size magnitude [s] (must be positive; direction is inferred from tf - t0)

Returns:

Final state, time, termination reason, and step count

IntegratorResult PropagateEx(const ODE &odefunc, Real t0, Real tf, const VecX &x0, Real dt, MatXd *J)

Same as PropagateEx(odefunc, t0, tf, x0, dt), additionally computing the state-transition matrix d(xf)/d(x0) via JacobianParallel if J is non-null.

Parameters:

J – Output state-transition matrix (size n x n, where n = x0.size()); pass nullptr to skip the Jacobian computation

inline void SetPrintProgress(bool print)

Enable/disable a progress bar (via Logger::GetProgressBar) during Propagate/PropagateEx calls — useful for long-running propagations in interactive/scripted runs.

virtual State Step(const ODE &f, Real t, const State &x, Real dt) = 0

Advance x by one integration step of size dt under ODE f at time t.

Implemented by each concrete integrator (RK4, RK8, IRKF/RKF45, PD45) and called repeatedly by Propagate/PropagateEx to march the state from t0 to tf.

Parameters:
  • f – Right-hand side dx/dt = f(t, x)

  • t – Current time [s]

  • x – Current state

  • dt – Step size [s] (signed; adaptive integrators may modify it in-place to reflect the step actually taken)

Returns:

State after stepping by dt

inline void SetParams(IntegratorParams params)

Set the tolerances/iteration-limit/termination predicate used by Propagate/PropagateEx and adaptive Step implementations.

inline void SetTerminateIf(std::function<bool(Real, const VecX&)> pred)

Install (or clear, with nullptr) an early-termination predicate evaluated during PropagateEx; propagation stops with TerminationReason::UserCondition once pred(t, x) returns true.

Protected Attributes

bool print_progress_ = false
IntegratorParams params_