gs2_abs_real_array_3 Function

private function gs2_abs_real_array_3(array_in) result(array_out)

Return absolute of 3D array

Arguments

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

Return Value real, dimension(:, :, :), allocatable


Contents

Source Code


Source Code

  function gs2_abs_real_array_3(array_in) result(array_out)
    implicit none
    real, dimension(:, :, :), intent(in) :: array_in
    real, dimension(:, :, :), allocatable :: array_out
    integer :: counter, start, end

    allocate(array_out, mold = array_in)
    start = lbound(array_in, dim = 3)
    end = ubound(array_in, dim = 3)

    !$OMP PARALLEL DO DEFAULT(none) &
    !$OMP SHARED(start, end, array_in, array_out) &
    !$OMP SCHEDULE(static)
    do counter = start, end
       array_out(:, :, counter) = abs(array_in(:, :, counter))
    end do
    !$OMP END PARALLEL DO
  end function gs2_abs_real_array_3