From 69dc82e06820a82bb2920ac76c7a945ca331bf56 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Tue, 31 Jan 2023 23:31:06 +0100
Subject: [PATCH] Transform function `get_1_outerm` into subroutine

Because we are going to add another intent out argument.
---
 Inst_eddies/Tests/test_get_1_outerm.f90 |  2 +-
 Inst_eddies/get_1_outerm.f90            | 11 ++++++-----
 Inst_eddies/set_all_outerm.f90          |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/Inst_eddies/Tests/test_get_1_outerm.f90 b/Inst_eddies/Tests/test_get_1_outerm.f90
index 4ca44ff4..86483f57 100644
--- a/Inst_eddies/Tests/test_get_1_outerm.f90
+++ b/Inst_eddies/Tests/test_get_1_outerm.f90
@@ -66,7 +66,7 @@ program test_get_1_outerm
   outside_points = transpose(outside_points) * deg_to_rad
   e%extr%coord_proj = ind_targ_extr
   e%extr%coord = corner + (ind_targ_extr - 1) * step
-  e%out_cont = get_1_outerm(cyclone, e%extr%coord, innermost_level, &
+  call get_1_outerm(e%out_cont, cyclone, e%extr%coord, innermost_level, &
        outside_points, ssh, corner, step)
 
   if (e%out_cont%closed) then
diff --git a/Inst_eddies/get_1_outerm.f90 b/Inst_eddies/get_1_outerm.f90
index 6ec1ac02..f0cd2d07 100644
--- a/Inst_eddies/get_1_outerm.f90
+++ b/Inst_eddies/get_1_outerm.f90
@@ -4,8 +4,8 @@ module get_1_outerm_m
 
 contains
 
-  type(ssh_contour) function get_1_outerm(cyclone, coord_extr, &
-       innermost_level_2, outside_points, ssh, corner, step)
+  subroutine get_1_outerm(out_cont, cyclone, coord_extr, innermost_level_2, &
+       outside_points, ssh, corner, step)
 
     ! This procedure gets one outermost good contour, if it can find
     ! one. If the procedure cannot find an outermost contour, it
@@ -43,6 +43,7 @@ contains
     use good_contour_m, only: good_contour
     use spher_polyline_area_m, only: spher_polyline_area
 
+    type(ssh_contour), intent(out):: out_cont
     logical, intent(in):: cyclone
     real, intent(in):: coord_extr(:) ! (2)
 
@@ -82,7 +83,7 @@ contains
          coord_extr, outside_points)
 
     if (cont_list(1)%n_points == 0) then
-       get_1_outerm = null_ssh_contour()
+       out_cont = null_ssh_contour()
     else
        n_cont = 1
        cont_list(1)%ssh = innermost_level_2
@@ -132,9 +133,9 @@ contains
 
        cont_list(n_cont)%area = spher_polyline_area(cont_list(n_cont)%polyline)
        call ccw_orient(cont_list(n_cont))
-       get_1_outerm = cont_list(n_cont)
+       out_cont = cont_list(n_cont)
     end if
 
-  end function get_1_outerm
+  end subroutine get_1_outerm
 
 end module get_1_outerm_m
diff --git a/Inst_eddies/set_all_outerm.f90 b/Inst_eddies/set_all_outerm.f90
index 54c68add..9da85966 100644
--- a/Inst_eddies/set_all_outerm.f90
+++ b/Inst_eddies/set_all_outerm.f90
@@ -118,7 +118,7 @@ contains
             + ceiling((corner_window(1) - outside_points(1, :)) / twopi) * twopi
        ! (Shift the longitude of each point to a value close to the
        ! longitude of the target extremum.)
-       s%list(i)%out_cont = get_1_outerm(s%list(i)%cyclone, &
+       call get_1_outerm(s%list(i)%out_cont, s%list(i)%cyclone, &
             s%list(i)%extr%coord, innermost_level_2, outside_points, &
             ssh(llc(1):urc(1), llc(2):urc(2)), corner_window, step)
        s%list(i)%valid = s%list(i)%out_cont%area >= min_area
-- 
GitLab