SUEWS API Site
Documentation of SUEWS source code
Functions/Subroutines
qsort_c_module Module Reference

Functions/Subroutines

recursive subroutine, public qsortc (a)
 
subroutine, private partition (a, marker)
 

Function/Subroutine Documentation

◆ partition()

subroutine, private qsort_c_module::partition ( real, dimension(:), intent(inout) a,
integer, intent(out) marker )
private

Definition at line 28 of file suews_util_qsort.f95.

29 REAL, INTENT(in out), DIMENSION(:) :: A
30 INTEGER, INTENT(out) :: marker
31 INTEGER :: i, j
32 REAL :: temp
33 REAL :: x ! pivot point
34 x = a(1)
35 i = 0
36 j = SIZE(a) + 1
37
38 DO
39 j = j - 1
40 DO
41 IF (a(j) <= x) EXIT
42 j = j - 1
43 END DO
44 i = i + 1
45 DO
46 IF (a(i) >= x) EXIT
47 i = i + 1
48 END DO
49 IF (i < j) THEN
50 ! exchange A(i) and A(j)
51 temp = a(i)
52 a(i) = a(j)
53 a(j) = temp
54 ELSEIF (i == j) THEN
55 marker = i + 1
56 RETURN
57 ELSE
58 marker = i
59 RETURN
60 END IF
61 END DO
62

Referenced by qsortc().

Here is the caller graph for this function:

◆ qsortc()

recursive subroutine, public qsort_c_module::qsortc ( real, dimension(:), intent(inout) a)

Definition at line 17 of file suews_util_qsort.f95.

18 REAL, INTENT(in out), DIMENSION(:) :: A
19 INTEGER :: iq
20
21 IF (SIZE(a) > 1) THEN
22 CALL partition(a, iq)
23 CALL qsortc(a(:iq - 1))
24 CALL qsortc(a(iq:))
25 END IF

References partition(), and qsortc().

Referenced by qsortc().

Here is the call graph for this function:
Here is the caller graph for this function: