72 Monitor m(*
this,
"Coarsen Uncoupled");
87 Teuchos::ArrayRCP<CANodeState> aggStat;
89 if (nRows > 0) aggStat = Teuchos::arcp<CANodeState>(nRows);
101 Teuchos::ArrayRCP<LO> randomVector;
102 RCP<MueLu::LinkedList> nodeList;
110 randomVector = Teuchos::arcp<LO>(nRows);
111 for (
my_size_t i = 0; i < nRows; ++i) randomVector[i] = i;
125 Teuchos::ArrayRCP<LO> vertex2AggId = aggregates.
GetVertex2AggId()->getDataNonConst(0);
127 while (iNode2 < nRows)
134 if (
ordering_ ==
"natural" ) iNode = iNode2++;
135 else if (
ordering_ ==
"random" ) iNode = randomVector[iNode2++];
138 if ( nodeList->IsEmpty() )
140 for (
int jNode = 0; jNode < nRows; ++jNode )
144 nodeList->Add(jNode);
149 if ( nodeList->IsEmpty() )
break;
151 iNode = nodeList->Pop();
165 typename Teuchos::ArrayView<const LO>::size_type length = neighOfINode.size();
169 supernode->list = Teuchos::arcp<int>(length+1);
170 }
catch (std::bad_alloc&) {
171 TEUCHOS_TEST_FOR_EXCEPTION(
true,
Exceptions::RuntimeError,
"MueLu::LocalAggregationAlgorithm::CoarsenUncoupled(): Error: couldn't allocate memory for supernode! length=" + Teuchos::toString(length));
174 supernode->maxLength = length;
175 supernode->length = 1;
176 supernode->list[0] = iNode;
185 for (
typename Teuchos::ArrayView<const LO>::const_iterator it = neighOfINode.begin(); it != neighOfINode.end(); ++it)
192 supernode->list[supernode->length++] = index;
213 if (selectFlag != 1 ||
220 for (
typename Teuchos::ArrayView<const LO>::const_iterator it = neighOfINode.begin(); it != neighOfINode.end(); ++it)
223 if ( index < nRows && aggStat[index] ==
CA_READY )
225 nodeList->Add(index);
233 for (
int j = 0; j < supernode->length; ++j )
235 int jNode = supernode->list[j];
237 vertex2AggId[jNode] = nAggregates;
243 for (
typename Teuchos::ArrayView<const LO>::const_iterator it = neighOfJNode.begin(); it != neighOfJNode.end(); ++it)
246 if ( index < nRows && aggStat[index] ==
CA_READY )
248 nodeList->Add(index);
253 supernode->next = NULL;
254 supernode->index = nAggregates;
255 if ( nAggregates == 0 )
258 aggCurrent = supernode;
262 aggCurrent->next = supernode;
263 aggCurrent = supernode;
275 nodeList = Teuchos::null;
282 const RCP<const Teuchos::Comm<int> > & comm = graph.
GetComm();
285 GO localReady=0, globalReady;
289 if (aggStat[i] ==
CA_READY) localReady++;
305 GO globalSelected;
MueLu_sumAll(comm, (GO)localSelected, globalSelected);
308 GO globalNRows;
MueLu_sumAll(comm, (GO)nRows, globalNRows);
310 GetOStream(
Statistics1) <<
"Nodes aggregated = " << globalSelected <<
" (" << globalNRows <<
")" << std::endl;
314 GO nAggregatesGlobal;
MueLu_sumAll(comm, (GO)nAggregates, nAggregatesGlobal);
324 aggCurrent = aggHead;
325 while ( aggCurrent != NULL )
327 supernode = aggCurrent;
328 aggCurrent = aggCurrent->next;