gravityModel

class GravityModel
#include <gravityModel.h>

GravityModel is a purely abstract class the represents a mathematical body for computing the gravity field generated by a body at some arbitrary point in space.

Subclassed by PointMassGravityModel

Public Functions

virtual ~GravityModel() = default
GravityModel() = default
GravityModel(const GravityModel&) = delete
GravityModel &operator=(const GravityModel&) = delete
GravityModel(GravityModel&&) = delete
GravityModel &operator=(GravityModel&&) = delete
virtual std::optional<std::string> initializeParameters() = 0

Initializes any parameters necessary for the computation of gravity.

This method can be called to generate all dependent parameters assuming that all independent parameters have been set.

This method returns an empty string whenever initialization was succesful. Otherwise, the returned string will be used as the error message.

virtual std::optional<std::string> initializeParameters(const GravBodyData&) = 0

Initialize any parameters necessary for the computation of gravity.

See GravityModel::initializeParameters().

Unlike GravityModel::initializeParameters(), this method is passed a GravBodyData, which can be used to initialize parameters, such as the gravitational constant or the radius.

This method is called by GravityEffector::Reset on all GravBodyData. If the returned optional is set, GravityEffector::Reset will log an error with the value in the optional.

virtual Eigen::Vector3d computeField(const Eigen::Vector3d &position_planetFixed) const = 0

Returns the gravity acceleration at a position around this body.

The position is given in the body-fixed reference frame. Likewise, the resulting acceleration should be given in the body-fixed reference frame.

virtual double computePotentialEnergy(const Eigen::Vector3d &positionWrtPlanet_N) const = 0

Returns the gravitational potential energy at a position around this body.

The position is given relative to the body and in the inertial reference frame.

inline virtual bool dependsOnOrientation() const

Returns true if the gravity field depends on the orientation of the body.

This is true when the field has terms that vary with the body’s longitude (e.g. the tesseral/sectoral spherical-harmonic terms of order >= 1). When it returns true, a planet-orientation message must be connected to the gravity body; otherwise the body is treated as non-rotating and those longitude-dependent terms produce spurious results.

The default implementation returns false (e.g. point-mass gravity is orientation-independent).

Public Members

BSKLogger *bskLogger

pointer to bsk logging instance