🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
ODEEventDetector.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24
25AST_NAMESPACE_BEGIN
26
27
28class Bracket;
29
35class AST_MATH_API ODEEventDetector
36{
37public:
40 {
41 eDecrease = -1,
42 eBoth = 0,
43 eIncrease = 1,
44 };
45
46 ODEEventDetector() = default;
47 virtual ~ODEEventDetector() = default;
48
53 virtual double getDifference(const double* y,double x) const{return getValue(y, x) - goal_;}
54
59 virtual double getValue(const double* y,double x) const = 0;
60
64 virtual bool containsEvent(const Bracket& bracket) const;
65
68 int getRepeatCount() const { return repeatCount_; }
69 void setRepeatCount(int repeatCount) { repeatCount_ = repeatCount; }
70
73 EDirection getDirection() const { return direction_; }
74 void setDirection(EDirection direction) { direction_ = direction; }
75
78 double getThreshold() const { return threshold_; }
79 void setThreshold(double threshold) { threshold_ = threshold; }
80
83 double getGoal() const { return goal_; }
84 void setGoal(double goal) { goal_ = goal; }
85
86
87private:
88 int repeatCount_{1};
89 EDirection direction_{EDirection::eBoth};
90 double threshold_{1e-10};
91 double goal_{0.0};
92};
93
96template<typename Func>
98{
99public:
100 explicit ODEEventDetectorGeneric(Func func)
101 : func_(std::move(func))
102 {}
103
104 double getValue(const double* y,double x) const override {
105 return func_(y, x);
106 }
107
108private:
109 Func func_;
110};
111
112
113AST_NAMESPACE_END
括号区间,包含左右边界和左右边界对应的值
定义 Bracket.hpp:34
泛型ODE积分的事件检测器
定义 ODEEventDetector.hpp:98
double getValue(const double *y, double x) const override
用于事件检测的开关函数值
定义 ODEEventDetector.hpp:104
ODE积分的事件检测器
定义 ODEEventDetector.hpp:36
virtual double getValue(const double *y, double x) const =0
用于事件检测的开关函数值
EDirection getDirection() const
事件检测开关函数的方向
定义 ODEEventDetector.hpp:73
virtual double getDifference(const double *y, double x) const
用于事件检测的开关函数与目标值的差值
定义 ODEEventDetector.hpp:53
double getGoal() const
事件检测的目标值
定义 ODEEventDetector.hpp:83
double getThreshold() const
事件检测开关函数的阈值
定义 ODEEventDetector.hpp:78
int getRepeatCount() const
事件触发重复次数
定义 ODEEventDetector.hpp:68
EDirection
事件检测开关函数的条件
定义 ODEEventDetector.hpp:40