Skip to content
Snippets Groups Projects
Commit c440ce20 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

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`.
parent ae7c1ccf
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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
......
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
......@@ -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 &
......
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment