fill_vector_dp Subroutine

private subroutine fill_vector_dp(vector, alpha, threaded)

Arguments

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

Called by

proc~~fill_vector_dp~~CalledByGraph proc~fill_vector_dp fill_vector_dp interface~fill fill interface~fill->proc~fill_vector_dp

Variables

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

Source Code

   subroutine fill_vector_dp(vector, alpha, threaded)
      real(dp), intent(inout) :: vector(:)
      real(dp), 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_dp