diff --git a/Common/read_field_indices.F90 b/Common/read_field_indices.F90 index eb2873c459dece6d733b71deea1a0a6023725679..421b5571bde4606561cc47f8fcabf23e41a92fb3 100644 --- a/Common/read_field_indices.F90 +++ b/Common/read_field_indices.F90 @@ -4,61 +4,38 @@ module read_field_indices_m contains - subroutine read_field_indices(hshp, rank) + subroutine read_field_indices(hshp) ! Libraries: -#ifdef HAVE_MPI - use ezmpi, only: ezmpi_bcast -#endif use shapelib_03, only: dbf_get_field_index_03 use derived_types, only: shpc TYPE(shpc), intent(inout):: hshp - integer, intent(in):: rank ! should be 0 if not in MPI program !--------------------------------------------------------------------- - if (rank == 0) then - call dbf_get_field_index_03(hshp%extremum, "ssh", hshp%extr_ssh) - call dbf_get_field_index_03(hshp%extremum, "date", hshp%extr_date) - call dbf_get_field_index_03(hshp%extremum, "eddy_index", & - hshp%extr_eddy_index) - call dbf_get_field_index_03(hshp%extremum, "valid", hshp%extr_valid) - call dbf_get_field_index_03(hshp%extremum, "speed", hshp%extr_speed) - - call dbf_get_field_index_03(hshp%outermost, "r_eq_area", & - hshp%out_r_eq_area) - call dbf_get_field_index_03(hshp%outermost, "ssh", hshp%out_ssh) - call dbf_get_field_index_03(hshp%outermost, "date", hshp%out_date) - call dbf_get_field_index_03(hshp%outermost, "eddy_index", & - hshp%out_eddy_index) - call dbf_get_field_index_03(hshp%outermost, "radius4", hshp%out_radius4) - - call dbf_get_field_index_03(hshp%max_speed, "r_eq_area", & - hshp%max_speed_r_eq_area) - call dbf_get_field_index_03(hshp%max_speed, "ssh", hshp%max_speed_ssh) - call dbf_get_field_index_03(hshp%max_speed, "date", hshp%max_speed_date) - call dbf_get_field_index_03(hshp%max_speed, "eddy_index", & - hshp%max_speed_eddy_index) - end if - -#ifdef HAVE_MPI - call ezmpi_bcast(hshp%extr_ssh, root = 0) - call ezmpi_bcast(hshp%extr_date, root = 0) - call ezmpi_bcast(hshp%extr_eddy_index, root = 0) - call ezmpi_bcast(hshp%extr_valid, root = 0) - call ezmpi_bcast(hshp%extr_speed, root = 0) - call ezmpi_bcast(hshp%out_r_eq_area, root = 0) - call ezmpi_bcast(hshp%out_ssh, root = 0) - call ezmpi_bcast(hshp%out_date, root = 0) - call ezmpi_bcast(hshp%out_eddy_index, root = 0) - call ezmpi_bcast(hshp%out_radius4, root = 0) - call ezmpi_bcast(hshp%max_speed_r_eq_area, root = 0) - call ezmpi_bcast(hshp%max_speed_ssh, root = 0) - call ezmpi_bcast(hshp%max_speed_date, root = 0) - call ezmpi_bcast(hshp%max_speed_eddy_index, root = 0) -#endif + call dbf_get_field_index_03(hshp%extremum, "ssh", hshp%extr_ssh) + call dbf_get_field_index_03(hshp%extremum, "date", hshp%extr_date) + call dbf_get_field_index_03(hshp%extremum, "eddy_index", & + hshp%extr_eddy_index) + call dbf_get_field_index_03(hshp%extremum, "valid", hshp%extr_valid) + call dbf_get_field_index_03(hshp%extremum, "speed", hshp%extr_speed) + + call dbf_get_field_index_03(hshp%outermost, "r_eq_area", & + hshp%out_r_eq_area) + call dbf_get_field_index_03(hshp%outermost, "ssh", hshp%out_ssh) + call dbf_get_field_index_03(hshp%outermost, "date", hshp%out_date) + call dbf_get_field_index_03(hshp%outermost, "eddy_index", & + hshp%out_eddy_index) + call dbf_get_field_index_03(hshp%outermost, "radius4", hshp%out_radius4) + + call dbf_get_field_index_03(hshp%max_speed, "r_eq_area", & + hshp%max_speed_r_eq_area) + call dbf_get_field_index_03(hshp%max_speed, "ssh", hshp%max_speed_ssh) + call dbf_get_field_index_03(hshp%max_speed, "date", hshp%max_speed_date) + call dbf_get_field_index_03(hshp%max_speed, "eddy_index", & + hshp%max_speed_eddy_index) end subroutine read_field_indices diff --git a/Common/shpc_open.F90 b/Common/shpc_open.F90 index acfe048112372ef157205a4298611f4b3e65aa69..631bfc749167181168260b138cdb544a343db97e 100644 --- a/Common/shpc_open.F90 +++ b/Common/shpc_open.F90 @@ -4,12 +4,9 @@ module shpc_open_m contains - subroutine shpc_open(hshp, shpc_dir, rank, pszaccess) + subroutine shpc_open(hshp, shpc_dir, pszaccess) ! Libraries: -#ifdef HAVE_MPI - use ezmpi, only: ezmpi_bcast -#endif USE jumble, only: new_unit use shapelib_03, only: shp_open_03 @@ -18,7 +15,6 @@ contains TYPE(shpc), intent(out):: hshp character(len = *), intent(in):: shpc_dir - integer, intent(in):: rank ! should be 0 if not in MPI program character(len = *), intent(in):: pszaccess ! should be "rb" or "rb+" ! Local: @@ -32,20 +28,13 @@ contains pszaccess) call shp_open_03(hshp%max_speed, shpc_dir // "/max_speed_contour", & pszaccess) - call read_field_indices(hshp, rank) - - if (rank == 0) then - call new_unit(unit) - open(unit, file = shpc_dir // "/orientation.txt", status = "old", & - action = "read", position = "rewind") - read(unit, fmt = *) orientation - close(unit) - hshp%cyclone = trim(adjustl(orientation)) == "cyclones" - end if - -#ifdef HAVE_MPI - call ezmpi_bcast(hshp%cyclone, root = 0) -#endif + call read_field_indices(hshp) + call new_unit(unit) + open(unit, file = shpc_dir // "/orientation.txt", status = "old", & + action = "read", position = "rewind") + read(unit, fmt = *) orientation + close(unit) + hshp%cyclone = trim(adjustl(orientation)) == "cyclones" end subroutine shpc_open diff --git a/Inst_eddies/Tests/test_nearby_extr.f90 b/Inst_eddies/Tests/test_nearby_extr.f90 index 280415c32364ab5f81f699645fc0a81d8cd130fc..46019b8a61bc565a1f122c5910cdf0301129ab39 100644 --- a/Inst_eddies/Tests/test_nearby_extr.f90 +++ b/Inst_eddies/Tests/test_nearby_extr.f90 @@ -48,7 +48,7 @@ program test_nearby_extr read(unit, fmt = *) ishape_last ! first date close(unit) - call shpc_open(hshp, trim(shpc_dir), rank = 0, pszaccess = "rb") + call shpc_open(hshp, trim(shpc_dir), pszaccess = "rb") call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, ishape = 0) call read_snapshot(s, hshp, nlon, nlat, d_init, k = d_init, & corner = corner_deg * deg_to_rad, step = step_deg * deg_to_rad, & diff --git a/Inst_eddies/Tests/test_set_max_speed.f90 b/Inst_eddies/Tests/test_set_max_speed.f90 index 0df3250d40f4007f6cd03f1e8bb1ad54594f06af..462c2abab6030e2bd763457f3c28b497487866c0 100644 --- a/Inst_eddies/Tests/test_set_max_speed.f90 +++ b/Inst_eddies/Tests/test_set_max_speed.f90 @@ -73,7 +73,7 @@ program test_set_max_speed call nf95_close(ncid) print *, "Reading from shapefiles..." - call shpc_open(hshp, shpc_dir, rank = 0, pszaccess = "rb") + call shpc_open(hshp, shpc_dir, pszaccess = "rb") call read_eddy(e, d, i, hshp, ishape = 0) CALL shpc_close(hshp) diff --git a/Inst_eddies/inst_eddies.f90 b/Inst_eddies/inst_eddies.f90 index 735d1d927b465bb46cb3060a7dee020e8e8d7f68..61c15d0f32569a7c0efb4300cf3ffefdaf39f209 100644 --- a/Inst_eddies/inst_eddies.f90 +++ b/Inst_eddies/inst_eddies.f90 @@ -172,10 +172,8 @@ program inst_eddies ! Write snapshot: if (exist) then - call shpc_open(hshpc_cyclo, shpc_dir = "SHPC_cyclo", rank = 0, & - pszaccess = "rb+") - call shpc_open(hshpc_anti, shpc_dir = "SHPC_anti", rank = 0, & - pszaccess = "rb+") + call shpc_open(hshpc_cyclo, shpc_dir = "SHPC_cyclo", pszaccess = "rb+") + call shpc_open(hshpc_anti, shpc_dir = "SHPC_anti", pszaccess = "rb+") else call shpc_create(hshpc_cyclo, shpc_dir = "SHPC_cyclo", cyclone = .true.) call shpc_create(hshpc_anti, shpc_dir = "SHPC_anti", cyclone = .false.) diff --git a/Overlap/Tests/test_get_dispatch_snap.f90 b/Overlap/Tests/test_get_dispatch_snap.f90 index cd9fed958206e009a4bfdef9f22e68afcb56e7da..3e4d98182c76069f7dbc0d871f24c5581e554383 100644 --- a/Overlap/Tests/test_get_dispatch_snap.f90 +++ b/Overlap/Tests/test_get_dispatch_snap.f90 @@ -77,7 +77,7 @@ program test_get_dispatch_snap copy = merge(dist_lim, 0, periodic) end if - call shpc_open(hshp, trim(shpc_dir), rank, pszaccess = "rb") + call shpc_open(hshp, trim(shpc_dir), pszaccess = "rb") if (rank == 0) then call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, & diff --git a/Overlap/Tests/test_overlap.f90 b/Overlap/Tests/test_overlap.f90 index 71998889adcbb98ac0f5d49cd14538308e6a3cfd..f6f073f0ce0d9316de3ec93efdb6d76a198f6ba7 100644 --- a/Overlap/Tests/test_overlap.f90 +++ b/Overlap/Tests/test_overlap.f90 @@ -66,7 +66,7 @@ program test_overlap corner = corner_deg * deg_to_rad step = step_deg * deg_to_rad allocate(flow(max_delta + 1)) - call shpc_open(hshp, trim(shpc_dir), rank = 0, pszaccess = "rb") + call shpc_open(hshp, trim(shpc_dir), pszaccess = "rb") call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, ishape = 0) call read_column(ishape_last, file = trim(shpc_dir) // "/ishape_last.txt", & my_lbound = d_init) diff --git a/Overlap/Tests/test_read_eddy.f90 b/Overlap/Tests/test_read_eddy.f90 index 526faff8e66d81dc11a737a4b710e5445800d061..5422a429c1f2900714f40d7a9375fcae85f5eab1 100644 --- a/Overlap/Tests/test_read_eddy.f90 +++ b/Overlap/Tests/test_read_eddy.f90 @@ -15,7 +15,7 @@ program test_read_eddy !------------------------------------------------------------------------- - call shpc_open(hshp, "SHPC_old", rank = 0, pszaccess = "rb") + call shpc_open(hshp, "SHPC_old", pszaccess = "rb") call read_eddy(e, k, i, hshp, ishape = 0) CALL shpc_close(hshp) diff --git a/Overlap/Tests/test_read_snapshot.f90 b/Overlap/Tests/test_read_snapshot.f90 index 0dc040a24d90555cd6be1080d38a8aa07a589504..edb1be690d396e5d040bce0dd48368af78b25e63 100644 --- a/Overlap/Tests/test_read_snapshot.f90 +++ b/Overlap/Tests/test_read_snapshot.f90 @@ -66,7 +66,7 @@ program test_read_snapshot read(unit, fmt = *) ishape_last ! first date close(unit) - call shpc_open(hshp, trim(shpc_dir), rank = 0, pszaccess = "rb") + call shpc_open(hshp, trim(shpc_dir), pszaccess = "rb") call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, ishape = 0) call read_snapshot(s, hshp, nlon, nlat, d_init, k = d_init, & corner = corner_deg * deg_to_rad, step = step_deg * deg_to_rad, & diff --git a/Overlap/Tests/test_send_recv.f90 b/Overlap/Tests/test_send_recv.f90 index d644bbab9bf875787b74c409784c8c0fd548bd2f..99a270a9d3f8299caf5f0bb7ee4099ae9bf701f0 100644 --- a/Overlap/Tests/test_send_recv.f90 +++ b/Overlap/Tests/test_send_recv.f90 @@ -86,7 +86,7 @@ program test_send_recv copy = merge(dist_lim, 0, periodic) end if - call shpc_open(hshp, trim(shpc_dir), rank, pszaccess = "rb") + call shpc_open(hshp, trim(shpc_dir), pszaccess = "rb") if (rank == 0) then call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, & diff --git a/Overlap/eddy_graph.f90 b/Overlap/eddy_graph.f90 index 74705068cd2efc7472f85176617ed2ea66b07777..482f96bb71641af0338b7d908a0dc40c75e63a15 100644 --- a/Overlap/eddy_graph.f90 +++ b/Overlap/eddy_graph.f90 @@ -93,7 +93,7 @@ program eddy_graph copy = merge(dist_lim, 0, periodic) end if - call shpc_open(hshp, trim(shpc_dir), rank, pszaccess = "rb") + call shpc_open(hshp, trim(shpc_dir), pszaccess = "rb") if (rank == 0) then call dbf_read_attribute_03(d_init, hshp%extremum, hshp%extr_date, &