82 RCP<ParameterList> validParamList = rcp(
new ParameterList());
87 typedef Teuchos::StringToIntegralParameterEntryValidator<int> validatorType;
88#define SET_VALID_ENTRY(name) validParamList->setEntry(name, MasterList::getEntry(name))
93 validParamList->getEntry(
"aggregation: ordering").setValidator(
94 rcp(
new validatorType(Teuchos::tuple<std::string>(
"natural",
"graph",
"random"),
"aggregation: ordering")));
104 SET_VALID_ENTRY(
"aggregation: error on nodes with no on-rank neighbors");
108#undef SET_VALID_ENTRY
111 validParamList->set< RCP<const FactoryBase> >(
"Graph", null,
"Generating factory of the graph");
112 validParamList->set< RCP<const FactoryBase> >(
"DofsPerNode", null,
"Generating factory for variable \'DofsPerNode\', usually the same as for \'Graph\'");
113 validParamList->set< RCP<const FactoryBase> >(
"AggregateQualities", null,
"Generating factory for variable \'AggregateQualities\'");
116 validParamList->set< std::string > (
"OnePt aggregate map name",
"",
"Name of input map for single node aggregates. (default='')");
117 validParamList->set< std::string > (
"OnePt aggregate map factory",
"",
"Generating factory of (DOF) map for single node aggregates.");
122 validParamList->set< std::string > (
"Interface aggregate map name",
"",
"Name of input map for interface aggregates. (default='')");
123 validParamList->set< std::string > (
"Interface aggregate map factory",
"",
"Generating factory of (DOF) map for interface aggregates.");
124 validParamList->set<RCP<const FactoryBase> > (
"nodeOnInterface", Teuchos::null,
"Array specifying whether or not a node is on the interface (1 or 0).");
126 return validParamList;
175 if (pL.get<
int>(
"aggregation: max agg size") == -1)
176 pL.set(
"aggregation: max agg size", INT_MAX);
179 RCP<const FactoryBase> graphFact =
GetFactory(
"Graph");
197 std::string mapOnePtName = pL.get<std::string>(
"OnePt aggregate map name");
198 RCP<Map> OnePtMap = Teuchos::null;
199 if (mapOnePtName.length()) {
200 std::string mapOnePtFactName = pL.get<std::string>(
"OnePt aggregate map factory");
201 if (mapOnePtFactName ==
"" || mapOnePtFactName ==
"NoFactory") {
204 RCP<const FactoryBase> mapOnePtFact =
GetFactory(mapOnePtFactName);
205 OnePtMap = currentLevel.
Get<RCP<Map> >(mapOnePtName, mapOnePtFact.get());
210 std::string mapInterfaceName = pL.get<std::string>(
"Interface aggregate map name");
211 RCP<Map> InterfaceMap = Teuchos::null;
216 RCP<Aggregates> aggregates = rcp(
new Aggregates(*graph));
217 aggregates->setObjectLabel(
"UC");
219 const LO numRows = graph->GetNodeNumVertices();
222 std::vector<unsigned> aggStat(numRows,
READY);
225 if (pL.get<
bool>(
"aggregation: use interface aggregation") ==
true){
226 Teuchos::Array<LO> nodeOnInterface =
Get<Array<LO>>(currentLevel,
"nodeOnInterface");
227 for (LO i = 0; i < numRows; i++) {
228 if (nodeOnInterface[i])
233 ArrayRCP<const bool> dirichletBoundaryMap = graph->GetBoundaryNodeMap();
234 if (dirichletBoundaryMap != Teuchos::null)
235 for (LO i = 0; i < numRows; i++)
236 if (dirichletBoundaryMap[i] ==
true)
239 LO nDofsPerNode =
Get<LO>(currentLevel,
"DofsPerNode");
240 GO indexBase = graph->GetDomainMap()->getIndexBase();
241 if (OnePtMap != Teuchos::null) {
242 for (LO i = 0; i < numRows; i++) {
244 GO grid = (graph->GetDomainMap()->getGlobalElement(i)-indexBase) * nDofsPerNode + indexBase;
246 for (LO kr = 0; kr < nDofsPerNode; kr++)
247 if (OnePtMap->isNodeGlobalElement(grid + kr))
254 const RCP<const Teuchos::Comm<int> > comm = graph->GetComm();
255 GO numGlobalRows = 0;
259 LO numNonAggregatedNodes = numRows;
260 GO numGlobalAggregatedPrev = 0, numGlobalAggsPrev = 0;
261 for (
size_t a = 0; a <
algos_.size(); a++) {
262 std::string phase =
algos_[a]->description();
266 algos_[a]->BuildAggregates(pL, *graph, *aggregates, aggStat, numNonAggregatedNodes);
267 algos_[a]->SetProcRankVerbose(oldRank);
270 GO numLocalAggregated = numRows - numNonAggregatedNodes, numGlobalAggregated = 0;
271 GO numLocalAggs = aggregates->GetNumAggregates(), numGlobalAggs = 0;
272 MueLu_sumAll(comm, numLocalAggregated, numGlobalAggregated);
275 double aggPercent = 100*as<double>(numGlobalAggregated)/as<double>(numGlobalRows);
276 if (aggPercent > 99.99 && aggPercent < 100.00) {
283 GetOStream(
Statistics1) <<
" aggregated : " << (numGlobalAggregated - numGlobalAggregatedPrev) <<
" (phase), " << std::fixed
284 << std::setprecision(2) << numGlobalAggregated <<
"/" << numGlobalRows <<
" [" << aggPercent <<
"%] (total)\n"
285 <<
" remaining : " << numGlobalRows - numGlobalAggregated <<
"\n"
286 <<
" aggregates : " << numGlobalAggs-numGlobalAggsPrev <<
" (phase), " << numGlobalAggs <<
" (total)" << std::endl;
287 numGlobalAggregatedPrev = numGlobalAggregated;
288 numGlobalAggsPrev = numGlobalAggs;
292 TEUCHOS_TEST_FOR_EXCEPTION(numNonAggregatedNodes,
Exceptions::RuntimeError,
"MueLu::UncoupledAggregationFactory::Build: Leftover nodes found! Error!");
294 aggregates->AggregatesCrossProcessors(
false);
295 aggregates->ComputeAggregateSizes(
true);
297 Set(currentLevel,
"Aggregates", aggregates);
299 if (pL.get<
bool>(
"aggregation: compute aggregate qualities")) {