Tudat/JsonInterface/UnitTests/unitTestGravityFieldVariation.cpp
// Test 3: tabulated field variation
Test 3: tabulated field variation
Test 3 : tabulated field variation
BOOST_AUTO_TEST_CASE( test_json_gravityFieldVariation_tabulated )
{
    using namespace interpolators;
    using namespace simulation_setup;
    using namespace json_interface;
    const std::shared_ptr< GravityFieldVariationSettings > fromFileSettings =
            parseJSONFile< std::shared_ptr< GravityFieldVariationSettings > >( INPUT( "tabulated" ) );
    const std::map< double, Eigen::MatrixXd > cosineCoefficientCorrections =
    {
        { 0.0, ( Eigen::Matrix2d( ) << 0.0, 1.0, -2.0, 1.0 ).finished( ) },
        { 1.0, ( Eigen::Matrix2d( ) << 3.0, 2.5, -1.0, 0.0 ).finished( ) }
    };
    const std::map< double, Eigen::MatrixXd > sineCoefficientCorrections =
    {
        { 0.0, ( Eigen::Matrix2d( ) << -1.0, 4.0, 0.0, 1.0 ).finished( ) },
        { 1.0, ( Eigen::Matrix2d( ) << 3.0, 0.5, -1.0, -2.0 ).finished( ) }
    };
    const int minimumDegree = 4;
    const int minimumOrder = 2;
    const std::shared_ptr< InterpolatorSettings > interpolatorSettings =
            std::make_shared< InterpolatorSettings >( cubic_spline_interpolator );
    const std::shared_ptr< GravityFieldVariationSettings > manualSettings =
            std::make_shared< TabulatedGravityFieldVariationSettings >( cosineCoefficientCorrections,
                                                                          sineCoefficientCorrections,
                                                                          minimumDegree,
                                                                          minimumOrder,
                                                                          interpolatorSettings );
    BOOST_CHECK_EQUAL_JSON( fromFileSettings, manualSettings );
}
BOOST_AUTO_TEST_CASE ( test_json_gravityFieldVariation_tabulated ) { using namespace interpolators ; using namespace simulation_setup ; using namespace json_interface ; const std :: shared_ptr < GravityFieldVariationSettings > fromFileSettings = parseJSONFile < std :: shared_ptr < GravityFieldVariationSettings > > ( INPUT ( " " ) ) ; const std :: map < double , Eigen :: MatrixXd > cosineCoefficientCorrections = { { 0.0 , ( Eigen :: Matrix2d ( ) << 0.0 , 1.0 , -2.0 , 1.0 ) . finished ( ) } , { 1.0 , ( Eigen :: Matrix2d ( ) << 3.0 , 2.5 , -1.0 , 0.0 ) . finished ( ) } } ; const std :: map < double , Eigen :: MatrixXd > sineCoefficientCorrections = { { 0.0 , ( Eigen :: Matrix2d ( ) << -1.0 , 4.0 , 0.0 , 1.0 ) . finished ( ) } , { 1.0 , ( Eigen :: Matrix2d ( ) << 3.0 , 0.5 , -1.0 , -2.0 ) . finished ( ) } } ; const int minimumDegree = 4 ; const int minimumOrder = 2 ; const std :: shared_ptr < InterpolatorSettings > interpolatorSettings = std :: make_shared < InterpolatorSettings > ( cubic_spline_interpolator ) ; const std :: shared_ptr < GravityFieldVariationSettings > manualSettings = std :: make_shared < TabulatedGravityFieldVariationSettings > ( cosineCoefficientCorrections , sineCoefficientCorrections , minimumDegree , minimumOrder , interpolatorSettings ) ; BOOST_CHECK_EQUAL_JSON ( fromFileSettings , manualSettings ) ; }
Test 3: tabulated field variation
Test 3 : tabulated field variation
// Create GravityFieldVariationSettings from JSON file // Create GravityFieldVariationSettings manually // Compare