Report Typos and Errors
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
interfaces
sparse_matrix_manager
sll_m_qsort_partition.F90
Go to the documentation of this file.
1
module
sll_m_qsort_partition
2
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3
implicit none
4
5
public
:: &
6
sll_s_qsortc
7
8
private
9
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10
11
contains
12
13
recursive
subroutine
sll_s_qsortc
(A)
14
15
integer
,
intent(inout)
,
dimension(:)
:: a
16
integer
:: iq
17
18
if
(
size
(a) > 1)
then
19
call
partition
(a, iq)
20
call
sll_s_qsortc
(a(:iq - 1))
21
call
sll_s_qsortc
(a(iq:))
22
end if
23
24
end subroutine
sll_s_qsortc
25
26
subroutine
partition
(A, marker)
27
28
integer
,
intent(inout)
,
dimension(:)
:: A
29
integer
,
intent(out)
:: marker
30
integer
:: i
31
integer
:: j
32
integer
:: temp
33
integer
:: x
34
35
x = a(1)
36
i = 0
37
j =
size
(a) + 1
38
39
do
40
j = j - 1
41
do
42
if
(a(j) <= x)
exit
43
j = j - 1
44
end do
45
i = i + 1
46
do
47
if
(a(i) >= x)
exit
48
i = i + 1
49
end do
50
if
(i < j)
then
51
! exchange A(i) and A(j)
52
temp = a(i)
53
a(i) = a(j)
54
a(j) = temp
55
elseif
(i == j)
then
56
marker = i + 1
57
return
58
else
59
marker = i
60
return
61
end if
62
end do
63
64
end subroutine
partition
65
66
end module
sll_m_qsort_partition
sll_m_qsort_partition
Definition:
sll_m_qsort_partition.F90:1
sll_m_qsort_partition::sll_s_qsortc
recursive subroutine, public sll_s_qsortc(A)
Definition:
sll_m_qsort_partition.F90:14
sll_m_qsort_partition::partition
subroutine partition(A, marker)
Definition:
sll_m_qsort_partition.F90:27
Report Typos and Errors
Generated on Mon Oct 23 2023 19:15:40 for Semi-Lagrangian Library by
1.9.1