10#ifndef MUELU_PARAMETERLISTINTERPRETER_DEF_HPP
11#define MUELU_PARAMETERLISTINTERPRETER_DEF_HPP
13#include <Teuchos_XMLParameterListHelpers.hpp>
15#include <Xpetra_Matrix.hpp>
16#include <Xpetra_MatrixUtils.hpp>
24#include "MueLu_Hierarchy.hpp"
25#include "MueLu_FactoryManager.hpp"
27#include "MueLu_AggregationExportFactory.hpp"
28#include "MueLu_AggregateQualityEstimateFactory.hpp"
29#include "MueLu_AmalgamationFactory.hpp"
30#include "MueLu_BrickAggregationFactory.hpp"
31#include "MueLu_ClassicalMapFactory.hpp"
32#include "MueLu_ClassicalPFactory.hpp"
33#include "MueLu_CoalesceDropFactory.hpp"
34#include "MueLu_CoarseMapFactory.hpp"
35#include "MueLu_ConstraintFactory.hpp"
36#include "MueLu_CoordinatesTransferFactory.hpp"
37#include "MueLu_DirectSolver.hpp"
38#include "MueLu_EdgeProlongatorPatternFactory.hpp"
39#include "MueLu_EminPFactory.hpp"
41#include "MueLu_FacadeClassFactory.hpp"
42#include "MueLu_FactoryFactory.hpp"
43#include "MueLu_FilteredAFactory.hpp"
44#include "MueLu_GenericRFactory.hpp"
45#include "MueLu_InitialBlockNumberFactory.hpp"
46#include "MueLu_LineDetectionFactory.hpp"
47#include "MueLu_LocalOrdinalTransferFactory.hpp"
48#include "MueLu_MatrixAnalysisFactory.hpp"
49#include "MueLu_MatrixTransferFactory.hpp"
50#include "MueLu_MultiVectorTransferFactory.hpp"
51#include "MueLu_NotayAggregationFactory.hpp"
52#include "MueLu_NullspaceFactory.hpp"
53#include "MueLu_PatternFactory.hpp"
54#include "MueLu_ReplicatePFactory.hpp"
55#include "MueLu_CombinePFactory.hpp"
56#include "MueLu_PgPFactory.hpp"
57#include "MueLu_RAPFactory.hpp"
58#include "MueLu_RAPShiftFactory.hpp"
59#include "MueLu_RebalanceAcFactory.hpp"
60#include "MueLu_RebalanceTransferFactory.hpp"
61#include "MueLu_RepartitionFactory.hpp"
62#include "MueLu_RepartitionHeuristicFactory.hpp"
63#include "MueLu_ReitzingerPFactory.hpp"
64#include "MueLu_SaPFactory.hpp"
65#include "MueLu_ScaledNullspaceFactory.hpp"
66#include "MueLu_SemiCoarsenPFactory.hpp"
67#include "MueLu_SmootherFactory.hpp"
68#include "MueLu_SmooVecCoalesceDropFactory.hpp"
69#include "MueLu_TentativePFactory.hpp"
70#include "MueLu_TogglePFactory.hpp"
71#include "MueLu_ToggleCoordinatesTransferFactory.hpp"
72#include "MueLu_TransPFactory.hpp"
73#include "MueLu_UncoupledAggregationFactory.hpp"
74#include "MueLu_ZoltanInterface.hpp"
75#include "MueLu_Zoltan2Interface.hpp"
76#include "MueLu_NodePartitionInterface.hpp"
77#include "MueLu_LowPrecisionFactory.hpp"
79#include "MueLu_CoalesceDropFactory_kokkos.hpp"
80#include "MueLu_SemiCoarsenPFactory_kokkos.hpp"
81#include "MueLu_TentativePFactory_kokkos.hpp"
82#include "Teuchos_Assert.hpp"
84#ifdef HAVE_MUELU_MATLAB
85#include "../matlab/src/MueLu_MatlabSmoother_decl.hpp"
86#include "../matlab/src/MueLu_MatlabSmoother_def.hpp"
87#include "../matlab/src/MueLu_TwoLevelMatlabFactory_decl.hpp"
88#include "../matlab/src/MueLu_TwoLevelMatlabFactory_def.hpp"
89#include "../matlab/src/MueLu_SingleLevelMatlabFactory_decl.hpp"
90#include "../matlab/src/MueLu_SingleLevelMatlabFactory_def.hpp"
98#if defined(HAVE_MUELU_INTREPID2) && defined(HAVE_MUELU_EXPERIMENTAL)
99#include "MueLu_IntrepidPCoarsenFactory.hpp"
104#include <unordered_set>
108template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
110 : factFact_(factFact) {
111 RCP<Teuchos::TimeMonitor> tM = rcp(
new Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(std::string(
"MueLu: ParameterListInterpreter (ParameterList)"))));
112 if (facadeFact == Teuchos::null)
113 facadeFact_ = Teuchos::rcp(
new FacadeClassFactory());
115 facadeFact_ = facadeFact;
117 if (paramList.isParameter(
"xml parameter file")) {
118 std::string filename = paramList.get(
"xml parameter file",
"");
119 if (filename.length() != 0) {
120 TEUCHOS_TEST_FOR_EXCEPTION(comm.is_null(), Exceptions::RuntimeError,
"xml parameter file requires a valid comm");
122 ParameterList paramList2 = paramList;
123 Teuchos::updateParametersFromXmlFileAndBroadcast(filename, Teuchos::Ptr<Teuchos::ParameterList>(¶mList2), *comm);
124 SetParameterList(paramList2);
127 SetParameterList(paramList);
131 SetParameterList(paramList);
135template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
137 : factFact_(factFact) {
138 RCP<Teuchos::TimeMonitor> tM = rcp(
new Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(std::string(
"MueLu: ParameterListInterpreter (XML)"))));
139 if (facadeFact == Teuchos::null)
144 ParameterList paramList;
145 Teuchos::updateParametersFromXmlFileAndBroadcast(xmlFileName, Teuchos::Ptr<ParameterList>(¶mList), comm);
149template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
152template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
156 scalingFactor_ = Teuchos::ScalarTraits<double>::one();
159 hierarchyLabel_ =
"";
161 if (paramList.isSublist(
"Hierarchy")) {
162 SetFactoryParameterList(paramList);
164 }
else if (paramList.isParameter(
"MueLu preconditioner") ==
true) {
165 this->GetOStream(
Runtime0) <<
"Use facade class: " << paramList.get<std::string>(
"MueLu preconditioner") << std::endl;
166 Teuchos::RCP<ParameterList> pp = facadeFact_->SetParameterList(paramList);
167 SetFactoryParameterList(*pp);
171 ParameterList serialList, nonSerialList;
174 Validate(serialList);
175 SetEasyParameterList(paramList);
183static inline bool areSame(
const ParameterList& list1,
const ParameterList& list2);
188template <
class paramType>
189static inline paramType
set_var_2list(
const Teuchos::ParameterList& paramList,
const Teuchos::ParameterList& defaultList,
const std::string& paramName) {
190 if (paramList.isParameter(paramName))
191 return paramList.get<paramType>(paramName);
192 else if (defaultList.isParameter(paramName))
193 return defaultList.get<paramType>(paramName);
195 return MasterList::getDefault<paramType>(paramName);
198template <
class paramType>
199static inline bool test_and_set_var(
const Teuchos::ParameterList& paramList,
const std::string& paramName, paramType& varName) {
200 if (paramList.isParameter(paramName)) {
201 varName = paramList.get<paramType>(paramName);
207template <
class paramType>
208static inline void test_and_set_param_2list(
const Teuchos::ParameterList& paramList,
const Teuchos::ParameterList& defaultList,
const std::string& paramName, Teuchos::ParameterList& listWrite) {
210 if (paramList.isParameter(paramName))
211 listWrite.set(paramName, paramList.get<paramType>(paramName));
212 else if (defaultList.isParameter(paramName))
213 listWrite.set(paramName, defaultList.get<paramType>(paramName));
214 }
catch (Teuchos::Exceptions::InvalidParameterType&) {
215 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(
true, Teuchos::Exceptions::InvalidParameterType,
216 "Error: parameter \"" << paramName <<
"\" must be of type " << Teuchos::TypeNameTraits<paramType>::name());
220template <
class paramType>
222 if (!paramList.isParameter(paramName)) {
223 paramList.set(paramName, MasterList::getDefault<paramType>(paramName));
227template <
class paramType>
228static inline bool test_param_2list(
const Teuchos::ParameterList& paramList,
const Teuchos::ParameterList& defaultList,
const std::string& paramName,
const paramType& cmpValue) {
229 return (cmpValue == set_var_2list<paramType>(paramList, defaultList, paramName));
232#define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory) \
233 RCP<Factory> varName; \
235 varName = rcp(new oldFactory()); \
237 varName = rcp(new newFactory());
238#define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory) \
240 varName = rcp(new oldFactory()); \
242 varName = rcp(new newFactory());
244template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
247 ParameterList paramList;
249 auto problemType = set_var_2list<std::string>(constParamList, constParamList,
"problem: type");
250 if (problemType !=
"unknown") {
252 paramList.setParameters(constParamList);
256 paramList = constParamList;
260 useKokkos_ = !Node::is_serial;
261 (void)test_and_set_var<bool>(paramList,
"use kokkos refactor", useKokkos_);
264 auto syncTimers = set_var_2list<bool>(paramList, paramList,
"synchronize factory timers");
269 if (paramList.isParameter(
"cycle type")) {
270 std::map<std::string, CycleType> cycleMap;
274 auto cycleType = paramList.get<std::string>(
"cycle type");
276 "Invalid cycle type: \"" << cycleType <<
"\"");
277 Cycle_ = cycleMap[cycleType];
280 if (paramList.isParameter(
"W cycle start level")) {
281 WCycleStartLevel_ = paramList.get<
int>(
"W cycle start level");
284 if (paramList.isParameter(
"hierarchy label")) {
285 this->hierarchyLabel_ = paramList.get<std::string>(
"hierarchy label");
288 if (paramList.isParameter(
"coarse grid correction scaling factor"))
289 scalingFactor_ = paramList.get<
double>(
"coarse grid correction scaling factor");
291 this->maxCoarseSize_ = paramList.get<
int>(
"coarse: max size", MasterList::getDefault<int>(
"coarse: max size"));
292 this->numDesiredLevel_ = paramList.get<
int>(
"max levels", MasterList::getDefault<int>(
"max levels"));
293 blockSize_ = paramList.get<
int>(
"number of equations", MasterList::getDefault<int>(
"number of equations"));
295 (void)test_and_set_var<int>(paramList,
"debug: graph level", this->graphOutputLevel_);
298 if (paramList.isParameter(
"keep data"))
299 this->dataToKeep_ = Teuchos::getArrayFromStringParameter<std::string>(paramList,
"keep data");
302 if (paramList.isSublist(
"export data")) {
303 ParameterList printList = paramList.sublist(
"export data");
306 if (printList.isParameter(
"Nullspace"))
307 this->nullspaceToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Nullspace");
308 if (printList.isParameter(
"Coordinates"))
309 this->coordinatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Coordinates");
310 if (printList.isParameter(
"Material"))
311 this->materialToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Material");
312 if (printList.isParameter(
"Aggregates"))
313 this->aggregatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Aggregates");
314 if (printList.isParameter(
"pcoarsen: element to node map"))
315 this->elementToNodeMapsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"pcoarsen: element to node map");
318 for (
auto iter = printList.begin(); iter != printList.end(); iter++) {
319 const std::string& name = printList.name(iter);
321 if (name ==
"Nullspace" || name ==
"Coordinates" || name ==
"Material" || name ==
"Aggregates" || name ==
"pcoarsen: element to node map")
324 this->matricesToPrint_[name] = Teuchos::getArrayFromStringParameter<int>(printList, name);
331 auto verbosityLevel = set_var_2list<std::string>(paramList, paramList,
"verbosity");
336 auto outputFilename = set_var_2list<std::string>(paramList, paramList,
"output filename");
337 if (outputFilename !=
"")
347 useCoordinates_ =
false;
348 useBlockNumber_ =
false;
349 if (test_param_2list<std::string>(paramList, paramList,
"aggregation: strength-of-connection: matrix",
"distance laplacian"))
350 useCoordinates_ =
true;
351 if (test_param_2list<bool>(paramList, paramList,
"aggregation: use blocking",
true))
352 useBlockNumber_ =
true;
353 if (test_param_2list<std::string>(paramList, paramList,
"aggregation: drop scheme",
"distance laplacian") ||
354 test_param_2list<std::string>(paramList, paramList,
"aggregation: type",
"brick") ||
355 test_param_2list<bool>(paramList, paramList,
"aggregation: export visualization data",
true)) {
356 useCoordinates_ =
true;
357 }
else if (test_param_2list<std::string>(paramList, paramList,
"aggregation: drop scheme",
"block diagonal distance laplacian")) {
358 useCoordinates_ =
true;
359 useBlockNumber_ =
true;
360 }
else if (test_param_2list<std::string>(paramList, paramList,
"aggregation: drop scheme",
"block diagonal") ||
361 test_param_2list<std::string>(paramList, paramList,
"aggregation: drop scheme",
"block diagonal classical") ||
362 test_param_2list<std::string>(paramList, paramList,
"aggregation: drop scheme",
"block diagonal signed classical") ||
363 test_param_2list<std::string>(paramList, paramList,
"aggregation: drop scheme",
"block diagonal colored signed classical") ||
364 test_param_2list<std::string>(paramList, paramList,
"aggregation: drop scheme",
"signed classical")) {
365 useBlockNumber_ =
true;
366 }
else if (paramList.isSublist(
"smoother: params")) {
367 const auto smooParamList = paramList.sublist(
"smoother: params");
368 if (smooParamList.isParameter(
"partitioner: type") &&
369 (smooParamList.get<std::string>(
"partitioner: type") ==
"line")) {
370 useCoordinates_ =
true;
373 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
374 std::string levelStr =
"level " +
toString(levelID);
376 if (paramList.isSublist(levelStr)) {
377 const ParameterList& levelList = paramList.sublist(levelStr);
379 if (test_param_2list<std::string>(levelList, paramList,
"aggregation: drop scheme",
"distance laplacian") ||
380 test_param_2list<std::string>(levelList, paramList,
"aggregation: type",
"brick") ||
381 test_param_2list<bool>(levelList, paramList,
"aggregation: export visualization data",
true)) {
382 useCoordinates_ =
true;
383 }
else if (test_param_2list<std::string>(levelList, paramList,
"aggregation: drop scheme",
"block diagonal distance laplacian")) {
384 useCoordinates_ =
true;
385 useBlockNumber_ =
true;
386 }
else if (test_param_2list<std::string>(levelList, paramList,
"aggregation: drop scheme",
"block diagonal") ||
387 test_param_2list<std::string>(levelList, paramList,
"aggregation: drop scheme",
"block diagonal classical") ||
388 test_param_2list<std::string>(levelList, paramList,
"aggregation: drop scheme",
"block diagonal signed classical") ||
389 test_param_2list<std::string>(levelList, paramList,
"aggregation: drop scheme",
"block diagonal colored signed classical") ||
390 test_param_2list<std::string>(levelList, paramList,
"aggregation: drop scheme",
"signed classical")) {
391 useBlockNumber_ =
true;
397 useMaterial_ =
false;
398 if (test_param_2list<std::string>(paramList, paramList,
"aggregation: distance laplacian metric",
"material")) {
402 if (test_param_2list<bool>(paramList, paramList,
"repartition: enable",
true)) {
404 if (test_param_2list<bool>(paramList, paramList,
"repartition: use subcommunicators",
true) &&
405 test_param_2list<bool>(paramList, paramList,
"repartition: use subcommunicators in place",
true)) {
407 }
else if (!paramList.isSublist(
"repartition: params")) {
408 useCoordinates_ =
true;
410 const ParameterList& repParams = paramList.sublist(
"repartition: params");
411 if (repParams.isType<std::string>(
"algorithm")) {
412 const std::string algo = repParams.get<std::string>(
"algorithm");
413 if (algo ==
"multijagged" || algo ==
"rcb") {
414 useCoordinates_ =
true;
417 useCoordinates_ =
true;
421 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
422 std::string levelStr =
"level " +
toString(levelID);
424 if (paramList.isSublist(levelStr)) {
425 const ParameterList& levelList = paramList.sublist(levelStr);
427 if (test_param_2list<bool>(levelList, paramList,
"repartition: enable",
true)) {
428 if (!levelList.isSublist(
"repartition: params")) {
429 useCoordinates_ =
true;
432 const ParameterList& repParams = levelList.sublist(
"repartition: params");
433 if (repParams.isType<std::string>(
"algorithm")) {
434 const std::string algo = repParams.get<std::string>(
"algorithm");
435 if (algo ==
"multijagged" || algo ==
"rcb") {
436 useCoordinates_ =
true;
440 useCoordinates_ =
true;
449 changedPRrebalance_ =
false;
450 changedPRViaCopyrebalance_ =
false;
451 if (test_param_2list<bool>(paramList, paramList,
"repartition: enable",
true)) {
452 changedPRrebalance_ = test_and_set_var<bool>(paramList,
"repartition: rebalance P and R", this->doPRrebalance_);
453 changedPRViaCopyrebalance_ = test_and_set_var<bool>(paramList,
"repartition: explicit via new copy rebalance P and R", this->doPRViaCopyrebalance_);
457 changedImplicitTranspose_ = test_and_set_var<bool>(paramList,
"transpose: use implicit", this->implicitTranspose_);
460 (void)test_and_set_var<bool>(paramList,
"fuse prolongation and update", this->fuseProlongationAndUpdate_);
463 (void)test_and_set_var<bool>(paramList,
"nullspace: suppress dimension check", this->suppressNullspaceDimensionCheck_);
465 if (paramList.isSublist(
"matvec params"))
466 this->matvecParams_ = Teuchos::parameterList(paramList.sublist(
"matvec params"));
471 defaultManager->SetVerbLevel(this->verbosity_);
472 defaultManager->SetKokkosRefactor(useKokkos_);
475 std::vector<keep_pair> keeps0;
476 UpdateFactoryManager(paramList, ParameterList(), *defaultManager, 0 , keeps0);
482 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
488 RCP<FactoryManager> levelManager = rcp(
new FactoryManager(*defaultManager));
489 levelManager->SetVerbLevel(defaultManager->GetVerbLevel());
491 std::vector<keep_pair> keeps;
492 if (paramList.isSublist(
"level " +
toString(levelID))) {
494 ParameterList& levelList = paramList.sublist(
"level " +
toString(levelID),
true );
495 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
498 ParameterList levelList;
499 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
502 this->keep_[levelID] = keeps;
503 this->AddFactoryManager(levelID, 1, levelManager);
512 if (test_param_2list<bool>(paramList, paramList,
"print initial parameters",
true))
513 this->GetOStream(
static_cast<MsgType>(
Runtime1), 0) << paramList << std::endl;
515 if (test_param_2list<bool>(paramList, paramList,
"print unused parameters",
true)) {
517 ParameterList unusedParamList;
520 for (ParameterList::ConstIterator it = paramList.begin(); it != paramList.end(); it++) {
521 const ParameterEntry& entry = paramList.entry(it);
523 if (!entry.isList() && !entry.isUsed())
524 unusedParamList.setEntry(paramList.name(it), entry);
528 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
529 std::string levelStr =
"level " +
toString(levelID);
531 if (paramList.isSublist(levelStr)) {
532 const ParameterList& levelList = paramList.sublist(levelStr);
534 for (ParameterList::ConstIterator itr = levelList.begin(); itr != levelList.end(); ++itr) {
535 const ParameterEntry& entry = levelList.entry(itr);
537 if (!entry.isList() && !entry.isUsed())
538 unusedParamList.sublist(levelStr).setEntry(levelList.name(itr), entry);
543 if (unusedParamList.numParams() > 0) {
544 std::ostringstream unusedParamsStream;
546 unusedParamList.print(unusedParamsStream, indent);
548 this->GetOStream(
Warnings1) <<
"The following parameters were not used:\n"
549 << unusedParamsStream.str() << std::endl;
559template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
562 int levelID, std::vector<keep_pair>& keeps)
const {
566 using strings = std::unordered_set<std::string>;
569 if (paramList.numParams() == 0 && defaultList.numParams() > 0)
570 paramList = ParameterList(defaultList);
572 auto reuseType = set_var_2list<std::string>(paramList, defaultList,
"reuse: type");
573 TEUCHOS_TEST_FOR_EXCEPTION(strings({
"none",
"tP",
"RP",
"emin",
"RAP",
"full",
"S"}).count(reuseType) == 0,
576 auto multigridAlgo = set_var_2list<std::string>(paramList, defaultList,
"multigrid algorithm");
577 TEUCHOS_TEST_FOR_EXCEPTION(strings({
"unsmoothed",
"sa",
"pg",
"emin",
"matlab",
"pcoarsen",
"classical",
"smoothed reitzinger",
"unsmoothed reitzinger",
"emin reitzinger",
"replicate",
"combine"}).count(multigridAlgo) == 0,
578 Exceptions::RuntimeError,
"Unknown \"multigrid algorithm\" value: \"" << multigridAlgo <<
"\". Please consult User's Guide.");
579#ifndef HAVE_MUELU_MATLAB
581 "Cannot use matlab for multigrid algorithm - MueLu was not configured with MATLAB support.");
583#ifndef HAVE_MUELU_INTREPID2
585 "Cannot use IntrepidPCoarsen prolongator factory - MueLu was not configured with Intrepid support.");
590 if (reuseType ==
"none" || reuseType ==
"S" || reuseType ==
"RP" || reuseType ==
"RAP") {
593 }
else if (reuseType ==
"tP" && (multigridAlgo !=
"sa" && multigridAlgo !=
"unsmoothed")) {
595 this->GetOStream(
Warnings0) <<
"Ignoring \"tP\" reuse option as it is only compatible with \"sa\", "
596 "or \"unsmoothed\" multigrid algorithms"
599 }
else if (reuseType ==
"emin" && multigridAlgo !=
"emin") {
601 this->GetOStream(
Warnings0) <<
"Ignoring \"emin\" reuse option it is only compatible with "
602 "\"emin\" multigrid algorithm"
608 bool have_userP =
false;
609 if (paramList.isParameter(
"P") && !paramList.get<RCP<Matrix>>(
"P").is_null())
613 UpdateFactoryManager_CoarseSolvers(paramList, defaultList, manager, levelID, keeps);
616 UpdateFactoryManager_Smoothers(paramList, defaultList, manager, levelID, keeps);
620 UpdateFactoryManager_BlockNumber(paramList, defaultList, manager, levelID, keeps);
623 if (multigridAlgo ==
"unsmoothed reitzinger" || multigridAlgo ==
"smoothed reitzinger")
624 UpdateFactoryManager_Reitzinger(paramList, defaultList, manager, levelID, keeps);
625 else if (multigridAlgo ==
"emin reitzinger")
626 UpdateFactoryManager_EminReitzinger(paramList, defaultList, manager, levelID, keeps);
628 UpdateFactoryManager_Aggregation_TentativeP(paramList, defaultList, manager, levelID, keeps);
631 RCP<Factory> nullSpaceFactory;
632 UpdateFactoryManager_Nullspace(paramList, defaultList, manager, levelID, keeps, nullSpaceFactory);
643 }
else if (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"unsmoothed reitzinger") {
647 }
else if (multigridAlgo ==
"classical") {
651 }
else if (multigridAlgo ==
"sa" || multigridAlgo ==
"smoothed reitzinger") {
653 UpdateFactoryManager_SA(multigridAlgo, paramList, defaultList, manager, levelID, keeps);
655 }
else if (multigridAlgo ==
"emin") {
657 UpdateFactoryManager_Emin(paramList, defaultList, manager, levelID, keeps);
659 }
else if (multigridAlgo ==
"emin reitzinger") {
662 }
else if (multigridAlgo ==
"replicate") {
663 UpdateFactoryManager_Replicate(paramList, defaultList, manager, levelID, keeps);
665 }
else if (multigridAlgo ==
"combine") {
666 UpdateFactoryManager_Combine(paramList, defaultList, manager, levelID, keeps);
668 }
else if (multigridAlgo ==
"pg") {
670 UpdateFactoryManager_PG(paramList, defaultList, manager, levelID, keeps);
672 }
else if (multigridAlgo ==
"matlab") {
674 UpdateFactoryManager_Matlab(paramList, defaultList, manager, levelID, keeps);
676 }
else if (multigridAlgo ==
"pcoarsen") {
678 UpdateFactoryManager_PCoarsen(paramList, defaultList, manager, levelID, keeps);
682 UpdateFactoryManager_SemiCoarsen(paramList, defaultList, manager, levelID, keeps);
685 UpdateFactoryManager_Restriction(paramList, defaultList, manager, levelID, keeps);
688 UpdateFactoryManager_RAP(paramList, defaultList, manager, levelID, keeps);
690 if (multigridAlgo ==
"smoothed reitzinger") {
692 auto saDampingFactor = set_var_2list<double>(paramList, defaultList,
"sa: damping factor");
693 if (saDampingFactor != 0.0)
694 UpdateFactoryManager_MatrixTransfer(
"CurlCurl", paramList, defaultList, manager, levelID, keeps);
698 UpdateFactoryManager_LocalOrdinalTransfer(
"BlockNumber", multigridAlgo, paramList, defaultList, manager, levelID, keeps);
701 UpdateFactoryManager_Coordinates(paramList, defaultList, manager, levelID, keeps);
704 UpdateFactoryManager_Material(paramList, defaultList, manager, levelID, keeps);
707 if ((reuseType ==
"RP" || reuseType ==
"RAP" || reuseType ==
"full") && levelID)
710 if (reuseType ==
"RP" && levelID) {
712 if (!this->implicitTranspose_)
715 if ((reuseType ==
"tP" || reuseType ==
"RP" || reuseType ==
"emin") && useCoordinates_ && levelID)
719 UpdateFactoryManager_Repartition(paramList, defaultList, manager, levelID, keeps, nullSpaceFactory);
722 auto socMatrix = set_var_2list<std::string>(paramList, defaultList,
"aggregation: strength-of-connection: matrix");
723 if (socMatrix ==
"MinvA") {
724 UpdateFactoryManager_MatrixTransfer(
"M", paramList, defaultList, manager, levelID, keeps);
728 UpdateFactoryManager_LowPrecision(paramList, defaultList, manager, levelID, keeps);
731 if ((reuseType ==
"RAP" || reuseType ==
"full") && levelID) {
733 if (!this->implicitTranspose_)
746template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
749 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
750 auto multigridAlgo = set_var_2list<std::string>(paramList, defaultList,
"multigrid algorithm");
751 auto reuseType = set_var_2list<std::string>(paramList, defaultList,
"reuse: type");
752 auto useMaxAbsDiagonalScaling = set_var_2list<bool>(paramList, defaultList,
"sa: use rowsumabs diagonal scaling");
756 bool isCustomSmoother =
757 paramList.isParameter(
"smoother: pre or post") ||
758 paramList.isParameter(
"smoother: type") || paramList.isParameter(
"smoother: pre type") || paramList.isParameter(
"smoother: post type") ||
759 paramList.isSublist(
"smoother: params") || paramList.isSublist(
"smoother: pre params") || paramList.isSublist(
"smoother: post params") ||
760 paramList.isParameter(
"smoother: sweeps") || paramList.isParameter(
"smoother: pre sweeps") || paramList.isParameter(
"smoother: post sweeps") ||
761 paramList.isParameter(
"smoother: overlap") || paramList.isParameter(
"smoother: pre overlap") || paramList.isParameter(
"smoother: post overlap");
763 auto PreOrPost = set_var_2list<std::string>(paramList, defaultList,
"smoother: pre or post");
765 manager.
SetFactory(
"Smoother", Teuchos::null);
767 }
else if (isCustomSmoother) {
771#define TEST_MUTUALLY_EXCLUSIVE(arg1, arg2) \
772 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isParameter(#arg1) && paramList.isParameter(#arg2), \
773 Exceptions::InvalidArgument, "You cannot specify both \"" #arg1 "\" and \"" #arg2 "\"");
774#define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2) \
775 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isSublist(#arg1) && paramList.isSublist(#arg2), \
776 Exceptions::InvalidArgument, "You cannot specify both \"" #arg1 "\" and \"" #arg2 "\"");
786 TEUCHOS_TEST_FOR_EXCEPTION(
PreOrPost ==
"both" && (paramList.isParameter(
"smoother: pre type") != paramList.isParameter(
"smoother: post type")),
791 ParameterList defaultSmootherParams;
792 defaultSmootherParams.set(
"relaxation: type",
"Symmetric Gauss-Seidel");
793 defaultSmootherParams.set(
"relaxation: sweeps", Teuchos::OrdinalTraits<LO>::one());
794 defaultSmootherParams.set(
"relaxation: damping factor", Teuchos::ScalarTraits<Scalar>::one());
796 RCP<SmootherFactory> preSmoother = Teuchos::null, postSmoother = Teuchos::null;
797 std::string preSmootherType, postSmootherType;
798 ParameterList preSmootherParams, postSmootherParams;
800 auto setChebyshevSettings = [&](
const std::string& smootherType, Teuchos::ParameterList& smootherParams) {
801 auto upperCaseSmootherType = smootherType;
802 std::transform(smootherType.begin(), smootherType.end(), upperCaseSmootherType.begin(), ::toupper);
803 if (upperCaseSmootherType !=
"CHEBYSHEV")
return;
805 if (smootherParams.isParameter(
"chebyshev: use rowsumabs diagonal scaling")) {
806 bool useMaxAbsDiagonalScalingCheby = smootherParams.get<
bool>(
"chebyshev: use rowsumabs diagonal scaling");
807 TEUCHOS_TEST_FOR_EXCEPTION(useMaxAbsDiagonalScaling != useMaxAbsDiagonalScalingCheby,
808 Exceptions::RuntimeError,
"'chebyshev: use rowsumabs diagonal scaling' (" << std::boolalpha << useMaxAbsDiagonalScalingCheby <<
") must match 'sa: use rowsumabs diagonal scaling' (" << std::boolalpha << useMaxAbsDiagonalScaling <<
")\n");
810 if (useMaxAbsDiagonalScaling)
811 smootherParams.set(
"chebyshev: use rowsumabs diagonal scaling", useMaxAbsDiagonalScaling);
815 if (paramList.isParameter(
"smoother: overlap"))
816 overlap = paramList.get<
int>(
"smoother: overlap");
819 if (paramList.isParameter(
"smoother: pre type")) {
820 preSmootherType = paramList.get<std::string>(
"smoother: pre type");
822 auto preSmootherTypeTmp = set_var_2list<std::string>(paramList, defaultList,
"smoother: type");
823 preSmootherType = preSmootherTypeTmp;
825 if (paramList.isParameter(
"smoother: pre overlap"))
826 overlap = paramList.get<
int>(
"smoother: pre overlap");
828 if (paramList.isSublist(
"smoother: pre params"))
829 preSmootherParams = paramList.sublist(
"smoother: pre params");
830 else if (paramList.isSublist(
"smoother: params"))
831 preSmootherParams = paramList.sublist(
"smoother: params");
832 else if (defaultList.isSublist(
"smoother: params"))
833 preSmootherParams = defaultList.sublist(
"smoother: params");
834 else if (preSmootherType ==
"RELAXATION")
835 preSmootherParams = defaultSmootherParams;
837 setChebyshevSettings(preSmootherType, preSmootherParams);
839#if defined(HAVE_MUELU_INTREPID2) && defined(HAVE_MUELU_EXPERIMENTAL)
841 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
842 defaultList.isParameter(
"pcoarsen: schedule") && defaultList.isParameter(
"pcoarsen: element")) {
845 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
846 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
848 if (levelID < (
int)pcoarsen_schedule.size()) {
850 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
851 preSmootherParams.set(
"pcoarsen: hi basis", lo);
856#ifdef HAVE_MUELU_MATLAB
857 if (preSmootherType ==
"matlab")
861#ifdef HAVE_MUELU_TEKO
862 if (preSmootherType ==
"teko")
870 if (paramList.isParameter(
"smoother: post type"))
871 postSmootherType = paramList.get<std::string>(
"smoother: post type");
873 auto postSmootherTypeTmp = set_var_2list<std::string>(paramList, defaultList,
"smoother: type");
874 postSmootherType = postSmootherTypeTmp;
877 if (paramList.isSublist(
"smoother: post params"))
878 postSmootherParams = paramList.sublist(
"smoother: post params");
879 else if (paramList.isSublist(
"smoother: params"))
880 postSmootherParams = paramList.sublist(
"smoother: params");
881 else if (defaultList.isSublist(
"smoother: params"))
882 postSmootherParams = defaultList.sublist(
"smoother: params");
883 else if (postSmootherType ==
"RELAXATION")
884 postSmootherParams = defaultSmootherParams;
885 if (paramList.isParameter(
"smoother: post overlap"))
886 overlap = paramList.get<
int>(
"smoother: post overlap");
888 setChebyshevSettings(postSmootherType, postSmootherParams);
890 if (postSmootherType == preSmootherType &&
areSame(preSmootherParams, postSmootherParams))
891 postSmoother = preSmoother;
893#if defined(HAVE_MUELU_INTREPID2) && defined(HAVE_MUELU_EXPERIMENTAL)
895 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
896 defaultList.isParameter(
"pcoarsen: schedule") && defaultList.isParameter(
"pcoarsen: element")) {
899 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
900 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
902 if (levelID < (
int)pcoarsen_schedule.size()) {
904 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
905 postSmootherParams.set(
"pcoarsen: hi basis", lo);
910#ifdef HAVE_MUELU_MATLAB
911 if (postSmootherType ==
"matlab")
915#ifdef HAVE_MUELU_TEKO
916 if (postSmootherType ==
"teko")
924 if (preSmoother == postSmoother)
927 manager.
SetFactory(
"PreSmoother", preSmoother);
928 manager.
SetFactory(
"PostSmoother", postSmoother);
935 bool reuseSmoothers = (reuseType ==
"S" || reuseType !=
"none");
936 if (reuseSmoothers) {
937 auto preSmootherFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<const Factory>(manager.
GetFactory(
"PreSmoother")));
939 if (preSmootherFactory != Teuchos::null) {
940 ParameterList postSmootherFactoryParams;
941 postSmootherFactoryParams.set(
"keep smoother data",
true);
942 preSmootherFactory->SetParameterList(postSmootherFactoryParams);
944 keeps.push_back(
keep_pair(
"PreSmoother data", preSmootherFactory.get()));
947 auto postSmootherFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<const Factory>(manager.
GetFactory(
"PostSmoother")));
948 if (postSmootherFactory != Teuchos::null) {
949 ParameterList postSmootherFactoryParams;
950 postSmootherFactoryParams.set(
"keep smoother data",
true);
951 postSmootherFactory->SetParameterList(postSmootherFactoryParams);
953 keeps.push_back(
keep_pair(
"PostSmoother data", postSmootherFactory.get()));
956 auto coarseFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<const Factory>(manager.
GetFactory(
"CoarseSolver")));
957 if (coarseFactory != Teuchos::null) {
958 ParameterList coarseFactoryParams;
959 coarseFactoryParams.set(
"keep smoother data",
true);
960 coarseFactory->SetParameterList(coarseFactoryParams);
962 keeps.push_back(
keep_pair(
"PreSmoother data", coarseFactory.get()));
966 if ((reuseType ==
"RAP" && levelID) || (reuseType ==
"full")) {
985template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
990 bool isCustomCoarseSolver =
991 paramList.isParameter(
"coarse: type") ||
992 paramList.isParameter(
"coarse: params");
993 if (test_param_2list<std::string>(paramList, defaultList,
"coarse: type",
"none")) {
994 manager.
SetFactory(
"CoarseSolver", Teuchos::null);
996 }
else if (isCustomCoarseSolver) {
1000 auto coarseType = set_var_2list<std::string>(paramList, defaultList,
"coarse: type");
1003 if (paramList.isParameter(
"coarse: overlap"))
1004 overlap = paramList.get<
int>(
"coarse: overlap");
1006 ParameterList coarseParams;
1007 if (paramList.isSublist(
"coarse: params"))
1008 coarseParams = paramList.sublist(
"coarse: params");
1009 else if (defaultList.isSublist(
"coarse: params"))
1010 coarseParams = defaultList.sublist(
"coarse: params");
1012 using strings = std::unordered_set<std::string>;
1014 RCP<SmootherPrototype> coarseSmoother;
1018 if (strings({
"RELAXATION",
"CHEBYSHEV",
"ILUT",
"ILU",
"RILUK",
"SCHWARZ",
"Amesos",
1019 "BLOCK RELAXATION",
"BLOCK_RELAXATION",
"BLOCKRELAXATION",
1020 "SPARSE BLOCK RELAXATION",
"SPARSE_BLOCK_RELAXATION",
"SPARSEBLOCKRELAXATION",
1021 "LINESMOOTHING_BANDEDRELAXATION",
"LINESMOOTHING_BANDED_RELAXATION",
"LINESMOOTHING_BANDED RELAXATION",
1022 "LINESMOOTHING_TRIDIRELAXATION",
"LINESMOOTHING_TRIDI_RELAXATION",
"LINESMOOTHING_TRIDI RELAXATION",
1023 "LINESMOOTHING_TRIDIAGONALRELAXATION",
"LINESMOOTHING_TRIDIAGONAL_RELAXATION",
"LINESMOOTHING_TRIDIAGONAL RELAXATION",
1024 "TOPOLOGICAL",
"FAST_ILU",
"FAST_IC",
"FAST_ILDL",
"HIPTMAIR"})
1025 .count(coarseType)) {
1026 coarseSmoother = rcp(
new TrilinosSmoother(coarseType, coarseParams, overlap));
1028#ifdef HAVE_MUELU_MATLAB
1029 if (coarseType ==
"matlab")
1033#ifdef HAVE_MUELU_TEKO
1034 if (coarseType ==
"teko")
1038 coarseSmoother = rcp(
new DirectSolver(coarseType, coarseParams));
1048template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1051 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1052 ParameterList rParams;
1053 test_and_set_param_2list<bool>(paramList, defaultList,
"repartition: enable", rParams);
1054 test_and_set_param_2list<bool>(paramList, defaultList,
"repartition: use subcommunicators", rParams);
1055 test_and_set_param_2list<bool>(paramList, defaultList,
"tentative: constant column sums", rParams);
1056 test_and_set_param_2list<bool>(paramList, defaultList,
"tentative: calculate qr", rParams);
1059 rFactory->SetParameterList(rParams);
1067 rFactory->SetFactory(
"D0", this->GetFactoryManager(levelID - 1)->GetFactory(
"D0"));
1079template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1082 int levelID, std::vector<keep_pair>& keeps)
const {
1083 ParameterList rParams;
1084 test_and_set_param_2list<bool>(paramList, defaultList,
"repartition: enable", rParams);
1085 test_and_set_param_2list<bool>(paramList, defaultList,
"repartition: use subcommunicators", rParams);
1086 test_and_set_param_2list<bool>(paramList, defaultList,
"tentative: constant column sums", rParams);
1087 test_and_set_param_2list<bool>(paramList, defaultList,
"tentative: calculate qr", rParams);
1090 rFactory->SetParameterList(rParams);
1098 rFactory->SetFactory(
"D0", this->GetFactoryManager(levelID - 1)->GetFactory(
"D0"));
1106 auto reuseType = set_var_2list<std::string>(paramList, defaultList,
"reuse: type");
1110 manager.
SetFactory(
"Ppattern", patternFactory);
1114 ParameterList constraintParams;
1115 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
1116 test_and_set_param_2list<std::string>(paramList, defaultList,
"emin: least squares solver type", constraintParams);
1117 constraintParams.set(
"emin: constraint type",
"maxwell");
1118 constraintFactory->SetParameterList(constraintParams);
1119 manager.
SetFactory(
"Constraint", constraintFactory);
1125 ParameterList Pparams;
1126 test_and_set_param_2list<int>(paramList, defaultList,
"emin: num iterations", Pparams);
1127 test_and_set_param_2list<std::string>(paramList, defaultList,
"emin: iterative method", Pparams);
1128 if (reuseType ==
"emin") {
1129 test_and_set_param_2list<int>(paramList, defaultList,
"emin: num reuse iterations", Pparams);
1130 Pparams.set(
"Keep P0",
true);
1131 Pparams.set(
"Keep Constraint0",
true);
1133 P->SetParameterList(Pparams);
1134 P->SetFactory(
"P", constraintFactory);
1135 P->SetFactory(
"Constraint", constraintFactory);
1142template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1145 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1146 using strings = std::unordered_set<std::string>;
1148 auto reuseType = set_var_2list<std::string>(paramList, defaultList,
"reuse: type");
1150 auto aggType = set_var_2list<std::string>(paramList, defaultList,
"aggregation: type");
1151 TEUCHOS_TEST_FOR_EXCEPTION(!strings({
"uncoupled",
"coupled",
"brick",
"matlab",
"notay",
"classical"}).count(aggType),
1155 RCP<AmalgamationFactory> amalgFact;
1156 if (aggType ==
"classical") {
1158 manager.
SetFactory(
"UnAmalgamationInfo", amalgFact);
1162 RCP<Factory> dropFactory;
1164 if (test_param_2list<std::string>(paramList, paramList,
"aggregation: drop scheme",
"matlab")) {
1165#ifdef HAVE_MUELU_MATLAB
1167 ParameterList socParams = paramList.sublist(
"strength-of-connection: params");
1168 dropFactory->SetParameterList(socParams);
1170 throw std::runtime_error(
"Cannot use MATLAB evolutionary strength-of-connection - MueLu was not configured with MATLAB support.");
1172 }
else if (test_param_2list<std::string>(paramList, paramList,
"aggregation: drop scheme",
"unsupported vector smoothing")) {
1174 ParameterList dropParams;
1175 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: drop scheme", dropParams);
1176 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: block diagonal: interleaved blocksize", dropParams);
1177 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: number of random vectors", dropParams);
1178 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: number of times to pre or post smooth", dropParams);
1179 test_and_set_param_2list<Teuchos::Array<double>>(paramList, defaultList,
"aggregation: penalty parameters", dropParams);
1180 dropFactory->SetParameterList(dropParams);
1183 ParameterList dropParams;
1184 if (!rcp_dynamic_cast<CoalesceDropFactory>(dropFactory).is_null())
1185 dropParams.set(
"lightweight wrap",
true);
1186 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: drop scheme", dropParams);
1187 test_and_set_param_2list<double>(paramList, defaultList,
"aggregation: row sum drop tol", dropParams);
1188 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: block diagonal: interleaved blocksize", dropParams);
1189 test_and_set_param_2list<double>(paramList, defaultList,
"aggregation: drop tol", dropParams);
1190 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: use ml scaling of drop tol", dropParams);
1192 test_and_set_param_2list<double>(paramList, defaultList,
"aggregation: Dirichlet threshold", dropParams);
1193 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: greedy Dirichlet", dropParams);
1195 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: distance laplacian metric", dropParams);
1196#ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1197 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: distance laplacian algo", dropParams);
1198 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: classical algo", dropParams);
1200 test_and_set_param_2list<Teuchos::Array<double>>(paramList, defaultList,
"aggregation: distance laplacian directional weights", dropParams);
1201 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: coloring: localize color graph", dropParams);
1202 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: dropping may create Dirichlet", dropParams);
1204 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: use blocking", dropParams);
1205 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: symmetrize graph after dropping", dropParams);
1206 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: strength-of-connection: matrix", dropParams);
1207 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: strength-of-connection: measure", dropParams);
1208 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: use lumping", dropParams);
1209 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: reuse graph", dropParams);
1210 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: reuse eigenvalue", dropParams);
1211 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: use root stencil", dropParams);
1212 test_and_set_param_2list<double>(paramList, defaultList,
"filtered matrix: Dirichlet threshold", dropParams);
1213 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: use spread lumping", dropParams);
1214 test_and_set_param_2list<std::string>(paramList, defaultList,
"filtered matrix: lumping choice", dropParams);
1215 test_and_set_param_2list<double>(paramList, defaultList,
"filtered matrix: spread lumping diag dom growth factor", dropParams);
1216 test_and_set_param_2list<double>(paramList, defaultList,
"filtered matrix: spread lumping diag dom cap", dropParams);
1217 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: count negative diagonals", dropParams);
1220#ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1221 if (!dropParams.isParameter(
"aggregation: drop scheme") ||
1222 (dropParams.isParameter(
"aggregation: drop scheme") &&
1223 ((dropParams.get<std::string>(
"aggregation: drop scheme") !=
"point-wise") && (dropParams.get<std::string>(
"aggregation: drop scheme") !=
"cut-drop")))) {
1224 Teuchos::ParameterList dropParamsWithDefaults(dropParams);
1226 test_and_set_var_from_masterlist<std::string>(dropParamsWithDefaults,
"aggregation: drop scheme");
1227 test_and_set_var_from_masterlist<std::string>(dropParamsWithDefaults,
"aggregation: strength-of-connection: matrix");
1228 test_and_set_var_from_masterlist<std::string>(dropParamsWithDefaults,
"aggregation: strength-of-connection: measure");
1229 test_and_set_var_from_masterlist<bool>(dropParamsWithDefaults,
"aggregation: use blocking");
1232 TEUCHOS_TEST_FOR_EXCEPTION(dropParams.isParameter(
"aggregation: strength-of-connection: matrix") ||
1233 dropParams.isParameter(
"aggregation: strength-of-connection: measure") ||
1234 dropParams.isParameter(
"aggregation: use blocking"),
1235 Teuchos::Exceptions::InvalidParameterType,
1236 "The inputs contain a mix of old and new dropping parameters:\n\n"
1237 << dropParams <<
"\n\nKeep in mind that defaults are set for old parameters, so this gets interpreted as\n\n"
1238 << dropParamsWithDefaults);
1242 if (!amalgFact.is_null())
1243 dropFactory->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
1245 if (dropParams.isParameter(
"aggregation: drop scheme")) {
1246 std::string drop_scheme = dropParams.get<std::string>(
"aggregation: drop scheme");
1247 if (drop_scheme ==
"block diagonal colored signed classical")
1248 manager.
SetFactory(
"Coloring Graph", dropFactory);
1249 if ((test_param_2list<bool>(dropParams, defaultList,
"aggregation: use blocking",
true)) ||
1250 (drop_scheme.find(
"block diagonal") != std::string::npos || drop_scheme ==
"signed classical")) {
1252 dropFactory->SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1254 dropFactory->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1258 if (useKokkos_ && (levelID > 0)) {
1259 if (dropParams.isParameter(
"aggregation: strength-of-connection: matrix") && dropParams.get<std::string>(
"aggregation: strength-of-connection: matrix") ==
"MinvA") {
1260 dropFactory->SetFactory(
"M", this->GetFactoryManager(levelID - 1)->GetFactory(
"M"));
1264 dropFactory->SetParameterList(dropParams);
1269#ifndef HAVE_MUELU_MATLAB
1270 if (aggType ==
"matlab")
1271 throw std::runtime_error(
"Cannot use MATLAB aggregation - MueLu was not configured with MATLAB support.");
1273 RCP<Factory> aggFactory;
1274 if (aggType ==
"uncoupled") {
1276 ParameterList aggParams;
1277 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: ordering", aggParams);
1278 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: min agg size", aggParams);
1279 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: max agg size", aggParams);
1280 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: max selected neighbors", aggParams);
1281 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: backend", aggParams);
1282 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: phase 1 algorithm", aggParams);
1283 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: deterministic", aggParams);
1284 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: coloring algorithm", aggParams);
1285 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: enable phase 1", aggParams);
1286 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: enable phase 2a", aggParams);
1287 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: enable phase 2b", aggParams);
1288 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: enable phase 3", aggParams);
1289 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: match ML phase1", aggParams);
1290 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: match ML phase2a", aggParams);
1291 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: match ML phase2b", aggParams);
1292 test_and_set_param_2list<double>(paramList, defaultList,
"aggregation: phase2a agg factor", aggParams);
1293 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: preserve Dirichlet points", aggParams);
1294 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: error on nodes with no on-rank neighbors", aggParams);
1295 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: phase3 avoid singletons", aggParams);
1296 aggFactory->SetParameterList(aggParams);
1298 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
1299 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1302 if (test_param_2list<std::string>(paramList, defaultList,
"aggregation: coloring algorithm",
"mis2 aggregation") ||
1303 test_param_2list<std::string>(paramList, defaultList,
"aggregation: coloring algorithm",
"mis2 coarsening")) {
1304 if (test_param_2list<bool>(paramList, defaultList,
"aggregation: symmetrize graph after dropping",
false))
1305 TEUCHOS_TEST_FOR_EXCEPTION(
true,
1307 "MIS2 algorithms require the use of a symmetrized graph. Please set \"aggregation: symmetrize graph after dropping\" to \"true\".");
1309 }
else if (aggType ==
"brick") {
1311 ParameterList aggParams;
1312 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: brick x size", aggParams);
1313 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: brick y size", aggParams);
1314 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: brick z size", aggParams);
1315 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: brick x Dirichlet", aggParams);
1316 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: brick y Dirichlet", aggParams);
1317 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: brick z Dirichlet", aggParams);
1318 aggFactory->SetParameterList(aggParams);
1322 manager.
SetFactory(
"DofsPerNode", aggFactory);
1328 aggFactory->SetFactory(
"Coordinates", this->GetFactoryManager(levelID - 1)->GetFactory(
"Coordinates"));
1330 }
else if (aggType ==
"classical") {
1333 ParameterList mapParams;
1334 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: deterministic", mapParams);
1335 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: coloring algorithm", mapParams);
1337 ParameterList tempParams;
1338 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: drop scheme", tempParams);
1339 std::string drop_algo = tempParams.get<std::string>(
"aggregation: drop scheme");
1340 if (drop_algo ==
"block diagonal colored signed classical") {
1341 mapParams.set(
"aggregation: coloring: use color graph",
true);
1342 mapFact->SetFactory(
"Coloring Graph", manager.
GetFactory(
"Coloring Graph"));
1344 mapFact->SetParameterList(mapParams);
1345 mapFact->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1346 mapFact->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
1352 ParameterList aggParams;
1353 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: classical scheme", aggParams);
1354 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: drop scheme", aggParams);
1355 aggFactory->SetParameterList(aggParams);
1356 aggFactory->SetFactory(
"FC Splitting", manager.
GetFactory(
"FC Splitting"));
1357 aggFactory->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1358 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
1359 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1361 if (drop_algo.find(
"block diagonal") != std::string::npos || drop_algo ==
"signed classical") {
1363 aggFactory->SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1365 aggFactory->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1372 if (reuseType ==
"tP" && levelID) {
1374 keeps.push_back(
keep_pair(
"Ptent", aggFactory.get()));
1377 }
else if (aggType ==
"notay") {
1379 ParameterList aggParams;
1380 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: pairwise: size", aggParams);
1381 test_and_set_param_2list<double>(paramList, defaultList,
"aggregation: pairwise: tie threshold", aggParams);
1382 test_and_set_param_2list<double>(paramList, defaultList,
"aggregation: Dirichlet threshold", aggParams);
1383 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: ordering", aggParams);
1384 aggFactory->SetParameterList(aggParams);
1385 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
1386 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1388#ifdef HAVE_MUELU_MATLAB
1389 else if (aggType ==
"matlab") {
1390 ParameterList aggParams = paramList.sublist(
"aggregation: params");
1392 aggFactory->SetParameterList(aggParams);
1396 manager.
SetFactory(
"Aggregates", aggFactory);
1400 coarseMap->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1405 ParameterList ptentParams;
1406 if (paramList.isSublist(
"matrixmatrix: kernel params"))
1407 ptentParams.sublist(
"matrixmatrix: kernel params",
false) = paramList.sublist(
"matrixmatrix: kernel params");
1408 if (defaultList.isSublist(
"matrixmatrix: kernel params"))
1409 ptentParams.sublist(
"matrixmatrix: kernel params",
false) = defaultList.sublist(
"matrixmatrix: kernel params");
1410 test_and_set_param_2list<bool>(paramList, defaultList,
"tentative: calculate qr", ptentParams);
1411 test_and_set_param_2list<bool>(paramList, defaultList,
"tentative: build coarse coordinates", ptentParams);
1412 test_and_set_param_2list<bool>(paramList, defaultList,
"sa: keep tentative prolongator", ptentParams);
1413 Ptent->SetParameterList(ptentParams);
1414 Ptent->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1415 Ptent->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1418 if (reuseType ==
"tP" && levelID) {
1419 keeps.push_back(
keep_pair(
"Nullspace", Ptent.get()));
1420 keeps.push_back(
keep_pair(
"P", Ptent.get()));
1427template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1430 int levelID, std::vector<keep_pair>& keeps)
const {
1431 if (paramList.isParameter(
"A") && !paramList.get<RCP<Matrix>>(
"A").is_null()) {
1437 ParameterList RAPparams;
1439 RCP<RAPFactory> RAP;
1440 RCP<RAPShiftFactory> RAPs;
1443 std::string alg = paramList.get(
"rap: algorithm",
"galerkin");
1444 if (alg ==
"shift" || alg ==
"non-galerkin") {
1446 test_and_set_param_2list<double>(paramList, defaultList,
"rap: shift", RAPparams);
1447 test_and_set_param_2list<bool>(paramList, defaultList,
"rap: shift diagonal M", RAPparams);
1448 test_and_set_param_2list<bool>(paramList, defaultList,
"rap: shift low storage", RAPparams);
1449 test_and_set_param_2list<Teuchos::Array<double>>(paramList, defaultList,
"rap: shift array", RAPparams);
1450 test_and_set_param_2list<Teuchos::Array<double>>(paramList, defaultList,
"rap: cfl array", RAPparams);
1456 test_and_set_param_2list<Teuchos::Array<double>>(paramList, defaultList,
"rap: relative diagonal floor", RAPparams);
1458 if (paramList.isSublist(
"matrixmatrix: kernel params"))
1459 RAPparams.sublist(
"matrixmatrix: kernel params",
false) = paramList.sublist(
"matrixmatrix: kernel params");
1460 if (defaultList.isSublist(
"matrixmatrix: kernel params"))
1461 RAPparams.sublist(
"matrixmatrix: kernel params",
false) = defaultList.sublist(
"matrixmatrix: kernel params");
1462 test_and_set_param_2list<bool>(paramList, defaultList,
"transpose: use implicit", RAPparams);
1463 test_and_set_param_2list<bool>(paramList, defaultList,
"rap: fix zero diagonals", RAPparams);
1464 test_and_set_param_2list<double>(paramList, defaultList,
"rap: fix zero diagonals threshold", RAPparams);
1465 test_and_set_param_2list<Scalar>(paramList, defaultList,
"rap: fix zero diagonals replacement", RAPparams);
1468 if (!paramList.isParameter(
"rap: triple product") &&
1469 paramList.isType<std::string>(
"multigrid algorithm") &&
1470 paramList.get<std::string>(
"multigrid algorithm") ==
"unsmoothed")
1471 paramList.set(
"rap: triple product",
true);
1473 test_and_set_param_2list<bool>(paramList, defaultList,
"rap: triple product", RAPparams);
1476 if (paramList.isParameter(
"aggregation: allow empty prolongator columns")) {
1477 RAPparams.set(
"CheckMainDiagonal", paramList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1478 RAPparams.set(
"RepairMainDiagonal", paramList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1479 }
else if (defaultList.isParameter(
"aggregation: allow empty prolongator columns")) {
1480 RAPparams.set(
"CheckMainDiagonal", defaultList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1481 RAPparams.set(
"RepairMainDiagonal", defaultList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1484 }
catch (Teuchos::Exceptions::InvalidParameterType&) {
1485 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(
true, Teuchos::Exceptions::InvalidParameterType,
1486 "Error: parameter \"aggregation: allow empty prolongator columns\" must be of type " << Teuchos::TypeNameTraits<bool>::name());
1489 if (!RAP.is_null()) {
1490 RAP->SetParameterList(RAPparams);
1491 RAP->SetFactory(
"P", manager.
GetFactory(
"P"));
1493 RAPs->SetParameterList(RAPparams);
1494 RAPs->SetFactory(
"P", manager.
GetFactory(
"P"));
1497 if (!this->implicitTranspose_) {
1499 RAP->SetFactory(
"R", manager.
GetFactory(
"R"));
1501 RAPs->SetFactory(
"R", manager.
GetFactory(
"R"));
1505 if (test_param_2list<bool>(paramList, defaultList,
"matrix: compute analysis",
true)) {
1509 RAP->AddTransferFactory(matrixAnalysisFact);
1511 RAPs->AddTransferFactory(matrixAnalysisFact);
1515 if (test_param_2list<bool>(paramList, defaultList,
"aggregation: compute aggregate qualities",
true)) {
1517 ParameterList aggQualityParams;
1518 test_and_set_param_2list<double>(paramList, defaultList,
"aggregate qualities: good aggregate threshold", aggQualityParams);
1519 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregate qualities: file output", aggQualityParams);
1520 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregate qualities: file base", aggQualityParams);
1521 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregate qualities: check symmetry", aggQualityParams);
1522 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregate qualities: algorithm", aggQualityParams);
1523 test_and_set_param_2list<double>(paramList, defaultList,
"aggregate qualities: zero threshold", aggQualityParams);
1524 test_and_set_param_2list<Teuchos::Array<double>>(paramList, defaultList,
"aggregate qualities: percentiles", aggQualityParams);
1525 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregate qualities: mode", aggQualityParams);
1526 aggQualityFact->SetParameterList(aggQualityParams);
1527 aggQualityFact->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1528 aggQualityFact->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1529 manager.
SetFactory(
"AggregateQualities", aggQualityFact);
1532 RAP->AddTransferFactory(aggQualityFact);
1534 RAPs->AddTransferFactory(aggQualityFact);
1537 if (test_param_2list<bool>(paramList, defaultList,
"aggregation: export visualization data",
true)) {
1539 ParameterList aggExportParams;
1540 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: output filename", aggExportParams);
1541 test_and_set_param_2list<std::string>(paramList, defaultList,
"aggregation: output file: agg style", aggExportParams);
1542 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: output file: iter", aggExportParams);
1543 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: output file: time step", aggExportParams);
1544 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: output file: fine graph edges", aggExportParams);
1545 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: output file: coarse graph edges", aggExportParams);
1546 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: output file: build colormap", aggExportParams);
1547 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: output file: aggregate qualities", aggExportParams);
1548 test_and_set_param_2list<bool>(paramList, defaultList,
"aggregation: output file: material", aggExportParams);
1549 aggExport->SetParameterList(aggExportParams);
1550 aggExport->SetFactory(
"AggregateQualities", manager.
GetFactory(
"AggregateQualities"));
1551 aggExport->SetFactory(
"DofsPerNode", manager.
GetFactory(
"DofsPerNode"));
1552 aggExport->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1553 aggExport->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1556 RAP->AddTransferFactory(aggExport);
1558 RAPs->AddTransferFactory(aggExport);
1565 auto reuseType = set_var_2list<std::string>(paramList, defaultList,
"reuse: type");
1566 auto useFiltering = set_var_2list<bool>(paramList, defaultList,
"sa: use filtered matrix");
1567 bool filteringChangesMatrix = useFiltering && !test_param_2list<double>(paramList, defaultList,
"aggregation: drop tol", 0);
1569 if (reuseType ==
"RP" || (reuseType ==
"tP" && !filteringChangesMatrix)) {
1570 if (!RAP.is_null()) {
1571 keeps.push_back(
keep_pair(
"AP reuse data", RAP.get()));
1572 keeps.push_back(
keep_pair(
"RAP reuse data", RAP.get()));
1575 keeps.push_back(
keep_pair(
"AP reuse data", RAPs.get()));
1576 keeps.push_back(
keep_pair(
"RAP reuse data", RAPs.get()));
1584template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1588 bool have_userCO =
false;
1589 if (paramList.isParameter(
"Coordinates") && !paramList.get<RCP<MultiVector>>(
"Coordinates").is_null())
1592 if (useCoordinates_) {
1598 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1599 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1602 auto RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(manager.
GetFactory(
"A")));
1603 if (!RAP.is_null()) {
1604 RAP->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1606 auto RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(manager.
GetFactory(
"A")));
1607 RAPs->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1616template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1620 bool have_userMaterial =
false;
1621 if (paramList.isParameter(
"Material") && !paramList.get<RCP<MultiVector>>(
"Material").is_null())
1622 have_userMaterial =
true;
1625 if (have_userMaterial) {
1629 ParameterList materialTransferParameters;
1630 materialTransferParameters.set(
"Vector name",
"Material");
1631 materialTransferParameters.set(
"Transfer name",
"Aggregates");
1632 materialTransferParameters.set(
"Normalize",
true);
1633 materialTransfer->SetParameterList(materialTransferParameters);
1634 materialTransfer->SetFactory(
"Transfer factory", manager.
GetFactory(
"Aggregates"));
1635 materialTransfer->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1636 manager.
SetFactory(
"Material", materialTransfer);
1638 auto RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(manager.
GetFactory(
"A")));
1639 if (!RAP.is_null()) {
1640 RAP->AddTransferFactory(manager.
GetFactory(
"Material"));
1642 auto RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(manager.
GetFactory(
"A")));
1643 RAPs->AddTransferFactory(manager.
GetFactory(
"Material"));
1652template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1655 FactoryManager& manager,
int levelID, std::vector<keep_pair>& )
const {
1658 if (useBlockNumber_ && (levelID > 0)) {
1659 auto RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(manager.
GetFactory(
"A")));
1660 auto RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(manager.
GetFactory(
"A")));
1661 if (!RAP.is_null() || !RAPs.is_null()) {
1663 if (multigridAlgo ==
"classical")
1664 fact->SetFactory(
"P Graph", manager.
GetFactory(
"P Graph"));
1666 fact->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1667 fact->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1669 fact->SetFactory(VarName, this->GetFactoryManager(levelID - 1)->GetFactory(VarName));
1674 RAP->AddTransferFactory(manager.
GetFactory(VarName));
1676 RAPs->AddTransferFactory(manager.
GetFactory(VarName));
1684template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1687 FactoryManager& manager,
int levelID, std::vector<keep_pair>& )
const {
1692 else if (levelID > 0) {
1694 auto RebalAc = rcp_const_cast<RebalanceAcFactory>(rcp_dynamic_cast<const RebalanceAcFactory>(Afact));
1695 RCP<RAPFactory> RAP;
1696 RCP<RAPShiftFactory> RAPs;
1697 if (!RebalAc.is_null()) {
1698 auto Afact2 = RebalAc->GetFactory(
"A");
1699 RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(Afact2));
1700 RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(Afact2));
1702 RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(Afact));
1703 RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(Afact));
1706 if (!RAP.is_null() || !RAPs.is_null()) {
1709 ParameterList transferParameters;
1710 transferParameters.set(
"Matrix name", VarName);
1711 transferParameters.set(
"transpose: use implicit", this->implicitTranspose_);
1712 mtf->SetParameterList(transferParameters);
1714 if (!RAP.is_null()) {
1715 mtf->SetFactory(
"P", RAP->GetFactory(
"P"));
1716 if (!this->implicitTranspose_)
1717 mtf->SetFactory(
"R", RAP->GetFactory(
"R"));
1718 RAP->AddTransferFactory(mtf);
1720 mtf->SetFactory(
"P", RAPs->GetFactory(
"P"));
1721 if (!this->implicitTranspose_)
1722 mtf->SetFactory(
"R", RAPs->GetFactory(
"R"));
1723 RAPs->AddTransferFactory(mtf);
1726 auto enableRepart = set_var_2list<bool>(paramList, defaultList,
"repartition: enable");
1727 if (!enableRepart) {
1731 Teuchos::ParameterList rebalParams;
1732 rebalParams.set(
"Matrix name", VarName);
1733 auto useSubCommInPlace = set_var_2list<bool>(paramList, defaultList,
"repartition: use subcommunicators in place");
1734 rebalParams.set(
"repartition: use subcommunicators in place", useSubCommInPlace);
1735 if (useSubCommInPlace) {
1736 auto inPlaceMapFact = manager.
GetFactory(
"InPlaceMap");
1737 rebalFact->SetFactory(
"InPlaceMap", inPlaceMapFact);
1739 TEUCHOS_ASSERT(!RebalAc.is_null());
1740 RCP<const FactoryBase> importerFact;
1741 importerFact = RebalAc->GetFactory(
"Importer");
1742 rebalFact->SetFactory(
"Importer", importerFact);
1743 RebalAc->AddRebalanceFactory(rebalFact);
1746 rebalFact->SetParameterList(rebalParams);
1747 rebalFact->SetFactory(
"A", mtf);
1758template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1761 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1762 if (useBlockNumber_) {
1763 ParameterList myParams;
1765 test_and_set_param_2list<int>(paramList, defaultList,
"aggregation: block diagonal: interleaved blocksize", myParams);
1766 fact->SetParameterList(myParams);
1774template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1777 int levelID, std::vector<keep_pair>& )
const {
1778 auto multigridAlgo = set_var_2list<std::string>(paramList, defaultList,
"multigrid algorithm");
1779 bool have_userR =
false;
1780 if (paramList.isParameter(
"R") && !paramList.get<RCP<Matrix>>(
"R").is_null())
1785 if (!this->implicitTranspose_) {
1786 auto isSymmetric = set_var_2list<bool>(paramList, defaultList,
"problem: symmetric");
1788 if (isSymmetric ==
false && (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"emin")) {
1789 this->GetOStream(
Warnings0) <<
"Switching \"problem: symmetric\" parameter to symmetric as multigrid algorithm. " << multigridAlgo <<
" is primarily supposed to be used for symmetric problems.\n\n"
1790 <<
"Please note: if you are using \"unsmoothed\" transfer operators the \"problem: symmetric\" parameter "
1791 <<
"has no real mathematical meaning, i.e. you can use it for non-symmetric\n"
1792 <<
"problems, too. With \"problem: symmetric\"=\"symmetric\" you can use implicit transpose for building "
1793 <<
"the restriction operators which may drastically reduce the amount of consumed memory." << std::endl;
1797 "Petrov-Galerkin smoothed transfer operators are only allowed for non-symmetric problems: Set \"problem: symmetric\" to false!\n"
1798 "While PG smoothed transfer operators generally would also work for symmetric problems this is an unusual use case. "
1799 "You can use the factory-based xml interface though if you need PG-AMG for symmetric problems.");
1818 if (paramList.isParameter(
"restriction: scale nullspace") && paramList.get<
bool>(
"restriction: scale nullspace")) {
1820 Teuchos::ParameterList tentPlist;
1821 tentPlist.set(
"Nullspace name",
"Scaled Nullspace");
1822 tentPFactory->SetParameterList(tentPlist);
1823 tentPFactory->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1824 tentPFactory->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1827 R->SetFactory(
"P", tentPFactory);
1834template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1837 int levelID, std::vector<keep_pair>& keeps, RCP<Factory>& nullSpaceFactory)
const {
1839 auto reuseType = set_var_2list<std::string>(paramList, defaultList,
"reuse: type");
1840 auto enableRepart = set_var_2list<bool>(paramList, defaultList,
"repartition: enable");
1842#if defined(HAVE_MPI) && (defined(HAVE_MUELU_ZOLTAN) || defined(HAVE_MUELU_ZOLTAN2))
1843 auto enableInPlace = set_var_2list<bool>(paramList, defaultList,
"repartition: use subcommunicators in place");
1880 "Reuse types \"tP\" and \"PR\" require \"repartition: rebalance P and R\" set to \"false\"");
1885 auto partName = set_var_2list<std::string>(paramList, defaultList,
"repartition: partitioner");
1887 "Invalid partitioner name: \"" << partName <<
"\". Valid options: \"zoltan\", \"zoltan2\"");
1889#ifndef HAVE_MUELU_ZOLTAN
1890 bool switched =
false;
1891 if (partName ==
"zoltan") {
1892 this->GetOStream(
Warnings0) <<
"Zoltan interface is not available, trying to switch to Zoltan2" << std::endl;
1893 partName =
"zoltan2";
1897#ifndef HAVE_MUELU_ZOLTAN2
1898 bool switched =
false;
1902#ifndef HAVE_MUELU_ZOLTAN2
1903 if (partName ==
"zoltan2" && !switched) {
1904 this->GetOStream(
Warnings0) <<
"Zoltan2 interface is not available, trying to switch to Zoltan" << std::endl;
1905 partName =
"zoltan";
1909 auto nodeRepartitionLevel = set_var_2list<int>(paramList, defaultList,
"repartition: node repartition level");
1913 ParameterList repartheurParams;
1914 test_and_set_param_2list<int>(paramList, defaultList,
"repartition: node repartition level", repartheurParams);
1915 test_and_set_param_2list<int>(paramList, defaultList,
"repartition: start level", repartheurParams);
1916 test_and_set_param_2list<int>(paramList, defaultList,
"repartition: min rows per proc", repartheurParams);
1917 test_and_set_param_2list<int>(paramList, defaultList,
"repartition: target rows per proc", repartheurParams);
1918 test_and_set_param_2list<int>(paramList, defaultList,
"repartition: min rows per thread", repartheurParams);
1919 test_and_set_param_2list<int>(paramList, defaultList,
"repartition: target rows per thread", repartheurParams);
1920 test_and_set_param_2list<double>(paramList, defaultList,
"repartition: max imbalance", repartheurParams);
1921 test_and_set_param_2list<int>(paramList, defaultList,
"repartition: put on single proc", repartheurParams);
1922 repartheurFactory->SetParameterList(repartheurParams);
1923 repartheurFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1924 manager.
SetFactory(
"number of partitions", repartheurFactory);
1925 manager.
SetFactory(
"repartition: heuristic target rows per process", repartheurFactory);
1928 RCP<Factory> partitioner;
1929 if (levelID == nodeRepartitionLevel) {
1932 ParameterList partParams;
1933 test_and_set_param_2list<int>(paramList, defaultList,
"repartition: node id", partParams);
1934 partitioner->SetParameterList(partParams);
1935 partitioner->SetFactory(
"Node Comm", manager.
GetFactory(
"Node Comm"));
1936 }
else if (partName ==
"zoltan") {
1937#ifdef HAVE_MUELU_ZOLTAN
1943 }
else if (partName ==
"zoltan2") {
1944#ifdef HAVE_MUELU_ZOLTAN2
1946 ParameterList partParams;
1947 RCP<const ParameterList> partpartParams = rcp(
new ParameterList(paramList.sublist(
"repartition: params",
false)));
1948 partParams.set(
"ParameterList", partpartParams);
1949 partitioner->SetParameterList(partParams);
1950 partitioner->SetFactory(
"repartition: heuristic target rows per process",
1951 manager.
GetFactory(
"repartition: heuristic target rows per process"));
1957 partitioner->SetFactory(
"A", manager.
GetFactory(
"A"));
1958 partitioner->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1959 if (useCoordinates_)
1960 partitioner->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1961 manager.
SetFactory(
"Partition", partitioner);
1965 ParameterList repartParams;
1966 test_and_set_param_2list<bool>(paramList, defaultList,
"repartition: print partition distribution", repartParams);
1967 test_and_set_param_2list<bool>(paramList, defaultList,
"repartition: remap parts", repartParams);
1968 test_and_set_param_2list<int>(paramList, defaultList,
"repartition: remap num values", repartParams);
1969 test_and_set_param_2list<bool>(paramList, defaultList,
"repartition: save importer", repartParams);
1970 repartFactory->SetParameterList(repartParams);
1971 repartFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1972 repartFactory->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1973 repartFactory->SetFactory(
"Partition", manager.
GetFactory(
"Partition"));
1974 manager.
SetFactory(
"Importer", repartFactory);
1975 if (reuseType !=
"none" && reuseType !=
"S" && levelID)
1978 if (enableInPlace) {
1983 ParameterList rebAcParams;
1984 test_and_set_param_2list<bool>(paramList, defaultList,
"repartition: use subcommunicators", rebAcParams);
1985 test_and_set_param_2list<bool>(paramList, defaultList,
"repartition: use subcommunicators in place", rebAcParams);
1986 newA->SetParameterList(rebAcParams);
1987 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1988 newA->SetFactory(
"InPlaceMap", manager.
GetFactory(
"InPlaceMap"));
1993 ParameterList rebAcParams;
1994 test_and_set_param_2list<bool>(paramList, defaultList,
"repartition: use subcommunicators", rebAcParams);
1995 newA->SetParameterList(rebAcParams);
1996 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1997 newA->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
2002 ParameterList newPparams;
2003 newPparams.set(
"type",
"Interpolation");
2004 if (changedPRrebalance_)
2005 newPparams.set(
"repartition: rebalance P and R", this->doPRrebalance_);
2006 if (changedPRViaCopyrebalance_)
2007 newPparams.set(
"repartition: explicit via new copy rebalance P and R",
true);
2008 test_and_set_param_2list<bool>(paramList, defaultList,
"repartition: use subcommunicators", newPparams);
2009 test_and_set_param_2list<std::string>(paramList, defaultList,
"repartition: send type", newPparams);
2010 newP->SetParameterList(newPparams);
2011 newP->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
2012 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
2014 if (!paramList.isParameter(
"semicoarsen: number of levels"))
2015 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
2017 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"P"));
2018 if (useCoordinates_) {
2019 newP->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
2023 newP->SetFactory(
"Material", manager.
GetFactory(
"Material"));
2026 if (useBlockNumber_ && (levelID > 0)) {
2027 newP->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
2033 ParameterList newRparams;
2034 newRparams.set(
"type",
"Restriction");
2035 test_and_set_param_2list<bool>(paramList, defaultList,
"repartition: use subcommunicators", newRparams);
2036 test_and_set_param_2list<std::string>(paramList, defaultList,
"repartition: send type", newRparams);
2037 if (changedPRrebalance_)
2038 newRparams.set(
"repartition: rebalance P and R", this->doPRrebalance_);
2039 if (changedPRViaCopyrebalance_)
2040 newPparams.set(
"repartition: explicit via new copy rebalance P and R",
true);
2041 if (changedImplicitTranspose_)
2042 newRparams.set(
"transpose: use implicit", this->implicitTranspose_);
2043 newR->SetParameterList(newRparams);
2044 newR->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
2045 if (!this->implicitTranspose_) {
2046 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
2057 ParameterList newNullparams;
2058 test_and_set_param_2list<bool>(paramList, defaultList,
"nullspace: calculate rotations", newNullparams);
2059 nullSpaceFactory->SetFactory(
"Nullspace", newP);
2060 nullSpaceFactory->SetParameterList(newNullparams);
2063 paramList.set(
"repartition: enable",
false);
2065 this->GetOStream(
Warnings0) <<
"No repartitioning available for a serial run\n";
2067 this->GetOStream(
Warnings0) <<
"Zoltan/Zoltan2 are unavailable for repartitioning\n";
2076template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2079 int levelID, std::vector<keep_pair>& keeps)
const {
2080 auto enableLowPrecision = set_var_2list<bool>(paramList, defaultList,
"transfers: half precision");
2082 if (enableLowPrecision) {
2085 ParameterList newPparams;
2086 newPparams.set(
"matrix key",
"P");
2087 newP->SetParameterList(newPparams);
2088 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
2091 if (!this->implicitTranspose_) {
2094 ParameterList newRparams;
2095 newRparams.set(
"matrix key",
"R");
2096 newR->SetParameterList(newRparams);
2097 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
2106template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2109 int , std::vector<keep_pair>& , RCP<Factory>& nullSpaceFactory)
const {
2113 bool have_userNS =
false;
2114 if (paramList.isParameter(
"Nullspace") && !paramList.get<RCP<MultiVector>>(
"Nullspace").is_null())
2118 ParameterList newNullparams;
2119 test_and_set_param_2list<bool>(paramList, defaultList,
"nullspace: calculate rotations", newNullparams);
2120 nullSpace->SetParameterList(newNullparams);
2121 nullSpace->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
2124 nullSpaceFactory = nullSpace;
2126 if (paramList.isParameter(
"restriction: scale nullspace") && paramList.get<
bool>(
"restriction: scale nullspace")) {
2128 scaledNSfactory->SetFactory(
"Nullspace", nullSpaceFactory);
2129 manager.
SetFactory(
"Scaled Nullspace", scaledNSfactory);
2136template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2139 int , std::vector<keep_pair>& )
const {
2141 RCP<Factory> semicoarsenFactory = Teuchos::null;
2142 if (paramList.isParameter(
"semicoarsen: number of levels") &&
2143 paramList.get<
int>(
"semicoarsen: number of levels") > 0) {
2144 ParameterList togglePParams;
2145 ParameterList semicoarsenPParams;
2146 ParameterList linedetectionParams;
2147 test_and_set_param_2list<int>(paramList, defaultList,
"semicoarsen: number of levels", togglePParams);
2148 test_and_set_param_2list<int>(paramList, defaultList,
"semicoarsen: coarsen rate", semicoarsenPParams);
2149 test_and_set_param_2list<bool>(paramList, defaultList,
"semicoarsen: piecewise constant", semicoarsenPParams);
2150 test_and_set_param_2list<bool>(paramList, defaultList,
"semicoarsen: piecewise linear", semicoarsenPParams);
2151 test_and_set_param_2list<bool>(paramList, defaultList,
"semicoarsen: calculate nonsym restriction", semicoarsenPParams);
2152 test_and_set_param_2list<std::string>(paramList, defaultList,
"linedetection: orientation", linedetectionParams);
2153 test_and_set_param_2list<int>(paramList, defaultList,
"linedetection: num layers", linedetectionParams);
2159 linedetectionFactory->SetParameterList(linedetectionParams);
2160 semicoarsenFactory->SetParameterList(semicoarsenPParams);
2161 togglePFactory->SetParameterList(togglePParams);
2163 togglePFactory->AddCoarseNullspaceFactory(semicoarsenFactory);
2164 togglePFactory->AddProlongatorFactory(semicoarsenFactory);
2165 togglePFactory->AddPtentFactory(semicoarsenFactory);
2166 togglePFactory->AddCoarseNullspaceFactory(manager.
GetFactory(
"Ptent"));
2167 togglePFactory->AddProlongatorFactory(manager.
GetFactory(
"P"));
2168 togglePFactory->AddPtentFactory(manager.
GetFactory(
"Ptent"));
2170 manager.
SetFactory(
"CoarseNumZLayers", linedetectionFactory);
2171 manager.
SetFactory(
"LineDetection_Layers", linedetectionFactory);
2172 manager.
SetFactory(
"LineDetection_VertLineIds", linedetectionFactory);
2176 manager.
SetFactory(
"Nullspace", togglePFactory);
2179 if (paramList.isParameter(
"semicoarsen: number of levels") &&
2180 paramList.get<
int>(
"semicoarsen: number of levels") > 0) {
2182 tf->SetFactory(
"Chosen P", manager.
GetFactory(
"P"));
2183 tf->AddCoordTransferFactory(semicoarsenFactory);
2186 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
2187 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
2188 tf->AddCoordTransferFactory(coords);
2196template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2199 int levelID, std::vector<keep_pair>& keeps)
const {
2200#if defined(HAVE_MUELU_INTREPID2) && defined(HAVE_MUELU_EXPERIMENTAL)
2202 if (defaultList.isParameter(
"pcoarsen: schedule") && defaultList.isParameter(
"pcoarsen: element")) {
2205 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
2206 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
2208 if (levelID >= (
int)pcoarsen_schedule.size()) {
2211 std::string multigridAlgo =
"SA";
2212 UpdateFactoryManager_SA(multigridAlgo, paramList, defaultList, manager, levelID, keeps);
2216 ParameterList Pparams;
2218 std::string lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
2219 std::string hi = (levelID ? pcoarsen_element + std::to_string(pcoarsen_schedule[levelID - 1]) : lo);
2220 Pparams.set(
"pcoarsen: hi basis", hi);
2221 Pparams.set(
"pcoarsen: lo basis", lo);
2222 P->SetParameterList(Pparams);
2231 ParameterList Pparams;
2233 test_and_set_param_2list<std::string>(paramList, defaultList,
"pcoarsen: hi basis", Pparams);
2234 test_and_set_param_2list<std::string>(paramList, defaultList,
"pcoarsen: lo basis", Pparams);
2235 P->SetParameterList(Pparams);
2248template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2250 UpdateFactoryManager_SA(std::string& multigridAlgo, ParameterList& paramList,
const ParameterList& defaultList,
FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
2253 ParameterList Pparams;
2254 if (paramList.isSublist(
"matrixmatrix: kernel params"))
2255 Pparams.sublist(
"matrixmatrix: kernel params",
false) = paramList.sublist(
"matrixmatrix: kernel params");
2256 if (defaultList.isSublist(
"matrixmatrix: kernel params"))
2257 Pparams.sublist(
"matrixmatrix: kernel params",
false) = defaultList.sublist(
"matrixmatrix: kernel params");
2258 test_and_set_param_2list<double>(paramList, defaultList,
"sa: damping factor", Pparams);
2259 test_and_set_param_2list<double>(paramList, defaultList,
"sa: nodal damping factor", Pparams);
2260 test_and_set_param_2list<bool>(paramList, defaultList,
"sa: calculate eigenvalue estimate", Pparams);
2261 test_and_set_param_2list<double>(paramList, defaultList,
"sa: max eigenvalue", Pparams);
2262 test_and_set_param_2list<int>(paramList, defaultList,
"sa: eigenvalue estimate num iterations", Pparams);
2263 test_and_set_param_2list<double>(paramList, defaultList,
"sa: diagonal replacement tolerance", Pparams);
2264 test_and_set_param_2list<bool>(paramList, defaultList,
"sa: use rowsumabs diagonal scaling", Pparams);
2265 test_and_set_param_2list<double>(paramList, defaultList,
"sa: rowsumabs diagonal replacement tolerance", Pparams);
2266 test_and_set_param_2list<double>(paramList, defaultList,
"sa: rowsumabs diagonal replacement value", Pparams);
2267 test_and_set_param_2list<bool>(paramList, defaultList,
"sa: rowsumabs use automatic diagonal tolerance", Pparams);
2268 test_and_set_param_2list<bool>(paramList, defaultList,
"sa: enforce constraints", Pparams);
2270 test_and_set_param_2list<bool>(paramList, defaultList,
"tentative: calculate qr", Pparams);
2272 if ((multigridAlgo ==
"smoothed reitzinger") && (levelID > 0)) {
2273 Pparams.set(
"sa: maxwell1 smoothing",
true);
2274 if (!Pparams.isType<
double>(
"sa: damping factor") || (Pparams.get<
double>(
"sa: damping factor") != 0.0))
2275 P->SetFactory(
"CurlCurl", this->GetFactoryManager(levelID - 1)->GetFactory(
"CurlCurl"));
2278 P->SetParameterList(Pparams);
2281 auto useFiltering = set_var_2list<bool>(paramList, defaultList,
"sa: use filtered matrix");
2289 ParameterList fParams;
2290 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: use lumping", fParams);
2291 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: reuse graph", fParams);
2292 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: reuse eigenvalue", fParams);
2293 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: use root stencil", fParams);
2294 test_and_set_param_2list<double>(paramList, defaultList,
"filtered matrix: Dirichlet threshold", fParams);
2295 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: use spread lumping", fParams);
2297 test_and_set_param_2list<double>(paramList, defaultList,
"filtered matrix: spread lumping diag dom growth factor", fParams);
2298 test_and_set_param_2list<double>(paramList, defaultList,
"filtered matrix: spread lumping diag dom cap", fParams);
2299 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: count negative diagonals", fParams);
2300 filterFactory->SetParameterList(fParams);
2301 filterFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
2302 filterFactory->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
2303 filterFactory->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
2305 filterFactory->SetFactory(
"Filtering", manager.
GetFactory(
"Graph"));
2307 P->SetFactory(
"A", filterFactory);
2310 P->SetFactory(
"A", manager.
GetFactory(
"Graph"));
2314 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2317 bool filteringChangesMatrix = useFiltering && !test_param_2list<double>(paramList, defaultList,
"aggregation: drop tol", 0);
2318 auto reuseType = set_var_2list<std::string>(paramList, defaultList,
"reuse: type");
2319 if (reuseType ==
"tP" && !filteringChangesMatrix)
2320 keeps.push_back(
keep_pair(
"AP reuse data", P.get()));
2326template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2329 int , std::vector<keep_pair>& )
const {
2330 auto patternType = set_var_2list<std::string>(paramList, defaultList,
"emin: pattern");
2331 auto reuseType = set_var_2list<std::string>(paramList, defaultList,
"reuse: type");
2333 "Invalid pattern name: \"" << patternType <<
"\". Valid options: \"AkPtent\"");
2336 ParameterList patternParams;
2337 test_and_set_param_2list<int>(paramList, defaultList,
"emin: pattern order", patternParams);
2338 patternFactory->SetParameterList(patternParams);
2339 patternFactory->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2342 auto useFiltering = set_var_2list<bool>(paramList, defaultList,
"emin: use filtered matrix");
2350 ParameterList fParams;
2351 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: use lumping", fParams);
2352 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: reuse graph", fParams);
2353 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: reuse eigenvalue", fParams);
2354 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: use root stencil", fParams);
2355 test_and_set_param_2list<double>(paramList, defaultList,
"filtered matrix: Dirichlet threshold", fParams);
2356 test_and_set_param_2list<bool>(paramList, defaultList,
"filtered matrix: use spread lumping", fParams);
2357 test_and_set_param_2list<std::string>(paramList, defaultList,
"filtered matrix: lumping choice", fParams);
2358 test_and_set_param_2list<double>(paramList, defaultList,
"filtered matrix: spread lumping diag dom growth factor", fParams);
2359 test_and_set_param_2list<double>(paramList, defaultList,
"filtered matrix: spread lumping diag dom cap", fParams);
2360 filterFactory->SetParameterList(fParams);
2361 filterFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
2362 filterFactory->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
2363 filterFactory->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
2365 filterFactory->SetFactory(
"Filtering", manager.
GetFactory(
"Graph"));
2367 patternFactory->SetFactory(
"A", filterFactory);
2370 patternFactory->SetFactory(
"A", manager.
GetFactory(
"Graph"));
2374 manager.
SetFactory(
"Ppattern", patternFactory);
2378 Teuchos::ParameterList constraintParams;
2379 test_and_set_param_2list<std::string>(paramList, defaultList,
"emin: least squares solver type", constraintParams);
2380 constraintParams.set(
"emin: constraint type",
"nullspace");
2381 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
2382 constraintFactory->SetFactory(
"CoarseNullspace", manager.
GetFactory(
"Ptent"));
2383 manager.
SetFactory(
"Constraint", constraintFactory);
2386 ParameterList Pparams;
2387 test_and_set_param_2list<int>(paramList, defaultList,
"emin: num iterations", Pparams);
2388 test_and_set_param_2list<std::string>(paramList, defaultList,
"emin: iterative method", Pparams);
2389 if (reuseType ==
"emin") {
2390 test_and_set_param_2list<int>(paramList, defaultList,
"emin: num reuse iterations", Pparams);
2391 Pparams.set(
"Keep P0",
true);
2392 Pparams.set(
"Keep Constraint0",
true);
2397 P->SetParameterList(Pparams);
2398 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2399 P->SetFactory(
"Constraint", manager.
GetFactory(
"Constraint"));
2406template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2409 int , std::vector<keep_pair>& )
const {
2411 "Implicit transpose not supported with Petrov-Galerkin smoothed transfer operators: Set \"transpose: use implicit\" to false!\n"
2412 "Petrov-Galerkin transfer operator smoothing for non-symmetric problems requires a separate handling of the restriction operator which "
2413 "does not allow the usage of implicit transpose easily.");
2417 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2424template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2429 ParameterList Pparams;
2430 test_and_set_param_2list<int>(paramList, defaultList,
"replicate: npdes", Pparams);
2432 P->SetParameterList(Pparams);
2439template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2444 ParameterList Pparams;
2445 test_and_set_param_2list<int>(paramList, defaultList,
"combine: numBlks", Pparams);
2446 test_and_set_param_2list<bool>(paramList, defaultList,
"combine: useMaxLevels", Pparams);
2448 P->SetParameterList(Pparams);
2455template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2458 int , std::vector<keep_pair>& )
const {
2459#ifdef HAVE_MUELU_MATLAB
2460 ParameterList Pparams = paramList.sublist(
"transfer: params");
2462 P->SetParameterList(Pparams);
2463 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2471#undef MUELU_KOKKOS_FACTORY
2475template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2477 ParameterList paramList = constParamList;
2480 const int maxLevels = 100;
2483 std::vector<ParameterList> paramLists;
2484 for (
int levelID = 0; levelID < maxLevels; levelID++) {
2485 std::string sublistName =
"level " +
toString(levelID);
2486 if (paramList.isSublist(sublistName)) {
2487 paramLists.push_back(paramList.sublist(sublistName));
2489 paramList.remove(sublistName);
2492 paramLists.push_back(paramList);
2494#ifdef HAVE_MUELU_MATLAB
2496 for (
size_t i = 0; i < paramLists.size(); i++) {
2497 std::vector<std::string> customVars;
2499 for (Teuchos::ParameterList::ConstIterator it = paramLists[i].begin(); it != paramLists[i].end(); it++) {
2500 std::string paramName = paramLists[i].name(it);
2503 customVars.push_back(paramName);
2507 for (
size_t j = 0; j < customVars.size(); j++)
2508 paramLists[i].remove(customVars[j],
false);
2512 const int maxDepth = 0;
2513 for (
size_t i = 0; i < paramLists.size(); i++) {
2516 paramLists[i].validateParameters(validList, maxDepth);
2518 }
catch (
const Teuchos::Exceptions::InvalidParameterName& e) {
2519 std::string eString = e.what();
2522 size_t nameStart = eString.find_first_of(
'"') + 1;
2523 size_t nameEnd = eString.find_first_of(
'"', nameStart);
2524 std::string name = eString.substr(nameStart, nameEnd - nameStart);
2526 size_t bestScore = 100;
2527 std::string bestName =
"";
2528 for (ParameterList::ConstIterator it = validList.begin(); it != validList.end(); it++) {
2529 const std::string& pName = validList.name(it);
2530 this->GetOStream(
Runtime1) <<
"| " << pName;
2531 size_t score =
LevenshteinDistance(name.c_str(), name.length(), pName.c_str(), pName.length());
2532 this->GetOStream(
Runtime1) <<
" -> " << score << std::endl;
2533 if (score < bestScore) {
2538 if (bestScore < 10 && bestName !=
"") {
2539 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameterName,
2540 eString <<
"The parameter name \"" + name +
"\" is not valid. Did you mean \"" + bestName <<
"\"?\n");
2543 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameterName,
2544 eString <<
"The parameter name \"" + name +
"\" is not valid.\n");
2553template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2558 ParameterList paramList = constParamList;
2565 if (paramList.isSublist(
"Matrix")) {
2566 blockSize_ = paramList.sublist(
"Matrix").get<
int>(
"PDE equations", MasterList::getDefault<int>(
"number of equations"));
2567 dofOffset_ = paramList.sublist(
"Matrix").get<
GlobalOrdinal>(
"DOF offset", 0);
2571 if (factFact_ == Teuchos::null)
2583 if (paramList.isSublist(
"Factories"))
2584 this->BuildFactoryMap(paramList.sublist(
"Factories"), factoryMap, factoryMap, factoryManagers);
2598 if (paramList.isSublist(
"Hierarchy")) {
2599 ParameterList hieraList = paramList.sublist(
"Hierarchy");
2602 if (hieraList.isParameter(
"max levels")) {
2603 this->numDesiredLevel_ = hieraList.get<
int>(
"max levels");
2604 hieraList.remove(
"max levels");
2607 if (hieraList.isParameter(
"coarse: max size")) {
2608 this->maxCoarseSize_ = hieraList.get<
int>(
"coarse: max size");
2609 hieraList.remove(
"coarse: max size");
2612 if (hieraList.isParameter(
"repartition: rebalance P and R")) {
2613 this->doPRrebalance_ = hieraList.get<
bool>(
"repartition: rebalance P and R");
2614 hieraList.remove(
"repartition: rebalance P and R");
2617 if (hieraList.isParameter(
"transpose: use implicit")) {
2618 this->implicitTranspose_ = hieraList.get<
bool>(
"transpose: use implicit");
2619 hieraList.remove(
"transpose: use implicit");
2622 if (hieraList.isParameter(
"fuse prolongation and update")) {
2623 this->fuseProlongationAndUpdate_ = hieraList.get<
bool>(
"fuse prolongation and update");
2624 hieraList.remove(
"fuse prolongation and update");
2627 if (hieraList.isParameter(
"nullspace: suppress dimension check")) {
2628 this->suppressNullspaceDimensionCheck_ = hieraList.get<
bool>(
"nullspace: suppress dimension check");
2629 hieraList.remove(
"nullspace: suppress dimension check");
2632 if (hieraList.isParameter(
"number of vectors")) {
2633 this->sizeOfMultiVectors_ = hieraList.get<
int>(
"number of vectors");
2634 hieraList.remove(
"number of vectors");
2637 if (hieraList.isSublist(
"matvec params"))
2638 this->matvecParams_ = Teuchos::parameterList(hieraList.sublist(
"matvec params"));
2640 if (hieraList.isParameter(
"coarse grid correction scaling factor")) {
2641 this->scalingFactor_ = hieraList.get<
double>(
"coarse grid correction scaling factor");
2642 hieraList.remove(
"coarse grid correction scaling factor");
2646 if (hieraList.isParameter(
"cycle type")) {
2647 std::map<std::string, CycleType> cycleMap;
2651 std::string cycleType = hieraList.get<std::string>(
"cycle type");
2652 TEUCHOS_TEST_FOR_EXCEPTION(cycleMap.count(cycleType) == 0,
Exceptions::RuntimeError,
"Invalid cycle type: \"" << cycleType <<
"\"");
2653 this->Cycle_ = cycleMap[cycleType];
2656 if (hieraList.isParameter(
"W cycle start level")) {
2657 this->WCycleStartLevel_ = hieraList.get<
int>(
"W cycle start level");
2660 if (hieraList.isParameter(
"hierarchy label")) {
2661 this->hierarchyLabel_ = hieraList.get<std::string>(
"hierarchy label");
2664 if (hieraList.isParameter(
"verbosity")) {
2665 std::string vl = hieraList.get<std::string>(
"verbosity");
2666 hieraList.remove(
"verbosity");
2670 if (hieraList.isParameter(
"output filename"))
2673 if (hieraList.isParameter(
"dependencyOutputLevel"))
2674 this->graphOutputLevel_ = hieraList.get<
int>(
"dependencyOutputLevel");
2677 if (hieraList.isParameter(
"reuse"))
2680 if (hieraList.isSublist(
"DataToWrite")) {
2683 ParameterList foo = hieraList.sublist(
"DataToWrite");
2684 std::string dataName =
"Matrices";
2685 if (foo.isParameter(dataName))
2686 this->matricesToPrint_[
"A"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2687 dataName =
"Prolongators";
2688 if (foo.isParameter(dataName))
2689 this->matricesToPrint_[
"P"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2690 dataName =
"Restrictors";
2691 if (foo.isParameter(dataName))
2692 this->matricesToPrint_[
"R"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2694 if (foo.isParameter(dataName))
2695 this->matricesToPrint_[
"D0"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2699 for (ParameterList::ConstIterator param = hieraList.begin(); param != hieraList.end(); ++param) {
2700 const std::string& paramName = hieraList.name(param);
2702 if (paramName !=
"DataToWrite" && hieraList.isSublist(paramName)) {
2703 ParameterList levelList = hieraList.sublist(paramName);
2706 if (levelList.isParameter(
"startLevel")) {
2707 startLevel = levelList.get<
int>(
"startLevel");
2708 levelList.remove(
"startLevel");
2710 int numDesiredLevel = 1;
2711 if (levelList.isParameter(
"numDesiredLevel")) {
2712 numDesiredLevel = levelList.get<
int>(
"numDesiredLevel");
2713 levelList.remove(
"numDesiredLevel");
2727 BuildFactoryMap(levelList, factoryMap, levelFactoryMap, factoryManagers);
2729 RCP<FactoryManager> m = rcp(
new FactoryManager(levelFactoryMap));
2730 if (hieraList.isParameter(
"use kokkos refactor"))
2731 m->SetKokkosRefactor(hieraList.get<
bool>(
"use kokkos refactor"));
2733 if (startLevel >= 0)
2734 this->AddFactoryManager(startLevel, numDesiredLevel, m);
2736 TEUCHOS_TEST_FOR_EXCEPTION(
true,
Exceptions::RuntimeError,
"MueLu::ParameterListInterpreter():: invalid level id");
2865template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2868 for (ParameterList::ConstIterator param = paramList.begin(); param != paramList.end(); ++param) {
2869 const std::string& paramName = paramList.name(param);
2870 const Teuchos::ParameterEntry& paramValue = paramList.entry(param);
2874 if (paramValue.isList()) {
2875 ParameterList paramList1 = Teuchos::getValue<ParameterList>(paramValue);
2876 if (paramList1.isParameter(
"factory")) {
2879 "MueLu::ParameterListInterpreter(): It seems that in the parameter lists for defining " << paramName <<
" there is both a 'factory' and 'dependency for' parameter. This is not allowed. Please remove the 'dependency for' parameter.");
2881 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2883 }
else if (paramList1.isParameter(
"dependency for")) {
2885 "MueLu::ParameterListInterpreter(): It seems that in the parameter lists for defining " << paramName <<
" there is both a 'factory' and 'dependency for' parameter. This is not allowed.");
2887 std::string factoryName = paramList1.get<std::string>(
"dependency for");
2889 RCP<const FactoryBase> factbase = factoryMapIn.find(factoryName )->second;
2891 "MueLu::ParameterListInterpreter(): could not find factory " + factoryName +
" in factory map. Did you define it before?");
2893 RCP<const Factory> factoryconst = Teuchos::rcp_dynamic_cast<const Factory>(factbase);
2894 RCP<Factory> factory = Teuchos::rcp_const_cast<Factory>(factoryconst);
2897 RCP<const ParameterList> validParamList = factory->GetValidParameterList();
2898 for (ParameterList::ConstIterator vparam = validParamList->begin(); vparam != validParamList->end(); ++vparam) {
2899 const std::string& pName = validParamList->name(vparam);
2901 if (!paramList1.isParameter(pName)) {
2906 if (validParamList->isType<RCP<const FactoryBase>>(pName)) {
2908 RCP<const FactoryBase> generatingFact = factFact_->BuildFactory(paramList1.getEntry(pName), factoryMapIn, factoryManagers);
2909 factory->SetFactory(pName, generatingFact.create_weak());
2911 }
else if (validParamList->isType<RCP<const ParameterList>>(pName)) {
2912 if (pName ==
"ParameterList") {
2917 RCP<const ParameterList> subList = Teuchos::sublist(rcp(
new ParameterList(paramList1)), pName);
2918 factory->SetParameter(pName, ParameterEntry(subList));
2921 factory->SetParameter(pName, paramList1.getEntry(pName));
2925 }
else if (paramList1.isParameter(
"group")) {
2927 std::string groupType = paramList1.get<std::string>(
"group");
2929 "group must be of type \"FactoryManager\".");
2931 ParameterList groupList = paramList1;
2932 groupList.remove(
"group");
2934 bool setKokkosRefactor =
false;
2935 bool kokkosRefactor = useKokkos_;
2936 if (groupList.isParameter(
"use kokkos refactor")) {
2937 kokkosRefactor = groupList.get<
bool>(
"use kokkos refactor");
2938 groupList.remove(
"use kokkos refactor");
2939 setKokkosRefactor =
true;
2943 BuildFactoryMap(groupList, factoryMapIn, groupFactoryMap, factoryManagers);
2947 RCP<FactoryManager> m = rcp(
new FactoryManager(groupFactoryMap));
2948 if (setKokkosRefactor)
2949 m->SetKokkosRefactor(kokkosRefactor);
2950 factoryManagers[paramName] = m;
2953 this->GetOStream(
Warnings0) <<
"Could not interpret parameter list " << paramList1 << std::endl;
2955 "XML Parameter list must either be of type \"factory\" or of type \"group\".");
2959 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2967template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2970 Matrix& A =
dynamic_cast<Matrix&
>(Op);
2971 if (A.IsFixedBlockSizeSet() && (A.GetFixedBlockSize() != blockSize_))
2972 this->GetOStream(
Warnings0) <<
"Setting matrix block size to " << blockSize_ <<
" (value of the parameter in the list) "
2973 <<
"instead of " << A.GetFixedBlockSize() <<
" (provided matrix)." << std::endl
2974 <<
"You may want to check \"number of equations\" (or \"PDE equations\" for factory style list) parameter." << std::endl;
2976 if ((blockSize_ != 1) || (dofOffset_ != 0))
2977 A.SetFixedBlockSize(blockSize_, dofOffset_);
2980 MatrixUtils::checkLocalRowMapMatchesColMap(A);
2982 }
catch (std::bad_cast&) {
2983 this->GetOStream(
Warnings0) <<
"Skipping setting block size as the operator is not a matrix" << std::endl;
2987template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2996static bool compare(
const ParameterList& list1,
const ParameterList& list2) {
2999 for (ParameterList::ConstIterator it = list1.begin(); it != list1.end(); it++) {
3000 const std::string& name = it->first;
3001 const Teuchos::ParameterEntry& entry1 = it->second;
3003 const Teuchos::ParameterEntry* entry2 = list2.getEntryPtr(name);
3006 if (entry1.isList() && entry2->isList()) {
3007 compare(Teuchos::getValue<ParameterList>(entry1), Teuchos::getValue<ParameterList>(*entry2));
3010 if (entry1.getAny(
false) != entry2->getAny(
false))
3017static inline bool areSame(
const ParameterList& list1,
const ParameterList& list2) {
3023#define MUELU_PARAMETERLISTINTERPRETER_SHORT
#define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2)
#define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory)
#define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory)
#define TEST_MUTUALLY_EXCLUSIVE(arg1, arg2)
MueLu::DefaultGlobalOrdinal GlobalOrdinal
An factory which assigns each aggregate a quality estimate. Originally developed by Napov and Notay i...
Factory to export aggregation info or visualize aggregates using VTK.
AmalgamationFactory for subblocks of strided map based amalgamation data.
static bool debug()
Whether MueLu is in debug mode.
Factory for generating F/C-splitting and a coarse level map. Used by ClassicalPFactory.
Factory for creating a graph based on a given matrix.
Factory for creating a graph based on a given matrix.
Factory for generating coarse level map. Used by TentativePFactory.
Prolongator factory that replicates 'Psubblock' matrix to create new prolongator suitable for PDE sys...
Factory for building the constraint operator.
Class for transferring coordinates from a finer level to a coarser one.
Class that encapsulates direct solvers. Autoselection of AmesosSmoother or Amesos2Smoother according ...
Factory for building Energy Minimization prolongators.
Exception throws to report invalid user entry.
Exception throws to report errors in the internal logical of the program.
Factory that can generate other factories from.
static void EnableTimerSync()
static void DisableMultipleCheckGlobally()
This class specifies the default factory that should generate some data on a Level if the data does n...
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Set Factory.
const RCP< const FactoryBase > GetFactory(const std::string &varName) const
Get factory associated with a particular data name.
const RCP< FactoryBase > GetFactoryNonConst(const std::string &varName)
Get factory associated with a particular data name (NONCONST version)
Factory for building filtered matrices using filtered graphs.
Factory for building restriction operators using a prolongator factory.
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
static CycleType GetDefaultCycle()
void SetCycleStartLevel(int cycleStart)
void SetLabel(const std::string &hierarchyLabel)
static int GetDefaultCycleStartLevel()
void SetCycle(CycleType Cycle)
Supports VCYCLE and WCYCLE types.
void SetProlongatorScalingFactor(double scalingFactor)
Specify damping factor alpha such that x = x + alpha*P*c, where c is the coarse grid correction.
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
Class for generating an initial LocalOrdinal-type BlockNumber vector, based on an input paraemter for...
Factory for building transfer operators based on coarsening in polynomial degree, following the Intre...
Factory for building line detection information.
Class for transferring a vector of local ordinals from a finer level to a coarser one,...
Factory for converting matrices to half precision operators.
static Teuchos::RCP< Teuchos::ParameterList > GetProblemSpecificList(std::string const &problemType)
Return default parameter settings for the specified problem type.
static Teuchos::RCP< const Teuchos::ParameterList > List()
Return a "master" list of all valid parameters and their default values.
Class that encapsulates Matlab smoothers.
This class checks matrix properties of A on current level. This factory can be plugged in everywhere ...
Class for restricting a Matrix from a finer to a coarser level.
Class for restricting a MultiVector from a finer to a coarser level.
static const RCP< const NoFactory > getRCP()
Static Get() functions.
Partitioning within a node only.
Factory for generating nullspace.
void UpdateFactoryManager_Nullspace(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps, RCP< Factory > &nullSpaceFactory) const
void UpdateFactoryManager_Reitzinger(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_RAP(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Smoothers(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_SA(std::string &multigridAlgo, Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Aggregation_TentativeP(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void SetEasyParameterList(const Teuchos::ParameterList ¶mList)
void UpdateFactoryManager_MatrixTransfer(const std::string &VarName, Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_EminReitzinger(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Coordinates(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void BuildFactoryMap(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, FactoryMap &factoryMapOut, FactoryManagerMap &factoryManagers) const
Interpret "Factories" sublist.
void UpdateFactoryManager_Restriction(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
virtual void SetupOperator(Operator &A) const
Setup Operator object.
void UpdateFactoryManager_Replicate(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_LowPrecision(ParameterList ¶mList, const ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_PCoarsen(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
Teuchos::RCP< MueLu::FacadeClassFactory< Scalar, LocalOrdinal, GlobalOrdinal, Node > > facadeFact_
FacadeClass factory.
ParameterListInterpreter()
Empty constructor.
std::pair< std::string, const FactoryBase * > keep_pair
void UpdateFactoryManager_PG(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void SetParameterList(const Teuchos::ParameterList ¶mList)
Set parameter list for Parameter list interpreter.
void UpdateFactoryManager_Material(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void Validate(const Teuchos::ParameterList ¶mList) const
void UpdateFactoryManager_Emin(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Combine(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Matlab(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
std::map< std::string, RCP< FactoryManagerBase > > FactoryManagerMap
virtual ~ParameterListInterpreter()
Destructor.
void UpdateFactoryManager_LocalOrdinalTransfer(const std::string &VarName, const std::string &multigridAlgo, Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_SemiCoarsen(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_BlockNumber(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
std::map< std::string, RCP< const FactoryBase > > FactoryMap
void SetupHierarchy(Hierarchy &H) const
Call the SetupHierarchy routine from the HiearchyManager object.
void SetFactoryParameterList(const Teuchos::ParameterList ¶mList)
Factory interpreter stuff.
void UpdateFactoryManager_CoarseSolvers(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Repartition(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps, RCP< Factory > &nullSpaceFactory) const
Factory for building nonzero patterns for energy minimization.
Factory for building Petrov-Galerkin Smoothed Aggregation prolongators.
Factory for building coarse matrices.
Factory for building coarse grid matrices, when the matrix is of the form K+a*M. Useful when you want...
Factory for building coarse matrices.
Applies permutation to grid transfer operators.
Factory for building tentative prolongator.
Factory for building permutation matrix that can be be used to shuffle data (matrices,...
Factory for determing the number of partitions for rebalancing.
Prolongator factory that replicates 'Psubblock' matrix to create new prolongator suitable for PDE sys...
Factory for building Smoothed Aggregation prolongators.
Factory for generating a very special nullspace.
Prolongator factory performing semi-coarsening.
Prolongator factory performing semi-coarsening.
Factory for interacting with Matlab.
Factory for creating a graph base on a given matrix.
Generic Smoother Factory for generating the smoothers of the MG hierarchy.
Interface to block smoothers in Teko package.
Factory for building tentative prolongator.
Class for transferring coordinates from a finer level to a coarser one.
Prolongator factory which allows switching between two different prolongator strategies.
Factory for building restriction operators.
Class that encapsulates external library smoothers.
Factory for interacting with Matlab.
Factory for building uncoupled aggregates.
static VerbLevel GetDefaultVerbLevel()
Get the default (global) verbosity level.
static void SetDefaultVerbLevel(const VerbLevel defaultVerbLevel)
Set the default (global) verbosity level.
static void SetMueLuOFileStream(const std::string &filename)
Interface to Zoltan2 library.
Interface to Zoltan library.
Namespace for MueLu classes and methods.
bool IsParamMuemexVariable(const std::string &name)
long ExtractNonSerializableData(const Teuchos::ParameterList &inList, Teuchos::ParameterList &serialList, Teuchos::ParameterList &nonSerialList)
Extract non-serializable data from level-specific sublists and move it to a separate parameter list.
@ Warnings0
Important warning messages (one line)
@ Runtime0
One-liner description of what is happening.
@ Runtime1
Description of what is happening (more verbose)
@ Warnings1
Additional warnings.
size_t LevenshteinDistance(const char *s, size_t len_s, const char *t, size_t len_t)
static bool test_and_set_var(const Teuchos::ParameterList ¶mList, const std::string ¶mName, paramType &varName)
MsgType toVerbLevel(const std::string &verbLevelStr)
static void test_and_set_param_2list(const Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, const std::string ¶mName, Teuchos::ParameterList &listWrite)
static bool areSame(const ParameterList &list1, const ParameterList &list2)
Helper functions to compare two paramter lists.
static bool compare(const ParameterList &list1, const ParameterList &list2)
static void test_and_set_var_from_masterlist(Teuchos::ParameterList ¶mList, const std::string ¶mName)
std::string toString(const T &what)
Little helper function to convert non-string types to strings.
static paramType set_var_2list(const Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, const std::string ¶mName)
static bool test_param_2list(const Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, const std::string ¶mName, const paramType &cmpValue)