From c440ce202014f65118eee257d14158fb9feec7a3 Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Wed, 30 Jun 2021 21:31:51 +0200 Subject: [PATCH] Write an edge across delta days In procedure overlap, write an edge across delta days instead of delta edges across single days. So we do not need procedure `write_overlap` any longer, nor program `test_write_overlap`. --- Overlap/CMakeLists.txt | 2 +- Overlap/Tests/CMakeLists.txt | 14 +---------- Overlap/Tests/test_write_overlap.f90 | 34 -------------------------- Overlap/overlap.f90 | 6 ++--- Overlap/write_overlap.f90 | 36 ---------------------------- 5 files changed, 5 insertions(+), 87 deletions(-) delete mode 100644 Overlap/Tests/test_write_overlap.f90 delete mode 100644 Overlap/write_overlap.f90 diff --git a/Overlap/CMakeLists.txt b/Overlap/CMakeLists.txt index c67dcd98..68c23257 100644 --- a/Overlap/CMakeLists.txt +++ b/Overlap/CMakeLists.txt @@ -6,7 +6,7 @@ add_executable(eddy_graph eddy_graph.f90 ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90 ${CMAKE_SOURCE_DIR}/Common/read_snapshot.f90 recv_snapshot.f90 candidate_overlap.f90 spher_polygon_area.f90 - ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90 write_overlap.f90 + ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90 weight.f90 send_snapshot.f90 ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90 ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90 diff --git a/Overlap/Tests/CMakeLists.txt b/Overlap/Tests/CMakeLists.txt index 23ec522f..7730d578 100644 --- a/Overlap/Tests/CMakeLists.txt +++ b/Overlap/Tests/CMakeLists.txt @@ -7,7 +7,7 @@ add_executable(test_overlap ${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/shpc_create.f90 write_overlap.f90 + ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 ${CMAKE_CURRENT_LIST_DIR}/test_overlap.f90 ${CMAKE_SOURCE_DIR}/Common/shpc_open.f90 ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90 unit_edge_m.f90) @@ -77,18 +77,6 @@ target_link_libraries(test_read_eddy shapelib_03 contour_531 gpc_f target_include_directories(test_read_eddy PRIVATE ${fortrangis_INCLUDE_DIR}) -# test_write_overlap - -add_executable(test_write_overlap - ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 - ${CMAKE_SOURCE_DIR}/Common/shpc_create.f90 - ${CMAKE_SOURCE_DIR}/Common/write_eddy.f90 write_overlap.f90 - ${CMAKE_CURRENT_LIST_DIR}/test_write_overlap.f90 - ${CMAKE_SOURCE_DIR}/Common/shpc_close.f90 unit_edge_m.f90) - -target_link_libraries(test_write_overlap shapelib_03 contour_531 nr_util jumble) -target_include_directories(test_write_overlap PRIVATE ${fortrangis_INCLUDE_DIR}) - # test_send_recv add_executable(test_send_recv diff --git a/Overlap/Tests/test_write_overlap.f90 b/Overlap/Tests/test_write_overlap.f90 deleted file mode 100644 index 34badabb..00000000 --- a/Overlap/Tests/test_write_overlap.f90 +++ /dev/null @@ -1,34 +0,0 @@ -program test_write_overlap - - use, intrinsic:: ISO_FORTRAN_ENV - - use unit_edge_m, only: open_edge_file, unit_edge - use write_overlap_m, only: write_overlap - - implicit none - - integer j_interp - integer:: k = 2, delta = 1 - namelist /main_nml/ k, delta - - !------------------------------------------------------------------------- - - write(unit = error_unit, nml = main_nml) - write(unit = error_unit, fmt = *) "Enter namelist main_nml." - read(unit = *, nml = main_nml) - write(unit = *, nml = main_nml) - - call open_edge_file(rank = 0) - - ! Title lines: - write(unit_edge, fmt = "(1x, a)") '"predecessor date subscript" ' & - // '"predecessor eddy subscript" "successor date subscript" ' & - // '"successor eddy subscript"' - write(unit_edge, fmt = *) "k1 i1 k2 i2 weight" - - call write_overlap(k, delta, i1 = 1, i2 = 2, & - i_interp = 10 + [(j_interp, j_interp = 1, delta - 1)], w = 0.) - close(unit_edge) - print *, 'Created file "edgelist.csv".' - -end program test_write_overlap diff --git a/Overlap/overlap.f90 b/Overlap/overlap.f90 index d135fed3..962b2c9c 100644 --- a/Overlap/overlap.f90 +++ b/Overlap/overlap.f90 @@ -21,6 +21,7 @@ contains use derived_types, only: snapshot use spher_polygon_area_m, only: spher_polygon_area use spher_polyline_area_m, only: spher_polyline_area + use unit_edge_m, only: unit_edge use weight_m, only: weight use write_overlap_m, only: write_overlap @@ -118,10 +119,9 @@ contains flow(j - delta + 1:j - 1)%number_eddies & = flow(j - delta + 1:j - 1)%number_eddies + 1 - call write_overlap(d, delta, i1, i2, & - flow(j - delta + 1:j - 1)%number_eddies, & + write(unit_edge, fmt = *) d - delta, i1, d, i2, & weight(flow(j - delta)%list_vis(i1), & - flow(j)%list_vis(i2))) + flow(j)%list_vis(i2)) flow(j - delta)%list_vis(i1)%delta_out & = min(flow(j - delta)%list_vis(i1)%delta_out, delta) flow(j)%list_vis(i2)%delta_in & diff --git a/Overlap/write_overlap.f90 b/Overlap/write_overlap.f90 deleted file mode 100644 index e613cb6c..00000000 --- a/Overlap/write_overlap.f90 +++ /dev/null @@ -1,36 +0,0 @@ -module write_overlap_m - - implicit none - -contains - - subroutine write_overlap(d, delta, i1, i2, i_interp, w) - - ! Writes edges to unit_edge between (d - delta, i1) and (d, i2). - - use unit_edge_m, only: unit_edge - - integer, intent(in):: d ! date, in days since 1950-1-1 - integer, intent(in):: delta, i1, i2 - integer, intent(in):: i_interp(:) ! (delta - 1) - real, intent(in):: w - - ! Local: - integer i_pred, j_interp, d_interp - - !------------------------------------------------------------------- - - i_pred = i1 - - do j_interp = 1, delta - 1 - d_interp = d - delta + j_interp - write(unit_edge, fmt = *) d_interp - 1, i_pred, d_interp, & - i_interp(j_interp), w - i_pred = i_interp(j_interp) - end do - - write(unit_edge, fmt = *) d - 1, i_pred, d, i2, w - - end subroutine write_overlap - -end module write_overlap_m -- GitLab