46 #ifndef MUELU_ONEPTAGGREGATIONALGORITHM_DEF_HPP
47 #define MUELU_ONEPTAGGREGATIONALGORITHM_DEF_HPP
49 #ifdef HAVE_MUELU_KOKKOS_REFACTOR
51 #include <Teuchos_Comm.hpp>
52 #include <Teuchos_CommHelpers.hpp>
54 #include <Xpetra_Vector.hpp>
56 #include "MueLu_OnePtAggregationAlgorithm_kokkos.hpp"
58 #include "MueLu_LWGraph_kokkos.hpp"
59 #include "MueLu_Aggregates_kokkos.hpp"
65 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
66 OnePtAggregationAlgorithm_kokkos<LocalOrdinal, GlobalOrdinal, Node>::OnePtAggregationAlgorithm_kokkos(RCP<const FactoryBase>
const &)
70 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
71 void OnePtAggregationAlgorithm_kokkos<LocalOrdinal, GlobalOrdinal, Node>::
73 LWGraph_kokkos
const & graph,
74 Aggregates_kokkos & aggregates,
76 LO& numNonAggregatedNodes)
const {
77 Monitor m(*
this,
"BuildAggregates");
80 = Kokkos::create_mirror(aggstat);
82 std::vector<unsigned> aggStat;
83 aggStat.resize(aggstatHost.
extent(0));
84 for(
size_t idx = 0; idx < aggstatHost.
extent(0); ++idx) {
85 aggStat[idx] = aggstatHost(idx);
89 const int myRank = graph.GetComm()->getRank();
96 LocalOrdinal nLocalAggregates = aggregates.GetNumAggregates();
100 while (iNode1 < nRows) {
102 if (aggStat[iNode1] ==
ONEPT) {
104 aggregates.SetIsRoot(iNode1);
105 std::vector<int> aggList;
106 aggList.push_back(iNode1);
107 int aggIndex = nLocalAggregates++;
110 for (
size_t k = 0; k < aggList.size(); k++) {
112 vertex2AggId[aggList[k]] = aggIndex;
113 procWinner[aggList[k]] = myRank;
115 numNonAggregatedNodes -= aggList.
size();
121 for(
size_t idx = 0; idx < aggstatHost.
extent(0); ++idx) {
122 aggstatHost(idx) = aggStat[idx];
127 aggregates.SetNumAggregates(nLocalAggregates);
132 #endif // HAVE_MUELU_KOKKOS_REFACTOR
133 #endif // MUELU_ONEPTAGGREGATIONALGORITHM_KOKKOS_DEF_HPP
MueLu::DefaultLocalOrdinal LocalOrdinal
void deep_copy(const View< DT, DP...> &dst, typename ViewTraits< DT, DP...>::const_value_type &value, typename std::enable_if< std::is_same< typename ViewTraits< DT, DP...>::specialize, void >::value >::type *=nullptr)
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< std::is_integral< iType >::value, size_t >::type extent(const iType &r) const noexcept