46 #ifndef MUELU_AGGREGATIONPHASE2AALGORITHM_DEF_HPP_
47 #define MUELU_AGGREGATIONPHASE2AALGORITHM_DEF_HPP_
50 #include <Teuchos_Comm.hpp>
51 #include <Teuchos_CommHelpers.hpp>
53 #include <Xpetra_Vector.hpp>
58 #include "MueLu_Aggregates.hpp"
64 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
66 Monitor m(*
this,
"BuildAggregates");
68 int minNodesPerAggregate = params.get<
int>(
"aggregation: min agg size");
69 int maxNodesPerAggregate = params.get<
int>(
"aggregation: max agg size");
72 const int myRank = graph.
GetComm()->getRank();
74 ArrayRCP<LO> vertex2AggId = aggregates.
GetVertex2AggId()->getDataNonConst(0);
75 ArrayRCP<LO> procWinner = aggregates.
GetProcWinner() ->getDataNonConst(0);
79 LO numLocalNodes = procWinner.size();
80 LO numLocalAggregated = numLocalNodes - numNonAggregatedNodes;
82 const double aggFactor = 0.5;
83 double factor = as<double>(numLocalAggregated)/(numLocalNodes+1);
84 factor = pow(factor, aggFactor);
90 for (LO rootCandidate = 0; rootCandidate < numRows; rootCandidate++) {
91 if (aggStat[rootCandidate] !=
READY)
99 for (
int j = 0; j < neighOfINode.size(); j++) {
100 LO neigh = neighOfINode[j];
102 if (neigh != rootCandidate) {
109 if (aggSize < as<size_t>(maxNodesPerAggregate))
110 aggList[aggSize++] = neigh;
118 if (aggSize > as<size_t>(minNodesPerAggregate) &&
119 aggSize > factor*numNeighbors) {
123 aggIndex = numLocalAggregates++;
125 for (
size_t k = 0; k < aggSize; k++) {
127 vertex2AggId[aggList[k]] = aggIndex;
128 procWinner [aggList[k]] = myRank;
131 numNonAggregatedNodes -= aggSize;