rootls
C ROOTLS SOURCE CHAT 05/01/13 03:04:26 5004 $ LS,XLS,DEPTH,WIDTH, $ IMPR,IRET) IMPLICIT INTEGER(I-N) IMPLICIT REAL*8 (A-H,O-Z) C*********************************************************************** C NOM : ROOTLS C DESCRIPTION : Generate rooted level structure using a FORTRAN 77 C implementation of the algorithm given by George and Liu C C LANGAGE : FORTRAN 77 (sauf E/S) C C AUTEUR : Scott Sloan C C BIBLIO : @Article{, C author = {S. W. Sloan}, C title = {A Fortran Program for Profile and Wavefront Reduction}, C journal = {International Journal for Numerical Methods in Engineering}, C year = {1989}, C volume = {28}, C pages = {2651-2679} C} C C*********************************************************************** C APPELES : ROOTLS, ISHELI C APPELE PAR : DIAMTR C*********************************************************************** C ENTREES : C N - Number of nodes C ROOT - Root node for level structure C MAXWID - Max permissible width of rooted level structure C - Abort assembly of level structure if width is ge MAXWID C - Assembly insured by setting MAXWID = N+1 C E2 - Twice the number of edges in the graph = XADJ(N+1)-1 C ADJ - Adjacency list for all nodes in graph C - List of length 2E where E is the number of edges in C the graph and 2E = XADJ(N+1)-1 C XADJ - Index vector for ADJ C - Nodes adjacent to node I are found in ADJ(J), where C J = XADJ(I),...,XADJ(I+1)-1 C - Degree of node I given by XADJ(I+1)-XADJ(I) C MASK - Masking vector for graph C - Visible nodes have MASK = 0 C ENTREES/SORTIES : - C SORTIES : C LS - List containing a rooted level structure C - List of length NC C XLS - Index vector for LS C - Nodes in level I are found in LS(J), where C J = XLS(I),...,XLS(I+1)-1 C - List of max length NC+1 C DEPTH - Number of levels in rooted level structure C WIDTH - Width of rooted level structure C C NOTES : C C If WIDTH ge MAXWID then assembly has been aborted C C CODE RETOUR (IRET) : = 0 si tout s'est bien passé C*********************************************************************** C VERSION : v1, 05/11/99, version initiale C HISTORIQUE : v1, 10/03/89, création C HISTORIQUE : C HISTORIQUE : C*********************************************************************** C Prière de PRENDRE LE TEMPS de compléter les commentaires C en cas de modification de ce sous-programme afin de faciliter C la maintenance ! C*********************************************************************** -INC PPARAM -INC CCOPTIO INTEGER ROOT,DEPTH,NBR,MAXWID,LSTRT,LSTOP,LWDTH INTEGER NODE,NC,WIDTH,N,JSTRT,JSTOP,I,J,E2 INTEGER XADJ(N+1),ADJ(E2),MASK(N),XLS(N+1),LS(N) INTEGER IMPR,IRET * * Executable statements * IF (IMPR.GT.1) WRITE(IOIMP,*) 'Entrée dans rootls' * * Initialisation * MASK(ROOT)=1 LS(1)=ROOT NC =1 WIDTH=1 DEPTH=0 LSTOP=0 LWDTH=1 10 CONTINUE IF (LWDTH.GT.0) THEN * * LWDTH is the width of the current level * LSTRT points to start of current level * LSTOP points to ende of current level * NC counts the nodes in component * LSTRT=LSTOP+1 LSTOP=NC DEPTH=DEPTH+1 XLS(DEPTH)=LSTRT * * Generate next levle by finding all visible neighbours * of node in current level * DO 30 I=LSTRT,LSTOP NODE=LS(I) JSTRT=XADJ(NODE) JSTOP=XADJ(NODE+1)-1 DO 20 J=JSTRT,JSTOP NBR=ADJ(J) IF (MASK(NBR).EQ.0) THEN NC=NC+1 LS(NC)=NBR MASK(NBR)=1 ENDIF 20 CONTINUE 30 CONTINUE * * Compute width of level just assembled and the width of the * level structure so far * LWDTH=NC-LSTOP WIDTH=MAX(LWDTH,WIDTH) * * Abort assembly if level structure is too wide * IF (WIDTH.GE.MAXWID) GOTO 35 GOTO 10 ENDIF XLS(DEPTH+1)=LSTOP+1 * * Reset MASK=0 for nodes in the level structure * 35 CONTINUE DO 40 I=1,NC MASK(LS(I))=0 40 CONTINUE * * Normal termination * IRET=0 RETURN * * Format handling * * * Error handling * 9999 CONTINUE IRET=1 WRITE(IOIMP,*) 'An error was detected in subroutine rootls' RETURN * * End of subroutine ROOTLS * END
© Cast3M 2003 - Tous droits réservés.
Mentions légales