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_VectorFactory.hpp> 54 #include "MueLu_Graph.hpp" 60 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
64 vertex2AggId_ = LOVectorFactory::Build(graph.
GetImportMap());
67 procWinner_ = LOVectorFactory::Build(graph.
GetImportMap());
73 aggregatesIncludeGhosts_ =
true;
77 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
81 vertex2AggId_ = LOVectorFactory::Build(map);
84 procWinner_ = LOVectorFactory::Build(map);
90 aggregatesIncludeGhosts_ =
true;
94 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
97 if (aggregateSizes_ != Teuchos::null && !forceRecompute) {
99 return aggregateSizes_;
104 aggregateSizes_ = Teuchos::null;
108 int myPid = vertex2AggId_->getMap()->getComm()->getRank();
111 LO size = procWinner.
size();
114 for (LO k = 0; k < size; ++k ) {
115 if (procWinner[k] == myPid) aggregateSizes[vertex2AggId[k]]++;
119 aggregateSizes_ = aggregateSizes;
121 return aggregateSizes;
126 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
128 std::ostringstream out;
130 out <<
"{nGlobalAggregates = " << GetNumGlobalAggregates() <<
"}";
134 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
139 out0 <<
"Global number of aggregates: " << GetNumGlobalAggregates() << std::endl;
142 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
144 LO nAggregates = GetNumAggregates();
145 GO nGlobalAggregates;
MueLu_sumAll(vertex2AggId_->getMap()->getComm(), (GO)nAggregates, nGlobalAggregates);
146 return nGlobalAggregates;
149 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
151 return vertex2AggId_->getMap();
156 #endif // MUELU_AGGREGATES_DEF_HPP
std::string description() const
Return a simple one-line description of this object.
#define MueLu_sumAll(rcpComm, in, out)
void print(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
Namespace for MueLu classes and methods.
Aggregates(const GraphBase &graph)
Standard constructor for Aggregates structure.
GO GetNumGlobalAggregates() const
Get global number of aggregates.
#define MUELU_UNAGGREGATED
#define MUELU_DESCRIBE
Helper macro for implementing Describable::describe() for BaseClass objects.
const RCP< const Map > GetMap() const
returns (overlapping) map of aggregate/node distribution
MueLu representation of a graph.
virtual const RCP< const Map > GetImportMap() const =0
virtual std::string description() const
Return a simple one-line description of this object.
Teuchos::ArrayRCP< LO > ComputeAggregateSizes(bool forceRecompute=true, bool cacheSizes=false) const
Compute sizes of aggregates.