10 #ifndef _ZOLTAN2_REBALANCECOLORING_HPP_
11 #define _ZOLTAN2_REBALANCECOLORING_HPP_
25 ArrayView<const lno_t> edgeIds,
26 ArrayView<const offset_t> offsets,
28 const int balanceColors,
32 #ifndef INCLUDE_ZOLTAN2_EXPERIMENTAL
40 Teuchos::Array<lno_t> colorSize(nVtx,0);
41 for (
lno_t i=0; i < nVtx; i++){
42 if (colors[i] > maxColor)
45 for (
lno_t i=0; i < nVtx; i++){
46 colorSize[colors[i]]++;
49 if (balanceColors > 0)
50 targetSize = nVtx/maxColor;
56 Teuchos::Array<int> forbidden(maxDegree+2, 0);
57 for (
lno_t i=0; i < nVtx; i++){
58 if (colorSize[colors[i]] > targetSize){
60 for (offset_t j=offsets[i]; j<offsets[i+1]; j++){
61 lno_t nbor = edgeIds[j];
62 if (colors[nbor] > 0){
64 forbidden[colors[nbor]] = i;
69 int newcolor = colors[i];
70 for (
int c=1; c <= maxColor; c++){
71 if ((forbidden[c] != i) && (colorSize[c]<targetSize)){
78 colorSize[colors[i]]--;
79 colorSize[newcolor]++;
map_t::local_ordinal_type lno_t
#define Z2_THROW_EXPERIMENTAL(mystr)
Throw an error when experimental code is requested but not compiled.
Gathering definitions used in software development.
int rebalanceColoring(const lno_t nVtx, ArrayView< const lno_t > edgeIds, ArrayView< const offset_t > offsets, ArrayRCP< int > colors, const int balanceColors, const lno_t minSize)