fill_vector_sp Subroutine

private subroutine fill_vector_sp(vector, alpha, threaded)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(inout) :: vector(:)
real(kind=sp), intent(in) :: alpha
logical, intent(in), optional :: threaded

Called by

proc~~fill_vector_sp~~CalledByGraph proc~fill_vector_sp fill_vector_sp interface~fill fill interface~fill->proc~fill_vector_sp

Variables

Type Visibility Attributes Name Initial
integer(kind=default_int), private :: i
logical, private :: use_threads

Source Code

   subroutine fill_vector_sp(vector, alpha, threaded)
      real(sp), intent(inout) :: vector(:)
      real(sp), intent(in)    :: alpha
      logical, intent(in), optional :: threaded
      logical :: use_threads
      integer(default_int) :: i

      if (present(threaded)) then
         use_threads = threaded
      else
         use_threads = use_threaded_default
      end if
      if (use_threads) then
         !$omp parallel do collapse(1) private(i)
         do i = 1, size(vector, 1)
            vector(i) = alpha
         end do
         !$omp end parallel do
      else
         vector = alpha
      end if

   end subroutine fill_vector_sp