gs2_max_abs_complex_array_3 Function

private function gs2_max_abs_complex_array_3(array_in) result(the_max)

Find maximum of abs 3D array

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :, :) :: array_in

Return Value real


Contents


Source Code

  real function gs2_max_abs_complex_array_3(array_in) result(the_max)
    implicit none
    complex, dimension(:, :, :), intent(in) :: array_in
    integer :: counter, start, end

    start = lbound(array_in, dim = 3)
    end = ubound(array_in, dim = 3)
    the_max = 0.0
    !$OMP PARALLEL DO DEFAULT(none) &
    !$OMP SHARED(start, end, array_in) &
    !$OMP REDUCTION(max: the_max) &
    !$OMP SCHEDULE(static)
    do counter = start, end
       the_max = max(maxval(abs(array_in(:, :, counter))), the_max)
    end do
    !$OMP END PARALLEL DO
  end function gs2_max_abs_complex_array_3