Skip to content

Commit

Permalink
Merge pull request #75 from DominicDirkx/CLangFix
Browse files Browse the repository at this point in the history
Modified code to prevent compilation error in Clang
  • Loading branch information
DominicDirkx authored Nov 4, 2016
2 parents f3f2a5c + 7fd43dc commit 9b78ec5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -128,5 +128,7 @@ double calculateSphericalHarmonicGravitationalPotential(
// Multiply by central term and return
return potential * gravitationalParameter / bodyFixedPosition.norm( );
}
}
}

} // namespace gravitation

} // namespace tudat
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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(
Expand Down
17 changes: 9 additions & 8 deletions Tudat/Mathematics/BasicMathematics/legendrePolynomials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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( ) )
{
Expand Down Expand Up @@ -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( ) )
Expand Down Expand Up @@ -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.
Expand Down
18 changes: 8 additions & 10 deletions Tudat/Mathematics/BasicMathematics/legendrePolynomials.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
/*!
Expand Down Expand Up @@ -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.
/*!
Expand All @@ -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
Expand Down

0 comments on commit 9b78ec5

Please sign in to comment.