diff --git a/Tests/test_overlap.f90 b/Tests/test_overlap.f90 index 8f2c35cd5ab5faaeb8f85356f1cb31cfb7385518..e8b67db31c1f54d3d9fde61fb3508639ecbb7407 100644 --- a/Tests/test_overlap.f90 +++ b/Tests/test_overlap.f90 @@ -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" ' & diff --git a/Tests/test_write_overlap.f90 b/Tests/test_write_overlap.f90 index 1b7e99f0a244523357f3f6a86dfb069400d98c3f..e8eea129e6fa74f61210cdb2e8b824e4a03ea746 100644 --- a/Tests/test_write_overlap.f90 +++ b/Tests/test_write_overlap.f90 @@ -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" ' & diff --git a/eddy_graph.f90 b/eddy_graph.f90 index 54f80ffba051ece80264fff37407ffbaeea276a6..49c60c5a36abb03f0a7dd11b697cb0002c4c2776 100644 --- a/eddy_graph.f90 +++ b/eddy_graph.f90 @@ -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)) diff --git a/unit_edge_m.f90 b/unit_edge_m.f90 index 33aa5975ebd68b9064a09e3778410227bdbad04f..3517b6c9b5cdb91133d9d5af50919dc2ed2eca2d 100644 --- a/unit_edge_m.f90 +++ b/unit_edge_m.f90 @@ -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