diff --git a/CMakeLists.txt b/CMakeLists.txt index 10afdbe..aa4fdda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,12 +96,14 @@ add_subdirectory(src) # Build validation executables add_subdirectory(validation) -# Create test scenarios -find_package(PFUNIT REQUIRED) -enable_testing() -#add_test(NAME execute_neptune COMMAND ../bin/neptune-sa WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/work/) -if (PFUNIT_FOUND) - add_subdirectory(tests) +if(ENABLE_PFUNIT) + # Create test scenarios + find_package(PFUNIT REQUIRED) + enable_testing() + #add_test(NAME execute_neptune COMMAND ../bin/neptune-sa WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/work/) + if (PFUNIT_FOUND) + add_subdirectory(tests) + endif() endif() diff --git a/libslam b/libslam index a5c14ee..9994297 160000 --- a/libslam +++ b/libslam @@ -1 +1 @@ -Subproject commit a5c14ee4ebecf6469924dbfc23eeb3d8e61eb893 +Subproject commit 9994297d3838444c9e9f59bc043d2d928924d20b diff --git a/src/propagatorschnittstelle.f90 b/src/propagatorschnittstelle.f90 index 4939ce7..99a0f84 100644 --- a/src/propagatorschnittstelle.f90 +++ b/src/propagatorschnittstelle.f90 @@ -99,6 +99,7 @@ subroutine OPI_Plugin_init(propagator) bind(c, name="OPI_Plugin_init") call OPI_Module_createProperty(propagator, "keplerian_elements_out", "ON") call OPI_Module_createProperty(propagator, "ecef_states_out", "OFF") call OPI_Module_createProperty(propagator, "mean_elements_out", "ON") + call OPI_Module_createProperty(propagator, "return_set_matrix", "OFF") ! instead of covariance do i = 1, 20 !** manoeuvre --> should be temp, this is a little bit an overkill @@ -210,6 +211,8 @@ function OPI_Plugin_propagate(propagator, data, julian_day, dt) result(opi_error integer(c_int),save :: cheby_degree logical,save :: store_data + logical,save :: return_set_matrix ! switch to return set instead of covariance + ! trying to access and write into the bytes array @@ -673,6 +676,16 @@ function OPI_Plugin_propagate(propagator, data, julian_day, dt) result(opi_error end if + !** check if we should return the set matrix instead of the covariance + write(temp_string,*) OPI_Module_getPropertyString(propagator,"return_set_matrix") + if (index(temp_string,"OFF") /= 0) then + return_set_matrix = .false. + + else + return_set_matrix = .true. + + end if + !** Allow saving the states, if wanted store_data = .false. if (.not. create_cheby) then @@ -1378,7 +1391,7 @@ function OPI_Plugin_propagate(propagator, data, julian_day, dt) result(opi_error end if !** allocate the ephemeris array - allocate(ephemeris(1000000, 1:28, data_size)) !** the 1000000 is the maximum allowed at the moment. It is fixed to avoid errors with PICARD. The 28 is: 1 date, 6 state, 21 co-variances + allocate(ephemeris(1000000, 1:43, data_size)) !** the 1000000 is the maximum allowed at the moment. The 43 is: 1 date, 6 state, 36 co-variances or STM ephemeris(:,:,:) = 0.d0 do j = 1, number_of_states @@ -1391,7 +1404,7 @@ function OPI_Plugin_propagate(propagator, data, julian_day, dt) result(opi_error !write (99,*) temp_state%epoch%mjd, temp_state%r(1:3), temp_state%v(1:3) ! Extract covariance from NEPTUNE API - if (propagate_covariance) then + if (propagate_covariance .and. (.not. return_set_matrix)) then temp_covariance = neptune_instance%getNeptuneCovarianceData(j) !** check, in what frame the covariance was provided write(temp_string,*) OPI_Module_getPropertyString(propagator,"covariance_ref_frame") @@ -1406,6 +1419,9 @@ function OPI_Plugin_propagate(propagator, data, julian_day, dt) result(opi_error covariance_matrix_UVW = matmul(matmul(jacobi,temp_covariance%elem),transpose(jacobi)) temp_covariance%elem = covariance_matrix_UVW end if + else if(return_set_matrix .and. propagate_covariance) then + ! Return SET matrix instead of covariance if requested + temp_covariance = neptune_instance%getNeptuneSetMatrixData(j) else temp_covariance%elem = initial_covariance%elem end if @@ -1429,8 +1445,22 @@ function OPI_Plugin_propagate(propagator, data, julian_day, dt) result(opi_error ephemeris(j,25, iobject) = temp_covariance%elem(6,3) ephemeris(j,26, iobject) = temp_covariance%elem(6,4) ephemeris(j,27, iobject) = temp_covariance%elem(6,5) - ephemeris(j,28, iobject) = temp_covariance%elem(6,6) - + ephemeris(j,28, iobject) = temp_covariance%elem(6,6) + ephemeris(j,29, iobject) = temp_covariance%elem(1,2) + ephemeris(j,30, iobject) = temp_covariance%elem(1,3) + ephemeris(j,31, iobject) = temp_covariance%elem(1,4) + ephemeris(j,32, iobject) = temp_covariance%elem(1,5) + ephemeris(j,33, iobject) = temp_covariance%elem(1,6) + ephemeris(j,34, iobject) = temp_covariance%elem(2,3) + ephemeris(j,35, iobject) = temp_covariance%elem(2,4) + ephemeris(j,36, iobject) = temp_covariance%elem(2,5) + ephemeris(j,37, iobject) = temp_covariance%elem(2,6) + ephemeris(j,38, iobject) = temp_covariance%elem(3,4) + ephemeris(j,39, iobject) = temp_covariance%elem(3,5) + ephemeris(j,40, iobject) = temp_covariance%elem(3,6) + ephemeris(j,41, iobject) = temp_covariance%elem(4,5) + ephemeris(j,42, iobject) = temp_covariance%elem(4,6) + ephemeris(j,43, iobject) = temp_covariance%elem(5,6) end do !write (99,*) propagation_epoch(2)%mjd, propagated_state%r(1:3), propagated_state%v(1:3) endif @@ -1449,7 +1479,7 @@ function OPI_Plugin_propagate(propagator, data, julian_day, dt) result(opi_error !**call message("Calling the bytes",LOG_AND_STDOUT) !** get the bytes pointer bytes_pointer => OPI_Population_getBytes(data) - call memcpy(c_loc(bytes_pointer(1)%bytes), c_loc(ephemeris), int(8*28*1000000*data_size,8)) + call memcpy(c_loc(bytes_pointer(1)%bytes), c_loc(ephemeris), int(8*43*1000000*data_size,8)) deallocate(ephemeris) end if diff --git a/tests/test_gravity.pf b/tests/test_gravity.pf index 185c667..354c5fc 100644 --- a/tests/test_gravity.pf +++ b/tests/test_gravity.pf @@ -54,7 +54,7 @@ contains ! Test 1 r_itrf = (/-3485.799126707284d0, -5898.652976745232d0, 835.9701786284777d0/) v_itrf = (/-1.3525457950562447d0, -0.2804534841971075d0, -7.4721873681232385d0/) - time_mjd = 56868.16721065d0 + time_mjd = 56868.16721065d0 ! Call the subroutine to be tested call gravity_model%getGravityAcceleration(reduction_handler, r_itrf, v_itrf, time_mjd, accel) @@ -70,7 +70,7 @@ contains ! Test 2 r_itrf = (/31986.08889084533, 3886.249797563777, -17606.478382491812/) v_itrf = (/-0.1326762314352175, 2.0844489979862724, -0.13643320490635982/) - time_mjd = 56868.16721065d0 + time_mjd = 56868.16721065d0 ! Call the subroutine to be tested call gravity_model%getGravityAcceleration(reduction_handler, r_itrf, v_itrf, time_mjd, accel) @@ -86,7 +86,7 @@ contains ! Test 2 r_itrf = (/-42044.21889179173, -3193.6719204189853, 105.63094940415252/) v_itrf = (/0.23272475970034712, -3.0658575760606777, 0.0006346736275647091/) - time_mjd = 56324.0d0 + time_mjd = 56324.0d0 ! Call the subroutine to be tested call gravity_model%getGravityAcceleration(reduction_handler, r_itrf, v_itrf, time_mjd, accel) @@ -102,7 +102,7 @@ contains ! Test 3 : r_itrf = (/-3485.799126707284, -5898.652976745232, 835.9701786284777/) v_itrf = (/-1.3525457950562447, -0.2804534841971075, -7.4721873681232385/) - time_mjd = 56600.0d0 + time_mjd = 56600.0d0 ! Call the subroutine to be tested call gravity_model%getGravityAcceleration(reduction_handler, r_itrf, v_itrf, time_mjd, accel)