Skip to content
Snippets Groups Projects
profil_sloan.f 2.39 KiB
Newer Older
  • Learn to ignore specific revisions
  • Douglas Guptill's avatar
    Douglas Guptill committed
          SUBROUTINE PROFIL_SLOAN(N,NNN,E2,ADJ,XADJ,OLDPRO,NEWPRO)
    ************************************************************************
    *
    *     PURPOSE:
    *     --------
    *
    *     Compute the profiles using both original and new node numbers
    *
    *     INPUT:
    *     ------
    *
    *     N      - Total number of nodes in graph
    *     NNN    - List of new node numbers for graph
    *            - New node number for node I is given by NNN(I)
    *     E2     - Twice the number of edges in the graph = XADJ(N+1)-1
    *     ADJ    - Adjacency list for all nodes in graph
    *            - List of length 2E where E is the number of edges in 
    *              the graph and 2E = XADJ(N+1)-1
    *     XADJ   - Index vector for ADJ
    *            - Nodes adjacent to node I are found in ADJ(J), where
    *              J = XADJ(I), XADJ(I)+1, ..., XADJ(I+1)-1
    *            - Degree of node I given by XADJ(I+1)-XADJ(I)
    *     OLDPRO - Undefined
    *     NEWPRO - Undefined
    *
    *     OUTPUT:
    *     -------
    *
    *     N      - Unchanged
    *     NNN    - Unchanged
    *     E2     - Unchanged
    *     ADJ    - Unchanged
    *     XADJ   - Unchanged
    *     OLDPRO - Profile with original node numbering
    *     NEWPRO - Profile with new node numbering
    *
    *     NOTE:      Profiles include diagonal terms
    *     -----
    *
    *     PROGRAMMER:             Scott Sloan
    *     -----------
    *
    *     LAST MODIFIED:          13 August 1991     Scott Sloan
    *     --------------
    *
    *     COPYRIGHT 1989:         Scott Sloan
    *     ---------------         Department of Civil Engineering
    *                             University of Newcastle
    *                             NSW 2308
    *
    ***********************************************************************
          INTEGER I,J,N
          INTEGER E2
          INTEGER JSTOP,JSTRT
          INTEGER NEWMIN,NEWPRO,OLDMIN,OLDPRO
          INTEGER ADJ(E2),NNN(N)
          INTEGER XADJ(N+1)
    *
    *     Set profiles and loop over each node in graph
    *
          OLDPRO=0
          NEWPRO=0
          DO 20 I=1,N
            JSTRT=XADJ(I)
            JSTOP=XADJ(I+1)-1
            OLDMIN=I
            NEWMIN=NNN(I)
    *
    *       Find lowest numbered neighbour of node I
    *       (using both old and new node numbers)
    *
            DO 10 J=JSTRT,JSTOP
              OLDMIN=MIN(OLDMIN,ADJ(J))
              NEWMIN=MIN(NEWMIN,NNN(ADJ(J)))
       10   CONTINUE
    *
    *       Update profiles
    *
            OLDPRO=OLDPRO+DIM(I,OLDMIN)
            NEWPRO=NEWPRO+DIM(NNN(I),NEWMIN)
       20 CONTINUE
    *
    *     Add diagonal terms to profiles
    *
          OLDPRO=OLDPRO+N
          NEWPRO=NEWPRO+N
          END