Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed minor style issues in recently committed code #64

Merged
merged 1 commit into from
Sep 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Tudat/Astrodynamics/Aerodynamics/aerodynamics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,12 +500,14 @@ double computeShockDeflectionAngle( double shockAngle, double machNumber,
return atan( tangentOfDeflectionAngle_ );
}

//! Function to compute the speed of sound in a gas
double computeSpeedOfSound( const double temperature, const double ratioOfSpecificHeats,
const double specificGasConstant )
{
return std::sqrt( temperature * ratioOfSpecificHeats * specificGasConstant );
}

//! Function to compute the mean free path of a particle.
double computeMeanFreePath( const double weightedAverageCollisionDiameter, const double averageNumberDensity )
{
return 1.0 / ( std::sqrt( 2.0 ) * tudat::mathematical_constants::PI * weightedAverageCollisionDiameter *
Expand Down
18 changes: 17 additions & 1 deletion Tudat/Astrodynamics/Aerodynamics/aerodynamics.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,26 @@ double computeShockTotalPressureRatio( double normalMachNumber,
double computeShockDeflectionAngle( double shockAngle, double machNumber,
double ratioOfSpecificHeats );

//! Function to compute the speed of sound in a gas
/*!
* Function to compute the speed of sound in a gas
* \param temperature Gas temperature
* \param ratioOfSpecificHeats Ratio of specific heats aat constant pressure and constant volume
* \param specificGasConstant Specific gas constant of the gas
* \return Speed of sound in the gas.
*/
double computeSpeedOfSound( const double temperature, const double ratioOfSpecificHeats,
const double specificGasConstant );

// (Chapman, S. & Cowling, T. The mathematical theory of nonuniform gases Cambridge University Press, 1970)
//! Function to compute the mean free path of a particle.
/*!
* Function to compute the mean free path of a particle from e.g. (Chapman, S. & Cowling, T. The mathematical theory of
* nonuniform gases Cambridge University Press, 1970)
* \param weightedAverageCollisionDiameter Weighted (using specie number density) average collision diameter of the
* particles in the gas.
* \param averageNumberDensity Average number density of the gas.
* \return Mean free path of a particle in the gas.
*/
double computeMeanFreePath( const double weightedAverageCollisionDiameter, const double averageNumberDensity );


Expand Down
4 changes: 2 additions & 2 deletions Tudat/Astrodynamics/Aerodynamics/nrlmsise00Atmosphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ std::ostream& operator<<( std::ostream& stream,
stream << "f107a = " << nrlmsiseInput.f107a << std::endl;
stream << "apDaily = " << nrlmsiseInput.apDaily << std::endl;

for( unsigned int i = 0 ; i < nrlmsiseInput.apVector.size() ; i++ )
for( unsigned int i = 0 ; i < nrlmsiseInput.apVector.size( ) ; i++ )
{
stream << "apVector[ " << i << " ] = " << nrlmsiseInput.apVector[i] << std::endl;
}

for( unsigned int i = 0 ; i < nrlmsiseInput.switches.size() ; i++ )
for( unsigned int i = 0 ; i < nrlmsiseInput.switches.size( ) ; i++ )
{
stream << "switches[ " << i << " ] = " << nrlmsiseInput.switches[i] << std::endl;
}
Expand Down
16 changes: 8 additions & 8 deletions Tudat/Astrodynamics/Aerodynamics/nrlmsise00Atmosphere.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct GasComponentProperties
* Data to be verified
*
*/
GasComponentProperties():
GasComponentProperties( ):
diameterArgon(340E-12), diameterAtomicHydrogen(260E-12), diameterHelium(256E-12),
diameterNitrogen(370E-12), diameterOxygen(358E-12), diameterAtomicNitrogen(290E-12),
diameterAtomicOxygen(280E-12), molarMassArgon(39.948E-3), molarMassAtomicHydrogen(1.008E-3),
Expand Down Expand Up @@ -213,12 +213,12 @@ class NRLMSISE00Atmosphere : public AtmosphereModel
* \param useIdealGasLaw Variable denoting whether to use the ideal gas law for computation of pressure.
*/
NRLMSISE00Atmosphere( const NRLMSISE00InputFunction nrlmsise00InputFunction,
const bool useIdealGasLaw = true)
: nrlmsise00InputFunction_(nrlmsise00InputFunction)
const bool useIdealGasLaw = true )
:nrlmsise00InputFunction_(nrlmsise00InputFunction)
{
resetHashKey();
resetHashKey( );
molarGasConstant_ = tudat::physical_constants::MOLAR_GAS_CONSTANT;
specificHeatRatio_ = 1.4 ;
specificHeatRatio_ = 1.4;
GasComponentProperties gasProperties;
gasComponentProperties_ = gasProperties; // Default gas properties
useIdealGasLaw_ = useIdealGasLaw;
Expand All @@ -239,11 +239,11 @@ class NRLMSISE00Atmosphere : public AtmosphereModel
const bool useIdealGasLaw = true)
: nrlmsise00InputFunction_(nrlmsise00InputFunction)
{
resetHashKey();
resetHashKey( );
molarGasConstant_ = tudat::physical_constants::MOLAR_GAS_CONSTANT;
specificHeatRatio_ = specificHeatRatio ;
specificHeatRatio_ = specificHeatRatio;
gasComponentProperties_ = gasProperties;
useIdealGasLaw_ = useIdealGasLaw ;
useIdealGasLaw_ = useIdealGasLaw;
}

//! Set gas component properties.
Expand Down
8 changes: 2 additions & 6 deletions Tudat/Astrodynamics/Aerodynamics/nrlmsise00InputFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ NRLMSISE00Input nrlmsiseInputFunction( const double altitude, const double longi
time, basic_astrodynamics::JULIAN_DAY_ON_J2000 );
double julianDay = std::floor( julianDate - 0.5 ) + 0.5;

// Move not always find, only if day changes
// Only use datamap with this day + some extra days..
// Find solar activity data for current date


// Check if solar activity is found for current day.
if( solarActivityMap.count( julianDay ) == 0 )
{
std::cerr << "Solar activity data could not be found for this date.." << std::endl;
Expand Down Expand Up @@ -104,7 +100,7 @@ NRLMSISE00Input nrlmsiseInputFunction( const double altitude, const double longi
nrlmsiseInputData.f107a = solarActivity->centered81DaySolarRadioFlux107Observed;
}
nrlmsiseInputData.apDaily = solarActivity->planetaryEquivalentAmplitudeAverage;
nrlmsiseInputData.apVector = eigenToStlVector( solarActivity->planetaryEquivalentAmplitudeVector ); // std vector
nrlmsiseInputData.apVector = eigenToStlVector( solarActivity->planetaryEquivalentAmplitudeVector );

// Compute local solar time
// Hrs since begin of the day at longitude 0 (GMT) + Hrs passed at current longitude
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,11 @@
/* Copyright (c) 2010-2015, Delft University of Technology
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* - Neither the name of the Delft University of Technology nor the names of its contributors
* may be used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Changelog
* YYMMDD Author Comment
* 110621 F.M. Engelen File created.
* 110707 E.A.G. Heeren Minor spelling/lay-out corrections.
* 110714 E.A.G. Heeren Minor spelling/lay-out corrections.
* 110905 S. Billemont Reorganized includes.
* Moved (con/de)structors and getter/setters to header.
* 120529 E.A.G. Heeren Boostified unit test.
* 120615 T. Secretin Added check for exception handling.
* 120716 D. Dirkx Updated with interpolator architecture.
*
* References
*
* Notes
/* Copyright (c) 2010-2016, Delft University of Technology
* All rigths reserved
*
* This file is part of the Tudat. Redistribution and use in source and
* binary forms, with or without modification, are permitted exclusively
* under the terms of the Modified BSD license. You should have received
* a copy of the license with this file. If not, please or visit:
* http://tudat.tudelft.nl/LICENSE.
*/

#define BOOST_TEST_MAIN
Expand Down
29 changes: 21 additions & 8 deletions Tudat/Mathematics/Interpolators/hermiteCubicSplineInterpolator.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/* Copyright (c) 2010-2016, Delft University of Technology
* All rigths reserved
*
* This file is part of the Tudat. Redistribution and use in source and
* binary forms, with or without modification, are permitted exclusively
* under the terms of the Modified BSD license. You should have received
* a copy of the license with this file. If not, please or visit:
* http://tudat.tudelft.nl/LICENSE.
*/


#ifndef TUDAT_HERMITE_CUBIC_SPLINE_INTERPOLATOR_H
#define TUDAT_HERMITE_CUBIC_SPLINE_INTERPOLATOR_H

Expand Down Expand Up @@ -113,7 +124,7 @@ class HermiteCubicSplineInterpolator :
int lowerEntry_ = lookUpScheme_->findNearestLowerNeighbour(
targetIndependentVariableValue );

// Compute Hermite spline: p(x) = a((x-x0)/(x1-x0))^3 + b((x-x0)/(x1-x0))^2 + c((x-x0)/(x1-x0)) + d
// Compute Hermite spline
IndependentVariableType factor = ( targetIndependentVariableValue - independentValues_[ lowerEntry_ ] )
/( independentValues_[ lowerEntry_ + 1 ] - independentValues_[ lowerEntry_ ] );
DependentVariableType targetValue =
Expand All @@ -128,7 +139,7 @@ class HermiteCubicSplineInterpolator :
protected:

//! Compute coefficients of the splines
void computeCoefficients()
void computeCoefficients( )
{
// Initialize vector
std::vector< DependentVariableType > zeroVect( independentValues_.size( ) - 1 );
Expand All @@ -138,24 +149,25 @@ class HermiteCubicSplineInterpolator :
coefficients_.push_back( zeroVect );
}

// Compute coefficients for polynomials.
// Compute coefficients for polynomials a, b, c and d so that interpolant p is:
// p(x) = a((x-x0)/(x1-x0))^3 + b((x-x0)/(x1-x0))^2 + c((x-x0)/(x1-x0)) + d.
for( unsigned int i = 0 ; i < ( independentValues_.size() - 1 ) ; i++ )
{
// p(x) = a((x-x0)/(x1-x0))^3 + b((x-x0)/(x1-x0))^2 + c((x-x0)/(x1-x0)) + d
// a

// Compute coefficient a
coefficients_[ 0 ][ i ] = 2.0 * dependentValues_[ i ] - 2.0 * dependentValues_[ i + 1 ] +
derivativeValues_[ i ]*(independentValues_[ i + 1 ]-independentValues_[ i ] ) +
derivativeValues_[ i + 1 ]*(independentValues_[ i + 1 ]-independentValues_[ i ] );

// b
// Compute coefficient b
coefficients_[ 1 ][ i ] = -3.0 * dependentValues_[ i ] + 3.0 * dependentValues_[ i + 1 ] -
2.0 * derivativeValues_[ i ]*(independentValues_[ i + 1 ]-independentValues_[ i ] ) -
derivativeValues_[ i + 1 ]*(independentValues_[ i + 1 ]-independentValues_[ i ] );

// c
// Compute coefficient c
coefficients_[ 2 ][ i ] = derivativeValues_[ i ] * ( independentValues_[ i + 1 ]-independentValues_[ i ] );

// d
// Compute coefficient d
coefficients_[ 3 ][ i ] = dependentValues_[ i ] ;
}
}
Expand All @@ -170,6 +182,7 @@ class HermiteCubicSplineInterpolator :
std::vector< std::vector< DependentVariableType > > coefficients_ ;
};

//! Typede for cubic hermite spline with double (in)dependent variables.
typedef HermiteCubicSplineInterpolator< double, double > HermiteCubicSplineInterpolatorDouble;

} //namespace tudat
Expand Down
43 changes: 9 additions & 34 deletions Tudat/Mathematics/NumericalQuadrature/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,12 @@
# Copyright (c) 2010-2015, Delft University of Technology
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
# - Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright notice, this list of
# conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
# - Neither the name of the Delft University of Technology nor the names of its contributors
# may be used to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Changelog
# YYMMDD Author Comment
# 110820 S.M. Persson File created.
# 111025 K. Kumar Adapted file to work with Revision 194.
# 111026 K. Kumar Adapted file so all headers show in project tree in Qt Creator.
#
# References
#
# Notes
#
# Copyright (c) 2010-2016, Delft University of Technology
# All rigths reserved
#
# This file is part of the Tudat. Redistribution and use in source and
# binary forms, with or without modification, are permitted exclusively
# under the terms of the Modified BSD license. You should have received
# a copy of the license with this file. If not, please or visit:
# http://tudat.tudelft.nl/LICENSE.
#

# Add source files.
set(NUMERICAL_QUADRATURE_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class TrapezoidNumericalQuadrature : public NumericalQuadrature< IndependentVari

};

//! Typede for trapezoidal quadrature with double (in)dependent variables.
typedef boost::shared_ptr< TrapezoidNumericalQuadrature< double, double > > TrapezoidNumericalIntegratorPointerd;

} // namespace numerical_quadrature
Expand Down