| 1 |
/* |
| 2 |
* Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions |
| 3 |
* of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 4 |
* NTESS, the U.S. Government retains certain rights in this software. |
| 5 |
* |
| 6 |
* See packages/seacas/LICENSE for details |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "structs.h" // for bilist |
| 10 |
#include <stdio.h> // for printf, NULL |
| 11 |
|
| 12 |
/*static void p1bucket();*/ |
| 13 |
|
| 14 |
void pbuckets(struct bilist ****buckets, /* pointers to bucket lists */ |
| 15 |
struct bilist **listspace, /* elements within buckets */ |
| 16 |
int maxdeg, /* maximum degree of a vertex */ |
| 17 |
int nsets /* number of sets being divided into */ |
| 18 |
) |
| 19 |
{ |
| 20 |
struct bilist *lptr; /* points to correct listspace */ |
| 21 |
int i, j; /* loop counter */ |
| 22 |
|
| 23 |
printf("\n"); |
| 24 |
for (i = 0; i < nsets; i++) { |
| 25 |
for (j = 0; j < nsets; j++) { |
| 26 |
if (i != j) { |
| 27 |
printf("For transition %d -> %d\n", i, j); |
| 28 |
if (j > i) { |
| 29 |
lptr = listspace[j - 1]; |
| 30 |
} |
| 31 |
else { |
| 32 |
lptr = listspace[j]; |
| 33 |
} |
| 34 |
p1bucket(buckets[i][j], lptr, maxdeg); |
| 35 |
printf("\n"); |
| 36 |
} |
| 37 |
} |
| 38 |
} |
| 39 |
printf("\n"); |
| 40 |
} |
| 41 |
|
| 42 |
/*static*/ void p1bucket(struct bilist **bucket, /* buckets holding bucket list */ |
| 43 |
struct bilist *lptr, /* elements within bucket */ |
| 44 |
int maxdeg /* maximum degree of a vertex */ |
| 45 |
) |
| 46 |
{ |
| 47 |
struct bilist *bptr; /* loops through list at a bucket */ |
| 48 |
int val; /* element in a bucket */ |
| 49 |
int size; /* array spacing */ |
| 50 |
int i; /* loop counter */ |
| 51 |
|
| 52 |
size = (int)(&(lptr[1]) - &(lptr[0])); |
| 53 |
for (i = 2 * maxdeg; i >= 0; i--) { |
| 54 |
if (bucket[i] != NULL) { |
| 55 |
printf(" Bucket %d:", i - maxdeg); |
| 56 |
for (bptr = bucket[i]; bptr != NULL; bptr = bptr->next) { |
| 57 |
val = ((int)(bptr - lptr)) / size; |
| 58 |
printf(" %d", val); |
| 59 |
} |
| 60 |
printf("\n"); |
| 61 |
} |
| 62 |
} |
| 63 |
} |