54 integer,
parameter :: qrm_fifo_=0
57 integer,
parameter :: qrm_lifo_=1
61 integer,
allocatable :: elems(:) !> contains the element of the queue
62 integer :: nelems !> number of elements present in the queue
63 integer :: h, t !> the head/tail of the queue
64 integer :: maxelems !> the maximum number of values allowed in the queue
65 integer :: pol !> the policy of the queue
67 integer(omp_lock_kind) :: lock !> a lock to prevent simultaneous access to the queue
94 integer :: nelems, pol
144 if (q%nelems .eq. 0)
then
148 else if (q%nelems .eq. q%maxelems)
then
149 write(*,
'("Cannot push anymore", i4,x,i4)')elem, q%nelems
152 if(q%pol .eq. qrm_fifo_)
then
156 else if(q%pol .eq. qrm_lifo_)
then
162 q%nelems = q%nelems+1
188 write(*,
'(i3,"->")',advance=
'no')elem
208 if (q%nelems .eq. 0)
then
214 q%nelems = q%nelems-1
239 if (q%nelems .eq. 0)
then
245 q%nelems = q%nelems-1
249 if (q%elems(tmp) .eq. n)
then
250 q%elems(tmp) = q%elems(n)
251 q%nelems = q%nelems-1
252 if(n .eq. q%t) q%t = tmp
295 call omp_set_lock(q%lock)
297 if (q%nelems .eq. 0)
then
299 else if (n .eq. q%t)
then
310 call omp_unset_lock(q%lock)
integer function qrm_queue_next(q, n)
Returns the element that follows n in the queue q. Very useful for sweeping through a queue...
Generic interface for the qrm_adealloc_i, qrm_adealloc_2i, qrm_adealloc_s, qrm_adealloc_2s, qrm_adealloc_3s, qrm_adealloc_d, qrm_adealloc_2d, qrm_adealloc_3d, qrm_adealloc_c, qrm_adealloc_2c, qrm_adealloc_3c, qrm_adealloc_z, qrm_adealloc_2z, qrm_adealloc_3z, routines.
A data type meant to to define a queue.
subroutine qrm_queue_rm(q, n)
Removes (without returning it) an element from a queue.
subroutine qrm_queue_prnt(q)
Prints the content of a queue.
subroutine qrm_queue_push(q, elem)
Pushes an element on a queue.
This module contains all the facilities for front queues.
Generic interface for the qrm_aalloc_i, qrm_aalloc_2i, qrm_aalloc_s, qrm_aalloc_2s, qrm_aalloc_3s, qrm_aalloc_d, qrm_aalloc_2d, qrm_aalloc_3d, qrm_aalloc_c, qrm_aalloc_2c, qrm_aalloc_3c, qrm_aalloc_z, qrm_aalloc_2z, qrm_aalloc_3z, routines.
integer function qrm_queue_pop(q)
Pops an element from a queue.
This module implements the memory handling routines. Pretty mucch allocations and deallocations...
subroutine qrm_queue_free(q)
Frees a queue.