Nbody6
Main Page
Files
File List
File Members
All
Files
Functions
Variables
sort1.f
Go to the documentation of this file.
1
SUBROUTINE
sort1
(N,RA,RB)
2
*
3
*
4
* Heapsort method (Press p. 231).
5
* -------------------------------
6
*
7
INTEGER
rb(n),rrb
8
REAL*8
ra(n),rra
9
*
10
*
11
IF
(n.LE.1)
RETURN
! bug fix Nov 2007.
12
l = n/2+1
13
ir=n
14
10
CONTINUE
15
IF
(l.GT.1)
THEN
16
l=l-1
17
rra=ra(l)
18
rrb=rb(l)
19
ELSE
20
rra=ra(ir)
21
rrb=rb(ir)
22
ra(ir)=ra(1)
23
rb(ir)=rb(1)
24
ir=ir-1
25
IF
(ir.EQ.1)
THEN
26
ra(1)=rra
27
rb(1)=rrb
28
RETURN
29
END IF
30
END IF
31
i=l
32
j=l+l
33
20
IF
(j.LE.ir)
THEN
34
IF
(j.LT.ir)
THEN
35
IF
(ra(j).LT.ra(j+1)) j=j+1
36
END IF
37
IF
(rra.LT.ra(j))
THEN
38
ra(i)=ra(j)
39
rb(i)=rb(j)
40
i=j
41
j=j+j
42
ELSE
43
j=ir+1
44
END IF
45
go to 20
46
END IF
47
ra(i)=rra
48
rb(i)=rrb
49
go to 10
50
*
51
END
Nbody6
Ncode
sort1.f
Generated on Sat Nov 30 2013 19:04:37 for Nbody6 by
1.8.2