Template Class CoroutineIntegrator

Class Documentation

template<typename State>
class CoroutineIntegrator

将积分器包装为协程,支持细粒度控制

Public Functions

inline explicit CoroutineIntegrator(std::unique_ptr<diffeq::core::AbstractIntegrator<State>> integrator)
inline IntegrationTask<State> integrate_coro(State initial_state, typename diffeq::core::AbstractIntegrator<State>::time_type dt, typename diffeq::core::AbstractIntegrator<State>::time_type end_time, size_t yield_interval = 10)

协程化的积分,每步都可以暂停

Parameters:
  • initial_state – 初始状态

  • dt – 时间步长

  • end_time – 结束时间

  • yield_interval – 产生中间结果的步数间隔

template<typename ProgressCallback>
inline IntegrationTask<State> integrate_with_progress(State initial_state, typename diffeq::core::AbstractIntegrator<State>::time_type dt, typename diffeq::core::AbstractIntegrator<State>::time_type end_time, ProgressCallback &&callback)

带进度回调的协程积分