28 module procedure sort_exec_without_idx
29 module procedure sort_exec_with_idxs
30 module procedure sort_exec_with_idx
31 end interface sort_exec
50 subroutine sort_exec_with_idxs( &
56 integer,
intent(in) :: npoints
57 real(RP),
intent(inout) :: val (npoints)
58 integer,
intent(inout) :: idx_i(npoints)
59 integer,
intent(inout) :: idx_j(npoints)
61 logical,
intent(in),
optional :: reverse
72 if (
present(reverse) )
then
73 if ( reverse ) sig = -1.0_rp
78 if ( val(n1) * sig > val(n2) * sig )
then
95 end subroutine sort_exec_with_idxs
98 subroutine sort_exec_with_idx( &
103 integer,
intent(in) :: npoints
104 real(RP),
intent(inout) :: val (npoints)
105 integer,
intent(inout) :: index(npoints)
107 logical,
intent(in),
optional :: reverse
117 if (
present(reverse) )
then
118 if ( reverse ) sig = -1.0_rp
122 do n2 = n1+1, npoints
123 if ( val(n1) * sig > val(n2) * sig )
then
127 index(n1) = index(n2)
137 end subroutine sort_exec_with_idx
140 subroutine sort_exec_without_idx( &
145 integer,
intent(in) :: npoints
146 real(RP),
intent(inout) :: val (npoints)
148 logical,
intent(in),
optional :: reverse
157 if (
present(reverse) )
then
158 if ( reverse ) sig = -1.0_rp
162 do n2 = n1+1, npoints
163 if ( val(n1) * sig > val(n2) * sig )
then
174 end subroutine sort_exec_without_idx