| 1 |
/* |
| 2 |
* Copyright(C) 1999-2020 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 vtx_data |
| 10 |
|
| 11 |
void count_weights(struct vtx_data **graph, /* data structure for graph */ |
| 12 |
int nvtxs, /* number of vtxs in graph */ |
| 13 |
int *sets, /* set each vertex is assigned to */ |
| 14 |
int nsets, /* number of sets in this division */ |
| 15 |
double *weights, /* vertex weights in each set */ |
| 16 |
int using_vwgts /* are vertex weights being used? */ |
| 17 |
) |
| 18 |
|
| 19 |
{ |
| 20 |
int i; /* loop counters */ |
| 21 |
|
| 22 |
/* Compute the sum of vertex weights for each set. */ |
| 23 |
for (i = 0; i < nsets; i++) { |
| 24 |
weights[i] = 0; |
| 25 |
} |
| 26 |
|
| 27 |
if (using_vwgts) { |
| 28 |
for (i = 1; i <= nvtxs; i++) { |
| 29 |
weights[sets[i]] += graph[i]->vwgt; |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
else { |
| 34 |
for (i = 1; i <= nvtxs; i++) { |
| 35 |
weights[sets[i]]++; |
| 36 |
} |
| 37 |
} |
| 38 |
} |