Skip to content
Snippets Groups Projects
Commit f2a1ec62 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Move code to new function `copy_shift`

Preparing for more complex association criterium.
parent 96cf3aeb
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,8 @@ if(MPI_Fortran_HAVE_F08_MODULE)
add_executable(eddy_graph eddy_graph.f90 get_snapshot.f90 overlap.f90
dispatch_snapshot.f90 recv_snapshot.f90 candidate_overlap.f90
spher_polygon_area.f90 send_snapshot.f90 unit_edge_m.f90 config_graph.F90
read_grid.F90 read_snapshot.f90 read_eddy.f90 inters_lines.f90)
read_grid.F90 read_snapshot.f90 read_eddy.f90 inters_lines.f90
copy_shift.f90)
target_link_libraries(eddy_graph PRIVATE EZMPI::ezmpi Jumble::jumble
Shapelib_03::shapelib_03 Contour_531::contour_531 gpc_f Geometry::geometry
MPI::MPI_Fortran Numer_Rec_95::numer_rec_95)
......@@ -21,7 +22,7 @@ endif()
add_subdirectory(Tests)
target_sources(test_overlap PRIVATE overlap.f90 spher_polygon_area.f90
candidate_overlap.f90 unit_edge_m.f90 config_graph.F90 read_grid.F90
read_snapshot.f90 read_eddy.f90 inters_lines.f90)
read_snapshot.f90 read_eddy.f90 inters_lines.f90 copy_shift.f90)
target_sources(test_spher_polygon_area PRIVATE spher_polygon_area.f90)
target_sources(test_read_snapshot PRIVATE read_snapshot.f90 read_eddy.f90
read_grid.F90 config_graph.F90)
......
module copy_shift_m
implicit none
contains
function copy_shift(p, delta_long)
! Libraries:
use contour_531, only: polyline
use jumble, only: twopi
type(polyline), intent(in):: p
real, intent(in):: delta_long ! difference in longitude, in rad
type(polyline) copy_shift
!------------------------------------------------------------------
copy_shift%n_points = p%n_points
copy_shift%closed = p%closed
allocate(copy_shift%points(2, p%n_points))
copy_shift%points(2, :) = p%points(2, :)
! Shift the longitudes of `p`:
copy_shift%points(1, :) = p%points(1, :) &
+ floor(delta_long / twopi + 0.5) * twopi
end function copy_shift
end module copy_shift_m
......@@ -13,9 +13,9 @@ contains
! Libraries:
use contour_531, only: polyline
use jumble, only: twopi
use inters_lines_m, only: inters_lines
use copy_shift_m, only: copy_shift
use candidate_overlap_m, only: candidate_overlap
use config_graph_m, only: dist_lim, min_inters_speed
use derived_types, only: snapshot
......@@ -86,19 +86,14 @@ contains
! Assertion: {e1%delta_out >= delta .or. e2%delta_in
! >= delta}
delta_long = e1%extr%coord(1) - e2%extr%coord(1)
if (e2%speed_cont%n_points /= 0) then
polyline_2 = e2%speed_cont%polyline
polyline_2 = copy_shift(e2%speed_cont%polyline, delta_long)
else
polyline_2 = e2%out_cont%polyline
polyline_2 = copy_shift(e2%out_cont%polyline, delta_long)
end if
delta_long = e1%extr%coord(1) - e2%extr%coord(1)
! Shift the longitudes of polyline_2 to values close to the
! longitude of extremum i1:
polyline_2%points(1, :) = polyline_2%points(1, :) &
+ floor(delta_long / twopi + 0.5) * twopi
assoc_eddies = inters_lines(polyline_1, polyline_2, &
min_inters_speed)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment