diff --git a/Tudat/Astrodynamics/Gravitation/sphericalHarmonicsGravityField.cpp b/Tudat/Astrodynamics/Gravitation/sphericalHarmonicsGravityField.cpp index c3a2cf0383..9ccd33fe07 100644 --- a/Tudat/Astrodynamics/Gravitation/sphericalHarmonicsGravityField.cpp +++ b/Tudat/Astrodynamics/Gravitation/sphericalHarmonicsGravityField.cpp @@ -110,7 +110,7 @@ double calculateSphericalHarmonicGravitationalPotential( order <= degree ); order++ ) { // Calculate legendre polynomial (geodesy-normalized) at current degree and order - legendrePolynomial = basic_mathematics::computeGeodesyLegendrePolynomial( + legendrePolynomial = basic_mathematics::computeGeodesyLegendrePolynomialFromCache( degree, order, legendreCacheReference ); // Calculate contribution to potential from current degree and order @@ -128,5 +128,7 @@ double calculateSphericalHarmonicGravitationalPotential( // Multiply by central term and return return potential * gravitationalParameter / bodyFixedPosition.norm( ); } -} -} + +} // namespace gravitation + +} // namespace tudat diff --git a/Tudat/Mathematics/BasicMathematics/UnitTests/unitTestLegendrePolynomials.cpp b/Tudat/Mathematics/BasicMathematics/UnitTests/unitTestLegendrePolynomials.cpp index 5c88449cd8..c407be6579 100644 --- a/Tudat/Mathematics/BasicMathematics/UnitTests/unitTestLegendrePolynomials.cpp +++ b/Tudat/Mathematics/BasicMathematics/UnitTests/unitTestLegendrePolynomials.cpp @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE( test_LegendrePolynomial ) for ( int index = 0; index < degree.size( ); index++ ) { // Compute test value of Legendre polynomial. - computedTestValues( index ) = basic_mathematics::computeLegendrePolynomial( + computedTestValues( index ) = basic_mathematics::computeLegendrePolynomialFromCache( degree( index ), order( index ), legendreCache ); @@ -150,7 +150,7 @@ BOOST_AUTO_TEST_CASE( test_GeodesyLegendrePolynomial ) for ( int index = 0; index < degree.size( ); index++ ) { // Compute test value of Legendre polynomial. - computedTestValues( index ) = basic_mathematics::computeGeodesyLegendrePolynomial( + computedTestValues( index ) = basic_mathematics::computeGeodesyLegendrePolynomialFromCache( degree( index ), order( index ), legendreCache ); computedTestValuesDirect( index ) = basic_mathematics::computeGeodesyLegendrePolynomial( diff --git a/Tudat/Mathematics/BasicMathematics/legendrePolynomials.cpp b/Tudat/Mathematics/BasicMathematics/legendrePolynomials.cpp index 78ea4fd988..338157defe 100644 --- a/Tudat/Mathematics/BasicMathematics/legendrePolynomials.cpp +++ b/Tudat/Mathematics/BasicMathematics/legendrePolynomials.cpp @@ -333,9 +333,9 @@ double LegendreCache::getLegendrePolynomialSecondDerivative( } //! Compute unnormalized associated Legendre polynomial. -double computeLegendrePolynomial( const int degree, - const int order, - LegendreCache& legendreCache ) +double computeLegendrePolynomialFromCache( const int degree, + const int order, + LegendreCache& legendreCache ) { if( legendreCache.getUseGeodesyNormalization( ) ) { @@ -412,14 +412,14 @@ double computeLegendrePolynomial( const int degree, { LegendreCache legendreCache( degree, order, 0 ); legendreCache.update( legendreParameter ); - return computeLegendrePolynomial( degree, order, legendreCache ); + return computeLegendrePolynomialFromCache( degree, order, legendreCache ); } //! Compute geodesy-normalized associated Legendre polynomial. -double computeGeodesyLegendrePolynomial( const int degree, - const int order, - LegendreCache& geodesyLegendreCache ) +double computeGeodesyLegendrePolynomialFromCache( const int degree, + const int order, + LegendreCache& geodesyLegendreCache ) { if( !geodesyLegendreCache.getUseGeodesyNormalization( ) ) @@ -490,13 +490,14 @@ double computeGeodesyLegendrePolynomial( const int degree, } } +//! Compute geodesy-normalized associated Legendre polynomial. double computeGeodesyLegendrePolynomial( const int degree, const int order, const double legendreParameter ) { LegendreCache legendreCache( degree, order, 1 ); legendreCache.update( legendreParameter ); - return computeGeodesyLegendrePolynomial( degree, order, legendreCache ); + return computeGeodesyLegendrePolynomialFromCache( degree, order, legendreCache ); } //! Compute derivative of unnormalized Legendre polynomial. diff --git a/Tudat/Mathematics/BasicMathematics/legendrePolynomials.h b/Tudat/Mathematics/BasicMathematics/legendrePolynomials.h index 937c67cbfc..924163f9bd 100644 --- a/Tudat/Mathematics/BasicMathematics/legendrePolynomials.h +++ b/Tudat/Mathematics/BasicMathematics/legendrePolynomials.h @@ -286,9 +286,9 @@ class LegendreCache * \param legendreCache Legendre cache from which to retrieve Legendre polynomial. * \return Unnormalized Legendre polynomial. */ -double computeLegendrePolynomial( const int degree, - const int order, - LegendreCache& legendreCache ); +double computeLegendrePolynomialFromCache( const int degree, + const int order, + LegendreCache& legendreCache ); //! Compute unnormalized associated Legendre polynomial. @@ -361,9 +361,9 @@ double computeLegendrePolynomial( const int degree, * \param geodesyLegendreCache Legendre cache from which to retrieve Legendre polynomial. * \return Geodesy-normalized Legendre polynomial. */ -double computeGeodesyLegendrePolynomial( const int degree, - const int order, - LegendreCache& geodesyLegendreCache ); +double computeGeodesyLegendrePolynomialFromCache( const int degree, + const int order, + LegendreCache& geodesyLegendreCache ); //! Compute geodesy-normalized associated Legendre polynomial. /*! @@ -643,8 +643,7 @@ double computeGeodesyLegendrePolynomialVertical( const int degree, //! Predefine boost function for geodesy-normalized Legendre polynomial. static const LegendreCache::LegendrePolynomialFunction geodesyNormalizedLegendrePolynomialFunction = - boost::bind( static_cast< double(&)( const int, const int, LegendreCache& )>( - &computeGeodesyLegendrePolynomial ), _1, _2, _3 ); + boost::bind( &computeGeodesyLegendrePolynomialFromCache, _1, _2, _3 ); //! Function to calculate the normalization factor for Legendre polynomials to geodesy-normalized. /*! @@ -660,8 +659,7 @@ double calculateLegendreGeodesyNormalizationFactor( const int degree, const int //! Predefine boost function for unnormalized Legendre polynomial. const LegendreCache::LegendrePolynomialFunction regularLegendrePolynomialFunction = - boost::bind( static_cast< double(&)( const int, const int, LegendreCache& )>( - &computeLegendrePolynomial ), _1, _2, _3 ); + boost::bind( &computeLegendrePolynomialFromCache, _1, _2, _3 ); } // namespace basic_mathematics } // namespace tudat