Actual source code: qmdrch.c
petsc-3.10.5 2019-03-28
2: /* qmdrch.f -- translated by f2c (version 19931217).*/
4: #include <petscsys.h>
5: #include <petsc/private/matorderimpl.h>
7: /*****************************************************************/
8: /********** QMDRCH ..... QUOT MIN DEG REACH SET ***********/
9: /*****************************************************************/
11: /* PURPOSE - THIS SUBROUTINE DETERMINES THE REACHABLE SET OF*/
12: /* A NODE THROUGH A GIVEN SUBSET. THE ADJACENCY STRUCTURE*/
13: /* IS ASSUMED TO BE STORED IN A QUOTIENT GRAPH FORMAT.*/
15: /* INPUT PARAMETERS -*/
16: /* ../../.. - THE GIVEN NODE NOT IN THE SUBSET.*/
17: /* (XADJ, ADJNCY) - THE ADJACENCY STRUCTURE PAIR.*/
18: /* DEG - THE DEGREE VECTOR. DEG(I) LT 0 MEANS THE NODE*/
19: /* BELONGS TO THE GIVEN SUBSET.*/
21: /* OUTPUT PARAMETERS -*/
22: /* (RCHSZE, RCHSET) - THE REACHABLE SET.*/
23: /* (NHDSZE, NBRHD) - THE NEIGHBORHOOD SET.*/
25: /* UPDATED PARAMETERS -*/
26: /* MARKER - THE MARKER VECTOR FOR REACH AND NBRHD SETS.*/
27: /* GT 0 MEANS THE NODE IS IN REACH SET.*/
28: /* LT 0 MEANS THE NODE HAS BEEN MERGED WITH*/
29: /* OTHERS IN THE QUOTIENT OR IT IS IN NBRHD SET.*/
30: /*****************************************************************/
31: PetscErrorCode SPARSEPACKqmdrch(const PetscInt *root,const PetscInt *xadj,const PetscInt *adjncy,
32: PetscInt *deg, PetscInt *marker, PetscInt *rchsze, PetscInt *rchset,
33: PetscInt *nhdsze, PetscInt *nbrhd)
34: {
35: /* System generated locals */
36: PetscInt i__1, i__2;
38: /* Local variables */
39: PetscInt node, i, j, nabor, istop, jstop, istrt, jstrt;
41: /* LOOP THROUGH THE NEIGHBORS OF ../../.. IN THE*/
42: /* QUOTIENT GRAPH.*/
46: /* Parameter adjustments */
47: --nbrhd;
48: --rchset;
49: --marker;
50: --deg;
51: --adjncy;
52: --xadj;
54: *nhdsze = 0;
55: *rchsze = 0;
56: istrt = xadj[*root];
57: istop = xadj[*root + 1] - 1;
58: if (istop < istrt) return(0);
59: i__1 = istop;
60: for (i = istrt; i <= i__1; ++i) {
61: nabor = adjncy[i];
62: if (!nabor) return(0);
63: if (marker[nabor] != 0) goto L600;
64: if (deg[nabor] < 0) goto L200;
66: /* INCLUDE NABOR INTO THE REACHABLE SET.*/
67: ++(*rchsze);
68: rchset[*rchsze] = nabor;
69: marker[nabor] = 1;
70: goto L600;
71: /* NABOR HAS BEEN ELIMINATED. FIND NODES*/
72: /* REACHABLE FROM IT.*/
73: L200:
74: marker[nabor] = -1;
75: ++(*nhdsze);
76: nbrhd[*nhdsze] = nabor;
77: L300:
78: jstrt = xadj[nabor];
79: jstop = xadj[nabor + 1] - 1;
80: i__2 = jstop;
81: for (j = jstrt; j <= i__2; ++j) {
82: node = adjncy[j];
83: nabor = -node;
84: if (node < 0) goto L300;
85: else if (!node) goto L600;
86: else goto L400;
87: L400:
88: if (marker[node] != 0) goto L500;
89: ++(*rchsze);
90: rchset[*rchsze] = node;
91: marker[node] = 1;
92: L500:
93: ;
94: }
95: L600:
96: ;
97: }
98: return(0);
99: }