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_EminPFactory.hpp"
40#include "MueLu_FacadeClassFactory.hpp"
41#include "MueLu_FactoryFactory.hpp"
42#include "MueLu_FilteredAFactory.hpp"
43#include "MueLu_GenericRFactory.hpp"
44#include "MueLu_InitialBlockNumberFactory.hpp"
45#include "MueLu_LineDetectionFactory.hpp"
46#include "MueLu_LocalOrdinalTransferFactory.hpp"
47#include "MueLu_MatrixAnalysisFactory.hpp"
48#include "MueLu_MultiVectorTransferFactory.hpp"
49#include "MueLu_NotayAggregationFactory.hpp"
50#include "MueLu_NullspaceFactory.hpp"
51#include "MueLu_PatternFactory.hpp"
52#include "MueLu_ReplicatePFactory.hpp"
53#include "MueLu_CombinePFactory.hpp"
54#include "MueLu_PgPFactory.hpp"
55#include "MueLu_RAPFactory.hpp"
56#include "MueLu_RAPShiftFactory.hpp"
57#include "MueLu_RebalanceAcFactory.hpp"
58#include "MueLu_RebalanceTransferFactory.hpp"
59#include "MueLu_RepartitionFactory.hpp"
60#include "MueLu_RepartitionHeuristicFactory.hpp"
61#include "MueLu_ReitzingerPFactory.hpp"
62#include "MueLu_SaPFactory.hpp"
63#include "MueLu_ScaledNullspaceFactory.hpp"
64#include "MueLu_SemiCoarsenPFactory.hpp"
65#include "MueLu_SmootherFactory.hpp"
66#include "MueLu_SmooVecCoalesceDropFactory.hpp"
67#include "MueLu_TentativePFactory.hpp"
68#include "MueLu_TogglePFactory.hpp"
69#include "MueLu_ToggleCoordinatesTransferFactory.hpp"
70#include "MueLu_TransPFactory.hpp"
71#include "MueLu_UncoupledAggregationFactory.hpp"
72#include "MueLu_ZoltanInterface.hpp"
73#include "MueLu_Zoltan2Interface.hpp"
74#include "MueLu_NodePartitionInterface.hpp"
75#include "MueLu_LowPrecisionFactory.hpp"
77#include "MueLu_CoalesceDropFactory_kokkos.hpp"
78#include "MueLu_SemiCoarsenPFactory_kokkos.hpp"
79#include "MueLu_TentativePFactory_kokkos.hpp"
81#ifdef HAVE_MUELU_MATLAB
82#include "../matlab/src/MueLu_MatlabSmoother_decl.hpp"
83#include "../matlab/src/MueLu_MatlabSmoother_def.hpp"
84#include "../matlab/src/MueLu_TwoLevelMatlabFactory_decl.hpp"
85#include "../matlab/src/MueLu_TwoLevelMatlabFactory_def.hpp"
86#include "../matlab/src/MueLu_SingleLevelMatlabFactory_decl.hpp"
87#include "../matlab/src/MueLu_SingleLevelMatlabFactory_def.hpp"
90#ifdef HAVE_MUELU_INTREPID2
91#include "MueLu_IntrepidPCoarsenFactory.hpp"
94#include <unordered_set>
98template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
100 : factFact_(factFact) {
101 RCP<Teuchos::TimeMonitor> tM = rcp(
new Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(std::string(
"MueLu: ParameterListInterpreter (ParameterList)"))));
102 if (facadeFact == Teuchos::null)
103 facadeFact_ = Teuchos::rcp(
new FacadeClassFactory());
105 facadeFact_ = facadeFact;
107 if (paramList.isParameter(
"xml parameter file")) {
108 std::string filename = paramList.get(
"xml parameter file",
"");
109 if (filename.length() != 0) {
110 TEUCHOS_TEST_FOR_EXCEPTION(comm.is_null(), Exceptions::RuntimeError,
"xml parameter file requires a valid comm");
112 ParameterList paramList2 = paramList;
113 Teuchos::updateParametersFromXmlFileAndBroadcast(filename, Teuchos::Ptr<Teuchos::ParameterList>(¶mList2), *comm);
114 SetParameterList(paramList2);
117 SetParameterList(paramList);
121 SetParameterList(paramList);
125template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
127 : factFact_(factFact) {
128 RCP<Teuchos::TimeMonitor> tM = rcp(
new Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(std::string(
"MueLu: ParameterListInterpreter (XML)"))));
129 if (facadeFact == Teuchos::null)
134 ParameterList paramList;
135 Teuchos::updateParametersFromXmlFileAndBroadcast(xmlFileName, Teuchos::Ptr<ParameterList>(¶mList), comm);
139template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
142template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
146 scalingFactor_ = Teuchos::ScalarTraits<double>::one();
149 hierarchyLabel_ =
"";
151 if (paramList.isSublist(
"Hierarchy")) {
152 SetFactoryParameterList(paramList);
154 }
else if (paramList.isParameter(
"MueLu preconditioner") ==
true) {
155 this->GetOStream(
Runtime0) <<
"Use facade class: " << paramList.get<std::string>(
"MueLu preconditioner") << std::endl;
156 Teuchos::RCP<ParameterList> pp = facadeFact_->SetParameterList(paramList);
157 SetFactoryParameterList(*pp);
161 ParameterList serialList, nonSerialList;
164 Validate(serialList);
165 SetEasyParameterList(paramList);
173static inline bool areSame(
const ParameterList& list1,
const ParameterList& list2);
178#define MUELU_SET_VAR_2LIST(paramList, defaultList, paramName, paramType, varName) \
180 if (paramList.isParameter(paramName)) \
181 varName = paramList.get<paramType>(paramName); \
182 else if (defaultList.isParameter(paramName)) \
183 varName = defaultList.get<paramType>(paramName); \
185 varName = MasterList::getDefault<paramType>(paramName);
187#define MUELU_TEST_AND_SET_VAR(paramList, paramName, paramType, varName) \
188 (paramList.isParameter(paramName) ? varName = paramList.get<paramType>(paramName), true : false)
192#define MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList, paramName, paramType, listWrite) \
194 if (paramList.isParameter(paramName)) \
195 listWrite.set(paramName, paramList.get<paramType>(paramName)); \
196 else if (defaultList.isParameter(paramName)) \
197 listWrite.set(paramName, defaultList.get<paramType>(paramName)); \
198 } catch (Teuchos::Exceptions::InvalidParameterType&) { \
199 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(true, Teuchos::Exceptions::InvalidParameterType, \
200 "Error: parameter \"" << paramName << "\" must be of type " << Teuchos::TypeNameTraits<paramType>::name()); \
203#define MUELU_TEST_PARAM_2LIST(paramList, defaultList, paramName, paramType, cmpValue) \
204 (cmpValue == (paramList.isParameter(paramName) ? paramList.get<paramType>(paramName) : (defaultList.isParameter(paramName) ? defaultList.get<paramType>(paramName) : MasterList::getDefault<paramType>(paramName))))
206#define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory) \
207 RCP<Factory> varName; \
209 varName = rcp(new oldFactory()); \
211 varName = rcp(new newFactory());
212#define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory) \
214 varName = rcp(new oldFactory()); \
216 varName = rcp(new newFactory());
218template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
221 ParameterList paramList;
223 MUELU_SET_VAR_2LIST(constParamList, constParamList,
"problem: type", std::string, problemType);
224 if (problemType !=
"unknown") {
226 paramList.setParameters(constParamList);
230 paramList = constParamList;
234 useKokkos_ = !Node::is_serial;
243 if (paramList.isParameter(
"cycle type")) {
244 std::map<std::string, CycleType> cycleMap;
248 auto cycleType = paramList.get<std::string>(
"cycle type");
250 "Invalid cycle type: \"" << cycleType <<
"\"");
251 Cycle_ = cycleMap[cycleType];
254 if (paramList.isParameter(
"W cycle start level")) {
255 WCycleStartLevel_ = paramList.get<
int>(
"W cycle start level");
258 if (paramList.isParameter(
"hierarchy label")) {
259 this->hierarchyLabel_ = paramList.get<std::string>(
"hierarchy label");
262 if (paramList.isParameter(
"coarse grid correction scaling factor"))
263 scalingFactor_ = paramList.get<
double>(
"coarse grid correction scaling factor");
265 this->maxCoarseSize_ = paramList.get<
int>(
"coarse: max size", MasterList::getDefault<int>(
"coarse: max size"));
266 this->numDesiredLevel_ = paramList.get<
int>(
"max levels", MasterList::getDefault<int>(
"max levels"));
267 blockSize_ = paramList.get<
int>(
"number of equations", MasterList::getDefault<int>(
"number of equations"));
272 if (paramList.isParameter(
"keep data"))
273 this->dataToKeep_ = Teuchos::getArrayFromStringParameter<std::string>(paramList,
"keep data");
276 if (paramList.isSublist(
"export data")) {
277 ParameterList printList = paramList.sublist(
"export data");
280 if (printList.isParameter(
"Nullspace"))
281 this->nullspaceToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Nullspace");
282 if (printList.isParameter(
"Coordinates"))
283 this->coordinatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Coordinates");
284 if (printList.isParameter(
"Material"))
285 this->materialToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Material");
286 if (printList.isParameter(
"Aggregates"))
287 this->aggregatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Aggregates");
288 if (printList.isParameter(
"pcoarsen: element to node map"))
289 this->elementToNodeMapsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"pcoarsen: element to node map");
292 for (
auto iter = printList.begin(); iter != printList.end(); iter++) {
293 const std::string& name = printList.name(iter);
295 if (name ==
"Nullspace" || name ==
"Coordinates" || name ==
"Material" || name ==
"Aggregates" || name ==
"pcoarsen: element to node map")
298 this->matricesToPrint_[name] = Teuchos::getArrayFromStringParameter<int>(printList, name);
311 if (outputFilename !=
"")
321 useCoordinates_ =
false;
322 useBlockNumber_ =
false;
323 if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: strength-of-connection: matrix", std::string,
"distance laplacian"))
324 useCoordinates_ =
true;
326 useBlockNumber_ =
true;
327 if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"distance laplacian") ||
330 useCoordinates_ =
true;
331 }
else if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal distance laplacian")) {
332 useCoordinates_ =
true;
333 useBlockNumber_ =
true;
334 }
else if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal") ||
335 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal classical") ||
336 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal signed classical") ||
337 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal colored signed classical") ||
338 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"signed classical")) {
339 useBlockNumber_ =
true;
340 }
else if (paramList.isSublist(
"smoother: params")) {
341 const auto smooParamList = paramList.sublist(
"smoother: params");
342 if (smooParamList.isParameter(
"partitioner: type") &&
343 (smooParamList.get<std::string>(
"partitioner: type") ==
"line")) {
344 useCoordinates_ =
true;
347 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
348 std::string levelStr =
"level " +
toString(levelID);
350 if (paramList.isSublist(levelStr)) {
351 const ParameterList& levelList = paramList.sublist(levelStr);
353 if (
MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"distance laplacian") ||
356 useCoordinates_ =
true;
357 }
else if (
MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal distance laplacian")) {
358 useCoordinates_ =
true;
359 useBlockNumber_ =
true;
360 }
else if (
MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal") ||
361 MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal classical") ||
362 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal signed classical") ||
363 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal colored signed classical") ||
364 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"signed classical")) {
365 useBlockNumber_ =
true;
371 useMaterial_ =
false;
372 if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: distance laplacian metric", std::string,
"material")) {
381 }
else if (!paramList.isSublist(
"repartition: params")) {
382 useCoordinates_ =
true;
384 const ParameterList& repParams = paramList.sublist(
"repartition: params");
385 if (repParams.isType<std::string>(
"algorithm")) {
386 const std::string algo = repParams.get<std::string>(
"algorithm");
387 if (algo ==
"multijagged" || algo ==
"rcb") {
388 useCoordinates_ =
true;
391 useCoordinates_ =
true;
395 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
396 std::string levelStr =
"level " +
toString(levelID);
398 if (paramList.isSublist(levelStr)) {
399 const ParameterList& levelList = paramList.sublist(levelStr);
402 if (!levelList.isSublist(
"repartition: params")) {
403 useCoordinates_ =
true;
406 const ParameterList& repParams = levelList.sublist(
"repartition: params");
407 if (repParams.isType<std::string>(
"algorithm")) {
408 const std::string algo = repParams.get<std::string>(
"algorithm");
409 if (algo ==
"multijagged" || algo ==
"rcb") {
410 useCoordinates_ =
true;
414 useCoordinates_ =
true;
423 changedPRrebalance_ =
false;
424 changedPRViaCopyrebalance_ =
false;
426 changedPRrebalance_ =
MUELU_TEST_AND_SET_VAR(paramList,
"repartition: rebalance P and R",
bool, this->doPRrebalance_);
427 changedPRViaCopyrebalance_ =
MUELU_TEST_AND_SET_VAR(paramList,
"repartition: explicit via new copy rebalance P and R",
bool, this->doPRViaCopyrebalance_);
431 changedImplicitTranspose_ =
MUELU_TEST_AND_SET_VAR(paramList,
"transpose: use implicit",
bool, this->implicitTranspose_);
434 (void)
MUELU_TEST_AND_SET_VAR(paramList,
"fuse prolongation and update",
bool, this->fuseProlongationAndUpdate_);
437 (void)
MUELU_TEST_AND_SET_VAR(paramList,
"nullspace: suppress dimension check",
bool, this->suppressNullspaceDimensionCheck_);
439 if (paramList.isSublist(
"matvec params"))
440 this->matvecParams_ = Teuchos::parameterList(paramList.sublist(
"matvec params"));
445 defaultManager->SetVerbLevel(this->verbosity_);
446 defaultManager->SetKokkosRefactor(useKokkos_);
449 std::vector<keep_pair> keeps0;
450 UpdateFactoryManager(paramList, ParameterList(), *defaultManager, 0 , keeps0);
456 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
462 RCP<FactoryManager> levelManager = rcp(
new FactoryManager(*defaultManager));
463 levelManager->SetVerbLevel(defaultManager->GetVerbLevel());
465 std::vector<keep_pair> keeps;
466 if (paramList.isSublist(
"level " +
toString(levelID))) {
468 ParameterList& levelList = paramList.sublist(
"level " +
toString(levelID),
true );
469 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
472 ParameterList levelList;
473 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
476 this->keep_[levelID] = keeps;
477 this->AddFactoryManager(levelID, 1, levelManager);
487 this->GetOStream(
static_cast<MsgType>(
Runtime1), 0) << paramList << std::endl;
491 ParameterList unusedParamList;
494 for (ParameterList::ConstIterator it = paramList.begin(); it != paramList.end(); it++) {
495 const ParameterEntry& entry = paramList.entry(it);
497 if (!entry.isList() && !entry.isUsed())
498 unusedParamList.setEntry(paramList.name(it), entry);
502 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
503 std::string levelStr =
"level " +
toString(levelID);
505 if (paramList.isSublist(levelStr)) {
506 const ParameterList& levelList = paramList.sublist(levelStr);
508 for (ParameterList::ConstIterator itr = levelList.begin(); itr != levelList.end(); ++itr) {
509 const ParameterEntry& entry = levelList.entry(itr);
511 if (!entry.isList() && !entry.isUsed())
512 unusedParamList.sublist(levelStr).setEntry(levelList.name(itr), entry);
517 if (unusedParamList.numParams() > 0) {
518 std::ostringstream unusedParamsStream;
520 unusedParamList.print(unusedParamsStream, indent);
522 this->GetOStream(
Warnings1) <<
"The following parameters were not used:\n"
523 << unusedParamsStream.str() << std::endl;
533template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
536 int levelID, std::vector<keep_pair>& keeps)
const {
540 using strings = std::unordered_set<std::string>;
543 if (paramList.numParams() == 0 && defaultList.numParams() > 0)
544 paramList = ParameterList(defaultList);
547 TEUCHOS_TEST_FOR_EXCEPTION(strings({
"none",
"tP",
"RP",
"emin",
"RAP",
"full",
"S"}).count(reuseType) == 0,
550 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
551 TEUCHOS_TEST_FOR_EXCEPTION(strings({
"unsmoothed",
"sa",
"pg",
"emin",
"matlab",
"pcoarsen",
"classical",
"smoothed reitzinger",
"unsmoothed reitzinger",
"replicate",
"combine"}).count(multigridAlgo) == 0,
552 Exceptions::RuntimeError,
"Unknown \"multigrid algorithm\" value: \"" << multigridAlgo <<
"\". Please consult User's Guide.");
553#ifndef HAVE_MUELU_MATLAB
555 "Cannot use matlab for multigrid algorithm - MueLu was not configured with MATLAB support.");
557#ifndef HAVE_MUELU_INTREPID2
559 "Cannot use IntrepidPCoarsen prolongator factory - MueLu was not configured with Intrepid support.");
564 if (reuseType ==
"none" || reuseType ==
"S" || reuseType ==
"RP" || reuseType ==
"RAP") {
567 }
else if (reuseType ==
"tP" && (multigridAlgo !=
"sa" && multigridAlgo !=
"unsmoothed")) {
569 this->GetOStream(
Warnings0) <<
"Ignoring \"tP\" reuse option as it is only compatible with \"sa\", "
570 "or \"unsmoothed\" multigrid algorithms"
573 }
else if (reuseType ==
"emin" && multigridAlgo !=
"emin") {
575 this->GetOStream(
Warnings0) <<
"Ignoring \"emin\" reuse option it is only compatible with "
576 "\"emin\" multigrid algorithm"
582 bool have_userP =
false;
583 if (paramList.isParameter(
"P") && !paramList.get<RCP<Matrix> >(
"P").is_null())
587 UpdateFactoryManager_CoarseSolvers(paramList, defaultList, manager, levelID, keeps);
590 UpdateFactoryManager_Smoothers(paramList, defaultList, manager, levelID, keeps);
594 UpdateFactoryManager_BlockNumber(paramList, defaultList, manager, levelID, keeps);
597 if (multigridAlgo ==
"unsmoothed reitzinger" || multigridAlgo ==
"smoothed reitzinger")
598 UpdateFactoryManager_Reitzinger(paramList, defaultList, manager, levelID, keeps);
600 UpdateFactoryManager_Aggregation_TentativeP(paramList, defaultList, manager, levelID, keeps);
603 RCP<Factory> nullSpaceFactory;
604 UpdateFactoryManager_Nullspace(paramList, defaultList, manager, levelID, keeps, nullSpaceFactory);
615 }
else if (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"unsmoothed reitzinger") {
619 }
else if (multigridAlgo ==
"classical") {
623 }
else if (multigridAlgo ==
"sa" || multigridAlgo ==
"smoothed reitzinger") {
625 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
627 }
else if (multigridAlgo ==
"emin") {
629 UpdateFactoryManager_Emin(paramList, defaultList, manager, levelID, keeps);
631 }
else if (multigridAlgo ==
"replicate") {
632 UpdateFactoryManager_Replicate(paramList, defaultList, manager, levelID, keeps);
634 }
else if (multigridAlgo ==
"combine") {
635 UpdateFactoryManager_Combine(paramList, defaultList, manager, levelID, keeps);
637 }
else if (multigridAlgo ==
"pg") {
639 UpdateFactoryManager_PG(paramList, defaultList, manager, levelID, keeps);
641 }
else if (multigridAlgo ==
"matlab") {
643 UpdateFactoryManager_Matlab(paramList, defaultList, manager, levelID, keeps);
645 }
else if (multigridAlgo ==
"pcoarsen") {
647 UpdateFactoryManager_PCoarsen(paramList, defaultList, manager, levelID, keeps);
651 UpdateFactoryManager_SemiCoarsen(paramList, defaultList, manager, levelID, keeps);
654 UpdateFactoryManager_Restriction(paramList, defaultList, manager, levelID, keeps);
657 UpdateFactoryManager_RAP(paramList, defaultList, manager, levelID, keeps);
660 UpdateFactoryManager_LocalOrdinalTransfer(
"BlockNumber", multigridAlgo, paramList, defaultList, manager, levelID, keeps);
663 UpdateFactoryManager_Coordinates(paramList, defaultList, manager, levelID, keeps);
666 UpdateFactoryManager_Material(paramList, defaultList, manager, levelID, keeps);
669 if ((reuseType ==
"RP" || reuseType ==
"RAP" || reuseType ==
"full") && levelID)
672 if (reuseType ==
"RP" && levelID) {
674 if (!this->implicitTranspose_)
677 if ((reuseType ==
"tP" || reuseType ==
"RP" || reuseType ==
"emin") && useCoordinates_ && levelID)
681 UpdateFactoryManager_Repartition(paramList, defaultList, manager, levelID, keeps, nullSpaceFactory);
684 UpdateFactoryManager_LowPrecision(paramList, defaultList, manager, levelID, keeps);
687 if ((reuseType ==
"RAP" || reuseType ==
"full") && levelID) {
689 if (!this->implicitTranspose_)
702template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
705 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
706 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
708 bool useMaxAbsDiagonalScaling =
false;
709 if (defaultList.isParameter(
"sa: use rowsumabs diagonal scaling"))
710 useMaxAbsDiagonalScaling = defaultList.get<
bool>(
"sa: use rowsumabs diagonal scaling");
714 bool isCustomSmoother =
715 paramList.isParameter(
"smoother: pre or post") ||
716 paramList.isParameter(
"smoother: type") || paramList.isParameter(
"smoother: pre type") || paramList.isParameter(
"smoother: post type") ||
717 paramList.isSublist(
"smoother: params") || paramList.isSublist(
"smoother: pre params") || paramList.isSublist(
"smoother: post params") ||
718 paramList.isParameter(
"smoother: sweeps") || paramList.isParameter(
"smoother: pre sweeps") || paramList.isParameter(
"smoother: post sweeps") ||
719 paramList.isParameter(
"smoother: overlap") || paramList.isParameter(
"smoother: pre overlap") || paramList.isParameter(
"smoother: post overlap");
723 manager.
SetFactory(
"Smoother", Teuchos::null);
725 }
else if (isCustomSmoother) {
729#define TEST_MUTUALLY_EXCLUSIVE(arg1, arg2) \
730 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isParameter(#arg1) && paramList.isParameter(#arg2), \
731 Exceptions::InvalidArgument, "You cannot specify both \"" #arg1 "\" and \"" #arg2 "\"");
732#define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2) \
733 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isSublist(#arg1) && paramList.isSublist(#arg2), \
734 Exceptions::InvalidArgument, "You cannot specify both \"" #arg1 "\" and \"" #arg2 "\"");
744 TEUCHOS_TEST_FOR_EXCEPTION(
PreOrPost ==
"both" && (paramList.isParameter(
"smoother: pre type") != paramList.isParameter(
"smoother: post type")),
749 ParameterList defaultSmootherParams;
750 defaultSmootherParams.set(
"relaxation: type",
"Symmetric Gauss-Seidel");
751 defaultSmootherParams.set(
"relaxation: sweeps", Teuchos::OrdinalTraits<LO>::one());
752 defaultSmootherParams.set(
"relaxation: damping factor", Teuchos::ScalarTraits<Scalar>::one());
754 RCP<SmootherFactory> preSmoother = Teuchos::null, postSmoother = Teuchos::null;
755 std::string preSmootherType, postSmootherType;
756 ParameterList preSmootherParams, postSmootherParams;
758 if (paramList.isParameter(
"smoother: overlap"))
759 overlap = paramList.get<
int>(
"smoother: overlap");
762 if (paramList.isParameter(
"smoother: pre type")) {
763 preSmootherType = paramList.get<std::string>(
"smoother: pre type");
765 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, preSmootherTypeTmp);
766 preSmootherType = preSmootherTypeTmp;
768 if (paramList.isParameter(
"smoother: pre overlap"))
769 overlap = paramList.get<
int>(
"smoother: pre overlap");
771 if (paramList.isSublist(
"smoother: pre params"))
772 preSmootherParams = paramList.sublist(
"smoother: pre params");
773 else if (paramList.isSublist(
"smoother: params"))
774 preSmootherParams = paramList.sublist(
"smoother: params");
775 else if (defaultList.isSublist(
"smoother: params"))
776 preSmootherParams = defaultList.sublist(
"smoother: params");
777 else if (preSmootherType ==
"RELAXATION")
778 preSmootherParams = defaultSmootherParams;
780 if (preSmootherType ==
"CHEBYSHEV" && useMaxAbsDiagonalScaling)
781 preSmootherParams.set(
"chebyshev: use rowsumabs diagonal scaling",
true);
783#ifdef HAVE_MUELU_INTREPID2
785 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
786 defaultList.isParameter(
"pcoarsen: schedule") && defaultList.isParameter(
"pcoarsen: element")) {
789 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
790 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
792 if (levelID < (
int)pcoarsen_schedule.size()) {
794 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
795 preSmootherParams.set(
"pcoarsen: hi basis", lo);
800#ifdef HAVE_MUELU_MATLAB
801 if (preSmootherType ==
"matlab")
809 if (paramList.isParameter(
"smoother: post type"))
810 postSmootherType = paramList.get<std::string>(
"smoother: post type");
812 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, postSmootherTypeTmp);
813 postSmootherType = postSmootherTypeTmp;
816 if (paramList.isSublist(
"smoother: post params"))
817 postSmootherParams = paramList.sublist(
"smoother: post params");
818 else if (paramList.isSublist(
"smoother: params"))
819 postSmootherParams = paramList.sublist(
"smoother: params");
820 else if (defaultList.isSublist(
"smoother: params"))
821 postSmootherParams = defaultList.sublist(
"smoother: params");
822 else if (postSmootherType ==
"RELAXATION")
823 postSmootherParams = defaultSmootherParams;
824 if (paramList.isParameter(
"smoother: post overlap"))
825 overlap = paramList.get<
int>(
"smoother: post overlap");
827 if (postSmootherType ==
"CHEBYSHEV" && useMaxAbsDiagonalScaling)
828 postSmootherParams.set(
"chebyshev: use rowsumabs diagonal scaling",
true);
830 if (postSmootherType == preSmootherType &&
areSame(preSmootherParams, postSmootherParams))
831 postSmoother = preSmoother;
833#ifdef HAVE_MUELU_INTREPID2
835 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
836 defaultList.isParameter(
"pcoarsen: schedule") && defaultList.isParameter(
"pcoarsen: element")) {
839 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
840 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
842 if (levelID < (
int)pcoarsen_schedule.size()) {
844 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
845 postSmootherParams.set(
"pcoarsen: hi basis", lo);
850#ifdef HAVE_MUELU_MATLAB
851 if (postSmootherType ==
"matlab")
859 if (preSmoother == postSmoother)
862 manager.
SetFactory(
"PreSmoother", preSmoother);
863 manager.
SetFactory(
"PostSmoother", postSmoother);
870 bool reuseSmoothers = (reuseType ==
"S" || reuseType !=
"none");
871 if (reuseSmoothers) {
872 auto preSmootherFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<const Factory>(manager.
GetFactory(
"PreSmoother")));
874 if (preSmootherFactory != Teuchos::null) {
875 ParameterList postSmootherFactoryParams;
876 postSmootherFactoryParams.set(
"keep smoother data",
true);
877 preSmootherFactory->SetParameterList(postSmootherFactoryParams);
879 keeps.push_back(
keep_pair(
"PreSmoother data", preSmootherFactory.get()));
882 auto postSmootherFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<const Factory>(manager.
GetFactory(
"PostSmoother")));
883 if (postSmootherFactory != Teuchos::null) {
884 ParameterList postSmootherFactoryParams;
885 postSmootherFactoryParams.set(
"keep smoother data",
true);
886 postSmootherFactory->SetParameterList(postSmootherFactoryParams);
888 keeps.push_back(
keep_pair(
"PostSmoother data", postSmootherFactory.get()));
891 auto coarseFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<const Factory>(manager.
GetFactory(
"CoarseSolver")));
892 if (coarseFactory != Teuchos::null) {
893 ParameterList coarseFactoryParams;
894 coarseFactoryParams.set(
"keep smoother data",
true);
895 coarseFactory->SetParameterList(coarseFactoryParams);
897 keeps.push_back(
keep_pair(
"PreSmoother data", coarseFactory.get()));
901 if ((reuseType ==
"RAP" && levelID) || (reuseType ==
"full")) {
920template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
925 bool isCustomCoarseSolver =
926 paramList.isParameter(
"coarse: type") ||
927 paramList.isParameter(
"coarse: params");
929 manager.
SetFactory(
"CoarseSolver", Teuchos::null);
931 }
else if (isCustomCoarseSolver) {
938 if (paramList.isParameter(
"coarse: overlap"))
939 overlap = paramList.get<
int>(
"coarse: overlap");
941 ParameterList coarseParams;
942 if (paramList.isSublist(
"coarse: params"))
943 coarseParams = paramList.sublist(
"coarse: params");
944 else if (defaultList.isSublist(
"coarse: params"))
945 coarseParams = defaultList.sublist(
"coarse: params");
947 using strings = std::unordered_set<std::string>;
949 RCP<SmootherPrototype> coarseSmoother;
953 if (strings({
"RELAXATION",
"CHEBYSHEV",
"ILUT",
"ILU",
"RILUK",
"SCHWARZ",
"Amesos",
954 "BLOCK RELAXATION",
"BLOCK_RELAXATION",
"BLOCKRELAXATION",
955 "SPARSE BLOCK RELAXATION",
"SPARSE_BLOCK_RELAXATION",
"SPARSEBLOCKRELAXATION",
956 "LINESMOOTHING_BANDEDRELAXATION",
"LINESMOOTHING_BANDED_RELAXATION",
"LINESMOOTHING_BANDED RELAXATION",
957 "LINESMOOTHING_TRIDIRELAXATION",
"LINESMOOTHING_TRIDI_RELAXATION",
"LINESMOOTHING_TRIDI RELAXATION",
958 "LINESMOOTHING_TRIDIAGONALRELAXATION",
"LINESMOOTHING_TRIDIAGONAL_RELAXATION",
"LINESMOOTHING_TRIDIAGONAL RELAXATION",
959 "TOPOLOGICAL",
"FAST_ILU",
"FAST_IC",
"FAST_ILDL",
"HIPTMAIR"})
960 .count(coarseType)) {
961 coarseSmoother = rcp(
new TrilinosSmoother(coarseType, coarseParams, overlap));
963#ifdef HAVE_MUELU_MATLAB
964 if (coarseType ==
"matlab")
968 coarseSmoother = rcp(
new DirectSolver(coarseType, coarseParams));
978template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
981 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
982 ParameterList rParams;
989 rFactory->SetParameterList(rParams);
997 rFactory->SetFactory(
"D0", this->GetFactoryManager(levelID - 1)->GetFactory(
"D0"));
1009template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1012 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1013 using strings = std::unordered_set<std::string>;
1018 TEUCHOS_TEST_FOR_EXCEPTION(!strings({
"uncoupled",
"coupled",
"brick",
"matlab",
"notay",
"classical"}).count(aggType),
1022 RCP<AmalgamationFactory> amalgFact;
1023 if (aggType ==
"classical") {
1025 manager.
SetFactory(
"UnAmalgamationInfo", amalgFact);
1029 RCP<Factory> dropFactory;
1032#ifdef HAVE_MUELU_MATLAB
1034 ParameterList socParams = paramList.sublist(
"strength-of-connection: params");
1035 dropFactory->SetParameterList(socParams);
1037 throw std::runtime_error(
"Cannot use MATLAB evolutionary strength-of-connection - MueLu was not configured with MATLAB support.");
1039 }
else if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"unsupported vector smoothing")) {
1041 ParameterList dropParams;
1047 dropFactory->SetParameterList(dropParams);
1050 ParameterList dropParams;
1051 if (!rcp_dynamic_cast<CoalesceDropFactory>(dropFactory).is_null())
1052 dropParams.set(
"lightweight wrap",
true);
1062#ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1066 MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList,
"aggregation: distance laplacian directional weights", Teuchos::Array<double>, dropParams);
1086#ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1087 if (!dropParams.isParameter(
"aggregation: drop scheme") ||
1088 (dropParams.isParameter(
"aggregation: drop scheme") &&
1089 ((dropParams.get<std::string>(
"aggregation: drop scheme") !=
"point-wise") && (dropParams.get<std::string>(
"aggregation: drop scheme") !=
"cut-drop")))) {
1090 Teuchos::ParameterList dropParamsWithDefaults(dropParams);
1092#define MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(paramList, paramName, paramType) \
1093 if (!paramList.isParameter(paramName)) { \
1094 paramList.set(paramName, MasterList::getDefault<paramType>(paramName)); \
1097 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: drop scheme", std::string);
1098 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: strength-of-connection: matrix", std::string);
1099 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: strength-of-connection: measure", std::string);
1100 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: use blocking",
bool);
1102#undef MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST
1105 TEUCHOS_TEST_FOR_EXCEPTION(dropParams.isParameter(
"aggregation: strength-of-connection: matrix") ||
1106 dropParams.isParameter(
"aggregation: strength-of-connection: measure") ||
1107 dropParams.isParameter(
"aggregation: use blocking"),
1108 Teuchos::Exceptions::InvalidParameterType,
1109 "The inputs contain a mix of old and new dropping parameters:\n\n"
1110 << dropParams <<
"\n\nKeep in mind that defaults are set for old parameters, so this gets interpreted as\n\n"
1111 << dropParamsWithDefaults);
1115 if (!amalgFact.is_null())
1116 dropFactory->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
1118 if (dropParams.isParameter(
"aggregation: drop scheme")) {
1119 std::string drop_scheme = dropParams.get<std::string>(
"aggregation: drop scheme");
1120 if (drop_scheme ==
"block diagonal colored signed classical")
1121 manager.
SetFactory(
"Coloring Graph", dropFactory);
1123 (drop_scheme.find(
"block diagonal") != std::string::npos || drop_scheme ==
"signed classical")) {
1125 dropFactory->SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1127 dropFactory->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1131 dropFactory->SetParameterList(dropParams);
1136#ifndef HAVE_MUELU_MATLAB
1137 if (aggType ==
"matlab")
1138 throw std::runtime_error(
"Cannot use MATLAB aggregation - MueLu was not configured with MATLAB support.");
1140 RCP<Factory> aggFactory;
1141 if (aggType ==
"uncoupled") {
1143 ParameterList aggParams;
1164 aggFactory->SetParameterList(aggParams);
1166 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
1167 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1170 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: coloring algorithm", std::string,
"mis2 aggregation") ||
1171 MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: coloring algorithm", std::string,
"mis2 coarsening")) {
1172 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: symmetrize graph after dropping",
bool,
false))
1173 TEUCHOS_TEST_FOR_EXCEPTION(
true,
1175 "MIS2 algorithms require the use of a symmetrized graph. Please set \"aggregation: symmetrize graph after dropping\" to \"true\".");
1177 }
else if (aggType ==
"brick") {
1179 ParameterList aggParams;
1186 aggFactory->SetParameterList(aggParams);
1190 manager.
SetFactory(
"DofsPerNode", aggFactory);
1196 aggFactory->SetFactory(
"Coordinates", this->GetFactoryManager(levelID - 1)->GetFactory(
"Coordinates"));
1198 }
else if (aggType ==
"classical") {
1201 ParameterList mapParams;
1205 ParameterList tempParams;
1207 std::string drop_algo = tempParams.get<std::string>(
"aggregation: drop scheme");
1208 if (drop_algo ==
"block diagonal colored signed classical") {
1209 mapParams.set(
"aggregation: coloring: use color graph",
true);
1210 mapFact->SetFactory(
"Coloring Graph", manager.
GetFactory(
"Coloring Graph"));
1212 mapFact->SetParameterList(mapParams);
1213 mapFact->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1214 mapFact->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
1220 ParameterList aggParams;
1223 aggFactory->SetParameterList(aggParams);
1224 aggFactory->SetFactory(
"FC Splitting", manager.
GetFactory(
"FC Splitting"));
1225 aggFactory->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1226 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
1227 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1229 if (drop_algo.find(
"block diagonal") != std::string::npos || drop_algo ==
"signed classical") {
1231 aggFactory->SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1233 aggFactory->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1240 if (reuseType ==
"tP" && levelID) {
1242 keeps.push_back(
keep_pair(
"Ptent", aggFactory.get()));
1245 }
else if (aggType ==
"notay") {
1247 ParameterList aggParams;
1252 aggFactory->SetParameterList(aggParams);
1253 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
1254 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1256#ifdef HAVE_MUELU_MATLAB
1257 else if (aggType ==
"matlab") {
1258 ParameterList aggParams = paramList.sublist(
"aggregation: params");
1260 aggFactory->SetParameterList(aggParams);
1264 manager.
SetFactory(
"Aggregates", aggFactory);
1268 coarseMap->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1273 ParameterList ptentParams;
1274 if (paramList.isSublist(
"matrixmatrix: kernel params"))
1275 ptentParams.sublist(
"matrixmatrix: kernel params",
false) = paramList.sublist(
"matrixmatrix: kernel params");
1276 if (defaultList.isSublist(
"matrixmatrix: kernel params"))
1277 ptentParams.sublist(
"matrixmatrix: kernel params",
false) = defaultList.sublist(
"matrixmatrix: kernel params");
1280 Ptent->SetParameterList(ptentParams);
1281 Ptent->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1282 Ptent->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1285 if (reuseType ==
"tP" && levelID) {
1286 keeps.push_back(
keep_pair(
"Nullspace", Ptent.get()));
1287 keeps.push_back(
keep_pair(
"P", Ptent.get()));
1294template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1297 int levelID, std::vector<keep_pair>& keeps)
const {
1298 if (paramList.isParameter(
"A") && !paramList.get<RCP<Matrix> >(
"A").is_null()) {
1304 ParameterList RAPparams;
1306 RCP<RAPFactory> RAP;
1307 RCP<RAPShiftFactory> RAPs;
1310 std::string alg = paramList.get(
"rap: algorithm",
"galerkin");
1311 if (alg ==
"shift" || alg ==
"non-galerkin") {
1325 if (paramList.isSublist(
"matrixmatrix: kernel params"))
1326 RAPparams.sublist(
"matrixmatrix: kernel params",
false) = paramList.sublist(
"matrixmatrix: kernel params");
1327 if (defaultList.isSublist(
"matrixmatrix: kernel params"))
1328 RAPparams.sublist(
"matrixmatrix: kernel params",
false) = defaultList.sublist(
"matrixmatrix: kernel params");
1335 if (!paramList.isParameter(
"rap: triple product") &&
1336 paramList.isType<std::string>(
"multigrid algorithm") &&
1337 paramList.get<std::string>(
"multigrid algorithm") ==
"unsmoothed")
1338 paramList.set(
"rap: triple product",
true);
1343 if (paramList.isParameter(
"aggregation: allow empty prolongator columns")) {
1344 RAPparams.set(
"CheckMainDiagonal", paramList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1345 RAPparams.set(
"RepairMainDiagonal", paramList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1346 }
else if (defaultList.isParameter(
"aggregation: allow empty prolongator columns")) {
1347 RAPparams.set(
"CheckMainDiagonal", defaultList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1348 RAPparams.set(
"RepairMainDiagonal", defaultList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1351 }
catch (Teuchos::Exceptions::InvalidParameterType&) {
1352 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(
true, Teuchos::Exceptions::InvalidParameterType,
1353 "Error: parameter \"aggregation: allow empty prolongator columns\" must be of type " << Teuchos::TypeNameTraits<bool>::name());
1356 if (!RAP.is_null()) {
1357 RAP->SetParameterList(RAPparams);
1358 RAP->SetFactory(
"P", manager.
GetFactory(
"P"));
1360 RAPs->SetParameterList(RAPparams);
1361 RAPs->SetFactory(
"P", manager.
GetFactory(
"P"));
1364 if (!this->implicitTranspose_) {
1366 RAP->SetFactory(
"R", manager.
GetFactory(
"R"));
1368 RAPs->SetFactory(
"R", manager.
GetFactory(
"R"));
1376 RAP->AddTransferFactory(matrixAnalysisFact);
1378 RAPs->AddTransferFactory(matrixAnalysisFact);
1382 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: compute aggregate qualities",
bool,
true)) {
1384 ParameterList aggQualityParams;
1393 aggQualityFact->SetParameterList(aggQualityParams);
1394 aggQualityFact->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1395 aggQualityFact->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1396 manager.
SetFactory(
"AggregateQualities", aggQualityFact);
1399 RAP->AddTransferFactory(aggQualityFact);
1401 RAPs->AddTransferFactory(aggQualityFact);
1404 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: export visualization data",
bool,
true)) {
1406 ParameterList aggExportParams;
1416 aggExport->SetParameterList(aggExportParams);
1417 aggExport->SetFactory(
"AggregateQualities", manager.
GetFactory(
"AggregateQualities"));
1418 aggExport->SetFactory(
"DofsPerNode", manager.
GetFactory(
"DofsPerNode"));
1419 aggExport->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1420 aggExport->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1423 RAP->AddTransferFactory(aggExport);
1425 RAPs->AddTransferFactory(aggExport);
1433 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
1434 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
1436 if (reuseType ==
"RP" || (reuseType ==
"tP" && !filteringChangesMatrix)) {
1437 if (!RAP.is_null()) {
1438 keeps.push_back(
keep_pair(
"AP reuse data", RAP.get()));
1439 keeps.push_back(
keep_pair(
"RAP reuse data", RAP.get()));
1442 keeps.push_back(
keep_pair(
"AP reuse data", RAPs.get()));
1443 keeps.push_back(
keep_pair(
"RAP reuse data", RAPs.get()));
1451template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1455 bool have_userCO =
false;
1456 if (paramList.isParameter(
"Coordinates") && !paramList.get<RCP<MultiVector> >(
"Coordinates").is_null())
1459 if (useCoordinates_) {
1465 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1466 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1469 auto RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(manager.
GetFactory(
"A")));
1470 if (!RAP.is_null()) {
1471 RAP->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1473 auto RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(manager.
GetFactory(
"A")));
1474 RAPs->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1483template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1487 bool have_userMaterial =
false;
1488 if (paramList.isParameter(
"Material") && !paramList.get<RCP<MultiVector> >(
"Material").is_null())
1489 have_userMaterial =
true;
1492 if (have_userMaterial) {
1496 ParameterList materialTransferParameters;
1497 materialTransferParameters.set(
"Vector name",
"Material");
1498 materialTransferParameters.set(
"Transfer name",
"Aggregates");
1499 materialTransferParameters.set(
"Normalize",
true);
1500 materialTransfer->SetParameterList(materialTransferParameters);
1501 materialTransfer->SetFactory(
"Transfer factory", manager.
GetFactory(
"Aggregates"));
1502 materialTransfer->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1503 manager.
SetFactory(
"Material", materialTransfer);
1505 auto RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(manager.
GetFactory(
"A")));
1506 if (!RAP.is_null()) {
1507 RAP->AddTransferFactory(manager.
GetFactory(
"Material"));
1509 auto RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(manager.
GetFactory(
"A")));
1510 RAPs->AddTransferFactory(manager.
GetFactory(
"Material"));
1519template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1522 FactoryManager& manager,
int levelID, std::vector<keep_pair>& )
const {
1525 if (useBlockNumber_ && (levelID > 0)) {
1526 auto RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(manager.
GetFactory(
"A")));
1527 auto RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(manager.
GetFactory(
"A")));
1528 if (!RAP.is_null() || !RAPs.is_null()) {
1530 if (multigridAlgo ==
"classical")
1531 fact->SetFactory(
"P Graph", manager.
GetFactory(
"P Graph"));
1533 fact->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1534 fact->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1536 fact->SetFactory(VarName, this->GetFactoryManager(levelID - 1)->GetFactory(VarName));
1541 RAP->AddTransferFactory(manager.
GetFactory(VarName));
1543 RAPs->AddTransferFactory(manager.
GetFactory(VarName));
1551template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1554 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1555 if (useBlockNumber_) {
1556 ParameterList myParams;
1559 fact->SetParameterList(myParams);
1567template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1570 int levelID, std::vector<keep_pair>& )
const {
1571 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
1572 bool have_userR =
false;
1573 if (paramList.isParameter(
"R") && !paramList.get<RCP<Matrix> >(
"R").is_null())
1578 if (!this->implicitTranspose_) {
1581 if (isSymmetric ==
false && (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"emin")) {
1582 this->GetOStream(
Warnings0) <<
"Switching \"problem: symmetric\" parameter to symmetric as multigrid algorithm. " << multigridAlgo <<
" is primarily supposed to be used for symmetric problems.\n\n"
1583 <<
"Please note: if you are using \"unsmoothed\" transfer operators the \"problem: symmetric\" parameter "
1584 <<
"has no real mathematical meaning, i.e. you can use it for non-symmetric\n"
1585 <<
"problems, too. With \"problem: symmetric\"=\"symmetric\" you can use implicit transpose for building "
1586 <<
"the restriction operators which may drastically reduce the amount of consumed memory." << std::endl;
1590 "Petrov-Galerkin smoothed transfer operators are only allowed for non-symmetric problems: Set \"problem: symmetric\" to false!\n"
1591 "While PG smoothed transfer operators generally would also work for symmetric problems this is an unusual use case. "
1592 "You can use the factory-based xml interface though if you need PG-AMG for symmetric problems.");
1611 if (paramList.isParameter(
"restriction: scale nullspace") && paramList.get<
bool>(
"restriction: scale nullspace")) {
1613 Teuchos::ParameterList tentPlist;
1614 tentPlist.set(
"Nullspace name",
"Scaled Nullspace");
1615 tentPFactory->SetParameterList(tentPlist);
1616 tentPFactory->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1617 tentPFactory->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1620 R->SetFactory(
"P", tentPFactory);
1627template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1630 int levelID, std::vector<keep_pair>& keeps, RCP<Factory>& nullSpaceFactory)
const {
1635#if defined(HAVE_MPI) && (defined(HAVE_MUELU_ZOLTAN) || defined(HAVE_MUELU_ZOLTAN2))
1636 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: use subcommunicators in place",
bool, enableInPlace);
1673 "Reuse types \"tP\" and \"PR\" require \"repartition: rebalance P and R\" set to \"false\"");
1678 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: partitioner", std::string, partName);
1680 "Invalid partitioner name: \"" << partName <<
"\". Valid options: \"zoltan\", \"zoltan2\"");
1682#ifndef HAVE_MUELU_ZOLTAN
1683 bool switched =
false;
1684 if (partName ==
"zoltan") {
1685 this->GetOStream(
Warnings0) <<
"Zoltan interface is not available, trying to switch to Zoltan2" << std::endl;
1686 partName =
"zoltan2";
1690#ifndef HAVE_MUELU_ZOLTAN2
1691 bool switched =
false;
1695#ifndef HAVE_MUELU_ZOLTAN2
1696 if (partName ==
"zoltan2" && !switched) {
1697 this->GetOStream(
Warnings0) <<
"Zoltan2 interface is not available, trying to switch to Zoltan" << std::endl;
1698 partName =
"zoltan";
1702 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: node repartition level",
int, nodeRepartitionLevel);
1706 ParameterList repartheurParams;
1715 repartheurFactory->SetParameterList(repartheurParams);
1716 repartheurFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1717 manager.
SetFactory(
"number of partitions", repartheurFactory);
1718 manager.
SetFactory(
"repartition: heuristic target rows per process", repartheurFactory);
1721 RCP<Factory> partitioner;
1722 if (levelID == nodeRepartitionLevel) {
1725 ParameterList partParams;
1727 partitioner->SetParameterList(partParams);
1728 partitioner->SetFactory(
"Node Comm", manager.
GetFactory(
"Node Comm"));
1729 }
else if (partName ==
"zoltan") {
1730#ifdef HAVE_MUELU_ZOLTAN
1736 }
else if (partName ==
"zoltan2") {
1737#ifdef HAVE_MUELU_ZOLTAN2
1739 ParameterList partParams;
1740 RCP<const ParameterList> partpartParams = rcp(
new ParameterList(paramList.sublist(
"repartition: params",
false)));
1741 partParams.set(
"ParameterList", partpartParams);
1742 partitioner->SetParameterList(partParams);
1743 partitioner->SetFactory(
"repartition: heuristic target rows per process",
1744 manager.
GetFactory(
"repartition: heuristic target rows per process"));
1750 partitioner->SetFactory(
"A", manager.
GetFactory(
"A"));
1751 partitioner->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1752 if (useCoordinates_)
1753 partitioner->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1754 manager.
SetFactory(
"Partition", partitioner);
1758 ParameterList repartParams;
1763 repartFactory->SetParameterList(repartParams);
1764 repartFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1765 repartFactory->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1766 repartFactory->SetFactory(
"Partition", manager.
GetFactory(
"Partition"));
1767 manager.
SetFactory(
"Importer", repartFactory);
1768 if (reuseType !=
"none" && reuseType !=
"S" && levelID)
1771 if (enableInPlace) {
1776 ParameterList rebAcParams;
1779 newA->SetParameterList(rebAcParams);
1780 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1781 newA->SetFactory(
"InPlaceMap", manager.
GetFactory(
"InPlaceMap"));
1786 ParameterList rebAcParams;
1788 newA->SetParameterList(rebAcParams);
1789 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1790 newA->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1795 ParameterList newPparams;
1796 newPparams.set(
"type",
"Interpolation");
1797 if (changedPRrebalance_)
1798 newPparams.set(
"repartition: rebalance P and R", this->doPRrebalance_);
1799 if (changedPRViaCopyrebalance_)
1800 newPparams.set(
"repartition: explicit via new copy rebalance P and R",
true);
1803 newP->SetParameterList(newPparams);
1804 newP->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1805 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
1807 if (!paramList.isParameter(
"semicoarsen: number of levels"))
1808 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1810 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"P"));
1811 if (useCoordinates_) {
1812 newP->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1816 newP->SetFactory(
"Material", manager.
GetFactory(
"Material"));
1819 if (useBlockNumber_ && (levelID > 0)) {
1820 newP->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1826 ParameterList newRparams;
1827 newRparams.set(
"type",
"Restriction");
1830 if (changedPRrebalance_)
1831 newRparams.set(
"repartition: rebalance P and R", this->doPRrebalance_);
1832 if (changedPRViaCopyrebalance_)
1833 newPparams.set(
"repartition: explicit via new copy rebalance P and R",
true);
1834 if (changedImplicitTranspose_)
1835 newRparams.set(
"transpose: use implicit", this->implicitTranspose_);
1836 newR->SetParameterList(newRparams);
1837 newR->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1838 if (!this->implicitTranspose_) {
1839 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1850 ParameterList newNullparams;
1852 nullSpaceFactory->SetFactory(
"Nullspace", newP);
1853 nullSpaceFactory->SetParameterList(newNullparams);
1856 paramList.set(
"repartition: enable",
false);
1858 this->GetOStream(
Warnings0) <<
"No repartitioning available for a serial run\n";
1860 this->GetOStream(
Warnings0) <<
"Zoltan/Zoltan2 are unavailable for repartitioning\n";
1869template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1872 int levelID, std::vector<keep_pair>& keeps)
const {
1873 MUELU_SET_VAR_2LIST(paramList, defaultList,
"transfers: half precision",
bool, enableLowPrecision);
1875 if (enableLowPrecision) {
1878 ParameterList newPparams;
1879 newPparams.set(
"matrix key",
"P");
1880 newP->SetParameterList(newPparams);
1881 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
1884 if (!this->implicitTranspose_) {
1887 ParameterList newRparams;
1888 newRparams.set(
"matrix key",
"R");
1889 newR->SetParameterList(newRparams);
1890 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1899template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1902 int , std::vector<keep_pair>& , RCP<Factory>& nullSpaceFactory)
const {
1906 bool have_userNS =
false;
1907 if (paramList.isParameter(
"Nullspace") && !paramList.get<RCP<MultiVector> >(
"Nullspace").is_null())
1911 ParameterList newNullparams;
1913 nullSpace->SetParameterList(newNullparams);
1914 nullSpace->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1917 nullSpaceFactory = nullSpace;
1919 if (paramList.isParameter(
"restriction: scale nullspace") && paramList.get<
bool>(
"restriction: scale nullspace")) {
1921 scaledNSfactory->SetFactory(
"Nullspace", nullSpaceFactory);
1922 manager.
SetFactory(
"Scaled Nullspace", scaledNSfactory);
1929template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1932 int , std::vector<keep_pair>& )
const {
1934 RCP<Factory> semicoarsenFactory = Teuchos::null;
1935 if (paramList.isParameter(
"semicoarsen: number of levels") &&
1936 paramList.get<
int>(
"semicoarsen: number of levels") > 0) {
1937 ParameterList togglePParams;
1938 ParameterList semicoarsenPParams;
1939 ParameterList linedetectionParams;
1952 linedetectionFactory->SetParameterList(linedetectionParams);
1953 semicoarsenFactory->SetParameterList(semicoarsenPParams);
1954 togglePFactory->SetParameterList(togglePParams);
1956 togglePFactory->AddCoarseNullspaceFactory(semicoarsenFactory);
1957 togglePFactory->AddProlongatorFactory(semicoarsenFactory);
1958 togglePFactory->AddPtentFactory(semicoarsenFactory);
1959 togglePFactory->AddCoarseNullspaceFactory(manager.
GetFactory(
"Ptent"));
1960 togglePFactory->AddProlongatorFactory(manager.
GetFactory(
"P"));
1961 togglePFactory->AddPtentFactory(manager.
GetFactory(
"Ptent"));
1963 manager.
SetFactory(
"CoarseNumZLayers", linedetectionFactory);
1964 manager.
SetFactory(
"LineDetection_Layers", linedetectionFactory);
1965 manager.
SetFactory(
"LineDetection_VertLineIds", linedetectionFactory);
1969 manager.
SetFactory(
"Nullspace", togglePFactory);
1972 if (paramList.isParameter(
"semicoarsen: number of levels")) {
1974 tf->SetFactory(
"Chosen P", manager.
GetFactory(
"P"));
1975 tf->AddCoordTransferFactory(semicoarsenFactory);
1978 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1979 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1980 tf->AddCoordTransferFactory(coords);
1988template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1991 int levelID, std::vector<keep_pair>& keeps)
const {
1992#ifdef HAVE_MUELU_INTREPID2
1994 if (defaultList.isParameter(
"pcoarsen: schedule") && defaultList.isParameter(
"pcoarsen: element")) {
1997 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
1998 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
2000 if (levelID >= (
int)pcoarsen_schedule.size()) {
2003 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
2007 ParameterList Pparams;
2009 std::string lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
2010 std::string hi = (levelID ? pcoarsen_element + std::to_string(pcoarsen_schedule[levelID - 1]) : lo);
2011 Pparams.set(
"pcoarsen: hi basis", hi);
2012 Pparams.set(
"pcoarsen: lo basis", lo);
2013 P->SetParameterList(Pparams);
2022 ParameterList Pparams;
2026 P->SetParameterList(Pparams);
2039template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2044 ParameterList Pparams;
2045 if (paramList.isSublist(
"matrixmatrix: kernel params"))
2046 Pparams.sublist(
"matrixmatrix: kernel params",
false) = paramList.sublist(
"matrixmatrix: kernel params");
2047 if (defaultList.isSublist(
"matrixmatrix: kernel params"))
2048 Pparams.sublist(
"matrixmatrix: kernel params",
false) = defaultList.sublist(
"matrixmatrix: kernel params");
2061 P->SetParameterList(Pparams);
2064 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
2072 ParameterList fParams;
2083 filterFactory->SetParameterList(fParams);
2084 filterFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
2085 filterFactory->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
2086 filterFactory->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
2088 filterFactory->SetFactory(
"Filtering", manager.
GetFactory(
"Graph"));
2090 P->SetFactory(
"A", filterFactory);
2093 P->SetFactory(
"A", manager.
GetFactory(
"Graph"));
2097 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2100 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
2102 if (reuseType ==
"tP" && !filteringChangesMatrix)
2103 keeps.push_back(
keep_pair(
"AP reuse data", P.get()));
2109template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2112 int , std::vector<keep_pair>& )
const {
2116 "Invalid pattern name: \"" << patternType <<
"\". Valid options: \"AkPtent\"");
2119 ParameterList patternParams;
2121 patternFactory->SetParameterList(patternParams);
2122 patternFactory->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2125 MUELU_SET_VAR_2LIST(paramList, defaultList,
"emin: use filtered matrix",
bool, useFiltering);
2133 ParameterList fParams;
2143 filterFactory->SetParameterList(fParams);
2144 filterFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
2145 filterFactory->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
2146 filterFactory->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
2148 filterFactory->SetFactory(
"Filtering", manager.
GetFactory(
"Graph"));
2150 patternFactory->SetFactory(
"A", filterFactory);
2153 patternFactory->SetFactory(
"A", manager.
GetFactory(
"Graph"));
2157 manager.
SetFactory(
"Ppattern", patternFactory);
2161 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
2162 constraintFactory->SetFactory(
"CoarseNullspace", manager.
GetFactory(
"Ptent"));
2163 manager.
SetFactory(
"Constraint", constraintFactory);
2166 ParameterList Pparams;
2169 if (reuseType ==
"emin") {
2171 Pparams.set(
"Keep P0",
true);
2172 Pparams.set(
"Keep Constraint0",
true);
2177 P->SetParameterList(Pparams);
2178 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2179 P->SetFactory(
"Constraint", manager.
GetFactory(
"Constraint"));
2186template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2189 int , std::vector<keep_pair>& )
const {
2191 "Implicit transpose not supported with Petrov-Galerkin smoothed transfer operators: Set \"transpose: use implicit\" to false!\n"
2192 "Petrov-Galerkin transfer operator smoothing for non-symmetric problems requires a separate handling of the restriction operator which "
2193 "does not allow the usage of implicit transpose easily.");
2197 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2204template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2209 ParameterList Pparams;
2212 P->SetParameterList(Pparams);
2219template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2224 ParameterList Pparams;
2228 P->SetParameterList(Pparams);
2235template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2238 int , std::vector<keep_pair>& )
const {
2239#ifdef HAVE_MUELU_MATLAB
2240 ParameterList Pparams = paramList.sublist(
"transfer: params");
2242 P->SetParameterList(Pparams);
2243 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2251#undef MUELU_SET_VAR_2LIST
2252#undef MUELU_TEST_AND_SET_VAR
2253#undef MUELU_TEST_AND_SET_PARAM_2LIST
2254#undef MUELU_TEST_PARAM_2LIST
2255#undef MUELU_KOKKOS_FACTORY
2259template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2261 ParameterList paramList = constParamList;
2264 const int maxLevels = 100;
2267 std::vector<ParameterList> paramLists;
2268 for (
int levelID = 0; levelID < maxLevels; levelID++) {
2269 std::string sublistName =
"level " +
toString(levelID);
2270 if (paramList.isSublist(sublistName)) {
2271 paramLists.push_back(paramList.sublist(sublistName));
2273 paramList.remove(sublistName);
2276 paramLists.push_back(paramList);
2278#ifdef HAVE_MUELU_MATLAB
2280 for (
size_t i = 0; i < paramLists.size(); i++) {
2281 std::vector<std::string> customVars;
2283 for (Teuchos::ParameterList::ConstIterator it = paramLists[i].begin(); it != paramLists[i].end(); it++) {
2284 std::string paramName = paramLists[i].name(it);
2287 customVars.push_back(paramName);
2291 for (
size_t j = 0; j < customVars.size(); j++)
2292 paramLists[i].remove(customVars[j],
false);
2296 const int maxDepth = 0;
2297 for (
size_t i = 0; i < paramLists.size(); i++) {
2300 paramLists[i].validateParameters(validList, maxDepth);
2302 }
catch (
const Teuchos::Exceptions::InvalidParameterName& e) {
2303 std::string eString = e.what();
2306 size_t nameStart = eString.find_first_of(
'"') + 1;
2307 size_t nameEnd = eString.find_first_of(
'"', nameStart);
2308 std::string name = eString.substr(nameStart, nameEnd - nameStart);
2310 size_t bestScore = 100;
2311 std::string bestName =
"";
2312 for (ParameterList::ConstIterator it = validList.begin(); it != validList.end(); it++) {
2313 const std::string& pName = validList.name(it);
2314 this->GetOStream(
Runtime1) <<
"| " << pName;
2315 size_t score =
LevenshteinDistance(name.c_str(), name.length(), pName.c_str(), pName.length());
2316 this->GetOStream(
Runtime1) <<
" -> " << score << std::endl;
2317 if (score < bestScore) {
2322 if (bestScore < 10 && bestName !=
"") {
2323 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameterName,
2324 eString <<
"The parameter name \"" + name +
"\" is not valid. Did you mean \"" + bestName <<
"\"?\n");
2327 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameterName,
2328 eString <<
"The parameter name \"" + name +
"\" is not valid.\n");
2337template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2342 ParameterList paramList = constParamList;
2349 if (paramList.isSublist(
"Matrix")) {
2350 blockSize_ = paramList.sublist(
"Matrix").get<
int>(
"PDE equations", MasterList::getDefault<int>(
"number of equations"));
2351 dofOffset_ = paramList.sublist(
"Matrix").get<
GlobalOrdinal>(
"DOF offset", 0);
2355 if (factFact_ == Teuchos::null)
2367 if (paramList.isSublist(
"Factories"))
2368 this->BuildFactoryMap(paramList.sublist(
"Factories"), factoryMap, factoryMap, factoryManagers);
2382 if (paramList.isSublist(
"Hierarchy")) {
2383 ParameterList hieraList = paramList.sublist(
"Hierarchy");
2386 if (hieraList.isParameter(
"max levels")) {
2387 this->numDesiredLevel_ = hieraList.get<
int>(
"max levels");
2388 hieraList.remove(
"max levels");
2391 if (hieraList.isParameter(
"coarse: max size")) {
2392 this->maxCoarseSize_ = hieraList.get<
int>(
"coarse: max size");
2393 hieraList.remove(
"coarse: max size");
2396 if (hieraList.isParameter(
"repartition: rebalance P and R")) {
2397 this->doPRrebalance_ = hieraList.get<
bool>(
"repartition: rebalance P and R");
2398 hieraList.remove(
"repartition: rebalance P and R");
2401 if (hieraList.isParameter(
"transpose: use implicit")) {
2402 this->implicitTranspose_ = hieraList.get<
bool>(
"transpose: use implicit");
2403 hieraList.remove(
"transpose: use implicit");
2406 if (hieraList.isParameter(
"fuse prolongation and update")) {
2407 this->fuseProlongationAndUpdate_ = hieraList.get<
bool>(
"fuse prolongation and update");
2408 hieraList.remove(
"fuse prolongation and update");
2411 if (hieraList.isParameter(
"nullspace: suppress dimension check")) {
2412 this->suppressNullspaceDimensionCheck_ = hieraList.get<
bool>(
"nullspace: suppress dimension check");
2413 hieraList.remove(
"nullspace: suppress dimension check");
2416 if (hieraList.isParameter(
"number of vectors")) {
2417 this->sizeOfMultiVectors_ = hieraList.get<
int>(
"number of vectors");
2418 hieraList.remove(
"number of vectors");
2421 if (hieraList.isSublist(
"matvec params"))
2422 this->matvecParams_ = Teuchos::parameterList(hieraList.sublist(
"matvec params"));
2424 if (hieraList.isParameter(
"coarse grid correction scaling factor")) {
2425 this->scalingFactor_ = hieraList.get<
double>(
"coarse grid correction scaling factor");
2426 hieraList.remove(
"coarse grid correction scaling factor");
2430 if (hieraList.isParameter(
"cycle type")) {
2431 std::map<std::string, CycleType> cycleMap;
2435 std::string cycleType = hieraList.get<std::string>(
"cycle type");
2436 TEUCHOS_TEST_FOR_EXCEPTION(cycleMap.count(cycleType) == 0,
Exceptions::RuntimeError,
"Invalid cycle type: \"" << cycleType <<
"\"");
2437 this->Cycle_ = cycleMap[cycleType];
2440 if (hieraList.isParameter(
"W cycle start level")) {
2441 this->WCycleStartLevel_ = hieraList.get<
int>(
"W cycle start level");
2444 if (hieraList.isParameter(
"hierarchy label")) {
2445 this->hierarchyLabel_ = hieraList.get<std::string>(
"hierarchy label");
2448 if (hieraList.isParameter(
"verbosity")) {
2449 std::string vl = hieraList.get<std::string>(
"verbosity");
2450 hieraList.remove(
"verbosity");
2454 if (hieraList.isParameter(
"output filename"))
2457 if (hieraList.isParameter(
"dependencyOutputLevel"))
2458 this->graphOutputLevel_ = hieraList.get<
int>(
"dependencyOutputLevel");
2461 if (hieraList.isParameter(
"reuse"))
2464 if (hieraList.isSublist(
"DataToWrite")) {
2467 ParameterList foo = hieraList.sublist(
"DataToWrite");
2468 std::string dataName =
"Matrices";
2469 if (foo.isParameter(dataName))
2470 this->matricesToPrint_[
"A"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2471 dataName =
"Prolongators";
2472 if (foo.isParameter(dataName))
2473 this->matricesToPrint_[
"P"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2474 dataName =
"Restrictors";
2475 if (foo.isParameter(dataName))
2476 this->matricesToPrint_[
"R"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2478 if (foo.isParameter(dataName))
2479 this->matricesToPrint_[
"D0"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2483 for (ParameterList::ConstIterator param = hieraList.begin(); param != hieraList.end(); ++param) {
2484 const std::string& paramName = hieraList.name(param);
2486 if (paramName !=
"DataToWrite" && hieraList.isSublist(paramName)) {
2487 ParameterList levelList = hieraList.sublist(paramName);
2490 if (levelList.isParameter(
"startLevel")) {
2491 startLevel = levelList.get<
int>(
"startLevel");
2492 levelList.remove(
"startLevel");
2494 int numDesiredLevel = 1;
2495 if (levelList.isParameter(
"numDesiredLevel")) {
2496 numDesiredLevel = levelList.get<
int>(
"numDesiredLevel");
2497 levelList.remove(
"numDesiredLevel");
2511 BuildFactoryMap(levelList, factoryMap, levelFactoryMap, factoryManagers);
2513 RCP<FactoryManager> m = rcp(
new FactoryManager(levelFactoryMap));
2514 if (hieraList.isParameter(
"use kokkos refactor"))
2515 m->SetKokkosRefactor(hieraList.get<
bool>(
"use kokkos refactor"));
2517 if (startLevel >= 0)
2518 this->AddFactoryManager(startLevel, numDesiredLevel, m);
2520 TEUCHOS_TEST_FOR_EXCEPTION(
true,
Exceptions::RuntimeError,
"MueLu::ParameterListInterpreter():: invalid level id");
2649template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2652 for (ParameterList::ConstIterator param = paramList.begin(); param != paramList.end(); ++param) {
2653 const std::string& paramName = paramList.name(param);
2654 const Teuchos::ParameterEntry& paramValue = paramList.entry(param);
2658 if (paramValue.isList()) {
2659 ParameterList paramList1 = Teuchos::getValue<ParameterList>(paramValue);
2660 if (paramList1.isParameter(
"factory")) {
2663 "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.");
2665 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2667 }
else if (paramList1.isParameter(
"dependency for")) {
2669 "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.");
2671 std::string factoryName = paramList1.get<std::string>(
"dependency for");
2673 RCP<const FactoryBase> factbase = factoryMapIn.find(factoryName )->second;
2675 "MueLu::ParameterListInterpreter(): could not find factory " + factoryName +
" in factory map. Did you define it before?");
2677 RCP<const Factory> factoryconst = Teuchos::rcp_dynamic_cast<const Factory>(factbase);
2678 RCP<Factory> factory = Teuchos::rcp_const_cast<Factory>(factoryconst);
2681 RCP<const ParameterList> validParamList = factory->GetValidParameterList();
2682 for (ParameterList::ConstIterator vparam = validParamList->begin(); vparam != validParamList->end(); ++vparam) {
2683 const std::string& pName = validParamList->name(vparam);
2685 if (!paramList1.isParameter(pName)) {
2690 if (validParamList->isType<RCP<const FactoryBase> >(pName)) {
2692 RCP<const FactoryBase> generatingFact = factFact_->BuildFactory(paramList1.getEntry(pName), factoryMapIn, factoryManagers);
2693 factory->SetFactory(pName, generatingFact.create_weak());
2695 }
else if (validParamList->isType<RCP<const ParameterList> >(pName)) {
2696 if (pName ==
"ParameterList") {
2701 RCP<const ParameterList> subList = Teuchos::sublist(rcp(
new ParameterList(paramList1)), pName);
2702 factory->SetParameter(pName, ParameterEntry(subList));
2705 factory->SetParameter(pName, paramList1.getEntry(pName));
2709 }
else if (paramList1.isParameter(
"group")) {
2711 std::string groupType = paramList1.get<std::string>(
"group");
2713 "group must be of type \"FactoryManager\".");
2715 ParameterList groupList = paramList1;
2716 groupList.remove(
"group");
2718 bool setKokkosRefactor =
false;
2719 bool kokkosRefactor = useKokkos_;
2720 if (groupList.isParameter(
"use kokkos refactor")) {
2721 kokkosRefactor = groupList.get<
bool>(
"use kokkos refactor");
2722 groupList.remove(
"use kokkos refactor");
2723 setKokkosRefactor =
true;
2727 BuildFactoryMap(groupList, factoryMapIn, groupFactoryMap, factoryManagers);
2731 RCP<FactoryManager> m = rcp(
new FactoryManager(groupFactoryMap));
2732 if (setKokkosRefactor)
2733 m->SetKokkosRefactor(kokkosRefactor);
2734 factoryManagers[paramName] = m;
2737 this->GetOStream(
Warnings0) <<
"Could not interpret parameter list " << paramList1 << std::endl;
2739 "XML Parameter list must either be of type \"factory\" or of type \"group\".");
2743 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2751template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2754 Matrix& A =
dynamic_cast<Matrix&
>(Op);
2755 if (A.IsFixedBlockSizeSet() && (A.GetFixedBlockSize() != blockSize_))
2756 this->GetOStream(
Warnings0) <<
"Setting matrix block size to " << blockSize_ <<
" (value of the parameter in the list) "
2757 <<
"instead of " << A.GetFixedBlockSize() <<
" (provided matrix)." << std::endl
2758 <<
"You may want to check \"number of equations\" (or \"PDE equations\" for factory style list) parameter." << std::endl;
2760 A.SetFixedBlockSize(blockSize_, dofOffset_);
2762#ifdef HAVE_MUELU_DEBUG
2763 MatrixUtils::checkLocalRowMapMatchesColMap(A);
2766 }
catch (std::bad_cast&) {
2767 this->GetOStream(
Warnings0) <<
"Skipping setting block size as the operator is not a matrix" << std::endl;
2771template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2780static bool compare(
const ParameterList& list1,
const ParameterList& list2) {
2783 for (ParameterList::ConstIterator it = list1.begin(); it != list1.end(); it++) {
2784 const std::string& name = it->first;
2785 const Teuchos::ParameterEntry& entry1 = it->second;
2787 const Teuchos::ParameterEntry* entry2 = list2.getEntryPtr(name);
2790 if (entry1.isList() && entry2->isList()) {
2791 compare(Teuchos::getValue<ParameterList>(entry1), Teuchos::getValue<ParameterList>(*entry2));
2794 if (entry1.getAny(
false) != entry2->getAny(
false))
2801static inline bool areSame(
const ParameterList& list1,
const ParameterList& list2) {
2807#define MUELU_PARAMETERLISTINTERPRETER_SHORT
#define MUELU_TEST_AND_SET_VAR(paramList, paramName, paramType, varName)
#define MUELU_SET_VAR_2LIST(paramList, defaultList, paramName, paramType, varName)
#define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2)
#define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory)
#define MUELU_TEST_PARAM_2LIST(paramList, defaultList, paramName, paramType, cmpValue)
#define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory)
#define TEST_MUTUALLY_EXCLUSIVE(arg1, arg2)
#define MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList, paramName, paramType, listWrite)
MueLu::DefaultScalar Scalar
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.
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.
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)
static void EnableTimerSync()
static void DisableMultipleCheckGlobally()
Factory for building filtered matrices using filtered graphs.
Factory for building restriction operators using a prolongator factory.
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
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.
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 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_SA(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
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_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_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.
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)
MsgType toVerbLevel(const std::string &verbLevelStr)
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)
std::string toString(const T &what)
Little helper function to convert non-string types to strings.