From 039f2b360028d9bff526a3a4cfad52fdcd840abd Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Tue, 8 Jun 2021 14:29:24 +0200
Subject: [PATCH] Move files to new directory Common

`read_eddy.f90`, `read_field_indices.f90` and `shp_tr_open.f90` will
become common to Overlap and `Inst_eddies` because they will be used
in `Inst_eddies/Tests/test_set_max_speed.f90`. So there are now enough
common files to justify a new directory.
---
 derived_types.f90 => Common/derived_types.f90 |  0
 {Overlap => Common}/read_eddy.f90             |  0
 {Overlap => Common}/read_field_indices.f90    |  0
 shp_tr_close.f90 => Common/shp_tr_close.f90   |  0
 shp_tr_create.f90 => Common/shp_tr_create.f90 |  0
 {Overlap => Common}/shp_tr_open.f90           |  0
 .../spher_polyline_area.f90                   |  0
 write_eddy.f90 => Common/write_eddy.f90       |  0
 Inst_eddies/CMakeLists.txt                    | 10 +--
 Inst_eddies/Tests/CMakeLists.txt              | 28 +++---
 Overlap/CMakeLists.txt                        | 21 +++--
 Overlap/Tests/CMakeLists.txt                  | 88 +++++++++++--------
 Tests/CMakeLists.txt                          |  2 +-
 13 files changed, 84 insertions(+), 65 deletions(-)
 rename derived_types.f90 => Common/derived_types.f90 (100%)
 rename {Overlap => Common}/read_eddy.f90 (100%)
 rename {Overlap => Common}/read_field_indices.f90 (100%)
 rename shp_tr_close.f90 => Common/shp_tr_close.f90 (100%)
 rename shp_tr_create.f90 => Common/shp_tr_create.f90 (100%)
 rename {Overlap => Common}/shp_tr_open.f90 (100%)
 rename spher_polyline_area.f90 => Common/spher_polyline_area.f90 (100%)
 rename write_eddy.f90 => Common/write_eddy.f90 (100%)

diff --git a/derived_types.f90 b/Common/derived_types.f90
similarity index 100%
rename from derived_types.f90
rename to Common/derived_types.f90
diff --git a/Overlap/read_eddy.f90 b/Common/read_eddy.f90
similarity index 100%
rename from Overlap/read_eddy.f90
rename to Common/read_eddy.f90
diff --git a/Overlap/read_field_indices.f90 b/Common/read_field_indices.f90
similarity index 100%
rename from Overlap/read_field_indices.f90
rename to Common/read_field_indices.f90
diff --git a/shp_tr_close.f90 b/Common/shp_tr_close.f90
similarity index 100%
rename from shp_tr_close.f90
rename to Common/shp_tr_close.f90
diff --git a/shp_tr_create.f90 b/Common/shp_tr_create.f90
similarity index 100%
rename from shp_tr_create.f90
rename to Common/shp_tr_create.f90
diff --git a/Overlap/shp_tr_open.f90 b/Common/shp_tr_open.f90
similarity index 100%
rename from Overlap/shp_tr_open.f90
rename to Common/shp_tr_open.f90
diff --git a/spher_polyline_area.f90 b/Common/spher_polyline_area.f90
similarity index 100%
rename from spher_polyline_area.f90
rename to Common/spher_polyline_area.f90
diff --git a/write_eddy.f90 b/Common/write_eddy.f90
similarity index 100%
rename from write_eddy.f90
rename to Common/write_eddy.f90
diff --git a/Inst_eddies/CMakeLists.txt b/Inst_eddies/CMakeLists.txt
index 1b816535..3864345b 100644
--- a/Inst_eddies/CMakeLists.txt
+++ b/Inst_eddies/CMakeLists.txt
@@ -1,11 +1,11 @@
 add_executable(inst_eddies inst_eddies.f90
-  ${CMAKE_SOURCE_DIR}/write_eddy.f90 local_extrema.f90
+  ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90 local_extrema.f90
   set_max_speed.f90 get_1_outerm.f90 max_speed_contour_ssh.f90
-  good_contour.f90 ${CMAKE_SOURCE_DIR}/spher_polyline_area.f90
+  good_contour.f90 ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90
   mean_speed.f90 inside_4.f90 set_all_outerm.f90
-  ${CMAKE_SOURCE_DIR}/derived_types.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_create.f90 nearby_extr.f90 get_var.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_close.f90 write_aux.f90 config.f90)
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 nearby_extr.f90 get_var.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90 write_aux.f90 config.f90)
 
 target_include_directories(inst_eddies PRIVATE ${fortrangis_INCLUDE_DIR})
 
