Small Body Geophysical Analysis Tool (SBGAT)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
SBGATSphericalHarmo Class Reference

Computes/evaluates the outer spherical harmonics expansion of the exterior gravity field around a constant density polyhedron. More...

#include <SBGATSphericalHarmo.hpp>

Inheritance diagram for SBGATSphericalHarmo:
Inheritance graph
[legend]
Collaboration diagram for SBGATSphericalHarmo:
Collaboration graph
[legend]

Public Member Functions

 vtkTypeMacro (SBGATSphericalHarmo, vtkPolyDataAlgorithm)
 
void PrintSelf (std::ostream &os, vtkIndent indent) override
 
void PrintHeader (std::ostream &os, vtkIndent indent) override
 
void PrintTrailer (std::ostream &os, vtkIndent indent) override
 
void SetDegree (const unsigned int deg)
 
void SetReferenceRadius (const double ref_radius)
 
void SetDensity (const double density)
 
void IsNormalized ()
 
void IsNonNormalized ()
 
arma::mat GetCnm ()
 
void GetCnm (arma::mat &C_nm)
 
arma::mat GetSnm ()
 
void GetSnm (arma::mat &S_nm)
 
arma::vec::fixed< 3 > GetAcceleration (const arma::vec::fixed< 3 > &pos)
 
void GetGravityGradientMatrix (const arma::vec::fixed< 3 > &pos, arma::mat::fixed< 3, 3 > &dAccdPos)
 
void GetPartialHarmonics (const arma::vec::fixed< 3 > &pos, arma::mat &partial_C, arma::mat &partial_S)
 
void SetScaleMeters ()
 
void SetScaleKiloMeters ()
 
void SaveToJson (std::string path) const
 
void LoadFromJson (std::string path)
 
void SetCnm (arma::mat Cnm)
 
void SetSnm (arma::mat Snm)
 

Static Public Member Functions

static SBGATSphericalHarmoNew ()
 

Protected Member Functions

 SBGATSphericalHarmo ()
 
 ~SBGATSphericalHarmo () override
 
