DiffEq - Modern C++ ODE Integration Library 1.0.0
High-performance C++ library for solving ODEs with async signal processing
Loading...
Searching...
No Matches
AsioIntegrationManager< State > Class Template Reference

使用 boost.asio 的异步积分器包装器 More...

Public Member Functions

 AsioIntegrationManager (std::unique_ptr< diffeq::core::AbstractIntegrator< State > > integrator, size_t thread_count=std::thread::hardware_concurrency())
 构造函数
 
 ~AsioIntegrationManager ()
 析构函数 - 确保所有任务完成
 
template<typename PostTask >
void integrate_async (State initial_state, typename diffeq::core::AbstractIntegrator< State >::time_type dt, typename diffeq::core::AbstractIntegrator< State >::time_type end_time, PostTask &&post_integration_task)
 异步执行积分任务
 
template<typename TaskList >
void integrate_batch_async (TaskList &&tasks)
 批量执行多个积分任务
 
void run (std::chrono::milliseconds timeout=std::chrono::milliseconds::max())
 运行事件循环
 
void wait_for_all_tasks ()
 等待所有任务完成
 
std::pair< size_t, size_t > get_progress () const
 获取完成统计
 
void reset_stats ()
 重置统计
 

Detailed Description

template<typename State>
class AsioIntegrationManager< State >

使用 boost.asio 的异步积分器包装器

这个示例展示了如何将 boost.asio 与我们的积分器结合使用, 实现 ODE 计算完成后的异步任务处理,如数据分析、参数调整、轨迹保存等。

设计理念:

  • 利用 boost.asio 的成熟异步设施,避免重复发明轮子
  • 专注于 ODE 计算完成后的任务编排,而不是积分器内部的异步化
  • 支持高并行度的 ODE 运算后的数据分析流程

Definition at line 27 of file asio_integration_demo.cpp.

Constructor & Destructor Documentation

◆ AsioIntegrationManager()

template<typename State >
AsioIntegrationManager< State >::AsioIntegrationManager ( std::unique_ptr< diffeq::core::AbstractIntegrator< State > >  integrator,
size_t  thread_count = std::thread::hardware_concurrency() 
)
inline

构造函数

Parameters
integrator积分器实例
thread_count线程池大小

Definition at line 44 of file asio_integration_demo.cpp.

◆ ~AsioIntegrationManager()

template<typename State >
AsioIntegrationManager< State >::~AsioIntegrationManager ( )
inline

析构函数 - 确保所有任务完成

Definition at line 57 of file asio_integration_demo.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ get_progress()

template<typename State >
std::pair< size_t, size_t > AsioIntegrationManager< State >::get_progress ( ) const
inline

获取完成统计

Definition at line 153 of file asio_integration_demo.cpp.

◆ integrate_async()

template<typename State >
template<typename PostTask >
void AsioIntegrationManager< State >::integrate_async ( State  initial_state,
typename diffeq::core::AbstractIntegrator< State >::time_type  dt,
typename diffeq::core::AbstractIntegrator< State >::time_type  end_time,
PostTask &&  post_integration_task 
)
inline

异步执行积分任务

Parameters
initial_state初始状态
dt时间步长
end_time结束时间
post_integration_task积分完成后的回调任务

Definition at line 70 of file asio_integration_demo.cpp.

Here is the caller graph for this function:

◆ integrate_batch_async()

template<typename State >
template<typename TaskList >
void AsioIntegrationManager< State >::integrate_batch_async ( TaskList &&  tasks)
inline

批量执行多个积分任务

Parameters
tasks任务列表,每个任务包含初始状态、积分参数和后处理函数

Definition at line 117 of file asio_integration_demo.cpp.

Here is the call graph for this function:

◆ reset_stats()

template<typename State >
void AsioIntegrationManager< State >::reset_stats ( )
inline

重置统计

Definition at line 160 of file asio_integration_demo.cpp.

◆ run()

template<typename State >
void AsioIntegrationManager< State >::run ( std::chrono::milliseconds  timeout = std::chrono::milliseconds::max())
inline

运行事件循环

Parameters
timeout超时时间(可选)

Definition at line 129 of file asio_integration_demo.cpp.

◆ wait_for_all_tasks()

template<typename State >
void AsioIntegrationManager< State >::wait_for_all_tasks ( )
inline

等待所有任务完成

Definition at line 144 of file asio_integration_demo.cpp.

Here is the caller graph for this function:

The documentation for this class was generated from the following file: