Tudat/SimulationSetup/PropagationSetup/createTorqueModel.cpp
//! Function to create a spherical harmonic gravitational torque
Function to create a spherical harmonic gravitational torque
Function to create a spherical harmonic gravitational torque
std::shared_ptr< gravitation::SphericalHarmonicGravitationalTorqueModel > createSphericalHarmonicGravitationalTorqueModel(
        const std::shared_ptr< simulation_setup::Body > bodyUndergoingTorque,
        const std::shared_ptr< simulation_setup::Body > bodyExertingTorque,
        const std::shared_ptr< TorqueSettings > torqueSettings,
        const std::string& nameOfBodyUndergoingTorque,
        const std::string& nameOfBodyExertingTorque )
{
    std::shared_ptr< SphericalHarmonicTorqueSettings > sphericalHarmonicTorqueSettings =
            std::dynamic_pointer_cast< SphericalHarmonicTorqueSettings >( torqueSettings );
    if( sphericalHarmonicTorqueSettings == nullptr )
    {
        throw std::runtime_error( "Error when creating spherical harmonic torque, input is inconsistent" );
    }
    std::shared_ptr< AccelerationSettings > sphericalHarmonicAccelerationSettings =
            std::make_shared< SphericalHarmonicAccelerationSettings >(
                sphericalHarmonicTorqueSettings->maximumDegree_,
                sphericalHarmonicTorqueSettings->maximumOrder_ );
    std::shared_ptr< gravitation::SphericalHarmonicsGravitationalAccelerationModel > sphericalHarmonicAcceleration =
            std::dynamic_pointer_cast< gravitation::SphericalHarmonicsGravitationalAccelerationModel >(
                 createSphericalHarmonicsGravityAcceleration(
                    bodyExertingTorque, bodyUndergoingTorque, nameOfBodyExertingTorque, nameOfBodyUndergoingTorque,
                    sphericalHarmonicAccelerationSettings, false, false ) );
    return std::make_shared< gravitation::SphericalHarmonicGravitationalTorqueModel >(
                sphericalHarmonicAcceleration,
                std::bind( &Body::getCurrentRotationToLocalFrame, bodyUndergoingTorque ),
                std::bind( &Body::getBodyMass, bodyExertingTorque ) );
}
std :: shared_ptr < gravitation :: SphericalHarmonicGravitationalTorqueModel > createSphericalHarmonicGravitationalTorqueModel ( const std :: shared_ptr < simulation_setup :: Body > bodyUndergoingTorque , const std :: shared_ptr < simulation_setup :: Body > bodyExertingTorque , const std :: shared_ptr < TorqueSettings > torqueSettings , const std :: string & nameOfBodyUndergoingTorque , const std :: string & nameOfBodyExertingTorque ) { std :: shared_ptr < SphericalHarmonicTorqueSettings > sphericalHarmonicTorqueSettings = std :: dynamic_pointer_cast < SphericalHarmonicTorqueSettings > ( torqueSettings ) ; if ( sphericalHarmonicTorqueSettings == nullptr ) { throw std :: runtime_error ( " " ) ; } std :: shared_ptr < AccelerationSettings > sphericalHarmonicAccelerationSettings = std :: make_shared < SphericalHarmonicAccelerationSettings > ( sphericalHarmonicTorqueSettings -> maximumDegree_ , sphericalHarmonicTorqueSettings -> maximumOrder_ ) ; std :: shared_ptr < gravitation :: SphericalHarmonicsGravitationalAccelerationModel > sphericalHarmonicAcceleration = std :: dynamic_pointer_cast < gravitation :: SphericalHarmonicsGravitationalAccelerationModel > ( createSphericalHarmonicsGravityAcceleration ( bodyExertingTorque , bodyUndergoingTorque , nameOfBodyExertingTorque , nameOfBodyUndergoingTorque , sphericalHarmonicAccelerationSettings , false , false ) ) ; return std :: make_shared < gravitation :: SphericalHarmonicGravitationalTorqueModel > ( sphericalHarmonicAcceleration , std :: bind ( & Body :: getCurrentRotationToLocalFrame , bodyUndergoingTorque ) , std :: bind ( & Body :: getBodyMass , bodyExertingTorque ) ) ; }
Function to create a spherical harmonic gravitational torque
Function to create a spherical harmonic gravitational torque