copy_vector_int32 Subroutine

private subroutine copy_vector_int32(dest, source, threaded)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(inout) :: dest(:)
integer(kind=int32), intent(in) :: source(:)
logical, intent(in), optional :: threaded

Called by

proc~~copy_vector_int32~~CalledByGraph proc~copy_vector_int32 copy_vector_int32 interface~copy copy interface~copy->proc~copy_vector_int32

Variables

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

Source Code

   subroutine copy_vector_int32(dest, source, threaded)
      integer(int32), intent(inout) :: dest(:)
      integer(int32), intent(in)    :: source(:)
      logical, intent(in), optional :: threaded
      logical :: use_threads
      integer(default_int) :: i
      if (size(dest, 1) /= size(source, 1)) then
         error stop "Vector size mismatch"
      end if
      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(dest, 1)
            dest(i) = source(i)
         end do
         !$omp end parallel do
      else
         dest = source
      end if
   end subroutine copy_vector_int32