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

C++20 协程与 diffeq 库集成示例 More...

Classes

struct  promise_type
 

Public Types

using handle_type = std::coroutine_handle< promise_type >
 

Public Member Functions

 IntegrationTask (handle_type h)
 
 IntegrationTask (IntegrationTask &&other) noexcept
 
IntegrationTaskoperator= (IntegrationTask &&other) noexcept
 
 IntegrationTask (const IntegrationTask &)=delete
 
IntegrationTaskoperator= (const IntegrationTask &)=delete
 
bool resume ()
 
bool done () const
 
std::pair< State, double > get_current () const
 
void check_exception ()
 
bool await_ready () const noexcept
 
void await_suspend (std::coroutine_handle<> h)
 
std::pair< State, double > await_resume ()
 

Public Attributes

handle_type coro
 

Detailed Description

template<typename State>
struct IntegrationTask< State >

C++20 协程与 diffeq 库集成示例

这个示例展示了如何使用 C++20 协程特性与微分方程积分器结合, 实现更细粒度的 CPU 运行控制和任务调度。

主要特性:

  • 协程化的积分步进,可以暂停和恢复
  • 细粒度的进度报告和控制
  • 协作式多任务处理
  • 零拷贝的状态传递

积分任务的协程返回类型

Definition at line 38 of file coroutine_integration_demo.cpp.

Member Typedef Documentation

◆ handle_type

template<typename State >
using IntegrationTask< State >::handle_type = std::coroutine_handle<promise_type>

Definition at line 67 of file coroutine_integration_demo.cpp.

Constructor & Destructor Documentation

◆ IntegrationTask() [1/2]

template<typename State >
IntegrationTask< State >::IntegrationTask ( handle_type  h)
inlineexplicit

Definition at line 70 of file coroutine_integration_demo.cpp.

◆ ~IntegrationTask()

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

Definition at line 72 of file coroutine_integration_demo.cpp.

◆ IntegrationTask() [2/2]

template<typename State >
IntegrationTask< State >::IntegrationTask ( IntegrationTask< State > &&  other)
inlinenoexcept

Definition at line 79 of file coroutine_integration_demo.cpp.

Member Function Documentation

◆ await_ready()

template<typename State >
bool IntegrationTask< State >::await_ready ( ) const
inlinenoexcept

Definition at line 122 of file coroutine_integration_demo.cpp.

◆ await_resume()

template<typename State >
std::pair< State, double > IntegrationTask< State >::await_resume ( )
inline

Definition at line 137 of file coroutine_integration_demo.cpp.

◆ await_suspend()

template<typename State >
void IntegrationTask< State >::await_suspend ( std::coroutine_handle<>  h)
inline

Definition at line 126 of file coroutine_integration_demo.cpp.

◆ check_exception()

template<typename State >
void IntegrationTask< State >::check_exception ( )
inline

Definition at line 115 of file coroutine_integration_demo.cpp.

◆ done()

template<typename State >
bool IntegrationTask< State >::done ( ) const
inline

Definition at line 102 of file coroutine_integration_demo.cpp.

◆ get_current()

template<typename State >
std::pair< State, double > IntegrationTask< State >::get_current ( ) const
inline

Definition at line 107 of file coroutine_integration_demo.cpp.

◆ operator=()

template<typename State >
IntegrationTask & IntegrationTask< State >::operator= ( IntegrationTask< State > &&  other)
inlinenoexcept

Definition at line 82 of file coroutine_integration_demo.cpp.

◆ resume()

template<typename State >
bool IntegrationTask< State >::resume ( )
inline

Definition at line 95 of file coroutine_integration_demo.cpp.

Member Data Documentation

◆ coro

template<typename State >
handle_type IntegrationTask< State >::coro

Definition at line 68 of file coroutine_integration_demo.cpp.


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