1
/* This software was developed by Bruce Hendrickson and Robert Leland *
2
* at Sandia National Laboratories under US Department of Energy *
3
* contract DE-AC04-76DP00789 and is copyrighted by Sandia Corporation. */
11
void make_bndy_list(graph, movelist, buckets, listspace, sets, nsets, bspace,
13
struct vtx_data **graph; /* data structure for graph */
14
struct bilist *movelist; /* list of vtxs to be moved */
15
struct bilist ****buckets; /* array of lists for bucket sort */
16
struct bilist **listspace; /* list data structure for each vertex */
17
short *sets; /* processor each vertex is assigned to */
18
int nsets; /* number of sets divided into */
19
int *bspace; /* list of active vertices for bucketsort */
20
int **tops; /* top of each set of buckets */
21
int **bndy_list; /* list of boundary vertices returned */
23
struct bilist *bptr; /* loops through bspace */
24
int vtx; /* vertex that was moved */
25
int set; /* set a vertex is in */
26
int list_length; /* number of active vertices */
27
int bndy_length; /* number of vertices actually on boundary */
28
int size; /* array spacing */
29
int i, j, k; /* loop counters */
31
/* First push all the moved vertices onto list, so they can be flagged. */
32
/* They've already been removed from buckets, so want to avoid them. */
33
size = (int) (&(listspace[0][1]) - &(listspace[0][0]));
36
while (bptr != NULL) {
37
vtx = ((int) (bptr - listspace[0])) / size;
38
bspace[list_length++] = vtx;
42
/* Now get all the vertices still in the bucket lists. */
43
for (k=tops[0][1]; k >= 0; k--) {
44
bptr = buckets[0][1][k];
45
while (bptr != NULL) {
46
vtx = ((int) (bptr - listspace[0])) / size;
47
bspace[list_length++] = vtx;
52
for (i=1; i<nsets; i++) {
53
for (k=tops[i][0]; k >= 0; k--) {
54
bptr = buckets[i][0][k];
55
while (bptr != NULL) {
56
vtx = ((int) (bptr - listspace[0])) / size;
57
bspace[list_length++] = vtx;
64
/* Now that list is constructed, go reconstruct all the set numbers. */
66
for (i = 0; i< list_length; i++) {
69
for (j=1; j<graph[vtx]->nedges; j++) {
70
if (sets[graph[vtx]->edges[j]] != set) {
71
bspace[bndy_length++] = vtx;
78
/* Finally, copy boundary vertices into boundary list. */
79
*bndy_list = smalloc((bndy_length + 1) * sizeof(int));
80
for (i=0; i<bndy_length; i++) {
81
(*bndy_list)[i] = bspace[i];
83
(*bndy_list)[bndy_length] = 0;