diff --git a/Inst_eddies/Tests/CMakeLists.txt b/Inst_eddies/Tests/CMakeLists.txt
index 0d810229..c53dba38 100644
--- a/Inst_eddies/Tests/CMakeLists.txt
+++ b/Inst_eddies/Tests/CMakeLists.txt
@@ -1,12 +1,12 @@
 # test_get_1_outerm
 
 add_executable(test_get_1_outerm good_contour.f90
-  ${CMAKE_SOURCE_DIR}/derived_types.f90 get_1_outerm.f90
-  ${CMAKE_SOURCE_DIR}/spher_polyline_area.f90
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 get_1_outerm.f90
+  ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90
   ${CMAKE_CURRENT_LIST_DIR}/test_get_1_outerm.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_create.f90
-  ${CMAKE_SOURCE_DIR}/write_eddy.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_close.f90)
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90
+  ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90)
 
 target_link_libraries(test_get_1_outerm geometry NetCDF95::netcdf95 shapelib_03
   contour_531 nr_util jumble NetCDF_Fortran::NetCDF_Fortran)
@@ -17,13 +17,13 @@ target_include_directories(test_get_1_outerm PRIVATE
 # test_set_all_outerm
 
 add_executable(test_set_all_outerm
-  ${CMAKE_SOURCE_DIR}/derived_types.f90 set_all_outerm.f90
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 set_all_outerm.f90
   local_extrema.f90 get_1_outerm.f90 good_contour.f90
-  ${CMAKE_SOURCE_DIR}/spher_polyline_area.f90 nearby_extr.f90
+  ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90 nearby_extr.f90
   get_var.f90 ${CMAKE_CURRENT_LIST_DIR}/test_set_all_outerm.f90
-  config.f90 ${CMAKE_SOURCE_DIR}/shp_tr_create.f90
-  ${CMAKE_SOURCE_DIR}/write_eddy.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_close.f90)
+  config.f90 ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90
+  ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90)
 
 target_link_libraries(test_set_all_outerm geometry NetCDF95::netcdf95
   numer_rec_95 shapelib_03 contour_531 jumble nr_util
@@ -65,7 +65,7 @@ target_include_directories(test_mean_speed PRIVATE
 # test_max_speed_contour_ssh
 
 add_executable(test_max_speed_contour_ssh
-  ${CMAKE_SOURCE_DIR}/derived_types.f90 max_speed_contour_ssh.f90
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 max_speed_contour_ssh.f90
   get_var.f90
   ${CMAKE_CURRENT_LIST_DIR}/test_max_speed_contour_ssh.f90)
 
@@ -78,7 +78,7 @@ target_include_directories(test_max_speed_contour_ssh PRIVATE
 # test_nearby_extr
 
 add_executable(test_nearby_extr nearby_extr.f90
-  ${CMAKE_SOURCE_DIR}/derived_types.f90
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90
   ${CMAKE_CURRENT_LIST_DIR}/test_nearby_extr.f90)
 
 target_link_libraries(test_nearby_extr NetCDF95::netcdf95 shapelib_03
@@ -99,9 +99,9 @@ target_link_libraries(test_local_extrema NetCDF95::netcdf95 nr_util
 # test_set_max_speed
 
 add_executable(test_set_max_speed
-  ${CMAKE_SOURCE_DIR}/derived_types.f90 set_max_speed.f90
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 set_max_speed.f90
   good_contour.f90 max_speed_contour_ssh.f90 mean_speed.f90
-  ${CMAKE_SOURCE_DIR}/spher_polyline_area.f90 inside_4.f90
+  ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90 inside_4.f90
   ${CMAKE_CURRENT_LIST_DIR}/test_set_max_speed.f90)
 
 target_link_libraries(test_set_max_speed geometry numer_rec_95
diff --git a/Overlap/CMakeLists.txt b/Overlap/CMakeLists.txt
index 730bac06..b3561617 100644
--- a/Overlap/CMakeLists.txt
+++ b/Overlap/CMakeLists.txt
@@ -1,15 +1,18 @@
 find_package(EZMPI REQUIRED CONFIG)
 find_package(GPC_F REQUIRED CONFIG)
 
-add_executable(eddy_graph eddy_graph.f90 shp_tr_open.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_create.f90 get_snapshot.f90 overlap.f90
-  dispatch_snapshot.f90 ${CMAKE_SOURCE_DIR}/shp_tr_close.f90
-  read_field_indices.f90 read_snapshot.f90 recv_snapshot.f90
-  candidate_overlap.f90 spher_polygon_area.f90
-  ${CMAKE_SOURCE_DIR}/spher_polyline_area.f90 write_overlap.f90
-  weight.f90 send_snapshot.f90 read_eddy.f90
-  ${CMAKE_SOURCE_DIR}/write_eddy.f90
-  ${CMAKE_SOURCE_DIR}/derived_types.f90 unit_edge_m.f90
+add_executable(eddy_graph eddy_graph.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 get_snapshot.f90
+  overlap.f90 dispatch_snapshot.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90
+  ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90 read_snapshot.f90
+  recv_snapshot.f90 candidate_overlap.f90 spher_polygon_area.f90
+  ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90 write_overlap.f90
+  weight.f90 send_snapshot.f90
+  ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 unit_edge_m.f90
   write_edge.f90)
 
 target_include_directories(eddy_graph PRIVATE ${fortrangis_INCLUDE_DIR})
diff --git a/Overlap/Tests/CMakeLists.txt b/Overlap/Tests/CMakeLists.txt
index 50c87d91..cfd73864 100644
--- a/Overlap/Tests/CMakeLists.txt
+++ b/Overlap/Tests/CMakeLists.txt
@@ -1,13 +1,17 @@
 # test_overlap
 
-add_executable(test_overlap ${CMAKE_SOURCE_DIR}/derived_types.f90
-  overlap.f90 read_snapshot.f90 spher_polygon_area.f90
-  ${CMAKE_SOURCE_DIR}/spher_polyline_area.f90 weight.f90 read_eddy.f90
-  read_field_indices.f90 candidate_overlap.f90
-  ${CMAKE_SOURCE_DIR}/write_eddy.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_create.f90 write_overlap.f90
-  ${CMAKE_CURRENT_LIST_DIR}/test_overlap.f90 shp_tr_open.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_close.f90 unit_edge_m.f90 write_edge.f90)
+add_executable(test_overlap
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 overlap.f90
+  read_snapshot.f90 spher_polygon_area.f90
+  ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90 weight.f90
+  ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90
+  candidate_overlap.f90 ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 write_overlap.f90
+  ${CMAKE_CURRENT_LIST_DIR}/test_overlap.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90 unit_edge_m.f90
+  write_edge.f90)
 
 target_link_libraries(test_overlap shapelib_03 geometry contour_531
   gpc_f ezmpi nr_util jumble MPI::MPI_Fortran)
@@ -17,14 +21,16 @@ target_include_directories(test_overlap PRIVATE ${fortrangis_INCLUDE_DIR})
 # test_read_snapshot
 
 add_executable(test_read_snapshot
-  ${CMAKE_SOURCE_DIR}/derived_types.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_create.f90 read_snapshot.f90
-  ${CMAKE_SOURCE_DIR}/write_eddy.f90 read_eddy.f90
-  read_field_indices.f90
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 read_snapshot.f90
+  ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90
   ${CMAKE_CURRENT_LIST_DIR}/test_read_snapshot.f90
   ${CMAKE_SOURCE_DIR}/Tests/write_extr_map.f90
-  ${CMAKE_CURRENT_LIST_DIR}/write_snapshot.f90 shp_tr_open.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_close.f90)
+  ${CMAKE_CURRENT_LIST_DIR}/write_snapshot.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90)
 
 target_link_libraries(test_read_snapshot NetCDF95::netcdf95
   shapelib_03 contour_531 gpc_f ezmpi nr_util jumble
@@ -36,7 +42,7 @@ target_include_directories(test_read_snapshot PRIVATE
 # test_spher_polygon_area
 
 add_executable(test_spher_polygon_area spher_polygon_area.f90
-  ${CMAKE_SOURCE_DIR}/spher_polyline_area.f90
+  ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90
   ${CMAKE_CURRENT_LIST_DIR}/test_spher_polygon_area.f90)
 
 target_link_libraries(test_spher_polygon_area geometry shapelib_03
@@ -47,7 +53,8 @@ target_include_directories(test_spher_polygon_area PRIVATE
 
 # test_weight
 
-add_executable(test_weight weight.f90 ${CMAKE_SOURCE_DIR}/derived_types.f90
+add_executable(test_weight weight.f90
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90
   ${CMAKE_CURRENT_LIST_DIR}/test_weight.f90)
 
 target_link_libraries(test_weight contour_531 nr_util)
@@ -55,11 +62,15 @@ target_include_directories(test_weight PRIVATE ${fortrangis_INCLUDE_DIR})
   
 # test_read_eddy
 
-add_executable(test_read_eddy ${CMAKE_SOURCE_DIR}/derived_types.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_create.f90 read_eddy.f90
-  ${CMAKE_SOURCE_DIR}/write_eddy.f90 read_field_indices.f90
-  ${CMAKE_CURRENT_LIST_DIR}/test_read_eddy.f90 shp_tr_open.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_close.f90)
+add_executable(test_read_eddy
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90
+  ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90
+  ${CMAKE_CURRENT_LIST_DIR}/test_read_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90)
 
 target_link_libraries(test_read_eddy shapelib_03 contour_531 gpc_f
   ezmpi nr_util MPI::MPI_Fortran)
@@ -69,11 +80,11 @@ target_include_directories(test_read_eddy PRIVATE ${fortrangis_INCLUDE_DIR})
 # test_write_overlap
 
 add_executable(test_write_overlap
-  ${CMAKE_SOURCE_DIR}/derived_types.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_create.f90
-  ${CMAKE_SOURCE_DIR}/write_eddy.f90 write_overlap.f90
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90
+  ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90 write_overlap.f90
   ${CMAKE_CURRENT_LIST_DIR}/test_write_overlap.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_close.f90 unit_edge_m.f90 write_edge.f90)
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90 unit_edge_m.f90 write_edge.f90)
 
 target_link_libraries(test_write_overlap shapelib_03 contour_531 nr_util jumble)
 target_include_directories(test_write_overlap PRIVATE ${fortrangis_INCLUDE_DIR})
@@ -84,13 +95,15 @@ find_package(MPI REQUIRED)
 
 add_executable(test_send_recv
   ${CMAKE_CURRENT_LIST_DIR}/test_send_recv.f90 send_snapshot.f90
-  recv_snapshot.f90 read_field_indices.f90 read_snapshot.f90
-  ${CMAKE_SOURCE_DIR}/write_eddy.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_create.f90 read_eddy.f90
+  recv_snapshot.f90 ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90
+  read_snapshot.f90 ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90
+  ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90
   ${CMAKE_CURRENT_LIST_DIR}/write_snapshot.f90
   ${CMAKE_SOURCE_DIR}/Tests/write_extr_map.f90
-  ${CMAKE_SOURCE_DIR}/derived_types.f90 shp_tr_open.f90
-  ${CMAKE_SOURCE_DIR}/shp_tr_close.f90)
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90)
 
 target_link_libraries(test_send_recv PRIVATE MPI::MPI_Fortran
   shapelib_03 ezmpi nr_util contour_531 gpc_f NetCDF95::netcdf95
@@ -103,13 +116,16 @@ target_include_directories(test_send_recv PRIVATE
 
 add_executable(test_get_dispatch_snap
   ${CMAKE_CURRENT_LIST_DIR}/test_get_dispatch_snap.f90
-  get_snapshot.f90 dispatch_snapshot.f90 read_field_indices.f90
+  get_snapshot.f90 dispatch_snapshot.f90
+  ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90
   ${CMAKE_CURRENT_LIST_DIR}/write_snapshot.f90 read_snapshot.f90
-  recv_snapshot.f90 ${CMAKE_SOURCE_DIR}/shp_tr_create.f90
-  ${CMAKE_SOURCE_DIR}/write_eddy.f90
-  ${CMAKE_SOURCE_DIR}/Tests/write_extr_map.f90 read_eddy.f90
-  send_snapshot.f90 ${CMAKE_SOURCE_DIR}/derived_types.f90
-  shp_tr_open.f90 ${CMAKE_SOURCE_DIR}/shp_tr_close.f90)
+  recv_snapshot.f90 ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90
+  ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90
+  ${CMAKE_SOURCE_DIR}/Tests/write_extr_map.f90
+  ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90 send_snapshot.f90
+  ${CMAKE_SOURCE_DIR}/Common/derived_types.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90
+  ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90)
 
 target_link_libraries(test_get_dispatch_snap shapelib_03 jumble
   contour_531 ezmpi NetCDF95::netcdf95 gpc_f nr_util
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index db70a081..858f64f6 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1,5 +1,5 @@
 add_executable(test_spher_polyline_area
-  ${CMAKE_SOURCE_DIR}/spher_polyline_area.f90
+  ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90
   ${CMAKE_CURRENT_LIST_DIR}/test_spher_polyline_area.f90)
 
 target_link_libraries(test_spher_polyline_area geometry contour_531 nr_util)
-- 
GitLab