From 161505276834c081d25975102ae128edd9b4e4ae Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Mon, 19 Jul 2021 12:57:33 +0200
Subject: [PATCH] Rename `number_vis_extr` to `number_extr`

Rename component `number_vis_extr` of derived type snapshot to
`number_extr`. Since there is no longer another compoment including
interpolated eddies.
---
 Common/derived_types.f90                  |  6 +++---
 Common/read_snapshot.f90                  | 12 ++++++------
 Inst_eddies/Tests/test_set_all_outerm.f90 |  8 ++++----
 Inst_eddies/inst_eddies.f90               |  4 ++--
 Inst_eddies/set_all_outerm.f90            | 14 +++++++-------
 Overlap/Tests/test_overlap.f90            |  8 ++++----
 Overlap/Tests/write_snapshot.f90          |  6 +++---
 Overlap/dispatch_snapshot.f90             |  2 +-
 Overlap/overlap.f90                       |  2 +-
 Overlap/recv_snapshot.f90                 |  8 ++++----
 Overlap/send_snapshot.f90                 |  4 ++--
 11 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/Common/derived_types.f90 b/Common/derived_types.f90
index b106c315..13f03d62 100644
--- a/Common/derived_types.f90
+++ b/Common/derived_types.f90
@@ -39,13 +39,13 @@ module derived_types
   end type eddy
 
   type snapshot
-     type(eddy), allocatable:: list_vis(:) ! (number_vis_extr)
+     type(eddy), allocatable:: list_vis(:) ! (number_extr)
      ! Visible "eddies" at a given date. These include "eddies"
      ! without an outermost contour, that is only the extremum is
      ! visible. The subscript value in list_vis is the "identification
      ! number" of the extremum.
      
-     integer number_vis_extr ! number of visible extrema
+     integer number_extr ! number of visible extrema
 
      integer, allocatable:: extr_map(:, :)
      ! (1 - copy:nlon + copy, nlat) if the grid is periodic in
@@ -53,7 +53,7 @@ module derived_types
      ! dist_lim, depending on the program. At a point of extremum SSH:
      ! identification number or this extremum. 0 at other points.
 
-     integer, allocatable:: ind_extr(:, :) ! (2, number_vis_extr)
+     integer, allocatable:: ind_extr(:, :) ! (2, number_extr)
      ! List of coordinates of ssh extrema in the global grid, in subscript
      ! space. The position in this list is the identifying number of
      ! the extremum.
diff --git a/Common/read_snapshot.f90 b/Common/read_snapshot.f90
index 4075be88..c50f1189 100644
--- a/Common/read_snapshot.f90
+++ b/Common/read_snapshot.f90
@@ -48,8 +48,8 @@ contains
        ishape_first = ishape_last(k) + 1
     end if
 
-    s%number_vis_extr = ishape_last(k + 1) - ishape_first + 1
-    allocate(s%list_vis(s%number_vis_extr))
+    s%number_extr = ishape_last(k + 1) - ishape_first + 1
+    allocate(s%list_vis(s%number_extr))
 
     do ishape = ishape_first, ishape_last(k + 1)
        call read_eddy(e, d, i, hshp, ishape)
@@ -60,8 +60,8 @@ contains
        s%list_vis(i) = e
     end do
 
-    allocate(s%ind_extr(2, s%number_vis_extr))
-    forall (i = 1:s%number_vis_extr) s%ind_extr(:, i) &
+    allocate(s%ind_extr(2, s%number_extr))
+    forall (i = 1:s%number_extr) s%ind_extr(:, i) &
          = nint(convert_to_ind(s%list_vis(i)%coord_extr, corner, step))
 
     ! Define s%extr_map from s%ind_extr:
@@ -71,11 +71,11 @@ contains
 
     ! Since we are not sure that there is no duplicate tuple in
     ! s%ind_extr, we must use a do construct and not a forall:
-    do i = 1, s%number_vis_extr
+    do i = 1, s%number_extr
        s%extr_map(s%ind_extr(1, i), s%ind_extr(2, i)) = i
     end do
 
-    call assert(count(s%extr_map(1:nlon, :) /= 0) == s%number_vis_extr, &
+    call assert(count(s%extr_map(1:nlon, :) /= 0) == s%number_extr, &
          "read_snapshot: one eddy per grid point")
 
     ! Extend in longitude:
diff --git a/Inst_eddies/Tests/test_set_all_outerm.f90 b/Inst_eddies/Tests/test_set_all_outerm.f90
index c671efa6..cfae6abc 100644
--- a/Inst_eddies/Tests/test_set_all_outerm.f90
+++ b/Inst_eddies/Tests/test_set_all_outerm.f90
@@ -82,7 +82,7 @@ program test_set_all_outerm
        corner = [lon_min, lat_min] * deg_to_rad, &
        min_area = pi * (min_radius * 1e3)**2)
 
-  do i = 1, s%number_vis_extr
+  do i = 1, s%number_extr
      s%list_vis(i)%speed_cont = null_ssh_contour()
      s%list_vis(i)%max_speed = missing_speed
      s%list_vis(i)%radius4 = 0
@@ -93,7 +93,7 @@ program test_set_all_outerm
   n_cyclo = 0
   n_anti = 0
 
-  do i = 1, s%number_vis_extr
+  do i = 1, s%number_extr
      if (s%list_vis(i)%cyclone) then
         n_cyclo = n_cyclo + 1
         call write_eddy(s%list_vis(i), hshp_cyclo, days_1950 = 1, i = n_cyclo)
@@ -103,12 +103,12 @@ program test_set_all_outerm
      end if
   end do
 
-  print *, "s%number_vis_extr = ", s%number_vis_extr
+  print *, "s%number_extr = ", s%number_extr
 
   CALL shpc_close(hshp_cyclo)
   CALL shpc_close(hshp_anti)
   print *, 'Created shapefile collections in SHPC_cyclo and SHPC_anti.'
   print *, "Average number of points per outermost contour: ", &
-       sum(s%list_vis%out_cont%n_points) / real(s%number_vis_extr)
+       sum(s%list_vis%out_cont%n_points) / real(s%number_extr)
 
 end program test_set_all_outerm
diff --git a/Inst_eddies/inst_eddies.f90 b/Inst_eddies/inst_eddies.f90
index 7489c4da..abf5b600 100644
--- a/Inst_eddies/inst_eddies.f90
+++ b/Inst_eddies/inst_eddies.f90
@@ -141,7 +141,7 @@ program inst_eddies
   ! Done with outermost contours, now let us take care of the
   ! max-speed contours.
 
-  do i = 1, s%number_vis_extr
+  do i = 1, s%number_extr
      if (s%list_vis(i)%valid) then
         ! Restrict the field to the outermost contour:
 
@@ -194,7 +194,7 @@ program inst_eddies
   n_cyclo = 0
   n_anti = 0
 
-  do i = 1, s%number_vis_extr
+  do i = 1, s%number_extr
      if (s%list_vis(i)%cyclone) then
         n_cyclo = n_cyclo + 1
         call write_eddy(s%list_vis(i), hshpc_cyclo, days_1950, n_cyclo)
diff --git a/Inst_eddies/set_all_outerm.f90 b/Inst_eddies/set_all_outerm.f90
index 22fac7f3..95c12684 100644
--- a/Inst_eddies/set_all_outerm.f90
+++ b/Inst_eddies/set_all_outerm.f90
@@ -46,16 +46,16 @@ contains
 
     integer nlon, nlat
 
-    real, allocatable:: innermost_level(:) ! (s%number_vis_extr)
+    real, allocatable:: innermost_level(:) ! (s%number_extr)
     ! SSH level of the innermost contour around each extremum, in
     ! m. By construction, innermost_level < extremum for a maximum, >
     ! extremum for a minimum.
 
-    logical, allocatable:: cyclone(:) ! (s%number_vis_extr)
+    logical, allocatable:: cyclone(:) ! (s%number_extr)
     integer i, l, copy
     integer n_cycl ! number of cyclones
 
-    integer, allocatable:: sorted_extr(:) ! (s%number_vis_extr)
+    integer, allocatable:: sorted_extr(:) ! (s%number_extr)
     ! Sorted identifying number of extrema: first, minima sorted in
     ! order of decreasing SSH, and second, maxima sorted in order of
     ! increasing SSH.
@@ -99,10 +99,10 @@ contains
             = s%extr_map(2:max_radius(1), :)
     end if
 
-    s%number_vis_extr = size(s%ind_extr, 2)
-    allocate(s%list_vis(s%number_vis_extr), sorted_extr(s%number_vis_extr))
+    s%number_extr = size(s%ind_extr, 2)
+    allocate(s%list_vis(s%number_extr), sorted_extr(s%number_extr))
 
-    forall (i = 1:s%number_vis_extr)
+    forall (i = 1:s%number_extr)
        s%list_vis(i)%coord_extr = corner + (s%ind_extr(:, i) - 1) * step
        ! (Even when periodic, this is within the original NetCDF grid,
        ! that is the grid without duplicated longitudes.)
@@ -125,7 +125,7 @@ contains
     selection = selection(indexx(s%list_vis(selection)%ssh_extr))
     sorted_extr(n_cycl + 1:) = selection
 
-    do l = 1, s%number_vis_extr
+    do l = 1, s%number_extr
        i = sorted_extr(l)
 
        ! Define the geographical window around each eddy extremum:
diff --git a/Overlap/Tests/test_overlap.f90 b/Overlap/Tests/test_overlap.f90
index 57c5935f..f8606b8c 100644
--- a/Overlap/Tests/test_overlap.f90
+++ b/Overlap/Tests/test_overlap.f90
@@ -84,10 +84,10 @@ program test_overlap
        corner, step, copy, ishape_last)
   CALL shpc_close(hshp)
   print *, "Enter flow(1)%list_vis%delta_out (array with ", &
-       flow(1)%number_vis_extr, " values):"
+       flow(1)%number_extr, " values):"
   read *, flow(1)%list_vis%delta_out
   print *, "Enter flow(max_delta + 1)%list_vis%delta_in (array with ", &
