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


Calls

proc~~add_to_queue~2~~CallsGraph proc~add_to_queue~2 problem_17::add_to_queue proc~expand_queue problem_17::expand_queue proc~add_to_queue~2->proc~expand_queue

Called by

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

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
            call expand_queue(queue,queue_size,item(state = state))
            idx = queue_size
        else
            queue = [item(state = state)]
            queue_size = 1
            idx = 1
        end if
    end subroutine add_to_queue