45 #ifndef _ZOLTAN2_REBALANCECOLORING_HPP_
46 #define _ZOLTAN2_REBALANCECOLORING_HPP_
60 ArrayView<const lno_t> edgeIds,
61 ArrayView<const offset_t> offsets,
63 const int balanceColors,
67 #ifndef INCLUDE_ZOLTAN2_EXPERIMENTAL
75 Teuchos::Array<lno_t> colorSize(nVtx,0);
76 for (lno_t i=0; i < nVtx; i++){
77 if (colors[i] > maxColor)
80 for (lno_t i=0; i < nVtx; i++){
81 colorSize[colors[i]]++;
84 if (balanceColors > 0)
85 targetSize = nVtx/maxColor;
91 Teuchos::Array<int> forbidden(maxDegree+2, 0);
92 for (lno_t i=0; i < nVtx; i++){
93 if (colorSize[colors[i]] > targetSize){
95 for (offset_t j=offsets[i]; j<offsets[i+1]; j++){
96 lno_t nbor = edgeIds[j];
97 if (colors[nbor] > 0){
99 forbidden[colors[nbor]] = i;
104 int newcolor = colors[i];
105 for (
int c=1; c <= maxColor; c++){
106 if ((forbidden[c] != i) && (colorSize[c]<targetSize)){
113 colorSize[colors[i]]--;
114 colorSize[newcolor]++;
115 colors[i] = newcolor;
#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)