Program Listing for File body.h¶
↰ Return to documentation for file (environment/body.h)
#pragma once
#include <string>
#include "lupnt/conversions/frame_converter.h"
#include "lupnt/core/constants.h"
namespace lupnt {
struct BodyData {
BodyId id;
std::string name;
Real GM;
Real R;
Frame fixed_frame;
Frame inertial_frame;
Real flattening;
Real omega; // sidereal rotation rate
UnitSystem units = SI_UNITS;
};
template <typename T = double> struct GravityField {
int n_max, m_max; // Maximum degree and order
int n, m; // Degree and order
T GM; // Gravitational constant [m^3/s^2]
T R; // Reference radius [m]
Matrix<T, Dynamic, Dynamic> CS; // Unnormalized coefficients
UnitSystem units = SI_UNITS;
};
struct Body {
BodyId id;
std::string name;
Real GM; // Gravitational constant
Real R; // Reference radius
Real omega; // sidereal rotation rate
UnitSystem units = SI_UNITS;
Frame fixed_frame;
Frame inertial_frame;
bool use_gravity_field;
GravityField<Real> gravity_field;
static Body Sun();
static Body Sun(const UnitSystem& units);
static Body Earth(int n = 0, int m = 0, std::string gravity_file = "EGM96.cof");
static Body Earth(const UnitSystem& units, int n = 0, int m = 0,
std::string gravity_file = "EGM96.cof");
static Body Moon(int n = 0, int m = 0, std::string gravity_file = "grgm900c.cof");
static Body Moon(const UnitSystem& units, int n = 0, int m = 0,
std::string gravity_file = "grgm900c.cof");
static Body Venus(int n = 0, int m = 0, std::string gravity_file = "MGN75HSAAP.cof");
static Body Venus(const UnitSystem& units, int n = 0, int m = 0,
std::string gravity_file = "MGN75HSAAP.cof");
static Body Mars(int n = 0, int m = 0, std::string gravity_file = "GMM1.cof");
static Body Mars(const UnitSystem& units, int n = 0, int m = 0,
std::string gravity_file = "GMM1.cof");
static Body Jupiter();
static Body Jupiter(const UnitSystem& units);
static Body Saturn();
static Body Saturn(const UnitSystem& units);
static Body Uranus();
static Body Uranus(const UnitSystem& units);
static Body Neptune();
static Body Neptune(const UnitSystem& units);
static Body CreateBody(BodyId body, int n = 0, int m = 0, std::string gravity_file = "");
static Body CreateBody(BodyId body, const UnitSystem& units, int n = 0, int m = 0,
std::string gravity_file = "");
};
template <typename T> GravityField<T> ReadHarmonicGravityField(const std::string& filename, int n,
int m, bool normalized);
template <typename T> GravityField<T> ReadHarmonicGravityField(const std::string& filename, int n,
int m, bool normalized,
const UnitSystem& units);
BodyData GetBodyData(BodyId id);
BodyData GetBodyData(BodyId id, const UnitSystem& units);
double GetBodyRadius(BodyId body);
double GetBodyRadius(BodyId body, const UnitSystem& units);
double GetBodyGM(BodyId body);
double GetBodyGM(BodyId body, const UnitSystem& units);
double GetBodyOmega(BodyId body);
double GetBodyOmega(BodyId body, const UnitSystem& units);
double GetBodyFlattening(BodyId body);
std::string GetBodyName(BodyId body);
Frame GetInertialFrameName(BodyId body);
Frame GetBodyFixedFrameName(BodyId body);
Body CreateBody(BodyId body, int n = 0, int m = 0);
Body CreateBody(BodyId body, const UnitSystem& units, int n = 0, int m = 0);
} // namespace lupnt