copy a vector of datatype int64
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(inout) | :: | dest(:) | |||
| integer(kind=int64), | intent(in) | :: | source(:) | |||
| logical, | intent(in), | optional | :: | threaded | ||
| type(error_t), | intent(inout), | optional | :: | err |
set to ERROR_VALIDATION on a size mismatch, leaving dest unchanged; when absent a mismatch aborts with error stop |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=default_int), | private | :: | i | ||||
| logical, | private | :: | use_threads |
subroutine copy_vector_int64(dest, source, threaded, err) !! copy a vector of datatype int64 integer(int64), intent(inout) :: dest(:) integer(int64), intent(in) :: source(:) logical, intent(in), optional :: threaded type(error_t), intent(inout), optional :: err !! set to ERROR_VALIDATION on a size mismatch, leaving dest unchanged; !! when absent a mismatch aborts with error stop logical :: use_threads integer(default_int) :: i if (size(dest, 1) /= size(source, 1)) then if (present(err)) then call error_raise(err, ERROR_VALIDATION, "pic_copy: vector size mismatch") return end if error stop "pic_copy: vector size mismatch" end if use_threads = pic_optional(threaded, use_threaded_default) 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_int64