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>::
68 LWGraph_kokkos
const & graph,
69 Aggregates_kokkos & aggregates,
71 LO& numNonAggregatedNodes)
const {
72 Monitor m(*
this,
"BuildAggregates");
73 using local_ordinal_type =
typename LWGraph_kokkos::local_ordinal_type;
77 const bool preserve = params.
get<
bool>(
"aggregation: preserve Dirichlet points");
80 const LO numNodes = graph.GetNodeNumVertices();
81 const int myRank = graph.GetComm()->getRank();
84 auto vertex2AggId = aggregates.GetVertex2AggId()->template getLocalView<memory_space>();
85 auto procWinner = aggregates.GetProcWinner() ->template getLocalView<memory_space>();
94 KOKKOS_LAMBDA(
const local_ordinal_type nodeIdx) {
97 const LO aggIdx = Kokkos::atomic_fetch_add(&aggCount(), 1);
102 vertex2AggId(nodeIdx, 0) = aggIdx;
103 procWinner(nodeIdx, 0) = myRank;
108 = Kokkos::create_mirror_view(aggCount);
112 numNonAggregatedNodes -= (aggCount_h() - aggregates.GetNumAggregates());
116 aggregates.SetNumAggregates(aggCount_h());
122 #endif // HAVE_MUELU_KOKKOS_REFACTOR
123 #endif // MUELU_PRESERVEDIRICHLETAGGREGATIONALGORITHM_KOKKOS_DEF_HPP
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)
T & get(const std::string &name, T def_value)
void parallel_for(const ExecPolicy &policy, const FunctorType &functor, const std::string &str="", typename std::enable_if< Kokkos::Impl::is_execution_policy< ExecPolicy >::value >::type *=nullptr)