Struct Body¶
Defined in File body.h
Struct Documentation¶
-
struct Body¶
A celestial body used by environment and dynamics models.
A Body stores the body’s gravity parameter, reference radius, rotation rate, fixed/inertial frames, optional spherical-harmonic gravity field, and unit system. Factory methods create common solar-system bodies with SI units by default or with a caller-provided UnitSystem.
Public Members
-
std::string name¶
-
UnitSystem units = SI_UNITS¶
-
bool use_gravity_field¶
-
GravityField<Real> gravity_field¶
Public Static Functions
-
static Body Sun()¶
Create the Sun as a point-mass
Body(no spherical-harmonic gravity field), in SI units.Create a Body object for the Sun.
- Returns:
Body object for the Sun
-
static Body Sun(const UnitSystem &units)¶
Vec3-units overload of
Sun(): create the Sun in the requested unit system.
-
static Body Earth(int n = 0, int m = 0, std::string gravity_file = "EGM96.cof")¶
Create Earth as a
Body, in SI units, optionally loading annxmspherical-harmonic gravity field fromgravity_file.Create a Body object for the Earth.
Called by
Body::CreateBody/NBodyDynamics::AddBodyto assemble the central or perturbing-body list forNumericalOrbitDynamics;n/msetGravityField::n_max/m_maxtruncation used byAccelarationGravityField.- Parameters:
n – Max degree of the gravity field to load (0 disables the field, point-mass only)
m – Max order of the gravity field to load (0 disables the field, point-mass only)
gravity_file – Spherical-harmonic coefficient file name (default “EGM96.cof”)
- Returns:
Earth
Bodywith GM, R, omega, frames, and (if requested) gravity field populated- Returns:
Body object for the Earth
-
static Body Earth(const UnitSystem &units, int n = 0, int m = 0, std::string gravity_file = "EGM96.cof")¶
Unit-system overload of
Earth(): create Earth in the requested unit system.
-
static Body Moon(int n = 0, int m = 0, std::string gravity_file = "grgm900c.cof")¶
Create the Moon as a
Body, in SI units, optionally loading annxmspherical-harmonic gravity field (default GRGM900C) fromgravity_file.Create a Body object for the Moon.
See
Earth()for the role of the gravity-field parameters; used the same way byBody::CreateBody/NBodyDynamics::AddBodyfor Moon-centered or Moon-perturbation dynamics.- Returns:
Body object for the Moon
-
static Body Moon(const UnitSystem &units, int n = 0, int m = 0, std::string gravity_file = "grgm900c.cof")¶
Unit-system overload of
Moon(): create the Moon in the requested unit system.
-
static Body Venus(int n = 0, int m = 0, std::string gravity_file = "MGN75HSAAP.cof")¶
Create Venus as a
Body, in SI units, optionally loading annxmspherical-harmonic gravity field (default MGN75HSAAP) fromgravity_file.Create a Body object for Venus.
- Returns:
Body object for Venus
-
static Body Venus(const UnitSystem &units, int n = 0, int m = 0, std::string gravity_file = "MGN75HSAAP.cof")¶
Unit-system overload of
Venus(): create Venus in the requested unit system.
-
static Body Mars(int n = 0, int m = 0, std::string gravity_file = "GMM1.cof")¶
Create Mars as a
Body, in SI units, optionally loading annxmspherical-harmonic gravity field (default GMM1) fromgravity_file.Create a Body object for Mars.
- Returns:
Body object for Mars
-
static Body Mars(const UnitSystem &units, int n = 0, int m = 0, std::string gravity_file = "GMM1.cof")¶
Unit-system overload of
Mars(): create Mars in the requested unit system.
-
static Body Jupiter(const UnitSystem &units)¶
Unit-system overload of
Jupiter(): create Jupiter in the requested unit system.
-
static Body Saturn(const UnitSystem &units)¶
Unit-system overload of
Saturn(): create Saturn in the requested unit system.
-
static Body Uranus(const UnitSystem &units)¶
Unit-system overload of
Uranus(): create Uranus in the requested unit system.
-
static Body Neptune(const UnitSystem &units)¶
Unit-system overload of
Neptune(): create Neptune in the requested unit system.
-
static Body CreateBody(BodyId body, int n = 0, int m = 0, std::string gravity_file = "")¶
Dispatch to the matching per-planet factory (
Sun/Earth/Moon/…) based onbody’sBodyId, in SI units.Called by
NBodyDynamics::AddBody(viaBody::CreateBody(body_id, units_, n, / m, gravity_file)) to build each perturbing/central body listed in a dynamics-model config without per-body switch statements at the call site.- Parameters:
body – SPICE/LuPNT body identifier selecting which planet factory to call
n – Max degree of the gravity field to load (0 disables the field)
m – Max order of the gravity field to load (0 disables the field)
gravity_file – Spherical-harmonic coefficient file name (empty = use the per-body default)
- Returns:
Bodypopulated by the corresponding factory method
-
static Body CreateBody(BodyId body, const UnitSystem &units, int n = 0, int m = 0, std::string gravity_file = "")¶
Unit-system overload of
CreateBody(): create a body from its identifier in the requested unit system.
-
std::string name¶