add_to_queue Subroutine

subroutine add_to_queue(state, idx)

Arguments

Type IntentOptional Attributes Name
integer(kind=ip), intent(in), dimension(NSTATE) :: state
integer(kind=ip), intent(out) :: idx

index of the element in the queue


Called by

proc~~add_to_queue~~CalledByGraph proc~add_to_queue problem_17::add_to_queue proc~check problem_17::check proc~check->proc~add_to_queue program~problem_17 problem_17 program~problem_17->proc~add_to_queue program~problem_17->proc~check

Source Code

    subroutine add_to_queue(state, idx)
        integer(ip),dimension(NSTATE),intent(in) :: state
        integer(ip),intent(out) :: idx !! index of the element in the queue
        if (allocated(queue)) then
            queue = [queue, item(state = state)]
            idx = size(queue)
        else
            queue = [item(state = state)]
            idx = 1
        end if
    end subroutine add_to_queue