Tudat/JsonInterface/UnitTests/unitTestGravityFieldVariation.cpp
// Test 2: basic solid body gravity field variation
Test 2: basic solid body gravity field variation
Test 2 : basic solid body gravity field variation
BOOST_AUTO_TEST_CASE( test_json_gravityFieldVariation_basicSolidBody )
{
    using namespace simulation_setup;
    using namespace json_interface;
    const std::shared_ptr< GravityFieldVariationSettings > fromFileSettings =
            parseJSONFile< std::shared_ptr< GravityFieldVariationSettings > >( INPUT( "basicSolidBody" ) );
    const std::vector< std::string > deformingBodies = { "Moon" };
    const std::vector< std::vector< std::complex< double > > > loveNumbers =
    {
        { std::complex< double >( 1.0, 2.0 ), std::complex< double >( 2.0, -1.0 ), std::complex< double >( 0.3, -5.0 ) },
        { std::complex< double >( 0.0, 0.5 ), std::complex< double >( 0.0, 2.0 ), std::complex< double >( 4.0, -2.0 ) },
        { std::complex< double >( -3.0, 0.0 ), std::complex< double >( -5.0, 1.0 ), std::complex< double >( 6.0, 0.5 ) }
    };
    const double referenceRadius = 6.4e6;
    const std::shared_ptr< GravityFieldVariationSettings > manualSettings =
            std::make_shared< BasicSolidBodyGravityFieldVariationSettings >( deformingBodies,
                                                                               loveNumbers,
                                                                               referenceRadius );
    BOOST_CHECK_EQUAL_JSON( fromFileSettings, manualSettings );
}
BOOST_AUTO_TEST_CASE ( test_json_gravityFieldVariation_basicSolidBody ) { using namespace simulation_setup ; using namespace json_interface ; const std :: shared_ptr < GravityFieldVariationSettings > fromFileSettings = parseJSONFile < std :: shared_ptr < GravityFieldVariationSettings > > ( INPUT ( " " ) ) ; const std :: vector < std :: string > deformingBodies = { " " } ; const std :: vector < std :: vector < std :: complex < double > > > loveNumbers = { { std :: complex < double > ( 1.0 , 2.0 ) , std :: complex < double > ( 2.0 , -1.0 ) , std :: complex < double > ( 0.3 , -5.0 ) } , { std :: complex < double > ( 0.0 , 0.5 ) , std :: complex < double > ( 0.0 , 2.0 ) , std :: complex < double > ( 4.0 , -2.0 ) } , { std :: complex < double > ( -3.0 , 0.0 ) , std :: complex < double > ( -5.0 , 1.0 ) , std :: complex < double > ( 6.0 , 0.5 ) } } ; const double referenceRadius = 6.4e6 ; const std :: shared_ptr < GravityFieldVariationSettings > manualSettings = std :: make_shared < BasicSolidBodyGravityFieldVariationSettings > ( deformingBodies , loveNumbers , referenceRadius ) ; BOOST_CHECK_EQUAL_JSON ( fromFileSettings , manualSettings ) ; }
Test 2: basic solid body gravity field variation
Test 2 : basic solid body gravity field variation
// Create GravityFieldVariationSettings from JSON file // Create GravityFieldVariationSettings manually // Compare