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

Group `new_unit` and open

Group `new_unit` and open in the same procedure, that we rename from
`set_unit_edge` to `open_edge_file`. This removes the need for a
special version of `new_unit` and it is closer to the use of the
`new_unit` keyword in Fortran 2008.
parent e1743a2e
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@ program test_overlap
use shp_tr_create_m, only: shp_tr_create
use shp_tr_open_m, only: shp_tr_open
use overlap_m, only: overlap
use unit_edge_m, only: set_unit_edge, unit_edge_cyclo, unit_edge_anti
use unit_edge_m, only: open_edge_file, unit_edge_cyclo, unit_edge_anti
use write_overlap_m, only: init_interpolated_eddy
implicit none
......@@ -96,12 +96,7 @@ program test_overlap
print *, "flow(max_delta + 1)%list_vis%delta_in:", &
flow(max_delta + 1)%list_vis%delta_in
flow(2:max_delta)%number_eddies = 20000
call set_unit_edge
open(unit_edge_cyclo, file = "edgelist_cyclo.csv", status = "replace", &
action = "write")
open(unit_edge_anti, file = "edgelist_anti.csv", status = "replace", &
action = "write")
call open_edge_file(rank = 0)
! Title lines:
write(unit_edge_cyclo, fmt = "(1x, a)") '"predecessor date subscript" ' &
......
......@@ -5,7 +5,7 @@ program test_write_overlap
use derived_types, only: shp_tr
use shp_tr_close_m, only: shp_tr_close
use shp_tr_create_m, only: shp_tr_create
use unit_edge_m, only: set_unit_edge, unit_edge_cyclo, unit_edge_anti
use unit_edge_m, only: open_edge_file, unit_edge_cyclo, unit_edge_anti
use write_overlap_m, only: write_overlap, init_interpolated_eddy
implicit none
......@@ -25,11 +25,7 @@ program test_write_overlap
read(unit = *, nml = main_nml)
write(unit = *, nml = main_nml)
call set_unit_edge
open(unit_edge_cyclo, file = "edgelist_cyclo.csv", status = "replace", &
action = "write")
open(unit_edge_anti, file = "edgelist_anti.csv", status = "replace", &
action = "write")
call open_edge_file(rank = 0)
! Title lines:
write(unit_edge_cyclo, fmt = "(1x, a)") '"predecessor date subscript" ' &
......
......@@ -14,7 +14,7 @@ program eddy_graph
use dispatch_snapshot_m, only: dispatch_snapshot
use get_snapshot_m, only: get_snapshot
use overlap_m, only: overlap
use unit_edge_m, only: set_unit_edge, unit_edge_cyclo, unit_edge_anti
use unit_edge_m, only: open_edge_file, unit_edge_cyclo, unit_edge_anti
use shp_tr_open_m, only: shp_tr_open
use shp_tr_close_m, only: shp_tr_close
use shp_tr_create_m, only: shp_tr_create
......@@ -130,13 +130,7 @@ program eddy_graph
open(unit_number_eddies, file = trim(file), status = "replace", &
action = "write")
call set_unit_edge
write(unit = file, fmt = '("edgelist_cyclo_", i0, ".csv")') rank
open(unit_edge_cyclo, file = trim(file), status = "replace", &
action = "write")
write(unit = file, fmt = '("edgelist_anti_", i0, ".csv")') rank
open(unit_edge_anti, file = trim(file), status = "replace", &
action = "write")
call open_edge_file(rank)
write(unit = file, fmt = '("SHP_triplet_", i0)') rank
call shp_tr_create(hshp_interp, shp_tr_dir = trim(file))
......
......@@ -7,15 +7,27 @@ module unit_edge_m
contains
subroutine set_unit_edge
subroutine open_edge_file(rank)
use jumble, only: new_unit
integer, intent(in):: rank
! Local:
character(len = 30) file
!--------------------------------------------------------------
call new_unit(unit_edge_cyclo)
call new_unit(unit_edge_anti, yield = .true.)
end subroutine set_unit_edge
write(unit = file, fmt = '("edgelist_cyclo_", i0, ".csv")') rank
open(unit_edge_cyclo, file = trim(file), status = "replace", &
action = "write")
call new_unit(unit_edge_anti)
write(unit = file, fmt = '("edgelist_anti_", i0, ".csv")') rank
open(unit_edge_anti, file = trim(file), status = "replace", &
action = "write")
end subroutine open_edge_file
end module unit_edge_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