chksum_argmax Subroutine

public pure subroutine chksum_argmax(arr, n1, n2, n3, i0, i1, j0, j1, im, jm, km, amax)

Interior argmax of |arr|: first-encountered strict maximum over i ∈ [i0, i1], j ∈ [j0, j1], all k (the ghost ring is excluded by the caller’s bounds). Host-side (debug-window cadence only).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: arr(n1,n2,n3)
integer, intent(in) :: n1
integer, intent(in) :: n2
integer, intent(in) :: n3
integer, intent(in) :: i0
integer, intent(in) :: i1
integer, intent(in) :: j0
integer, intent(in) :: j1
integer, intent(out) :: im
integer, intent(out) :: jm
integer, intent(out) :: km
real(kind=wp), intent(out) :: amax

Called by

proc~~chksum_argmax~~CalledByGraph proc~chksum_argmax chksum_argmax proc~chksum_hotface chksum_hotface proc~chksum_hotface->proc~chksum_argmax proc~run_stage_split run_stage_split proc~run_stage_split->proc~chksum_hotface proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~run_stage_split proc~engine_step engine_step proc~engine_step->proc~ocean_dyn_step_split proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: j
integer, private :: k

Source Code

   pure subroutine chksum_argmax(arr, n1, n2, n3, i0, i1, j0, j1, im, jm, km, amax)
      !! Interior argmax of |arr|: first-encountered strict maximum over
      !! `i ∈ [i0, i1]`, `j ∈ [j0, j1]`, all k (the ghost ring is excluded
      !! by the caller's bounds).  Host-side (debug-window cadence only).
      integer, intent(in) :: n1, n2, n3
      real(wp), intent(in) :: arr(n1, n2, n3)
      integer, intent(in) :: i0, i1, j0, j1
      integer, intent(out) :: im, jm, km
      real(wp), intent(out) :: amax
      integer :: i, j, k

      amax = -1.0_wp
      im = 0
      jm = 0
      km = 0
      do k = 1, n3
         do j = j0, j1
            do i = i0, i1
               if (abs(arr(i, j, k)) > amax) then
                  amax = abs(arr(i, j, k))
                  im = i
                  jm = j
                  km = k
               end if
            end do
         end do
      end do
   end subroutine chksum_argmax