24#include "AstMath/ODEEventDetectorList.hpp"
25#include "AstMath/ODEStateObserverList.hpp"
26#include "AstMath/ODEInnerStateObserver.hpp"
27#include "AstMath/OrdinaryDifferentialEquation.hpp"
28#include "AstUtil/Object.hpp"
29#include "AstUtil/ObjectNamed.hpp"
35class ODEEventDetector;
56 virtual errc_t
integrate(
ODE& ode,
double* y,
double& t,
double tf) = 0;
75 virtual errc_t
singleStep(
ODE& ode,
double* y,
double t0,
double step) = 0;
88 using IODEIntegrator::integrate;
90 errc_t initialize(
ODE& ode)
override;
103 ODE& ode,
double* y,
double& t,
double tf,
104 std::vector<double>& xlist, std::vector<std::vector<double>>& ylist
114 template<
typename Func>
115 errc_t
integrate(
int ndim, Func func,
double* y,
double& t,
double tf)
118 return integrate(ode, y, t, tf);
130 template<
typename Func>
131 typename std::enable_if<!std::is_base_of<ODEEventDetector, typename std::remove_pointer<Func>::type>::value,
ODEEventDetector*>::type
134 addEventDetector(detector);
145 void clearEventDetectors();
149 void clearStateObservers();
161 template<
typename Func>
162 typename std::enable_if<!std::is_base_of<ODEStateObserver, typename std::remove_pointer<Func>::type>::value,
ODEStateObserver*>::type
165 addStateObserver(observer);
204 errc_t integrateOneFixedStep(
ODE& ode,
double absStepSize,
double* y,
double& t,
double tf);
205 errc_t integrateFixedStep(
ODE& ode,
double absStepSize,
double* y,
double& t,
double tf,
int* pNumSteps=
nullptr);
208 void initWorkStateObserver();
216 double* stateAtStepStart_{
nullptr};
217 double* stateAtStepEnd_{
nullptr};
218 double* stateTemp_{
nullptr};
219 double timeAtStepStart_{0.0};
220 double timeAtStepEnd_{0.0};
ODE 积分器接口类
定义 ODEIntegrator.hpp:41
virtual errc_t singleStep(ODE &ode, double *y, double t0, double step)=0
执行一步积分(执行单次步进)
virtual errc_t integrateOneStep(ODE &ode, double *y, double &t, double tf)=0
从当前时间t朝着最终时间tf方向积分一步,并将积分结果存储在y中 如果当前时间t已经到达最终时间tf,则直接返回 如果是变步长积分器,步长会根据误差自动调整 如果是定步长积分器,步长会固定为初始步长
virtual errc_t integrate(ODE &ode, double *y, double &t, double tf)=0
从当前时间t开始积分到最终时间tf,直到事件检测器触发事件或者积分到最终时间tf,并将积分结果存储在y中
virtual errc_t initialize(ODE &ode)=0
初始化积分器
泛型ODE积分的事件检测器
定义 ODEEventDetector.hpp:98
定义 ODEEventDetectorList.hpp:32
ODE积分的事件检测器
定义 ODEEventDetector.hpp:36
定义 ODEInnerStateObserver.hpp:31
ODE 积分器
定义 ODEIntegrator.hpp:83
double * stateTemp()
获取临时状态向量
定义 ODEIntegrator.hpp:202
errc_t integrate(int ndim, Func func, double *y, double &t, double tf)
积分ODE
定义 ODEIntegrator.hpp:115
double & timeAtStepEnd()
获取当前积分步的结束时间
定义 ODEIntegrator.hpp:197
std::enable_if<!std::is_base_of< ODEStateObserver, typenamestd::remove_pointer< Func >::type >::value, ODEStateObserver * >::type addStateObserver(Func func)
添加状态观察者(泛型模板)
定义 ODEIntegrator.hpp:163
double * stateAtStepEnd()
获取当前积分步的结束状态
定义 ODEIntegrator.hpp:187
std::enable_if<!std::is_base_of< ODEEventDetector, typenamestd::remove_pointer< Func >::type >::value, ODEEventDetector * >::type addEventDetector(Func func)
添加事件检测器(泛型模板)
定义 ODEIntegrator.hpp:132
ODE * getODE()
获取ODE方程
定义 ODEIntegrator.hpp:177
ODEEventDetectorList eventDetectorList_
事件检测器列表
定义 ODEIntegrator.hpp:213
ODEStateObserverList stateObserverList_
状态观察者列表
定义 ODEIntegrator.hpp:214
double & timeAtStepStart()
获取当前积分步的开始时间
定义 ODEIntegrator.hpp:192
double * stateAtStepStart()
获取当前积分步的开始状态
定义 ODEIntegrator.hpp:182
泛型ODE状态量观察者
定义 ODEStateObserver.hpp:84
定义 ODEStateObserverList.hpp:30
ODE状态量观察者
定义 ODEStateObserver.hpp:39
命名对象
定义 ObjectNamed.hpp:36
常微分方程基接口
定义 OrdinaryDifferentialEquation.hpp:33
ODEGeneric< Func > make_ode(Func func, int dim)
创建一个常微分方程
定义 OrdinaryDifferentialEquation.hpp:89