int RequestData (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
 

Protected Attributes

arma::mat Cnm
 
arma::mat Snm
 
double referenceRadius
 
double density
 
double totalMass
 
double scaleFactor = 1
 
bool normalized
 
unsigned int degree
 
int n_facets
 
int n_vertices
 
bool degreeSet
 
bool densitySet
 
bool referenceRadiusSet
 
bool scaleFactorSet
 
bool setFromJSON
 

Private Member Functions

 SBGATSphericalHarmo (const SBGATSphericalHarmo &)=delete
 
void operator= (const SBGATSphericalHarmo &)=delete
 

Detailed Description

Computes/evaluates the outer spherical harmonics expansion of the exterior gravity field around a constant density polyhedron.

Author
Benjamin Bercovici
Jay McMahon
Date
October 2018

Computes/evaluates the outer spherical harmonics expansion of the exterior gravity field around a constant density polyhedron. Normalized or non-normalized coefficients can be computed. The computed coefficients are completely independent of the mass and density of the considered object as they are only a geometric construct, thanks to the constant-density assumption. This class will always use results expressed in meters as their distance unit (e.g accelerations in m/s^2, potentials in m^2/s^2,...) . Unit consistency is enforced through the use of the SetScaleMeters() and SetScaleKiloMeters() method.

Adapted from the works of Yu Takahashi and Siamak Hesar by Benjamin Bercovici, University of Colorado Boulder for more details, see Werner, R. a. (1997). Spherical harmonic coefficients for the potential of a constant-density polyhedron. Computers & Geosciences, 23(10), 1071–1077. https://doi.org/10.1016/S0098-3004(97)00110-6

Definition at line 50 of file SBGATSphericalHarmo.hpp.

Constructor & Destructor Documentation

◆ SBGATSphericalHarmo() [1/2]

SBGATSphericalHarmo::SBGATSphericalHarmo ( )
protected

Definition at line 57 of file SBGATSphericalHarmo.cpp.

◆ ~SBGATSphericalHarmo()

SBGATSphericalHarmo::~SBGATSphericalHarmo ( )
overrideprotected

Definition at line 72 of file SBGATSphericalHarmo.cpp.

◆ SBGATSphericalHarmo() [2/2]

SBGATSphericalHarmo::SBGATSphericalHarmo ( const SBGATSphericalHarmo )
privatedelete

Member Function Documentation

◆ GetAcceleration()

arma::vec::fixed< 3 > SBGATSphericalHarmo::GetAcceleration ( const arma::vec::fixed< 3 > &  pos)

Return the acceleration due to gravity at the specified point

Parameters
posposition at which the acceleration must be evaluated (meters)
Returns
acceleration (m / s ^ 2)

Definition at line 191 of file SBGATSphericalHarmo.cpp.

◆ GetCnm() [1/2]

arma::mat SBGATSphericalHarmo::GetCnm ( )
inline

Definition at line 118 of file SBGATSphericalHarmo.hpp.

◆ GetCnm() [2/2]

void SBGATSphericalHarmo::GetCnm ( arma::mat &  C_nm)
inline

Definition at line 134 of file SBGATSphericalHarmo.hpp.

◆ GetGravityGradientMatrix()

void SBGATSphericalHarmo::GetGravityGradientMatrix ( const arma::vec::fixed< 3 > &  pos,
arma::mat::fixed< 3, 3 > &  dAccdPos 
)

Evaluates the gravity gradient matrix (the partial derivative of the spherical harmonics acceleration with respect to the position vector) at the prescribed location. Note that this gravity gradient matrix is expressed in the body-fixed frame of the considered object.

Parameters
[in]posposition at which the gravity gradient matrix must be evaluated, expressed in the same frame/same unit L as the shape used to build the spherical harmonics expansion.
[out]dAccdPoscontainer holding the gravity gradient matrix (1 / s ^ 2)

Definition at line 271 of file SBGATSphericalHarmo.cpp.

◆ GetPartialHarmonics()

void SBGATSphericalHarmo::GetPartialHarmonics ( const arma::vec::fixed< 3 > &  pos,
arma::mat &  partial_C,
arma::mat &  partial_S 
)

Evaluates the partial derivative of the spherical harmonics acceleration with respect to the spherical harmonics coefficients. The coefficients and the partials of the acceleration w/r to the coefficients are ordered like so:

Cnm : (C_00 == 1) 0 0 0 0 0 C_10 C_11 0 0 0 0 C_20 C_21 C_22 0 0 0

C_30 C_31 C_32 C_33 0 0

C_40 C_41 C_42 C_43 C_44 0 C_50 C_51 C_52 C_53 C_54 C_55

Snm : 0 0 0 0 0 0 0 S_11 0 0 0 0 0 S_21 S_22 0 0 0 0 S_31 S_32 S_33 0 0 0 S_41 S_42 S_43 S_44 0 0 S_51 S_52 S_53 S_54 S_55

so

partial_C = [ dA/C_00,dA/C_10,dA/C_11,dA/C_20,dA/C_21,dA/C_22,...] partial_S = [ dA/S_11,dA/C_21,dA/S_22,dA/S_31,dA/S_32,dA/S_33,...]

Parameters
[in]posposition at which the partial derivatives must be evaluated, expressed in the same frame/same unit as the shape used to build the spherical harmonics expansion.
[out]partial_Ccontainer holding the partial derivative of the acceleration with respect to the Cnm spherical harmonic coefficients. If the degree/order is n, then there are (n+1) * (n + 2)/2 non-zero Cnm coefficients
[out]partial_Scontainer holding the partial derivative of the acceleration with respect to the Snm spherical harmonic coefficients. If the degree/order is n, then there are (n+1) * (n + 2)/2 - n non-zero Snm coefficients

Definition at line 393 of file SBGATSphericalHarmo.cpp.

◆ GetSnm() [1/2]

arma::mat SBGATSphericalHarmo::GetSnm ( )
inline

Definition at line 151 of file SBGATSphericalHarmo.hpp.

◆ GetSnm() [2/2]

void SBGATSphericalHarmo::GetSnm ( arma::mat &  S_nm)
inline

Definition at line 165 of file SBGATSphericalHarmo.hpp.

◆ IsNonNormalized()

void SBGATSphericalHarmo::IsNonNormalized ( )
inline

Definition at line 101 of file SBGATSphericalHarmo.hpp.

◆ IsNormalized()

void SBGATSphericalHarmo::IsNormalized ( )
inline

Definition at line 94 of file SBGATSphericalHarmo.hpp.

◆ LoadFromJson()

void SBGATSphericalHarmo::LoadFromJson ( std::string  path)

Loads a previously computed spherical harmonics expansion from a JSON file. Will set the appropriate fields in the SBGATSphericalHarmo object to allow calls to other methods. The loadable fields are:

  • facets == number of facets (not needed for evaluation)
  • vertices == number of vertices (not needed for evaluation)
  • totalMass : {value, unit}
  • density : {value, unit}
  • reference_radius : {value, unit}
  • normalized == true if the coefficients are normalized
  • degree == degree of the spherical expansion
  • Cnm_coefs - vector of coefficients triplets {n,m,Cnm}
  • Snm_coefs - vector of coefficients triplets {n,m,Snm}
    Parameters
    pathJSON file storing the spherical harmonics model

Definition at line 540 of file SBGATSphericalHarmo.cpp.

◆ New()

static SBGATSphericalHarmo* SBGATSphericalHarmo::New ( )
static

Constructs with initial values of zero.

◆ operator=()

void SBGATSphericalHarmo::operator= ( const SBGATSphericalHarmo )
privatedelete

◆ PrintHeader()

void SBGATSphericalHarmo::PrintHeader ( std::ostream &  os,
vtkIndent  indent 
)
override

Definition at line 470 of file SBGATSphericalHarmo.cpp.

◆ PrintSelf()

void SBGATSphericalHarmo::PrintSelf ( std::ostream &  os,
vtkIndent  indent 
)
override

Definition at line 598 of file SBGATSphericalHarmo.cpp.

◆ PrintTrailer()

void SBGATSphericalHarmo::PrintTrailer ( std::ostream &  os,
vtkIndent  indent 
)
override

Definition at line 473 of file SBGATSphericalHarmo.cpp.

◆ RequestData()

int SBGATSphericalHarmo::RequestData ( vtkInformation *  request,
vtkInformationVector **  inputVector,
vtkInformationVector *  outputVector 
)
overrideprotected

Definition at line 81 of file SBGATSphericalHarmo.cpp.

◆ SaveToJson()

void SBGATSphericalHarmo::SaveToJson ( std::string  path) const

Exports the computed spherical harmonics expansion to a JSON file. The saved fields are:

  • facets == number of facets
  • vertices == number of vertices
  • totalMass : {value, unit}
  • density : {value, unit}
  • reference_radius : {value, unit}
  • normalized == true if the coefficients are normalized
  • degree == degree of the spherical expansion
  • Cnm_coefs - vector of coefficients triplets {n,m,Cnm}
  • Snm_coefs - vector of coefficients triplets {n,m,Snm}
    Parameters
    pathJSON file where the spherical harmonics model will be saved

Definition at line 478 of file SBGATSphericalHarmo.cpp.

◆ SetCnm()

void SBGATSphericalHarmo::SetCnm ( arma::mat  Cnm)
inline

Sets the Cnm coefficients. There is normally no need to use this method outside of Sbgat's tests

Parameters
[in]Cnmcoefficients

Definition at line 275 of file SBGATSphericalHarmo.hpp.

◆ SetDegree()

void SBGATSphericalHarmo::SetDegree ( const unsigned int  deg)
inline

Sets degree of spherical harmonics expansion

Parameters
degdegree of spherical harmonics expansion

Definition at line 66 of file SBGATSphericalHarmo.hpp.

◆ SetDensity()

void SBGATSphericalHarmo::SetDensity ( const double  density)
inline

Sets polyhedron density

Parameters
densitybulk density of polyhedron (kg/m^3)

Definition at line 85 of file SBGATSphericalHarmo.hpp.

◆ SetReferenceRadius()

void SBGATSphericalHarmo::SetReferenceRadius ( const double  ref_radius)
inline

Sets reference radius in spherical harmonics expansion. Must be consistent with the units in which the shape coordinates are expressed

Parameters
ref_radiusreference radius in spherical harmonics expansion

Definition at line 76 of file SBGATSphericalHarmo.hpp.

◆ SetScaleKiloMeters()

void SBGATSphericalHarmo::SetScaleKiloMeters ( )
inline

Sets the scale factor to 1000, indicative that the polydata has its coordinates expressed in kilometers

Definition at line 233 of file SBGATSphericalHarmo.hpp.

◆ SetScaleMeters()

void SBGATSphericalHarmo::SetScaleMeters ( )
inline

Sets the scale factor to 1, indicative that the polydata has its coordinates expressed in meters

Definition at line 228 of file SBGATSphericalHarmo.hpp.

◆ SetSnm()

void SBGATSphericalHarmo::SetSnm ( arma::mat  Snm)
inline

Sets the Snm coefficients. There is normally no need to use this method outside of Sbgat's tests

Parameters
[in]Snmcoefficients

Definition at line 281 of file SBGATSphericalHarmo.hpp.

◆ vtkTypeMacro()

SBGATSphericalHarmo::vtkTypeMacro ( SBGATSphericalHarmo  ,
vtkPolyDataAlgorithm   
)

Member Data Documentation

◆ Cnm

arma::mat SBGATSphericalHarmo::Cnm
protected

Definition at line 293 of file SBGATSphericalHarmo.hpp.

◆ degree

unsigned int SBGATSphericalHarmo::degree
protected

Definition at line 302 of file SBGATSphericalHarmo.hpp.

◆ degreeSet

bool SBGATSphericalHarmo::degreeSet
protected

Definition at line 307 of file SBGATSphericalHarmo.hpp.

◆ density

double SBGATSphericalHarmo::density
protected

Definition at line 297 of file SBGATSphericalHarmo.hpp.

◆ densitySet

bool SBGATSphericalHarmo::densitySet
protected

Definition at line 308 of file SBGATSphericalHarmo.hpp.

◆ n_facets

int SBGATSphericalHarmo::n_facets
protected

Definition at line 304 of file SBGATSphericalHarmo.hpp.

◆ n_vertices

int SBGATSphericalHarmo::n_vertices
protected

Definition at line 305 of file SBGATSphericalHarmo.hpp.

◆ normalized

bool SBGATSphericalHarmo::normalized
protected

Definition at line 301 of file SBGATSphericalHarmo.hpp.

◆ referenceRadius

double SBGATSphericalHarmo::referenceRadius
protected

Definition at line 296 of file SBGATSphericalHarmo.hpp.

◆ referenceRadiusSet

bool SBGATSphericalHarmo::referenceRadiusSet
protected

Definition at line 309 of file SBGATSphericalHarmo.hpp.

◆ scaleFactor

double SBGATSphericalHarmo::scaleFactor = 1
protected

Definition at line 299 of file SBGATSphericalHarmo.hpp.

◆ scaleFactorSet

bool SBGATSphericalHarmo::scaleFactorSet
protected

Definition at line 310 of file SBGATSphericalHarmo.hpp.

◆ setFromJSON

bool SBGATSphericalHarmo::setFromJSON
protected

Definition at line 311 of file SBGATSphericalHarmo.hpp.

◆ Snm

arma::mat SBGATSphericalHarmo::Snm
protected

Definition at line 294 of file SBGATSphericalHarmo.hpp.

◆ totalMass

double SBGATSphericalHarmo::totalMass
protected

Definition at line 298 of file SBGATSphericalHarmo.hpp.


The documentation for this class was generated from the following files: