From a24e8dfde73696d454dd9e8533419cf4d02800e5 Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Thu, 1 Jul 2021 10:47:12 +0200
Subject: [PATCH] Remove component `number_eddies` of snapshot

Remove component `number_eddies` of derived type snapshot. It was the
same as `number_vis_extr` since there are no interpolated eddies any longer.
---
 Common/derived_types.f90         | 2 --
 Common/read_snapshot.f90         | 2 --
 Inst_eddies/set_all_outerm.f90   | 3 +--
 Overlap/Tests/test_overlap.f90   | 1 -
 Overlap/Tests/write_snapshot.f90 | 1 -
 Overlap/dispatch_snapshot.f90    | 3 +--
 Overlap/eddy_graph_in.sh         | 4 ++--
 Overlap/overlap.f90              | 8 +-------
 Overlap/recv_snapshot.f90        | 2 --
 Overlap/send_snapshot.f90        | 1 -
 10 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/Common/derived_types.f90 b/Common/derived_types.f90
index 0a7a575b..b106c315 100644
--- a/Common/derived_types.f90
+++ b/Common/derived_types.f90
@@ -57,8 +57,6 @@ module derived_types
      ! 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.
-     
-     integer number_eddies ! number of eddies, including interpolated eddies
   end type snapshot
 
   real, parameter:: missing_ssh = 1e4 ! flag for undefined SSH
diff --git a/Common/read_snapshot.f90 b/Common/read_snapshot.f90
index f2501f86..4075be88 100644
--- a/Common/read_snapshot.f90
+++ b/Common/read_snapshot.f90
@@ -64,8 +64,6 @@ contains
     forall (i = 1:s%number_vis_extr) s%ind_extr(:, i) &
          = nint(convert_to_ind(s%list_vis(i)%coord_extr, corner, step))
 
-    s%number_eddies = s%number_vis_extr
-
     ! Define s%extr_map from s%ind_extr:
 
     allocate(s%extr_map(1 - copy:nlon + copy, nlat))
diff --git a/Inst_eddies/set_all_outerm.f90 b/Inst_eddies/set_all_outerm.f90
index 667fada0..22fac7f3 100644
--- a/Inst_eddies/set_all_outerm.f90
+++ b/Inst_eddies/set_all_outerm.f90
@@ -24,8 +24,7 @@ contains
 
     type(snapshot), intent(out):: s
     ! Specifically: define everything in s except
-    ! s%list_vis%speed_cont, s%list_vis%max_speed, s%list_vis%radius4
-    ! and s%number_eddies.
+    ! s%list_vis%speed_cont, s%list_vis%max_speed and s%list_vis%radius4.
 
     integer, intent(in):: max_radius(:) ! (2) maximum radius of an
     ! eddy in longitude and latitude, in number of grid points
diff --git a/Overlap/Tests/test_overlap.f90 b/Overlap/Tests/test_overlap.f90
index 44a0a1e1..2e0e429d 100644
--- a/Overlap/Tests/test_overlap.f90
+++ b/Overlap/Tests/test_overlap.f90
@@ -91,7 +91,6 @@ program test_overlap
   print *, "Enter flow(max_delta + 1)%list_vis%delta_in (array with ", &
        flow(max_delta + 1)%number_vis_extr, " values)):"
   read *, flow(max_delta + 1)%list_vis%delta_in
-  flow(2:max_delta)%number_eddies = 20000
   call open_edge_file(rank = 0)
 
   ! Title lines:
diff --git a/Overlap/Tests/write_snapshot.f90 b/Overlap/Tests/write_snapshot.f90
index 24b0454b..f7082f71 100644
--- a/Overlap/Tests/write_snapshot.f90
+++ b/Overlap/Tests/write_snapshot.f90
@@ -46,7 +46,6 @@ contains
     print *, 'Created shapefiles in SHPC.'
 
     print *, "Number of extrema:", s%number_vis_extr
-    print *, "Number of eddies:", s%number_eddies
     
     print *, "s%ind_extr:"
 
