🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
ODEEventDetector.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24
25AST_NAMESPACE_BEGIN
26
32class AST_MATH_API ODEEventDetector
33{
34public:
37 {
38 eDecrease = -1,
39 eBoth = 0,
40 eIncrease = 1,
41 };
42
43 ODEEventDetector() = default;
44 virtual ~ODEEventDetector() = default;
45
50 virtual double getDifference(const double* y,double x) const{return getValue(y, x) - goal_;}
51
56 virtual double getValue(const double* y,double x) const = 0;
57
60 int getRepeatCount() const { return repeatCount_; }
61 void setRepeatCount(int repeatCount) { repeatCount_ = repeatCount; }
62
65 EDirection getDirection() const { return direction_; }
66 void setDirection(EDirection direction) { direction_ = direction; }
67
70 double getThreshold() const { return threshold_; }
71 void setThreshold(double threshold) { threshold_ = threshold; }
72
75 double getGoal() const { return goal_; }
76 void setGoal(double goal) { goal_ = goal; }
77
78
79private:
80 int repeatCount_{1};
81 EDirection direction_{eBoth};
82 double threshold_{1e-10};
83 double goal_{0.0};
84};
85
88template<typename Func>
90{
91public:
92 explicit ODEEventDetectorGeneric(Func func)
93 : func_(std::move(func))
94 {}
95
96 double getValue(const double* y,double x) const override {
97 return func_(y, x);
98 }
99
100private:
101 Func func_;
102};
103
104
105AST_NAMESPACE_END
泛型ODE积分的事件检测器
定义 ODEEventDetector.hpp:90
double getValue(const double *y, double x) const override
用于事件检测的开关函数值
定义 ODEEventDetector.hpp:96
ODE积分的事件检测器
定义 ODEEventDetector.hpp:33
virtual double getValue(const double *y, double x) const =0
用于事件检测的开关函数值
EDirection getDirection() const
事件检测开关函数的方向
定义 ODEEventDetector.hpp:65
virtual double getDifference(const double *y, double x) const
用于事件检测的开关函数与目标值的差值
定义 ODEEventDetector.hpp:50
double getGoal() const
事件检测的目标值
定义 ODEEventDetector.hpp:75
double getThreshold() const
事件检测开关函数的阈值
定义 ODEEventDetector.hpp:70
int getRepeatCount() const
事件触发后的重复次数
定义 ODEEventDetector.hpp:60
EDirection
事件检测开关函数的条件
定义 ODEEventDetector.hpp:37