46 #ifndef MUELU_PRESERVEDIRICHLETAGGREGATIONALGORITHM_KOKKOS_DEF_HPP
47 #define MUELU_PRESERVEDIRICHLETAGGREGATIONALGORITHM_KOKKOS_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>
68 Kokkos::View<unsigned*, typename LWGraph_kokkos::device_type>& aggStat,
69 LO& numNonAggregatedNodes)
const {
70 Monitor m(*
this,
"BuildAggregates");
75 const bool preserve = params.
get<
bool>(
"aggregation: preserve Dirichlet points");
79 const int myRank = graph.
GetComm()->getRank();
82 auto vertex2AggId = aggregates.
GetVertex2AggId()->getDeviceLocalView(Xpetra::Access::ReadWrite);
83 auto procWinner = aggregates.
GetProcWinner()->getDeviceLocalView(Xpetra::Access::ReadWrite);
86 Kokkos::View<LO, device_type> aggCount(
"aggCount");
91 "MueLu - PreserveDirichlet: tagging ignored nodes",
92 Kokkos::RangePolicy<local_ordinal_type, execution_space>(0, numNodes),
93 KOKKOS_LAMBDA(
const local_ordinal_type nodeIdx) {
96 const LO aggIdx = Kokkos::atomic_fetch_add(&aggCount(), 1);
101 vertex2AggId(nodeIdx, 0) = aggIdx;
102 procWinner(nodeIdx, 0) = myRank;
106 typename Kokkos::View<LO, device_type>::HostMirror aggCount_h = Kokkos::create_mirror_view(aggCount);
107 Kokkos::deep_copy(aggCount_h, aggCount);
120 #endif // MUELU_PRESERVEDIRICHLETAGGREGATIONALGORITHM_KOKKOS_DEF_HPP
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
T & get(const std::string &name, T def_value)
void BuildAggregates(const Teuchos::ParameterList ¶ms, const LWGraph_kokkos &graph, Aggregates &aggregates, Kokkos::View< unsigned *, device_type > &aggStat, LO &numNonAggregatedNodes) const
Local aggregation.
KOKKOS_INLINE_FUNCTION size_type GetNodeNumVertices() const
Return number of graph vertices.
LocalOrdinal local_ordinal_type
const RCP< LOMultiVector > & GetVertex2AggId() const
Returns constant vector that maps local node IDs to local aggregates IDs.
Timer to be used in non-factories.
const RCP< const Teuchos::Comm< int > > GetComm() const
void SetNumAggregates(LO nAggregates)
Set number of local aggregates on current processor.