summaryrefslogtreecommitdiff
path: root/Utilib/src/RENINS.f
blob: f5a1029199bf112483b392e3fc0506a1345de8de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
*DECK RENINS
      SUBROUTINE RENINS(SIZE,LEV,DEG)
*
*-----------------------------------------------------------------------
*
*Purpose:
* Sort a level by increasing degree using the "Insertion method".
*
*Copyright:
* Copyright (C) 2002 Ecole Polytechnique de Montreal
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version
*
*Author(s): R. Le Tellier
*
*Parameters: input
* SIZE    number of nodes in the level.
* LEV     level to sort.
* DEG     degrees of the level.
*
*-----------------------------------------------------------------------
*
      IMPLICIT NONE
*---
* SUBROUTINE ARGUMENTS
*---
      INTEGER SIZE,LEV(SIZE),DEG(SIZE)
*---
* LOCAL VARIABLES
*---
      INTEGER I,INDD,INDL,J
*
      DO I=2,SIZE
         INDD=DEG(I)
         INDL=LEV(I)
         J=I
         DO WHILE ((J.GT.1).AND.(DEG(J-1).GT.INDD))
            DEG(J)=DEG(J-1)
            LEV(J)=LEV(J-1)
            J=J-1
         ENDDO
         DEG(J)=INDD
         LEV(J)=INDL
      ENDDO
*
      RETURN
      END