diff --git a/set_all_outerm.f b/set_all_outerm.f index ed5f4806badf6b3d1e0af28c26fda8dc99ff128a..4e324351f27bf70d7767ef94b7410f933a67a147 100644 --- a/set_all_outerm.f +++ b/set_all_outerm.f @@ -113,20 +113,13 @@ contains do l = 1, s%number_vis_eddies i = sorted_extr(l) - if (flat_extr(i)) & - s%list_vis(i)%out_cont = get_1_outerm(s%list_vis(i)%cyclone, & - s%list_vis(i)%coord_extr, innermost_level(i), & - nearby_extr(s%extr_map(llc(1, i):urc(1, i), & - llc(2, i):urc(2, i)), s%list_vis, i), & - ssh(llc(1, i):urc(1, i), llc(2, i):urc(2, i)), & - corner_window(:, i), step) - end do - - ! We must modify s%list_vis(i)%suff_amp in this loop, separate - ! from the previous loop, so we do not influence the batch of - ! get_1_outerm. - do i = 1, s%number_vis_eddies if (flat_extr(i)) then + s%list_vis(i)%out_cont = get_1_outerm(s%list_vis(i)%cyclone, & + s%list_vis(i)%coord_extr, innermost_level(i), & + nearby_extr(s%extr_map(llc(1, i):urc(1, i), & + llc(2, i):urc(2, i)), s%list_vis, i), & + ssh(llc(1, i):urc(1, i), llc(2, i):urc(2, i)), & + corner_window(:, i), step) if (s%list_vis(i)%out_cont%n_points == 0) then s%list_vis(i)%suff_amp = .false. else @@ -142,33 +135,33 @@ contains if (flat_extr(i) .and. s%list_vis(i)%suff_amp) then associate (extr_map => s%extr_map(llc(1, i):urc(1, i), & llc(2, i):urc(2, i))) - selection = pack(extr_map, extr_map /= 0) - end associate - noise_around(i) = .not. all(s%list_vis(selection)%suff_amp) - end if - end do - end if - - s%list_vis%twice = flat_extr .and. s%list_vis%suff_amp .and. noise_around - - do l = 1, s%number_vis_eddies - i = sorted_extr(l) - if (s%list_vis(i)%suff_amp .and. noise_around(i) & - .or. .not. flat_extr(i)) & - s%list_vis(i)%out_cont = get_1_outerm(s%list_vis(i)%cyclone, & - s%list_vis(i)%coord_extr, innermost_level(i), & - nearby_extr(s%extr_map(llc(1, i):urc(1, i), & - llc(2, i):urc(2, i)), s%list_vis, i), & - ssh(llc(1, i):urc(1, i), llc(2, i):urc(2, i)), & - corner_window(:, i), step) - end do - - ! We must modify s%list_vis(i)%suff_amp in this loop, separate from - ! the previous loop, so we do not influence the batch of - ! get_1_outerm. - forall (i = 1:s%number_vis_eddies, .not. flat_extr(i)) & - s%list_vis(i)%suff_amp = s%list_vis(i)%out_cont%n_points /= 0 - -end subroutine set_all_outerm + selection = pack(extr_map, extr_map /= 0) + end associate + noise_around(i) = .not. all(s%list_vis(selection)%suff_amp) + end if + end do + end if + + s%list_vis%twice = flat_extr .and. s%list_vis%suff_amp .and. noise_around + + do l = 1, s%number_vis_eddies + i = sorted_extr(l) + if (s%list_vis(i)%suff_amp .and. noise_around(i) & + .or. .not. flat_extr(i)) & + s%list_vis(i)%out_cont = get_1_outerm(s%list_vis(i)%cyclone, & + s%list_vis(i)%coord_extr, innermost_level(i), & + nearby_extr(s%extr_map(llc(1, i):urc(1, i), & + llc(2, i):urc(2, i)), s%list_vis, i), & + ssh(llc(1, i):urc(1, i), llc(2, i):urc(2, i)), & + corner_window(:, i), step) + end do + + ! We must modify s%list_vis(i)%suff_amp in this loop, separate from + ! the previous loop, so we do not influence the batch of + ! get_1_outerm. + forall (i = 1:s%number_vis_eddies, .not. flat_extr(i)) & + s%list_vis(i)%suff_amp = s%list_vis(i)%out_cont%n_points /= 0 + + end subroutine set_all_outerm end module set_all_outerm_m