Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into feature/odf_range
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriof7 committed Nov 15, 2024
2 parents c2ec600 + 50d94df commit 9cfed98
Show file tree
Hide file tree
Showing 103 changed files with 731 additions and 606 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.13.0.dev35
current_version = 2.13.0.dev41
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<dev>\d+))?
Expand Down
2 changes: 1 addition & 1 deletion include/tudat/astro/basic_astro/accelerationModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ typedef AccelerationModel< Eigen::Vector2d > AccelerationModel2d;
//! Typedef for shared-pointer to a 2D acceleration model.
typedef std::shared_ptr< AccelerationModel2d > AccelerationModel2dPointer;

extern template class AccelerationModel< Eigen::Vector3d >;
//extern template class AccelerationModel< Eigen::Vector3d >;


//! Update the members of an acceleration model and evaluate the acceleration.
Expand Down
2 changes: 2 additions & 0 deletions include/tudat/astro/basic_astro/accelerationModelTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "tudat/astro/gravitation/sphericalHarmonicsGravityModel.h"
#include "tudat/astro/gravitation/mutualSphericalHarmonicGravityModel.h"
#include "tudat/astro/gravitation/thirdBodyPerturbation.h"
#include "tudat/astro/gravitation/ringGravityModel.h"
#include "tudat/astro/gravitation/polyhedronGravityModel.h"
#include "tudat/astro/gravitation/directTidalDissipationAcceleration.h"
#include "tudat/astro/aerodynamics/aerodynamicAcceleration.h"
#include "tudat/astro/basic_astro/massRateModel.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,23 @@ class TerrestrialTimeScaleConverter
return convertedTimes;
}

template< typename TimeType >
std::vector< TimeType > getCurrentTimesFromSinglePosition(
const basic_astrodynamics::TimeScales inputScale, const basic_astrodynamics::TimeScales outputScale,
const std::vector< TimeType >& inputTimeValues,
const Eigen::Vector3d& earthFixedPosition )
{
std::vector < TimeType > convertedTimes;
convertedTimes.resize( inputTimeValues.size( ) );

for ( unsigned int i = 0; i < inputTimeValues.size(); ++i )
{
convertedTimes [ i ] =
getCurrentTime( inputScale, outputScale, inputTimeValues.at( i ), earthFixedPosition );
}
return convertedTimes;
}

//! Function to reset all current times at given precision to NaN.
template< typename TimeType >
void resetTimes( )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ std::shared_ptr< RotationalEphemeris > getTabulatedRotationalEphemeris(

}

extern template class TabulatedRotationalEphemeris< double, double >;
//extern template class TabulatedRotationalEphemeris< double, double >;


bool isTabulatedRotationalEphemeris( const std::shared_ptr< RotationalEphemeris > rotationalEphemeris );
Expand Down
2 changes: 1 addition & 1 deletion include/tudat/astro/gravitation/centralGravityModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ double computeGravitationalPotential(

//! Template class for central gravitational acceleration model.
/*!
* This template class implements a central gravitational acceleration model, i.e., only the
* This //template class implements a central gravitational acceleration model, i.e., only the
* central term of the general spherical harmonics expansion.
* \tparam StateMatrix Data type for state matrix (default = Eigen::Vector3d).
*/
Expand Down
55 changes: 54 additions & 1 deletion include/tudat/astro/gravitation/polyhedronGravityModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,66 @@ class PolyhedronGravitationalAccelerationModel: public basic_astrodynamics::Acce
updateLaplacianOfPotential_( updateLaplacianOfGravitationalPotential )
{ }

~PolyhedronGravitationalAccelerationModel( ){ }

//! Update class members.
/*!
* Updates all the base class members to their current values and also updates the class members of this class.
* The potential and laplacian of potential are only updated if the associated flags indicate so.
* \param currentTime Time at which acceleration model is to be updated.
*/
void updateMembers( const double currentTime = TUDAT_NAN );
void updateMembers( const double currentTime = TUDAT_NAN )
{
if( !( this->currentTime_ == currentTime ) )
{

rotationToIntegrationFrame_ = rotationFromBodyFixedToIntegrationFrameFunction_( );

subjectPositionFunction_( positionOfBodySubjectToAcceleration_ );
sourcePositionFunction_( positionOfBodyExertingAcceleration_ );
currentInertialRelativePosition_ =
positionOfBodySubjectToAcceleration_ - positionOfBodyExertingAcceleration_ ;

currentRelativePosition_ = rotationToIntegrationFrame_.inverse( ) * currentInertialRelativePosition_;

polyhedronCache_->update( currentRelativePosition_ );

// Compute the current acceleration
currentAccelerationInBodyFixedFrame_ = basic_mathematics::calculatePolyhedronGradientOfGravitationalPotential(
gravitationalParameterFunction_() / volumeFunction_(),
polyhedronCache_->getVerticesCoordinatesRelativeToFieldPoint(),
getVerticesDefiningEachFacet_(),
getVerticesDefiningEachEdge_(),
getFacetDyads_(),
getEdgeDyads_(),
polyhedronCache_->getPerFacetFactor(),
polyhedronCache_->getPerEdgeFactor() );

currentAcceleration_ = rotationToIntegrationFrame_ * currentAccelerationInBodyFixedFrame_;

// Compute the current gravitational potential
if ( updatePotential_ )
{
currentPotential_ = basic_mathematics::calculatePolyhedronGravitationalPotential(
gravitationalParameterFunction_( ) / volumeFunction_( ),
polyhedronCache_->getVerticesCoordinatesRelativeToFieldPoint( ),
getVerticesDefiningEachFacet_( ),
getVerticesDefiningEachEdge_( ),
getFacetDyads_( ),
getEdgeDyads_( ),
polyhedronCache_->getPerFacetFactor( ),
polyhedronCache_->getPerEdgeFactor( ) );
}

// Compute the current laplacian
if ( updateLaplacianOfPotential_ )
{
currentLaplacianOfPotential_ = basic_mathematics::calculatePolyhedronLaplacianOfGravitationalPotential(
gravitationalParameterFunction_( ) / volumeFunction_( ),
polyhedronCache_->getPerFacetFactor( ) );
}
}
}

//! Function to return current position vector from body exerting acceleration to body undergoing acceleration, in frame
//! fixed to body undergoing acceleration
Expand Down
43 changes: 42 additions & 1 deletion include/tudat/astro/gravitation/ringGravityModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,54 @@ class RingGravitationalAccelerationModel: public basic_astrodynamics::Accelerati
updatePotential_( updateGravitationalPotential )
{ }

~RingGravitationalAccelerationModel( ){ }

//! Update class members.
/*!
* Updates all the base class members to their current values and also updates the class members of this class.
* The potential and laplacian of potential are only updated if the associated flags indicate so.
* \param currentTime Time at which acceleration model is to be updated.
*/
void updateMembers( const double currentTime = TUDAT_NAN );
void updateMembers( const double currentTime = TUDAT_NAN )
{
if( !( this->currentTime_ == currentTime ) )
{

rotationToIntegrationFrame_ = rotationFromBodyFixedToIntegrationFrameFunction_( );

subjectPositionFunction_( positionOfBodySubjectToAcceleration_ );
sourcePositionFunction_( positionOfBodyExertingAcceleration_ );
currentInertialRelativePosition_ =
positionOfBodySubjectToAcceleration_ - positionOfBodyExertingAcceleration_ ;

currentRelativePosition_ = rotationToIntegrationFrame_.inverse( ) * currentInertialRelativePosition_;

ringCache_->setRingRadius( ringRadiusFunction_( ) );
ringCache_->update( currentRelativePosition_ );

// Compute the current acceleration
currentAccelerationInBodyFixedFrame_ = computeRingGravitationalAcceleration(
currentRelativePosition_,
ringRadiusFunction_( ),
gravitationalParameterFunction_(),
ringCache_->getEllipticIntegralB( ),
ringCache_->getEllipticIntegralE( ),
ringCache_->getEllipticIntegralS( ) );

currentAcceleration_ = rotationToIntegrationFrame_ * currentAccelerationInBodyFixedFrame_;

// Compute the current gravitational potential
if ( updatePotential_ )
{
currentPotential_ = computeRingGravitationalPotential(
currentRelativePosition_,
ringRadiusFunction_( ),
gravitationalParameterFunction_(),
ringCache_->getEllipticIntegralK( ) );
}

}
}

//! Function to return current position vector from body exerting acceleration to body undergoing acceleration, in frame
//! fixed to body undergoing acceleration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace gravitation

//! Template base class for spherical harmonics gravitational acceleration models.
/*!
* This template class serves as the base class for the
* This //template class serves as the base class for the
* SphericalHarmonicsGravitationalAccelerationModel, CentralGravitationalAccelerationModel,
* CentralJ2GravitationalAccelerationModel, CentralJ2J3GravitationalAccelerationModel, and
* CentralJ2J3J4GravitationalAccelerationModel classes.
Expand Down
43 changes: 9 additions & 34 deletions include/tudat/astro/ground_stations/transmittingFrequencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,47 +238,22 @@ class PiecewiseLinearFrequencyInterpolator: public StationFrequencyInterpolator
{
TimeType lookupTime = lookupTimeOriginal;
int lowerNearestNeighbour = -1;
try
{
lowerNearestNeighbour = startTimeLookupScheme_->findNearestLowerNeighbour( lookupTime );
}
catch( const std::exception& caughtException )
{
std::string exceptionText = std::string( caughtException.what( ) );
throw std::runtime_error(
"Error when interpolating ramp reference frequency: look up time (" + std::to_string(
static_cast< double >( lookupTime ) ) + ", caught exception: " + exceptionText );
}


// if( lookupTime > endTimes_.at( lowerNearestNeighbour ) || lookupTime < startTimes_.at ( lowerNearestNeighbour ) )
// {
// throw std::runtime_error(
// "Error when interpolating ramp reference frequency: look up time (" + std::to_string(
// static_cast< double >( lookupTime ) ) +
// ") is outside the ramp table interval (" + std::to_string( double( startTimes_.at( 0 ) ) ) + " to " +
// std::to_string( double( startTimes_.back( ) ) ) + ")." );
// }
if ( lookupTime > endTimes_.at( lowerNearestNeighbour ) )
{
lowerNearestNeighbour = endTimes_.size( ) - 1;
}
if ( lookupTime < startTimes_.at ( lowerNearestNeighbour ) )
if( lookupTimeOriginal < startTimes_.at( 0 ) )
{
lowerNearestNeighbour = 0;
}
else if ( invalidStartTimeLookupScheme_ != nullptr )
else
{
int invalidLowestNearestNeighbour = invalidStartTimeLookupScheme_->findNearestLowerNeighbour( lookupTime );
if ( lookupTime > invalidTimeBlocksStartTimes_.at ( invalidLowestNearestNeighbour ) &&
lookupTime < invalidTimeBlocksEndTimes_.at ( invalidLowestNearestNeighbour ) )
try
{
lowerNearestNeighbour = startTimeLookupScheme_->findNearestLowerNeighbour( lookupTime );
}
catch ( const std::exception &caughtException )
{
std::string exceptionText = std::string( caughtException.what( ));
throw std::runtime_error(
"Error when interpolating ramp reference frequency: look up time (" + std::to_string(
static_cast< double >( lookupTime ) ) +
") is in time interval without transmitted frequency (" +
std::to_string( double( invalidTimeBlocksStartTimes_.at ( invalidLowestNearestNeighbour ) ) ) + " to " +
std::to_string( double( invalidTimeBlocksEndTimes_.at ( invalidLowestNearestNeighbour ) ) ) + ")." );
static_cast< double >( lookupTime )) + ", caught exception: " + exceptionText );
}
}

Expand Down
12 changes: 6 additions & 6 deletions include/tudat/astro/observation_models/observationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,12 @@ class ObservationManager: public ObservationManagerBase< ObservationScalarType,

};


extern template class ObservationManagerBase< double, double >;
extern template class ObservationManager< 1, double, double >;
extern template class ObservationManager< 2, double, double >;
extern template class ObservationManager< 3, double, double >;
extern template class ObservationManager< 6, double, double >;
//
//extern template class ObservationManagerBase< double, double >;
//extern template class ObservationManager< 1, double, double >;
//extern template class ObservationManager< 2, double, double >;
//extern template class ObservationManager< 3, double, double >;
//extern template class ObservationManager< 6, double, double >;

}

Expand Down
10 changes: 5 additions & 5 deletions include/tudat/astro/observation_models/observationModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,11 +656,11 @@ class ObservationModel
//! Pre-define list of states used when calling function returning link-end states/times from interface function.
std::vector< Eigen::Matrix< double, 6, 1 > > linkEndStates_;
};

extern template class ObservationModel< 1, double, double >;
extern template class ObservationModel< 2, double, double >;
extern template class ObservationModel< 3, double, double >;
extern template class ObservationModel< 6, double, double >;
//
//extern template class ObservationModel< 1, double, double >;
//extern template class ObservationModel< 2, double, double >;
//extern template class ObservationModel< 3, double, double >;
//extern template class ObservationModel< 6, double, double >;

//! Function to compute an observation of size 1 at double precision, with double precision input
/*!
Expand Down
10 changes: 5 additions & 5 deletions include/tudat/astro/orbit_determination/podInputOutputTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1144,11 +1144,11 @@ struct EstimationOutput: public CovarianceAnalysisOutput< ObservationScalarType,

};

extern template class CovarianceAnalysisInput< double, double >;
extern template struct CovarianceAnalysisOutput< double >;

extern template class EstimationInput< double, double >;
extern template struct EstimationOutput< double >;
//extern template class CovarianceAnalysisInput< double, double >;
//extern template struct CovarianceAnalysisOutput< double >;
//
//extern template class EstimationInput< double, double >;
//extern template struct EstimationOutput< double >;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ class DynamicsStateDerivativeModel
std::map< TimeType, unsigned int > cumulativeFunctionEvaluationCounter_;
};

extern template class DynamicsStateDerivativeModel< double, double >;
//extern template class DynamicsStateDerivativeModel< double, double >;

inline std::vector< std::shared_ptr< basic_astrodynamics::AccelerationModel3d > > getAccelerationBetweenBodies(
const std::string bodyUndergoingAcceleration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class NBodyCowellStateDerivative: public NBodyStateDerivative< StateScalarType,

};

extern template class NBodyCowellStateDerivative< double, double >;
//extern template class NBodyCowellStateDerivative< double, double >;

} // namespace propagators

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class NBodyEnckeStateDerivative: public NBodyStateDerivative< StateScalarType, T

};

extern template class NBodyEnckeStateDerivative< double, double >;
//extern template class NBodyEnckeStateDerivative< double, double >;


} // namespace propagators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class NBodyGaussKeplerStateDerivative: public NBodyStateDerivative< StateScalarT

};

extern template class NBodyGaussKeplerStateDerivative< double, double >;
//extern template class NBodyGaussKeplerStateDerivative< double, double >;

} // namespace propagators

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class NBodyGaussModifiedEquinictialStateDerivative: public NBodyStateDerivative<

};

extern template class NBodyGaussModifiedEquinictialStateDerivative< double, double >;
//extern template class NBodyGaussModifiedEquinictialStateDerivative< double, double >;

} // namespace propagators

Expand Down
2 changes: 1 addition & 1 deletion include/tudat/astro/propagators/nBodyStateDerivative.h
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ class NBodyStateDerivative: public propagators::SingleStateTypeDerivative< State

};

extern template class NBodyStateDerivative< double, double >;
//extern template class NBodyStateDerivative< double, double >;

} // namespace propagators

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class NBodyUnifiedStateModelExponentialMapStateDerivative: public NBodyStateDeri

};

extern template class NBodyUnifiedStateModelExponentialMapStateDerivative< double, double >;
//extern template class NBodyUnifiedStateModelExponentialMapStateDerivative< double, double >;

} // namespace propagators

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class NBodyUnifiedStateModelModifiedRodriguesParametersStateDerivative: public N

};

extern template class NBodyUnifiedStateModelModifiedRodriguesParametersStateDerivative< double, double >;
//extern template class NBodyUnifiedStateModelModifiedRodriguesParametersStateDerivative< double, double >;

} // namespace propagators

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ class NBodyUnifiedStateModelQuaternionsStateDerivative: public NBodyStateDerivat
};


extern template class NBodyUnifiedStateModelQuaternionsStateDerivative< double, double >;
//extern template class NBodyUnifiedStateModelQuaternionsStateDerivative< double, double >;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class RotationalMotionExponentialMapStateDerivative: public RotationalMotionStat

};

extern template class RotationalMotionExponentialMapStateDerivative< double, double >;
//extern template class RotationalMotionExponentialMapStateDerivative< double, double >;

} // namespace propagators

Expand Down
Loading

0 comments on commit 9cfed98

Please sign in to comment.