46 #ifndef MUELU_AGGREGATIONPHASE3ALGORITHM_KOKKOS_DEF_HPP 47 #define MUELU_AGGREGATIONPHASE3ALGORITHM_KOKKOS_DEF_HPP 49 #ifdef HAVE_MUELU_KOKKOS_REFACTOR 51 #include <Teuchos_Comm.hpp> 52 #include <Teuchos_CommHelpers.hpp> 54 #include <Xpetra_Vector.hpp> 58 #include "MueLu_Aggregates_kokkos.hpp" 60 #include "MueLu_LWGraph_kokkos.hpp" 67 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
68 void AggregationPhase3Algorithm_kokkos<LocalOrdinal, GlobalOrdinal, Node>::BuildAggregates(
const ParameterList& params,
const LWGraph_kokkos& graph, Aggregates_kokkos& aggregates, std::vector<unsigned>& aggStat, LO& numNonAggregatedNodes)
const {
69 Monitor m(*
this,
"BuildAggregates");
71 const LO numRows = graph.GetNodeNumVertices();
72 const int myRank = graph.GetComm()->getRank();
74 ArrayRCP<LO> vertex2AggId = aggregates.GetVertex2AggId()->getDataNonConst(0);
75 ArrayRCP<LO> procWinner = aggregates.GetProcWinner() ->getDataNonConst(0);
77 LO numLocalAggregates = aggregates.GetNumAggregates();
79 for (LO i = 0; i < numRows; i++) {
83 typename LWGraph_kokkos::row_type neighOfINode = graph.getNeighborVertices(i);
87 bool isNewAggregate =
false;
88 for (
int j = 0; j < neighOfINode.size(); j++) {
89 LO neigh = neighOfINode(j);
91 if (neigh != i && graph.isLocalNeighborVertex(neigh) && aggStat[neigh] ==
READY) {
92 isNewAggregate =
true;
95 vertex2AggId[neigh] = numLocalAggregates;
96 procWinner [neigh] = myRank;
98 numNonAggregatedNodes--;
102 if (isNewAggregate) {
104 aggregates.SetIsRoot(i);
105 vertex2AggId[i] = numLocalAggregates++;
113 for (; j < neighOfINode.size(); j++) {
114 LO neigh = neighOfINode(j);
117 if (graph.isLocalNeighborVertex(neigh) && aggStat[neigh] ==
AGGREGATED)
121 if (j < neighOfINode.size()) {
123 vertex2AggId[i] = vertex2AggId[neighOfINode(j)];
127 this->GetOStream(
Warnings1) <<
"Found singleton: " << i << std::endl;
129 aggregates.SetIsRoot(i);
130 vertex2AggId[i] = numLocalAggregates++;
136 procWinner[i] = myRank;
137 numNonAggregatedNodes--;
142 aggregates.SetNumAggregates(numLocalAggregates);
147 #endif // HAVE_MUELU_KOKKOS_REFACTOR 148 #endif // MUELU_AGGREGATIONPHASE3ALGORITHM_KOKKOS_DEF_HPP
Namespace for MueLu classes and methods.