-       flow(max_delta + 1)%number_vis_extr, " values)):"
+       flow(max_delta + 1)%number_extr, " values)):"
   read *, flow(max_delta + 1)%list_vis%delta_in
   call open_edge_file(rank = 0)
   call overlap(flow, nlon, nlat, periodic, dist_lim, e_overestim, &
@@ -97,7 +97,7 @@ program test_overlap
 
   print *, k_test_1, ":"
   print *, "Valid isolated eddies:"
-  do i = 1, flow(1)%number_vis_extr
+  do i = 1, flow(1)%number_extr
      if (flow(1)%list_vis(i)%valid .and. flow(1)%list_vis(i)%delta_out &
           == huge(0)) write(unit = *, fmt = "(i0, 1x)", advance = "no") i
   end do
@@ -107,7 +107,7 @@ program test_overlap
   print *, k_test_2, ":"
   print *, "Valid isolated eddies:"
 
-  do i = 1, flow(max_delta + 1)%number_vis_extr
+  do i = 1, flow(max_delta + 1)%number_extr
      if (flow(max_delta + 1)%list_vis(i)%valid &
           .and. flow(max_delta + 1)%list_vis(i)%delta_in == huge(0)) &
           write(unit = *, fmt = "(i0, 1x)", advance = "no") i
diff --git a/Overlap/Tests/write_snapshot.f90 b/Overlap/Tests/write_snapshot.f90
index 613da3d7..500df569 100644
--- a/Overlap/Tests/write_snapshot.f90
+++ b/Overlap/Tests/write_snapshot.f90
@@ -38,16 +38,16 @@ contains
     call shpc_create(hshp, shpc_dir = "SHPC", cyclone = s%list_vis(1)%cyclone)
 
     ! Write snapshot:
-    do i = 1, s%number_vis_extr
+    do i = 1, s%number_extr
        call write_eddy(s%list_vis(i), hshp, d, i)
     end do
 
     CALL shpc_close(hshp)
     print *, 'Created shapefiles in SHPC.'
-    print *, "Number of extrema:", s%number_vis_extr
+    print *, "Number of extrema:", s%number_extr
     print *, "s%ind_extr:"
 
-    do i = 1, s%number_vis_extr
+    do i = 1, s%number_extr
        print *, s%ind_extr(:, i)
     end do
 
diff --git a/Overlap/dispatch_snapshot.f90 b/Overlap/dispatch_snapshot.f90
index ee1a8159..e4a70f51 100644
--- a/Overlap/dispatch_snapshot.f90
+++ b/Overlap/dispatch_snapshot.f90
@@ -26,7 +26,7 @@ contains
     if (rank == 0 .or. k >= k_begin + max_delta) then
        d = k + d_init
        
-       do i = 1, s%number_vis_extr
+       do i = 1, s%number_extr
           if (s%list_vis(i)%valid .and. s%list_vis(i)%delta_in == huge(0) &
                .and. s%list_vis(i)%delta_out == huge(0)) &
                write(unit_isolated, fmt = *) d, i
diff --git a/Overlap/overlap.f90 b/Overlap/overlap.f90
index bfc604ab..b0a9f57f 100644
--- a/Overlap/overlap.f90
+++ b/Overlap/overlap.f90
@@ -58,7 +58,7 @@ contains
 
     !-----------------------------------------------------------------------
 
-    loop_i1: do i1 = 1, flow(j - delta)%number_vis_extr
+    loop_i1: do i1 = 1, flow(j - delta)%number_extr
        test_valid: if (flow(j - delta)%list_vis(i1)%valid) then
           ! Define the geographical window around each eddy extremum:
 
diff --git a/Overlap/recv_snapshot.f90 b/Overlap/recv_snapshot.f90
index 4068768c..f572123c 100644
--- a/Overlap/recv_snapshot.f90
+++ b/Overlap/recv_snapshot.f90
@@ -26,10 +26,10 @@ contains
 
     !-----------------------------------------------------------
 
-    call ezmpi_recv(s%number_vis_extr, source, tag)
-    allocate(s%list_vis(s%number_vis_extr))
+    call ezmpi_recv(s%number_extr, source, tag)
+    allocate(s%list_vis(s%number_extr))
 
-    do i = 1, s%number_vis_extr
+    do i = 1, s%number_extr
        call ezmpi_recv(s%list_vis(i)%coord_extr, source, tag)
        call ezmpi_recv(s%list_vis(i)%ssh_extr, source, tag)
        call ezmpi_recv(s%list_vis(i)%cyclone, source, tag)
@@ -45,7 +45,7 @@ contains
     allocate(s%extr_map(1 - copy:nlon + copy, nlat))
     call ezmpi_recv(s%extr_map, source, tag)
 
-    allocate(s%ind_extr(2, s%number_vis_extr))
+    allocate(s%ind_extr(2, s%number_extr))
     call ezmpi_recv(s%ind_extr, source, tag)
 
   end subroutine recv_snapshot
diff --git a/Overlap/send_snapshot.f90 b/Overlap/send_snapshot.f90
index 790f4c3b..e68f7321 100644
--- a/Overlap/send_snapshot.f90
+++ b/Overlap/send_snapshot.f90
@@ -22,9 +22,9 @@ contains
 
     !------------------------------------------------------------------
 
-    call ezmpi_send(s%number_vis_extr, dest, tag)
+    call ezmpi_send(s%number_extr, dest, tag)
 
-    do i = 1, s%number_vis_extr
+    do i = 1, s%number_extr
        call ezmpi_send(s%list_vis(i)%coord_extr, dest, tag)
        call ezmpi_send(s%list_vis(i)%ssh_extr, dest, tag)
        call ezmpi_send(s%list_vis(i)%cyclone, dest, tag)
-- 
GitLab