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