extract_scalar_from_vector Subroutine

private subroutine extract_scalar_from_vector(val, x, i)

Extract the value from the vector and update the index

Arguments

Type IntentOptional 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


Called by

proc~~extract_scalar_from_vector~~CalledByGraph proc~extract_scalar_from_vector vector_module::extract_scalar_from_vector interface~extract_vector vector_module::extract_vector interface~extract_vector->proc~extract_scalar_from_vector proc~extract_vector_from_vector vector_module::extract_vector_from_vector interface~extract_vector->proc~extract_vector_from_vector proc~extract_vector_from_vector->interface~extract_vector

Source Code

    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