diff --git a/Overlap/dispatch_snapshot.f90 b/Overlap/dispatch_snapshot.f90
index cb295aed..e3be4425 100644
--- a/Overlap/dispatch_snapshot.f90
+++ b/Overlap/dispatch_snapshot.f90
@@ -35,8 +35,7 @@ contains
                write(unit_isolated, fmt = *) d, i
        end do
 
-       write(unit_number_eddies, fmt = *) d, s%number_vis_extr, &
-            s%number_eddies - s%number_vis_extr
+       write(unit_number_eddies, fmt = *) d, s%number_vis_extr
     else
        call send_snapshot(s, tag = k, dest = rank - 1)
     end if
diff --git a/Overlap/eddy_graph_in.sh b/Overlap/eddy_graph_in.sh
index 4b4de108..6a18e772 100755
--- a/Overlap/eddy_graph_in.sh
+++ b/Overlap/eddy_graph_in.sh
@@ -17,8 +17,8 @@ ${mpiexec:-mpiexec} -n $1 @CMAKE_CURRENT_BINARY_DIR@/eddy_graph $2
 
 # Two titles lines, one with long names, one with short names:
 cat >number_eddies.csv <<EOF
- "days since 1950-1-1" "number of visible extrema" "number of interpolated eddies" 
- days_1950 number_vis_extr n_interp
+ "days since 1950-1-1" "number of visible extrema"  
+ days_1950 number_vis_extr
 EOF
 
 rm -f isolated_nodes.txt
diff --git a/Overlap/overlap.f90 b/Overlap/overlap.f90
index 962b2c9c..0a71d186 100644
--- a/Overlap/overlap.f90
+++ b/Overlap/overlap.f90
@@ -9,8 +9,7 @@ contains
     ! This procedure finds edges between flow(j - delta) and flow(j),
     ! corresponding to dates d - delta and d. It calls write_overlap
     ! for these edges. It updates flow(j - delta)%list_vis%delta_out,
-    ! flow(j)%list_vis%delta_in and flow(j - delta + 1:j -
-    ! 1)%number_eddies.
+    ! and flow(j)%list_vis%delta_in.
 
     ! Libraries:
     use contour_531, only: polyline
@@ -114,11 +113,6 @@ contains
                 if (spher_polygon_area(res_pol) >= 0.25 &
                      * min(spher_polyline_area(polyline_1), &
                      spher_polyline_area(polyline_2))) then
-                   ! Count one more fictitious eddy for all dates
-                   ! between j - delta + 1 and j - 1:
-                   flow(j - delta + 1:j - 1)%number_eddies &
-                        = flow(j - delta + 1:j - 1)%number_eddies + 1
-
                    write(unit_edge, fmt = *) d - delta, i1, d, i2, &
                         weight(flow(j - delta)%list_vis(i1), &
                         flow(j)%list_vis(i2))
diff --git a/Overlap/recv_snapshot.f90 b/Overlap/recv_snapshot.f90
index f592d5e2..4068768c 100644
--- a/Overlap/recv_snapshot.f90
+++ b/Overlap/recv_snapshot.f90
@@ -48,8 +48,6 @@ contains
     allocate(s%ind_extr(2, s%number_vis_extr))
     call ezmpi_recv(s%ind_extr, source, tag)
 
-    call ezmpi_recv(s%number_eddies, source, tag)
-
   end subroutine recv_snapshot
 
   !*******************************************************************
diff --git a/Overlap/send_snapshot.f90 b/Overlap/send_snapshot.f90
index 5f9d1834..790f4c3b 100644
--- a/Overlap/send_snapshot.f90
+++ b/Overlap/send_snapshot.f90
@@ -39,7 +39,6 @@ contains
 
     call ezmpi_send(s%extr_map, dest, tag)
     call ezmpi_send(s%ind_extr, dest, tag)
-    call ezmpi_send(s%number_eddies, dest, tag)
 
   end subroutine send_snapshot
 
-- 
GitLab