Put the value in the vector and update the index
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(inout), | dimension(:) | :: | x | ||
real(kind=wp), | intent(in) | :: | val | |||
integer, | intent(inout) | :: | i |
should be initialized to 0 before the first call |
subroutine fill_vector_with_scalar(x, val, i) implicit none real(wp),dimension(:),intent(inout) :: x real(wp),intent(in) :: val integer,intent(inout) :: i !! should be initialized to 0 before the first call i = i + 1 if (i>size(x)) error stop 'error in fill_vector: x is not large enough.' x(i) = val end subroutine fill_vector_with_scalar