46 #ifndef MUELU_ONEPTAGGREGATIONALGORITHM_DEF_HPP
47 #define MUELU_ONEPTAGGREGATIONALGORITHM_DEF_HPP
49 #include <Teuchos_Comm.hpp>
50 #include <Teuchos_CommHelpers.hpp>
56 #include "MueLu_LWGraph_kokkos.hpp"
57 #include "MueLu_Aggregates.hpp"
63 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
67 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
72 Kokkos::View<unsigned*, typename LWGraph_kokkos::device_type>& aggstat,
73 LO& numNonAggregatedNodes)
const {
74 Monitor m(*
this,
"BuildAggregates");
76 typename Kokkos::View<unsigned*, device_type>::HostMirror aggstatHost = Kokkos::create_mirror(aggstat);
77 Kokkos::deep_copy(aggstatHost, aggstat);
78 std::vector<unsigned> aggStat;
79 aggStat.resize(aggstatHost.extent(0));
80 for (
size_t idx = 0; idx < aggstatHost.extent(0); ++idx) {
81 aggStat[idx] = aggstatHost(idx);
85 const int myRank = graph.
GetComm()->getRank();
96 while (iNode1 < nRows) {
97 if (aggStat[iNode1] ==
ONEPT) {
99 std::vector<int> aggList;
100 aggList.push_back(iNode1);
101 int aggIndex = nLocalAggregates++;
104 for (
size_t k = 0; k < aggList.size(); k++) {
106 vertex2AggId[aggList[k]] = aggIndex;
107 procWinner[aggList[k]] = myRank;
109 numNonAggregatedNodes -= aggList.
size();
115 for (
size_t idx = 0; idx < aggstatHost.extent(0); ++idx) {
116 aggstatHost(idx) = aggStat[idx];
118 Kokkos::deep_copy(aggstat, aggstatHost);
126 #endif // MUELU_ONEPTAGGREGATIONALGORITHM_KOKKOS_DEF_HPP
MueLu::DefaultLocalOrdinal LocalOrdinal
Lightweight MueLu representation of a compressed row storage graph.
const RCP< LOVector > & GetProcWinner() const
Returns constant vector that maps local node IDs to owning processor IDs.
Container class for aggregation information.
KOKKOS_INLINE_FUNCTION LO GetNumAggregates() const
KOKKOS_INLINE_FUNCTION size_type GetNodeNumVertices() const
Return number of graph vertices.
void SetIsRoot(LO i, bool value=true)
Set root node information.
const RCP< LOMultiVector > & GetVertex2AggId() const
Returns constant vector that maps local node IDs to local aggregates IDs.
Timer to be used in non-factories.
OnePtAggregationAlgorithm_kokkos(RCP< const FactoryBase > const &graphFact=Teuchos::null)
Constructor.
void BuildAggregates(Teuchos::ParameterList const ¶ms, LWGraph_kokkos const &graph, Aggregates &aggregates, Kokkos::View< unsigned *, device_type > &aggStat, LO &numNonAggregatedNodes) const
Local aggregation.
const RCP< const Teuchos::Comm< int > > GetComm() const
void SetNumAggregates(LO nAggregates)
Set number of local aggregates on current processor.