46 #ifndef MUELU_AGGREGATES_DEF_HPP
47 #define MUELU_AGGREGATES_DEF_HPP
49 #include <Xpetra_Map.hpp>
50 #include <Xpetra_Vector.hpp>
51 #include <Xpetra_MultiVector.hpp>
52 #include <Xpetra_BlockedMultiVector.hpp>
53 #include <Xpetra_BlockedVector.hpp>
54 #include <Xpetra_VectorFactory.hpp>
55 #include <Xpetra_MultiVectorFactory.hpp>
58 #include "MueLu_Graph.hpp"
64 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
68 vertex2AggId_ = LOMultiVectorFactory::Build(graph.
GetImportMap(), 1);
71 procWinner_ = LOVectorFactory::Build(graph.
GetImportMap());
77 aggregatesIncludeGhosts_ =
true;
81 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
85 vertex2AggId_ = LOMultiVectorFactory::Build(map, 1);
88 procWinner_ = LOVectorFactory::Build(map);
94 aggregatesIncludeGhosts_ =
true;
98 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
101 if (aggregateSizes_ != Teuchos::null && !forceRecompute) {
103 return aggregateSizes_;
108 aggregateSizes_ = Teuchos::null;
112 int myPid = vertex2AggId_->getMap()->getComm()->getRank();
115 LO size = procWinner.
size();
118 for (LO k = 0; k < size; ++k ) {
119 if (procWinner[k] == myPid) aggregateSizes[vertex2AggId[k]]++;
122 aggregateSizes_ = aggregateSizes;
124 return aggregateSizes;
129 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
131 std::ostringstream out;
133 out <<
"{nGlobalAggregates = " << GetNumGlobalAggregates() <<
"}";
137 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
142 out0 <<
"Global number of aggregates: " << GetNumGlobalAggregates() << std::endl;
145 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
147 LO nAggregates = GetNumAggregates();
148 GO nGlobalAggregates;
MueLu_sumAll(vertex2AggId_->getMap()->getComm(), (GO)nAggregates, nGlobalAggregates);
149 return nGlobalAggregates;
152 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
154 return vertex2AggId_->getMap();
159 #endif // MUELU_AGGREGATES_DEF_HPP
#define MueLu_sumAll(rcpComm, in, out)
const RCP< const Map > GetMap() const
returns (overlapping) map of aggregate/node distribution
Teuchos::ArrayRCP< LO > ComputeAggregateSizes(bool forceRecompute=false) const
Compute sizes of aggregates.
GO GetNumGlobalAggregates() const
Get global number of aggregates.
Aggregates(const GraphBase &graph)
Standard constructor for Aggregates structure.
MueLu::DefaultGlobalOrdinal GlobalOrdinal
#define MUELU_UNAGGREGATED
#define MUELU_DESCRIBE
Helper macro for implementing Describable::describe() for BaseClass objects.
MueLu representation of a graph.
virtual const RCP< const Map > GetImportMap() const =0
void print(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
std::string description() const
Return a simple one-line description of this object.
virtual std::string description() const
Return a simple one-line description of this object.