From 8c7f93dc57fcdeabbed3b9061ef16642ea65cd50 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Fri, 28 Jun 2024 17:58:32 +0200
Subject: [PATCH] Test `closed` instead of `n_points`

This is equivalent for a return value of `good_contour`. It is a
little faster to test a logical value, maybe.
---
 Inst_eddies/get_1_outerm.f90 | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/Inst_eddies/get_1_outerm.f90 b/Inst_eddies/get_1_outerm.f90
index f1d18d48..7f4c56fc 100644
--- a/Inst_eddies/get_1_outerm.f90
+++ b/Inst_eddies/get_1_outerm.f90
@@ -107,7 +107,7 @@ contains
          ssh, innermost_level_2, coord_extr_proj, outside_points_proj), &
          corner_whole, step)
 
-    test_n_points: if (cont_list(1)%n_points == 0) then
+    test_n_points: if (.not. cont_list(1)%closed) then
        out_cont = null_ssh_contour()
     else test_n_points
        n_cont = 1
@@ -121,7 +121,7 @@ contains
             ssh, level_try, coord_extr_proj, outside_points_proj), &
             corner_whole, step)
 
-       if (cont_list(2)%n_points /= 0) then
+       if (cont_list(2)%closed) then
           ! This can only happen if there are degenerate extrema
           ! everywhere around the path of contour. So it should
           ! probably never happen.
@@ -138,7 +138,7 @@ contains
                   level_try, coord_extr_proj, outside_points_proj), &
                   corner_whole, step)
 
-             if (cont_list(n_cont + 1)%n_points /= 0) then
+             if (cont_list(n_cont + 1)%closed) then
                 cont_list(n_cont + 1)%ssh = level_try
 
                 if (n_cont == n_max_cont - 1) then
@@ -153,9 +153,10 @@ contains
                 level_bad = level_try
              end if
 
-             ! Assertion: cont_list(n_cont)%polyline == good_contour(. . .,
-             ! level_good) and cont_list(n_cont)%%n_points /= 0 and
-             ! no good contour at level_bad
+             ! Assertion: cont_list(n_cont)%polyline ==
+             ! good_contour(. . ., level_good) and
+             ! cont_list(n_cont)%closed and no good contour at
+             ! level_bad
           end do
           ! Assertion: n_cont <= n_max_cont - 1
        end if
-- 
GitLab