46 #ifndef MUELU_PRESERVEDIRICHLETAGGREGATIONALGORITHM_KOKKOS_DEF_HPP
47 #define MUELU_PRESERVEDIRICHLETAGGREGATIONALGORITHM_KOKKOS_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_PreserveDirichletAggregationAlgorithm_kokkos.hpp"
58 #include "MueLu_LWGraph_kokkos.hpp"
59 #include "MueLu_Aggregates_kokkos.hpp"
65 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
66 void PreserveDirichletAggregationAlgorithm_kokkos<LocalOrdinal, GlobalOrdinal, Node>::
67 BuildAggregates(Teuchos::ParameterList
const & params,
68 LWGraph_kokkos
const & graph,
69 Aggregates_kokkos & aggregates,
71 LO& numNonAggregatedNodes)
const {
72 Monitor m(*
this,
"BuildAggregates");
75 = Kokkos::create_mirror(aggstat);
77 std::vector<unsigned> aggStat;
78 aggStat.resize(aggstatHost.
extent(0));
79 for(
size_t idx = 0; idx < aggstatHost.
extent(0); ++idx) {
80 aggStat[idx] = aggstatHost(idx);
83 bool preserve = params.get<
bool>(
"aggregation: preserve Dirichlet points");
85 const LO numRows = graph.GetNodeNumVertices();
86 const int myRank = graph.GetComm()->getRank();
88 ArrayRCP<LO> vertex2AggId = aggregates.GetVertex2AggId()->getDataNonConst(0);
89 ArrayRCP<LO> procWinner = aggregates.GetProcWinner() ->getDataNonConst(0);
91 LO numLocalAggregates = aggregates.GetNumAggregates();
93 for (LO i = 0; i < numRows; i++)
96 numNonAggregatedNodes--;
99 aggregates.SetIsRoot(i);
101 vertex2AggId[i] = numLocalAggregates++;
102 procWinner [i] = myRank;
106 for(
size_t idx = 0; idx < aggstatHost.
extent(0); ++idx) {
107 aggstatHost(idx) = aggStat[idx];
112 aggregates.SetNumAggregates(numLocalAggregates);
constexpr KOKKOS_INLINE_FUNCTION std::enable_if< std::is_integral< iType >::value, size_t >::type extent(const iType &r) const noexcept
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 *=0)
Namespace for MueLu classes and methods.