🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
CelestialBody.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstCore/Object.hpp"
25#include "AstCore/GravityField.hpp"
26#include "AstCore/JplDe.hpp"
27#include "AstCore/BodyEphemeris.hpp"
28#include "AstCore/BodyOrientation.hpp"
29#include "AstCore/AxesBodyInertial.hpp"
30#include "AstCore/AxesBodyFixed.hpp"
31#include "AstCore/AxesBodyMOD.hpp"
32#include "AstCore/AxesBodyTOD.hpp"
33#include "AstCore/Point.hpp"
34#include "AstCore/Frame.hpp"
35#include "AstCore/AxesAPI.hpp"
36#include "AstCore/BodyShape.hpp"
37#include "AstUtil/SharedPtr.hpp"
38#include "AstUtil/ScopedPtr.hpp"
39
40AST_NAMESPACE_BEGIN
41
47class CelestialBody;
48using Body = CelestialBody;
49
51class AST_CORE_API CelestialBody : public Point
52{
53public:
54 AST_OBJECT(CelestialBody)
55 static CelestialBody* Resolve(StringView value);
56
58 CelestialBody(SolarSystem* solarSystem);
59 CelestialBody(StringView name, SolarSystem* solarSystem = nullptr);
61
63 const std::string& getName() const override { return name_; }
64 const std::string& name() const { return name_; }
65 void setName(StringView name) override { name_ = std::string(name); }
66
68 int getJplSpiceId() const { return jplSpiceId_; }
69 void setJplSpiceId(int id) { jplSpiceId_ = id; }
70
72 int getJplIndex() const { return jplIndex_; }
73 void setJplIndex(int index);
74
76 std::string getDirpath() const;
77
79 SolarSystem* getSolarSystem() const;
80
82 CelestialBody* getParent() const { return parent_.get(); }
83public:
84
86 const std::string& getGravityModel() const{ return gravityField_.getModelName(); }
87
91 errc_t load(StringView filepath);
92
94 double getRadius() const { return radius_; }
95
97 double getGM() const { return gm_; }
98
100 double getSystemGM() const { return systemGM_; }
101
103 errc_t setGravityModel(StringView model);
104
106 double getJ2() const { return getJn(2); }
107
109 double getJ3() const { return getJn(3); }
110
112 double getJ4() const { return getJn(4); }
113
115 double getJ5() const { return getJn(5); }
116
118 double getJ6() const { return getJn(6); }
119
121 bool isEarth() const { return jplIndex_ == JplDe::eEarth; }
122
127 errc_t getPosICRF(const TimePoint& tp, Vector3d& pos) const;
128
129
135 errc_t getPosVelICRF(const TimePoint& tp, Vector3d& pos, Vector3d& vel) const;
136
137public: // 从Point继承重写的函数
138
139 Frame* getFrame() const final;
140 errc_t getPos(const TimePoint& tp, Vector3d& pos) const final;
141 errc_t getPosVel(const TimePoint& tp, Vector3d& pos, Vector3d& vel) const final;
142
143public: // 天体的形状、重力场、星历、姿态
144
146 BodyShape* getShape() const { return shape_.get(); }
147
149 const GravityField& getGravityField() const { return gravityField_; }
150
152 BodyEphemeris* getEphemeris() const { return ephemeris_.get(); }
153
155 BodyOrientation* getOrientation() const { return orientation_.get(); }
156
157public:
158
160 Point* getPointCenter() const { return const_cast<CelestialBody*>(this); }
161
163 Axes* getAxesInertial() const { return axesInertial_.get(); }
164
166 Axes* getAxesFixed() const { return axesFixed_.get(); }
167
169 Axes* getAxesMOD() const { return axesMOD_.get(); }
170
172 Axes* getAxesTOD() const { return axesTOD_.get(); }
173
178 Axes* getAxes(StringView name) const;
179
180#ifndef SWIG // 还没解决好swig封装智能指针的问题,暂时屏蔽
181public:
187 HAxes makeEpochAxes(Axes* sourceAxes, const TimePoint& tp, Axes* reference) const{return aMakeEpochAxes(sourceAxes, tp, reference);}
188
194 HAxes makeEpochAxes(Axes* sourceAxes, EventTime* time, Axes* reference) const{return aMakeEpochAxes(sourceAxes, time, reference);}
195
196
202 HFrame makeEpochFrame(Axes* sourceAxes, const TimePoint& tp, Axes* reference) const;
203
209 HFrame makeEpochFrame(Axes* sourceAxes, EventTime* time, Axes* reference) const;
210
212 HAxes makeAxesMOE(const TimePoint& tp) const;
213
215 HAxes makeAxesMOE(EventTime* time) const;
216
218 HAxes makeAxesTOE(const TimePoint& tp) const;
219
221 HAxes makeAxesTOE(EventTime* time) const;
222
224 HFrame makeFrameMOE(const TimePoint& tp) const;
225
227 HFrame makeFrameMOE(EventTime* time) const;
228
230 HFrame makeFrameTOE(const TimePoint& tp) const;
231
233 HFrame makeFrameTOE(EventTime* time) const;
234
235public:
238 HFrame makeFrame(Axes* axes) const;
239
241 HFrame makeFrameInertial() const;
242
244 HFrame makeFrameFixed() const;
245
247 HFrame makeFrameMOD() const;
248
250 HFrame makeFrameTOD() const;
251
253 HFrame makeFrameJ2000() const;
254
256 HFrame makeFrameICRF() const;
257#endif
258protected:
259
260 Axes* getEpochAxesReference() const;
261protected:
263 double getJn(int n) const { return gravityField_.getJn(n); }
264
266 errc_t loadGravityModel(StringView model);
267protected:
268 friend class SolarSystem;
269
271 errc_t loadAstroDefinition(BKVParser& parser);
272
274 errc_t loadSpinData(BKVParser& parser);
275
277 errc_t loadEphemerisData(BKVParser& parser);
278
280 errc_t loadEarth(BKVParser& parser);
281
283 errc_t loadMoon(BKVParser& parser);
284
286 errc_t loadMeanEarthDefinition(BKVParser& parser);
287
288 A_DISABLE_COPY(CelestialBody)
289protected:
292 std::string name_;
293 double gm_{0.0};
294 double systemGM_{0.0};
295 double radius_{0.0};
296 int jplSpiceId_{-1};
297 int jplIndex_{-1};
302
307
311};
312
313
314
315
319{
320 eSolarSystemBarycenter = 0,
321 eMercuryBarycenter = 1,
322 eVenusBarycenter = 2,
323 eEarthBarycenter = 3,
324 eMarsBarycenter = 4,
325 eJupiterBarycenter = 5,
326 eSaturnBarycenter = 6,
327 eUranusBarycenter = 7,
328 eNeptuneBarycenter = 8,
329 ePlutoBarycenter = 9,
330 eSun = 10,
331
332 eMercury = 199,
333
334 eVenus = 299,
335
336 eEarth = 399,
337 eMoon = 301,
338
339 eMars = 499,
340 ePhobos = 401,
341 eDeimos = 402,
342
343
344 eJupiter = 599,
345 eIo = 501,
346 eEuropa = 502,
347 eGanymede = 503,
348 eCallisto = 504,
349 eAmalthea = 505,
350 eHimalia = 506,
351 eElara = 507,
352 ePasiphae = 508,
353 eSinope = 509,
354 eLysithea = 510,
355 eCarme = 511,
356 eAnanke = 512,
357 eLeda = 513,
358 eThebe = 514,
359 eAdrastea = 515,
360 eMetis = 516,
361
362 eSaturn = 699,
363 eMimas = 601,
364 eEnceladus = 602,
365 eTethys = 603,
366 eDione = 604,
367 eRhea = 605,
368 eTitan = 606,
369 eHyperion = 607,
370 eIapetus = 608,
371 ePhoebe = 609,
372 eJanus = 610,
373 eEpimetheus = 611,
374 eHelene = 612,
375 eTelesto = 613,
376 eCalypso = 614,
377 eAtlas = 615,
378 ePrometheus = 616,
379 ePandora = 617,
380 ePan = 618,
381 eMethone = 632,
382 ePallene = 633,
383 ePolydeuces = 634,
384 eDaphnis = 635,
385 eAnthe = 649,
386 eAegaeon = 653,
387
388
389 eUranus = 799,
390 eAriel = 701,
391 eUmbriel = 702,
392 eTitania = 703,
393 eOberon = 704,
394 eMiranda = 705,
395 eCordelia = 706,
396 eOphelia = 707,
397 eBianca = 708,
398 eCressida = 709,
399 eDesdemona = 710,
400 eJuliet = 711,
401 ePortia = 712,
402 eRosalind = 713,
403 eBelinda = 714,
404 ePuck = 715,
405
406
407 eNeptune = 899,
408 eTriton = 801,
409 eNereid = 802,
410 eNaiad = 803,
411 eThalassa = 804,
412 eDespina = 805,
413 eGalatea = 806,
414 eLarissa = 807,
415 eProteus = 808,
416
417 ePluto = 999,
418 eCharon = 901,
419};
420
421
422
425
428
429
432AST_NAMESPACE_END
433
434
435
轴系类
定义 Axes.hpp:70
键值对解析器(BlockKeyValueParser)
定义 BKVParser.hpp:45
天体星历接口
定义 BodyEphemeris.hpp:38
天体姿态/指向
定义 BodyOrientation.hpp:39
天体形状基类
定义 BodyShape.hpp:30
天体
定义 CelestialBody.hpp:52
SharedPtr< BodyEphemeris > ephemeris_
天体星历
定义 CelestialBody.hpp:301
GravityField gravityField_
重力场
定义 CelestialBody.hpp:298
int getJplIndex() const
获取JPL索引
定义 CelestialBody.hpp:72
double getJ3() const
获取J3项
定义 CelestialBody.hpp:109
SharedPtr< BodyShape > shape_
天体形状
定义 CelestialBody.hpp:299
SharedPtr< AxesBodyMOD > axesMOD_
天体MOD轴
定义 CelestialBody.hpp:305
HAxes makeEpochAxes(Axes *sourceAxes, const TimePoint &tp, Axes *reference) const
创建新的历元轴系
定义 CelestialBody.hpp:187
double getJn(int n) const
获取Jn项
定义 CelestialBody.hpp:263
const std::string & getGravityModel() const
获取重力模型名称
定义 CelestialBody.hpp:86
SharedPtr< AxesBodyTOD > axesTOD_
天体TOD轴
定义 CelestialBody.hpp:306
SharedPtr< AxesBodyFixed > axesFixed_
天体固定轴
定义 CelestialBody.hpp:304
double getJ4() const
获取J4项
定义 CelestialBody.hpp:112
BodyEphemeris * getEphemeris() const
获取天体星历
定义 CelestialBody.hpp:152
CelestialBody * getParent() const
获取父天体
定义 CelestialBody.hpp:82
double getJ2() const
获取J2项
定义 CelestialBody.hpp:106
Axes * getAxesTOD() const
获取天体TOD轴系
定义 CelestialBody.hpp:172
double getGM() const
获取引力常数
定义 CelestialBody.hpp:97
HAxes makeEpochAxes(Axes *sourceAxes, EventTime *time, Axes *reference) const
创建新的历元轴系
定义 CelestialBody.hpp:194
Axes * getAxesMOD() const
获取天体MOD轴系
定义 CelestialBody.hpp:169
Point * getPointCenter() const
获取天体中心
定义 CelestialBody.hpp:160
Axes * getAxesFixed() const
获取天体固定轴系
定义 CelestialBody.hpp:166
void setName(StringView name) override
设置对象的名称
定义 CelestialBody.hpp:65
double getSystemGM() const
获取系统引力常数
定义 CelestialBody.hpp:100
double getRadius() const
获取天体半径
定义 CelestialBody.hpp:94
WeakPtr< SolarSystem > solarSystem_
太阳系指针
定义 CelestialBody.hpp:290
std::string name_
天体名称
定义 CelestialBody.hpp:292
SharedPtr< AxesBodyInertial > axesInertial_
天体惯性轴
定义 CelestialBody.hpp:303
bool isEarth() const
是否为地球
定义 CelestialBody.hpp:121
BodyOrientation * getOrientation() const
获取天体姿态
定义 CelestialBody.hpp:155
const std::string & getName() const override
获取天体名称
定义 CelestialBody.hpp:63
const GravityField & getGravityField() const
获取天体重力场
定义 CelestialBody.hpp:149
double getJ6() const
获取J6项
定义 CelestialBody.hpp:118
Axes * getAxesInertial() const
获取天体惯性轴系
定义 CelestialBody.hpp:163
SharedPtr< CelestialBody > parent_
父天体
定义 CelestialBody.hpp:291
int getJplSpiceId() const
获取JPL SPICE ID
定义 CelestialBody.hpp:68
double getJ5() const
获取J5项
定义 CelestialBody.hpp:115
SharedPtr< BodyOrientation > orientation_
天体姿态
定义 CelestialBody.hpp:300
事件时间
定义 EventTime.hpp:44
坐标系类
定义 Frame.hpp:60
重力场系数
定义 GravityField.hpp:63
@ eEarth
地球
定义 JplDe.hpp:48
const std::string & name() const
获取对象的名称
定义 Object.hpp:133
static Object * Resolve(StringView value)
解析字符串
定义 Object.cpp:38
定义 Point.hpp:38
virtual Frame * getFrame() const =0
获取点所在的参考坐标系
太阳系
定义 SolarSystem.hpp:54
绝对时间点
定义 TimePoint.hpp:106
弱引用指针
定义 WeakPtr.hpp:35
ESpiceId
SPICE 天体ID
定义 CelestialBody.hpp:319
HAxes aMakeEpochAxes(Axes *sourceAxes, const TimePoint &tp, Axes *referenceAxes)
创建一个历元轴系
定义 AxesAPI.cpp:27