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 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use rowsumabs diagonal scaling",
bool, useMaxAbsDiagonalScaling);
712 bool isCustomSmoother =
713 paramList.isParameter(
"smoother: pre or post") ||
714 paramList.isParameter(
"smoother: type") || paramList.isParameter(
"smoother: pre type") || paramList.isParameter(
"smoother: post type") ||
715 paramList.isSublist(
"smoother: params") || paramList.isSublist(
"smoother: pre params") || paramList.isSublist(
"smoother: post params") ||
716 paramList.isParameter(
"smoother: sweeps") || paramList.isParameter(
"smoother: pre sweeps") || paramList.isParameter(
"smoother: post sweeps") ||
717 paramList.isParameter(
"smoother: overlap") || paramList.isParameter(
"smoother: pre overlap") || paramList.isParameter(
"smoother: post overlap");
721 manager.
SetFactory(
"Smoother", Teuchos::null);
723 }
else if (isCustomSmoother) {
727#define TEST_MUTUALLY_EXCLUSIVE(arg1, arg2) \
728 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isParameter(#arg1) && paramList.isParameter(#arg2), \
729 Exceptions::InvalidArgument, "You cannot specify both \"" #arg1 "\" and \"" #arg2 "\"");
730#define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2) \
731 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isSublist(#arg1) && paramList.isSublist(#arg2), \
732 Exceptions::InvalidArgument, "You cannot specify both \"" #arg1 "\" and \"" #arg2 "\"");
742 TEUCHOS_TEST_FOR_EXCEPTION(
PreOrPost ==
"both" && (paramList.isParameter(
"smoother: pre type") != paramList.isParameter(
"smoother: post type")),
747 ParameterList defaultSmootherParams;
748 defaultSmootherParams.set(
"relaxation: type",
"Symmetric Gauss-Seidel");
749 defaultSmootherParams.set(
"relaxation: sweeps", Teuchos::OrdinalTraits<LO>::one());
750 defaultSmootherParams.set(
"relaxation: damping factor", Teuchos::ScalarTraits<Scalar>::one());
752 RCP<SmootherFactory> preSmoother = Teuchos::null, postSmoother = Teuchos::null;
753 std::string preSmootherType, postSmootherType;
754 ParameterList preSmootherParams, postSmootherParams;
756 auto setChebyshevSettings = [&](
const std::string& smootherType, Teuchos::ParameterList& smootherParams) {
757 auto upperCaseSmootherType = smootherType;
758 std::transform(smootherType.begin(), smootherType.end(), upperCaseSmootherType.begin(), ::toupper);
759 if (upperCaseSmootherType !=
"CHEBYSHEV")
return;
761 if (smootherParams.isParameter(
"chebyshev: use rowsumabs diagonal scaling")) {
762 bool useMaxAbsDiagonalScalingCheby = smootherParams.get<
bool>(
"chebyshev: use rowsumabs diagonal scaling");
763 TEUCHOS_TEST_FOR_EXCEPTION(useMaxAbsDiagonalScaling != useMaxAbsDiagonalScalingCheby,
764 Exceptions::RuntimeError,
"'chebyshev: use rowsumabs diagonal scaling' (" << std::boolalpha << useMaxAbsDiagonalScalingCheby <<
") must match 'sa: use rowsumabs diagonal scaling' (" << std::boolalpha << useMaxAbsDiagonalScaling <<
")\n");
766 if (useMaxAbsDiagonalScaling)
767 smootherParams.set(
"chebyshev: use rowsumabs diagonal scaling", useMaxAbsDiagonalScaling);
771 if (paramList.isParameter(
"smoother: overlap"))
772 overlap = paramList.get<
int>(
"smoother: overlap");
775 if (paramList.isParameter(
"smoother: pre type")) {
776 preSmootherType = paramList.get<std::string>(
"smoother: pre type");
778 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, preSmootherTypeTmp);
779 preSmootherType = preSmootherTypeTmp;
781 if (paramList.isParameter(
"smoother: pre overlap"))
782 overlap = paramList.get<
int>(
"smoother: pre overlap");
784 if (paramList.isSublist(
"smoother: pre params"))
785 preSmootherParams = paramList.sublist(
"smoother: pre params");
786 else if (paramList.isSublist(
"smoother: params"))
787 preSmootherParams = paramList.sublist(
"smoother: params");
788 else if (defaultList.isSublist(
"smoother: params"))
789 preSmootherParams = defaultList.sublist(
"smoother: params");
790 else if (preSmootherType ==
"RELAXATION")
791 preSmootherParams = defaultSmootherParams;
793 setChebyshevSettings(preSmootherType, preSmootherParams);
795#ifdef HAVE_MUELU_INTREPID2
797 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
798 defaultList.isParameter(
"pcoarsen: schedule") && defaultList.isParameter(
"pcoarsen: element")) {
801 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
802 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
804 if (levelID < (
int)pcoarsen_schedule.size()) {
806 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
807 preSmootherParams.set(
"pcoarsen: hi basis", lo);
812#ifdef HAVE_MUELU_MATLAB
813 if (preSmootherType ==
"matlab")
821 if (paramList.isParameter(
"smoother: post type"))
822 postSmootherType = paramList.get<std::string>(
"smoother: post type");
824 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, postSmootherTypeTmp);
825 postSmootherType = postSmootherTypeTmp;
828 if (paramList.isSublist(
"smoother: post params"))
829 postSmootherParams = paramList.sublist(
"smoother: post params");
830 else if (paramList.isSublist(
"smoother: params"))
831 postSmootherParams = paramList.sublist(
"smoother: params");
832 else if (defaultList.isSublist(
"smoother: params"))
833 postSmootherParams = defaultList.sublist(
"smoother: params");
834 else if (postSmootherType ==
"RELAXATION")
835 postSmootherParams = defaultSmootherParams;
836 if (paramList.isParameter(
"smoother: post overlap"))
837 overlap = paramList.get<
int>(
"smoother: post overlap");
839 setChebyshevSettings(postSmootherType, postSmootherParams);
841 if (postSmootherType == preSmootherType &&
areSame(preSmootherParams, postSmootherParams))
842 postSmoother = preSmoother;
844#ifdef HAVE_MUELU_INTREPID2
846 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
847 defaultList.isParameter(
"pcoarsen: schedule") && defaultList.isParameter(
"pcoarsen: element")) {
850 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
851 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
853 if (levelID < (
int)pcoarsen_schedule.size()) {
855 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
856 postSmootherParams.set(
"pcoarsen: hi basis", lo);
861#ifdef HAVE_MUELU_MATLAB
862 if (postSmootherType ==
"matlab")
870 if (preSmoother == postSmoother)
873 manager.
SetFactory(
"PreSmoother", preSmoother);
874 manager.
SetFactory(
"PostSmoother", postSmoother);
881 bool reuseSmoothers = (reuseType ==
"S" || reuseType !=
"none");
882 if (reuseSmoothers) {
883 auto preSmootherFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<const Factory>(manager.
GetFactory(
"PreSmoother")));
885 if (preSmootherFactory != Teuchos::null) {
886 ParameterList postSmootherFactoryParams;
887 postSmootherFactoryParams.set(
"keep smoother data",
true);
888 preSmootherFactory->SetParameterList(postSmootherFactoryParams);
890 keeps.push_back(
keep_pair(
"PreSmoother data", preSmootherFactory.get()));
893 auto postSmootherFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<const Factory>(manager.
GetFactory(
"PostSmoother")));
894 if (postSmootherFactory != Teuchos::null) {
895 ParameterList postSmootherFactoryParams;
896 postSmootherFactoryParams.set(
"keep smoother data",
true);
897 postSmootherFactory->SetParameterList(postSmootherFactoryParams);
899 keeps.push_back(
keep_pair(
"PostSmoother data", postSmootherFactory.get()));
902 auto coarseFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<const Factory>(manager.
GetFactory(
"CoarseSolver")));
903 if (coarseFactory != Teuchos::null) {
904 ParameterList coarseFactoryParams;
905 coarseFactoryParams.set(
"keep smoother data",
true);
906 coarseFactory->SetParameterList(coarseFactoryParams);
908 keeps.push_back(
keep_pair(
"PreSmoother data", coarseFactory.get()));
912 if ((reuseType ==
"RAP" && levelID) || (reuseType ==
"full")) {
931template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
936 bool isCustomCoarseSolver =
937 paramList.isParameter(
"coarse: type") ||
938 paramList.isParameter(
"coarse: params");
940 manager.
SetFactory(
"CoarseSolver", Teuchos::null);
942 }
else if (isCustomCoarseSolver) {
949 if (paramList.isParameter(
"coarse: overlap"))
950 overlap = paramList.get<
int>(
"coarse: overlap");
952 ParameterList coarseParams;
953 if (paramList.isSublist(
"coarse: params"))
954 coarseParams = paramList.sublist(
"coarse: params");
955 else if (defaultList.isSublist(
"coarse: params"))
956 coarseParams = defaultList.sublist(
"coarse: params");
958 using strings = std::unordered_set<std::string>;
960 RCP<SmootherPrototype> coarseSmoother;
964 if (strings({
"RELAXATION",
"CHEBYSHEV",
"ILUT",
"ILU",
"RILUK",
"SCHWARZ",
"Amesos",
965 "BLOCK RELAXATION",
"BLOCK_RELAXATION",
"BLOCKRELAXATION",
966 "SPARSE BLOCK RELAXATION",
"SPARSE_BLOCK_RELAXATION",
"SPARSEBLOCKRELAXATION",
967 "LINESMOOTHING_BANDEDRELAXATION",
"LINESMOOTHING_BANDED_RELAXATION",
"LINESMOOTHING_BANDED RELAXATION",
968 "LINESMOOTHING_TRIDIRELAXATION",
"LINESMOOTHING_TRIDI_RELAXATION",
"LINESMOOTHING_TRIDI RELAXATION",
969 "LINESMOOTHING_TRIDIAGONALRELAXATION",
"LINESMOOTHING_TRIDIAGONAL_RELAXATION",
"LINESMOOTHING_TRIDIAGONAL RELAXATION",
970 "TOPOLOGICAL",
"FAST_ILU",
"FAST_IC",
"FAST_ILDL",
"HIPTMAIR"})
971 .count(coarseType)) {
972 coarseSmoother = rcp(
new TrilinosSmoother(coarseType, coarseParams, overlap));
974#ifdef HAVE_MUELU_MATLAB
975 if (coarseType ==
"matlab")
979 coarseSmoother = rcp(
new DirectSolver(coarseType, coarseParams));
989template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
992 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
993 ParameterList rParams;
1000 rFactory->SetParameterList(rParams);
1008 rFactory->SetFactory(
"D0", this->GetFactoryManager(levelID - 1)->GetFactory(
"D0"));
1020template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1023 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1024 using strings = std::unordered_set<std::string>;
1029 TEUCHOS_TEST_FOR_EXCEPTION(!strings({
"uncoupled",
"coupled",
"brick",
"matlab",
"notay",
"classical"}).count(aggType),
1033 RCP<AmalgamationFactory> amalgFact;
1034 if (aggType ==
"classical") {
1036 manager.
SetFactory(
"UnAmalgamationInfo", amalgFact);
1040 RCP<Factory> dropFactory;
1043#ifdef HAVE_MUELU_MATLAB
1045 ParameterList socParams = paramList.sublist(
"strength-of-connection: params");
1046 dropFactory->SetParameterList(socParams);
1048 throw std::runtime_error(
"Cannot use MATLAB evolutionary strength-of-connection - MueLu was not configured with MATLAB support.");
1050 }
else if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"unsupported vector smoothing")) {
1052 ParameterList dropParams;
1058 dropFactory->SetParameterList(dropParams);
1061 ParameterList dropParams;
1062 if (!rcp_dynamic_cast<CoalesceDropFactory>(dropFactory).is_null())
1063 dropParams.set(
"lightweight wrap",
true);
1074#ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1078 MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList,
"aggregation: distance laplacian directional weights", Teuchos::Array<double>, dropParams);
1098#ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1099 if (!dropParams.isParameter(
"aggregation: drop scheme") ||
1100 (dropParams.isParameter(
"aggregation: drop scheme") &&
1101 ((dropParams.get<std::string>(
"aggregation: drop scheme") !=
"point-wise") && (dropParams.get<std::string>(
"aggregation: drop scheme") !=
"cut-drop")))) {
1102 Teuchos::ParameterList dropParamsWithDefaults(dropParams);
1104#define MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(paramList, paramName, paramType) \
1105 if (!paramList.isParameter(paramName)) { \
1106 paramList.set(paramName, MasterList::getDefault<paramType>(paramName)); \
1109 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: drop scheme", std::string);
1110 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: strength-of-connection: matrix", std::string);
1111 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: strength-of-connection: measure", std::string);
1112 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: use blocking",
bool);
1114#undef MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST
1117 TEUCHOS_TEST_FOR_EXCEPTION(dropParams.isParameter(
"aggregation: strength-of-connection: matrix") ||
1118 dropParams.isParameter(
"aggregation: strength-of-connection: measure") ||
1119 dropParams.isParameter(
"aggregation: use blocking"),
1120 Teuchos::Exceptions::InvalidParameterType,
1121 "The inputs contain a mix of old and new dropping parameters:\n\n"
1122 << dropParams <<
"\n\nKeep in mind that defaults are set for old parameters, so this gets interpreted as\n\n"
1123 << dropParamsWithDefaults);
1127 if (!amalgFact.is_null())
1128 dropFactory->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
1130 if (dropParams.isParameter(
"aggregation: drop scheme")) {
1131 std::string drop_scheme = dropParams.get<std::string>(
"aggregation: drop scheme");
1132 if (drop_scheme ==
"block diagonal colored signed classical")
1133 manager.
SetFactory(
"Coloring Graph", dropFactory);
1135 (drop_scheme.find(
"block diagonal") != std::string::npos || drop_scheme ==
"signed classical")) {
1137 dropFactory->SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1139 dropFactory->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1143 dropFactory->SetParameterList(dropParams);
1148#ifndef HAVE_MUELU_MATLAB
1149 if (aggType ==
"matlab")
1150 throw std::runtime_error(
"Cannot use MATLAB aggregation - MueLu was not configured with MATLAB support.");
1152 RCP<Factory> aggFactory;
1153 if (aggType ==
"uncoupled") {
1155 ParameterList aggParams;
1175 aggFactory->SetParameterList(aggParams);
1177 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
1178 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1181 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: coloring algorithm", std::string,
"mis2 aggregation") ||
1182 MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: coloring algorithm", std::string,
"mis2 coarsening")) {
1183 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: symmetrize graph after dropping",
bool,
false))
1184 TEUCHOS_TEST_FOR_EXCEPTION(
true,
1186 "MIS2 algorithms require the use of a symmetrized graph. Please set \"aggregation: symmetrize graph after dropping\" to \"true\".");
1188 }
else if (aggType ==
"brick") {
1190 ParameterList aggParams;
1197 aggFactory->SetParameterList(aggParams);
1201 manager.
SetFactory(
"DofsPerNode", aggFactory);
1207 aggFactory->SetFactory(
"Coordinates", this->GetFactoryManager(levelID - 1)->GetFactory(
"Coordinates"));
1209 }
else if (aggType ==
"classical") {
1212 ParameterList mapParams;
1216 ParameterList tempParams;
1218 std::string drop_algo = tempParams.get<std::string>(
"aggregation: drop scheme");
1219 if (drop_algo ==
"block diagonal colored signed classical") {
1220 mapParams.set(
"aggregation: coloring: use color graph",
true);
1221 mapFact->SetFactory(
"Coloring Graph", manager.
GetFactory(
"Coloring Graph"));
1223 mapFact->SetParameterList(mapParams);
1224 mapFact->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1225 mapFact->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
1231 ParameterList aggParams;
1234 aggFactory->SetParameterList(aggParams);
1235 aggFactory->SetFactory(
"FC Splitting", manager.
GetFactory(
"FC Splitting"));
1236 aggFactory->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1237 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
1238 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1240 if (drop_algo.find(
"block diagonal") != std::string::npos || drop_algo ==
"signed classical") {
1242 aggFactory->SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1244 aggFactory->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1251 if (reuseType ==
"tP" && levelID) {
1253 keeps.push_back(
keep_pair(
"Ptent", aggFactory.get()));
1256 }
else if (aggType ==
"notay") {
1258 ParameterList aggParams;
1263 aggFactory->SetParameterList(aggParams);
1264 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
1265 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1267#ifdef HAVE_MUELU_MATLAB
1268 else if (aggType ==
"matlab") {
1269 ParameterList aggParams = paramList.sublist(
"aggregation: params");
1271 aggFactory->SetParameterList(aggParams);
1275 manager.
SetFactory(
"Aggregates", aggFactory);
1279 coarseMap->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1284 ParameterList ptentParams;
1285 if (paramList.isSublist(
"matrixmatrix: kernel params"))
1286 ptentParams.sublist(
"matrixmatrix: kernel params",
false) = paramList.sublist(
"matrixmatrix: kernel params");
1287 if (defaultList.isSublist(
"matrixmatrix: kernel params"))
1288 ptentParams.sublist(
"matrixmatrix: kernel params",
false) = defaultList.sublist(
"matrixmatrix: kernel params");
1291 Ptent->SetParameterList(ptentParams);
1292 Ptent->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1293 Ptent->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1296 if (reuseType ==
"tP" && levelID) {
1297 keeps.push_back(
keep_pair(
"Nullspace", Ptent.get()));
1298 keeps.push_back(
keep_pair(
"P", Ptent.get()));
1305template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1308 int levelID, std::vector<keep_pair>& keeps)
const {
1309 if (paramList.isParameter(
"A") && !paramList.get<RCP<Matrix> >(
"A").is_null()) {
1315 ParameterList RAPparams;
1317 RCP<RAPFactory> RAP;
1318 RCP<RAPShiftFactory> RAPs;
1321 std::string alg = paramList.get(
"rap: algorithm",
"galerkin");
1322 if (alg ==
"shift" || alg ==
"non-galerkin") {
1336 if (paramList.isSublist(
"matrixmatrix: kernel params"))
1337 RAPparams.sublist(
"matrixmatrix: kernel params",
false) = paramList.sublist(
"matrixmatrix: kernel params");
1338 if (defaultList.isSublist(
"matrixmatrix: kernel params"))
1339 RAPparams.sublist(
"matrixmatrix: kernel params",
false) = defaultList.sublist(
"matrixmatrix: kernel params");
1346 if (!paramList.isParameter(
"rap: triple product") &&
1347 paramList.isType<std::string>(
"multigrid algorithm") &&
1348 paramList.get<std::string>(
"multigrid algorithm") ==
"unsmoothed")
1349 paramList.set(
"rap: triple product",
true);
1354 if (paramList.isParameter(
"aggregation: allow empty prolongator columns")) {
1355 RAPparams.set(
"CheckMainDiagonal", paramList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1356 RAPparams.set(
"RepairMainDiagonal", paramList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1357 }
else if (defaultList.isParameter(
"aggregation: allow empty prolongator columns")) {
1358 RAPparams.set(
"CheckMainDiagonal", defaultList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1359 RAPparams.set(
"RepairMainDiagonal", defaultList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1362 }
catch (Teuchos::Exceptions::InvalidParameterType&) {
1363 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(
true, Teuchos::Exceptions::InvalidParameterType,
1364 "Error: parameter \"aggregation: allow empty prolongator columns\" must be of type " << Teuchos::TypeNameTraits<bool>::name());
1367 if (!RAP.is_null()) {
1368 RAP->SetParameterList(RAPparams);
1369 RAP->SetFactory(
"P", manager.
GetFactory(
"P"));
1371 RAPs->SetParameterList(RAPparams);
1372 RAPs->SetFactory(
"P", manager.
GetFactory(
"P"));
1375 if (!this->implicitTranspose_) {
1377 RAP->SetFactory(
"R", manager.
GetFactory(
"R"));
1379 RAPs->SetFactory(
"R", manager.
GetFactory(
"R"));
1387 RAP->AddTransferFactory(matrixAnalysisFact);
1389 RAPs->AddTransferFactory(matrixAnalysisFact);
1393 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: compute aggregate qualities",
bool,
true)) {
1395 ParameterList aggQualityParams;
1404 aggQualityFact->SetParameterList(aggQualityParams);
1405 aggQualityFact->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1406 aggQualityFact->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1407 manager.
SetFactory(
"AggregateQualities", aggQualityFact);
1410 RAP->AddTransferFactory(aggQualityFact);
1412 RAPs->AddTransferFactory(aggQualityFact);
1415 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: export visualization data",
bool,
true)) {
1417 ParameterList aggExportParams;
1427 aggExport->SetParameterList(aggExportParams);
1428 aggExport->SetFactory(
"AggregateQualities", manager.
GetFactory(
"AggregateQualities"));
1429 aggExport->SetFactory(
"DofsPerNode", manager.
GetFactory(
"DofsPerNode"));
1430 aggExport->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1431 aggExport->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1434 RAP->AddTransferFactory(aggExport);
1436 RAPs->AddTransferFactory(aggExport);
1444 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
1445 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
1447 if (reuseType ==
"RP" || (reuseType ==
"tP" && !filteringChangesMatrix)) {
1448 if (!RAP.is_null()) {
1449 keeps.push_back(
keep_pair(
"AP reuse data", RAP.get()));
1450 keeps.push_back(
keep_pair(
"RAP reuse data", RAP.get()));
1453 keeps.push_back(
keep_pair(
"AP reuse data", RAPs.get()));
1454 keeps.push_back(
keep_pair(
"RAP reuse data", RAPs.get()));
1462template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1466 bool have_userCO =
false;
1467 if (paramList.isParameter(
"Coordinates") && !paramList.get<RCP<MultiVector> >(
"Coordinates").is_null())
1470 if (useCoordinates_) {
1476 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1477 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1480 auto RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(manager.
GetFactory(
"A")));
1481 if (!RAP.is_null()) {
1482 RAP->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1484 auto RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(manager.
GetFactory(
"A")));
1485 RAPs->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1494template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1498 bool have_userMaterial =
false;
1499 if (paramList.isParameter(
"Material") && !paramList.get<RCP<MultiVector> >(
"Material").is_null())
1500 have_userMaterial =
true;
1503 if (have_userMaterial) {
1507 ParameterList materialTransferParameters;
1508 materialTransferParameters.set(
"Vector name",
"Material");
1509 materialTransferParameters.set(
"Transfer name",
"Aggregates");
1510 materialTransferParameters.set(
"Normalize",
true);
1511 materialTransfer->SetParameterList(materialTransferParameters);
1512 materialTransfer->SetFactory(
"Transfer factory", manager.
GetFactory(
"Aggregates"));
1513 materialTransfer->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1514 manager.
SetFactory(
"Material", materialTransfer);
1516 auto RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(manager.
GetFactory(
"A")));
1517 if (!RAP.is_null()) {
1518 RAP->AddTransferFactory(manager.
GetFactory(
"Material"));
1520 auto RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(manager.
GetFactory(
"A")));
1521 RAPs->AddTransferFactory(manager.
GetFactory(
"Material"));
1530template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1533 FactoryManager& manager,
int levelID, std::vector<keep_pair>& )
const {
1536 if (useBlockNumber_ && (levelID > 0)) {
1537 auto RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(manager.
GetFactory(
"A")));
1538 auto RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(manager.
GetFactory(
"A")));
1539 if (!RAP.is_null() || !RAPs.is_null()) {
1541 if (multigridAlgo ==
"classical")
1542 fact->SetFactory(
"P Graph", manager.
GetFactory(
"P Graph"));
1544 fact->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1545 fact->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1547 fact->SetFactory(VarName, this->GetFactoryManager(levelID - 1)->GetFactory(VarName));
1552 RAP->AddTransferFactory(manager.
GetFactory(VarName));
1554 RAPs->AddTransferFactory(manager.
GetFactory(VarName));
1562template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1565 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1566 if (useBlockNumber_) {
1567 ParameterList myParams;
1570 fact->SetParameterList(myParams);
1578template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1581 int levelID, std::vector<keep_pair>& )
const {
1582 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
1583 bool have_userR =
false;
1584 if (paramList.isParameter(
"R") && !paramList.get<RCP<Matrix> >(
"R").is_null())
1589 if (!this->implicitTranspose_) {
1592 if (isSymmetric ==
false && (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"emin")) {
1593 this->GetOStream(
Warnings0) <<
"Switching \"problem: symmetric\" parameter to symmetric as multigrid algorithm. " << multigridAlgo <<
" is primarily supposed to be used for symmetric problems.\n\n"
1594 <<
"Please note: if you are using \"unsmoothed\" transfer operators the \"problem: symmetric\" parameter "
1595 <<
"has no real mathematical meaning, i.e. you can use it for non-symmetric\n"
1596 <<
"problems, too. With \"problem: symmetric\"=\"symmetric\" you can use implicit transpose for building "
1597 <<
"the restriction operators which may drastically reduce the amount of consumed memory." << std::endl;
1601 "Petrov-Galerkin smoothed transfer operators are only allowed for non-symmetric problems: Set \"problem: symmetric\" to false!\n"
1602 "While PG smoothed transfer operators generally would also work for symmetric problems this is an unusual use case. "
1603 "You can use the factory-based xml interface though if you need PG-AMG for symmetric problems.");
1622 if (paramList.isParameter(
"restriction: scale nullspace") && paramList.get<
bool>(
"restriction: scale nullspace")) {
1624 Teuchos::ParameterList tentPlist;
1625 tentPlist.set(
"Nullspace name",
"Scaled Nullspace");
1626 tentPFactory->SetParameterList(tentPlist);
1627 tentPFactory->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1628 tentPFactory->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1631 R->SetFactory(
"P", tentPFactory);
1638template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1641 int levelID, std::vector<keep_pair>& keeps, RCP<Factory>& nullSpaceFactory)
const {
1646#if defined(HAVE_MPI) && (defined(HAVE_MUELU_ZOLTAN) || defined(HAVE_MUELU_ZOLTAN2))
1647 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: use subcommunicators in place",
bool, enableInPlace);
1684 "Reuse types \"tP\" and \"PR\" require \"repartition: rebalance P and R\" set to \"false\"");
1689 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: partitioner", std::string, partName);
1691 "Invalid partitioner name: \"" << partName <<
"\". Valid options: \"zoltan\", \"zoltan2\"");
1693#ifndef HAVE_MUELU_ZOLTAN
1694 bool switched =
false;
1695 if (partName ==
"zoltan") {
1696 this->GetOStream(
Warnings0) <<
"Zoltan interface is not available, trying to switch to Zoltan2" << std::endl;
1697 partName =
"zoltan2";
1701#ifndef HAVE_MUELU_ZOLTAN2
1702 bool switched =
false;
1706#ifndef HAVE_MUELU_ZOLTAN2
1707 if (partName ==
"zoltan2" && !switched) {
1708 this->GetOStream(
Warnings0) <<
"Zoltan2 interface is not available, trying to switch to Zoltan" << std::endl;
1709 partName =
"zoltan";
1713 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: node repartition level",
int, nodeRepartitionLevel);
1717 ParameterList repartheurParams;
1726 repartheurFactory->SetParameterList(repartheurParams);
1727 repartheurFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1728 manager.
SetFactory(
"number of partitions", repartheurFactory);
1729 manager.
SetFactory(
"repartition: heuristic target rows per process", repartheurFactory);
1732 RCP<Factory> partitioner;
1733 if (levelID == nodeRepartitionLevel) {
1736 ParameterList partParams;
1738 partitioner->SetParameterList(partParams);
1739 partitioner->SetFactory(
"Node Comm", manager.
GetFactory(
"Node Comm"));
1740 }
else if (partName ==
"zoltan") {
1741#ifdef HAVE_MUELU_ZOLTAN
1747 }
else if (partName ==
"zoltan2") {
1748#ifdef HAVE_MUELU_ZOLTAN2
1750 ParameterList partParams;
1751 RCP<const ParameterList> partpartParams = rcp(
new ParameterList(paramList.sublist(
"repartition: params",
false)));
1752 partParams.set(
"ParameterList", partpartParams);
1753 partitioner->SetParameterList(partParams);
1754 partitioner->SetFactory(
"repartition: heuristic target rows per process",
1755 manager.
GetFactory(
"repartition: heuristic target rows per process"));
1761 partitioner->SetFactory(
"A", manager.
GetFactory(
"A"));
1762 partitioner->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1763 if (useCoordinates_)
1764 partitioner->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1765 manager.
SetFactory(
"Partition", partitioner);
1769 ParameterList repartParams;
1774 repartFactory->SetParameterList(repartParams);
1775 repartFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1776 repartFactory->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1777 repartFactory->SetFactory(
"Partition", manager.
GetFactory(
"Partition"));
1778 manager.
SetFactory(
"Importer", repartFactory);
1779 if (reuseType !=
"none" && reuseType !=
"S" && levelID)
1782 if (enableInPlace) {
1787 ParameterList rebAcParams;
1790 newA->SetParameterList(rebAcParams);
1791 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1792 newA->SetFactory(
"InPlaceMap", manager.
GetFactory(
"InPlaceMap"));
1797 ParameterList rebAcParams;
1799 newA->SetParameterList(rebAcParams);
1800 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1801 newA->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1806 ParameterList newPparams;
1807 newPparams.set(
"type",
"Interpolation");
1808 if (changedPRrebalance_)
1809 newPparams.set(
"repartition: rebalance P and R", this->doPRrebalance_);
1810 if (changedPRViaCopyrebalance_)
1811 newPparams.set(
"repartition: explicit via new copy rebalance P and R",
true);
1814 newP->SetParameterList(newPparams);
1815 newP->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1816 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
1818 if (!paramList.isParameter(
"semicoarsen: number of levels"))
1819 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1821 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"P"));
1822 if (useCoordinates_) {
1823 newP->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1827 newP->SetFactory(
"Material", manager.
GetFactory(
"Material"));
1830 if (useBlockNumber_ && (levelID > 0)) {
1831 newP->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1837 ParameterList newRparams;
1838 newRparams.set(
"type",
"Restriction");
1841 if (changedPRrebalance_)
1842 newRparams.set(
"repartition: rebalance P and R", this->doPRrebalance_);
1843 if (changedPRViaCopyrebalance_)
1844 newPparams.set(
"repartition: explicit via new copy rebalance P and R",
true);
1845 if (changedImplicitTranspose_)
1846 newRparams.set(
"transpose: use implicit", this->implicitTranspose_);
1847 newR->SetParameterList(newRparams);
1848 newR->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1849 if (!this->implicitTranspose_) {
1850 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1861 ParameterList newNullparams;
1863 nullSpaceFactory->SetFactory(
"Nullspace", newP);
1864 nullSpaceFactory->SetParameterList(newNullparams);
1867 paramList.set(
"repartition: enable",
false);
1869 this->GetOStream(
Warnings0) <<
"No repartitioning available for a serial run\n";
1871 this->GetOStream(
Warnings0) <<
"Zoltan/Zoltan2 are unavailable for repartitioning\n";
1880template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1883 int levelID, std::vector<keep_pair>& keeps)
const {
1884 MUELU_SET_VAR_2LIST(paramList, defaultList,
"transfers: half precision",
bool, enableLowPrecision);
1886 if (enableLowPrecision) {
1889 ParameterList newPparams;
1890 newPparams.set(
"matrix key",
"P");
1891 newP->SetParameterList(newPparams);
1892 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
1895 if (!this->implicitTranspose_) {
1898 ParameterList newRparams;
1899 newRparams.set(
"matrix key",
"R");
1900 newR->SetParameterList(newRparams);
1901 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1910template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1913 int , std::vector<keep_pair>& , RCP<Factory>& nullSpaceFactory)
const {
1917 bool have_userNS =
false;
1918 if (paramList.isParameter(
"Nullspace") && !paramList.get<RCP<MultiVector> >(
"Nullspace").is_null())
1922 ParameterList newNullparams;
1924 nullSpace->SetParameterList(newNullparams);
1925 nullSpace->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1928 nullSpaceFactory = nullSpace;
1930 if (paramList.isParameter(
"restriction: scale nullspace") && paramList.get<
bool>(
"restriction: scale nullspace")) {
1932 scaledNSfactory->SetFactory(
"Nullspace", nullSpaceFactory);
1933 manager.
SetFactory(
"Scaled Nullspace", scaledNSfactory);
1940template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1943 int , std::vector<keep_pair>& )
const {
1945 RCP<Factory> semicoarsenFactory = Teuchos::null;
1946 if (paramList.isParameter(
"semicoarsen: number of levels") &&
1947 paramList.get<
int>(
"semicoarsen: number of levels") > 0) {
1948 ParameterList togglePParams;
1949 ParameterList semicoarsenPParams;
1950 ParameterList linedetectionParams;
1963 linedetectionFactory->SetParameterList(linedetectionParams);
1964 semicoarsenFactory->SetParameterList(semicoarsenPParams);
1965 togglePFactory->SetParameterList(togglePParams);
1967 togglePFactory->AddCoarseNullspaceFactory(semicoarsenFactory);
1968 togglePFactory->AddProlongatorFactory(semicoarsenFactory);
1969 togglePFactory->AddPtentFactory(semicoarsenFactory);
1970 togglePFactory->AddCoarseNullspaceFactory(manager.
GetFactory(
"Ptent"));
1971 togglePFactory->AddProlongatorFactory(manager.
GetFactory(
"P"));
1972 togglePFactory->AddPtentFactory(manager.
GetFactory(
"Ptent"));
1974 manager.
SetFactory(
"CoarseNumZLayers", linedetectionFactory);
1975 manager.
SetFactory(
"LineDetection_Layers", linedetectionFactory);
1976 manager.
SetFactory(
"LineDetection_VertLineIds", linedetectionFactory);
1980 manager.
SetFactory(
"Nullspace", togglePFactory);
1983 if (paramList.isParameter(
"semicoarsen: number of levels") &&
1984 paramList.get<
int>(
"semicoarsen: number of levels") > 0) {
1986 tf->SetFactory(
"Chosen P", manager.
GetFactory(
"P"));
1987 tf->AddCoordTransferFactory(semicoarsenFactory);
1990 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1991 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1992 tf->AddCoordTransferFactory(coords);
2000template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2003 int levelID, std::vector<keep_pair>& keeps)
const {
2004#ifdef HAVE_MUELU_INTREPID2
2006 if (defaultList.isParameter(
"pcoarsen: schedule") && defaultList.isParameter(
"pcoarsen: element")) {
2009 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
2010 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
2012 if (levelID >= (
int)pcoarsen_schedule.size()) {
2015 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
2019 ParameterList Pparams;
2021 std::string lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
2022 std::string hi = (levelID ? pcoarsen_element + std::to_string(pcoarsen_schedule[levelID - 1]) : lo);
2023 Pparams.set(
"pcoarsen: hi basis", hi);
2024 Pparams.set(
"pcoarsen: lo basis", lo);
2025 P->SetParameterList(Pparams);
2034 ParameterList Pparams;
2038 P->SetParameterList(Pparams);
2051template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2056 ParameterList Pparams;
2057 if (paramList.isSublist(
"matrixmatrix: kernel params"))
2058 Pparams.sublist(
"matrixmatrix: kernel params",
false) = paramList.sublist(
"matrixmatrix: kernel params");
2059 if (defaultList.isSublist(
"matrixmatrix: kernel params"))
2060 Pparams.sublist(
"matrixmatrix: kernel params",
false) = defaultList.sublist(
"matrixmatrix: kernel params");
2073 P->SetParameterList(Pparams);
2076 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
2084 ParameterList fParams;
2095 filterFactory->SetParameterList(fParams);
2096 filterFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
2097 filterFactory->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
2098 filterFactory->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
2100 filterFactory->SetFactory(
"Filtering", manager.
GetFactory(
"Graph"));
2102 P->SetFactory(
"A", filterFactory);
2105 P->SetFactory(
"A", manager.
GetFactory(
"Graph"));
2109 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2112 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
2114 if (reuseType ==
"tP" && !filteringChangesMatrix)
2115 keeps.push_back(
keep_pair(
"AP reuse data", P.get()));
2121template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2124 int , std::vector<keep_pair>& )
const {
2128 "Invalid pattern name: \"" << patternType <<
"\". Valid options: \"AkPtent\"");
2131 ParameterList patternParams;
2133 patternFactory->SetParameterList(patternParams);
2134 patternFactory->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2137 MUELU_SET_VAR_2LIST(paramList, defaultList,
"emin: use filtered matrix",
bool, useFiltering);
2145 ParameterList fParams;
2155 filterFactory->SetParameterList(fParams);
2156 filterFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
2157 filterFactory->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
2158 filterFactory->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
2160 filterFactory->SetFactory(
"Filtering", manager.
GetFactory(
"Graph"));
2162 patternFactory->SetFactory(
"A", filterFactory);
2165 patternFactory->SetFactory(
"A", manager.
GetFactory(
"Graph"));
2169 manager.
SetFactory(
"Ppattern", patternFactory);
2173 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
2174 constraintFactory->SetFactory(
"CoarseNullspace", manager.
GetFactory(
"Ptent"));
2175 manager.
SetFactory(
"Constraint", constraintFactory);
2178 ParameterList Pparams;
2181 if (reuseType ==
"emin") {
2183 Pparams.set(
"Keep P0",
true);
2184 Pparams.set(
"Keep Constraint0",
true);
2189 P->SetParameterList(Pparams);
2190 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2191 P->SetFactory(
"Constraint", manager.
GetFactory(
"Constraint"));
2198template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2201 int , std::vector<keep_pair>& )
const {
2203 "Implicit transpose not supported with Petrov-Galerkin smoothed transfer operators: Set \"transpose: use implicit\" to false!\n"
2204 "Petrov-Galerkin transfer operator smoothing for non-symmetric problems requires a separate handling of the restriction operator which "
2205 "does not allow the usage of implicit transpose easily.");
2209 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2216template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2221 ParameterList Pparams;
2224 P->SetParameterList(Pparams);
2231template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2236 ParameterList Pparams;
2240 P->SetParameterList(Pparams);
2247template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2250 int , std::vector<keep_pair>& )
const {
2251#ifdef HAVE_MUELU_MATLAB
2252 ParameterList Pparams = paramList.sublist(
"transfer: params");
2254 P->SetParameterList(Pparams);
2255 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2263#undef MUELU_SET_VAR_2LIST
2264#undef MUELU_TEST_AND_SET_VAR
2265#undef MUELU_TEST_AND_SET_PARAM_2LIST
2266#undef MUELU_TEST_PARAM_2LIST
2267#undef MUELU_KOKKOS_FACTORY
2271template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2273 ParameterList paramList = constParamList;
2276 const int maxLevels = 100;
2279 std::vector<ParameterList> paramLists;
2280 for (
int levelID = 0; levelID < maxLevels; levelID++) {
2281 std::string sublistName =
"level " +
toString(levelID);
2282 if (paramList.isSublist(sublistName)) {
2283 paramLists.push_back(paramList.sublist(sublistName));
2285 paramList.remove(sublistName);
2288 paramLists.push_back(paramList);
2290#ifdef HAVE_MUELU_MATLAB
2292 for (
size_t i = 0; i < paramLists.size(); i++) {
2293 std::vector<std::string> customVars;
2295 for (Teuchos::ParameterList::ConstIterator it = paramLists[i].begin(); it != paramLists[i].end(); it++) {
2296 std::string paramName = paramLists[i].name(it);
2299 customVars.push_back(paramName);
2303 for (
size_t j = 0; j < customVars.size(); j++)
2304 paramLists[i].remove(customVars[j],
false);
2308 const int maxDepth = 0;
2309 for (
size_t i = 0; i < paramLists.size(); i++) {
2312 paramLists[i].validateParameters(validList, maxDepth);
2314 }
catch (
const Teuchos::Exceptions::InvalidParameterName& e) {
2315 std::string eString = e.what();
2318 size_t nameStart = eString.find_first_of(
'"') + 1;
2319 size_t nameEnd = eString.find_first_of(
'"', nameStart);
2320 std::string name = eString.substr(nameStart, nameEnd - nameStart);
2322 size_t bestScore = 100;
2323 std::string bestName =
"";
2324 for (ParameterList::ConstIterator it = validList.begin(); it != validList.end(); it++) {
2325 const std::string& pName = validList.name(it);
2326 this->GetOStream(
Runtime1) <<
"| " << pName;
2327 size_t score =
LevenshteinDistance(name.c_str(), name.length(), pName.c_str(), pName.length());
2328 this->GetOStream(
Runtime1) <<
" -> " << score << std::endl;
2329 if (score < bestScore) {
2334 if (bestScore < 10 && bestName !=
"") {
2335 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameterName,
2336 eString <<
"The parameter name \"" + name +
"\" is not valid. Did you mean \"" + bestName <<
"\"?\n");
2339 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameterName,
2340 eString <<
"The parameter name \"" + name +
"\" is not valid.\n");
2349template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2354 ParameterList paramList = constParamList;
2361 if (paramList.isSublist(
"Matrix")) {
2362 blockSize_ = paramList.sublist(
"Matrix").get<
int>(
"PDE equations", MasterList::getDefault<int>(
"number of equations"));
2363 dofOffset_ = paramList.sublist(
"Matrix").get<
GlobalOrdinal>(
"DOF offset", 0);
2367 if (factFact_ == Teuchos::null)
2379 if (paramList.isSublist(
"Factories"))
2380 this->BuildFactoryMap(paramList.sublist(
"Factories"), factoryMap, factoryMap, factoryManagers);
2394 if (paramList.isSublist(
"Hierarchy")) {
2395 ParameterList hieraList = paramList.sublist(
"Hierarchy");
2398 if (hieraList.isParameter(
"max levels")) {
2399 this->numDesiredLevel_ = hieraList.get<
int>(
"max levels");
2400 hieraList.remove(
"max levels");
2403 if (hieraList.isParameter(
"coarse: max size")) {
2404 this->maxCoarseSize_ = hieraList.get<
int>(
"coarse: max size");
2405 hieraList.remove(
"coarse: max size");
2408 if (hieraList.isParameter(
"repartition: rebalance P and R")) {
2409 this->doPRrebalance_ = hieraList.get<
bool>(
"repartition: rebalance P and R");
2410 hieraList.remove(
"repartition: rebalance P and R");
2413 if (hieraList.isParameter(
"transpose: use implicit")) {
2414 this->implicitTranspose_ = hieraList.get<
bool>(
"transpose: use implicit");
2415 hieraList.remove(
"transpose: use implicit");
2418 if (hieraList.isParameter(
"fuse prolongation and update")) {
2419 this->fuseProlongationAndUpdate_ = hieraList.get<
bool>(
"fuse prolongation and update");
2420 hieraList.remove(
"fuse prolongation and update");
2423 if (hieraList.isParameter(
"nullspace: suppress dimension check")) {
2424 this->suppressNullspaceDimensionCheck_ = hieraList.get<
bool>(
"nullspace: suppress dimension check");
2425 hieraList.remove(
"nullspace: suppress dimension check");
2428 if (hieraList.isParameter(
"number of vectors")) {
2429 this->sizeOfMultiVectors_ = hieraList.get<
int>(
"number of vectors");
2430 hieraList.remove(
"number of vectors");
2433 if (hieraList.isSublist(
"matvec params"))
2434 this->matvecParams_ = Teuchos::parameterList(hieraList.sublist(
"matvec params"));
2436 if (hieraList.isParameter(
"coarse grid correction scaling factor")) {
2437 this->scalingFactor_ = hieraList.get<
double>(
"coarse grid correction scaling factor");
2438 hieraList.remove(
"coarse grid correction scaling factor");
2442 if (hieraList.isParameter(
"cycle type")) {
2443 std::map<std::string, CycleType> cycleMap;
2447 std::string cycleType = hieraList.get<std::string>(
"cycle type");
2448 TEUCHOS_TEST_FOR_EXCEPTION(cycleMap.count(cycleType) == 0,
Exceptions::RuntimeError,
"Invalid cycle type: \"" << cycleType <<
"\"");
2449 this->Cycle_ = cycleMap[cycleType];
2452 if (hieraList.isParameter(
"W cycle start level")) {
2453 this->WCycleStartLevel_ = hieraList.get<
int>(
"W cycle start level");
2456 if (hieraList.isParameter(
"hierarchy label")) {
2457 this->hierarchyLabel_ = hieraList.get<std::string>(
"hierarchy label");
2460 if (hieraList.isParameter(
"verbosity")) {
2461 std::string vl = hieraList.get<std::string>(
"verbosity");
2462 hieraList.remove(
"verbosity");
2466 if (hieraList.isParameter(
"output filename"))
2469 if (hieraList.isParameter(
"dependencyOutputLevel"))
2470 this->graphOutputLevel_ = hieraList.get<
int>(
"dependencyOutputLevel");
2473 if (hieraList.isParameter(
"reuse"))
2476 if (hieraList.isSublist(
"DataToWrite")) {
2479 ParameterList foo = hieraList.sublist(
"DataToWrite");
2480 std::string dataName =
"Matrices";
2481 if (foo.isParameter(dataName))
2482 this->matricesToPrint_[
"A"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2483 dataName =
"Prolongators";
2484 if (foo.isParameter(dataName))
2485 this->matricesToPrint_[
"P"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2486 dataName =
"Restrictors";
2487 if (foo.isParameter(dataName))
2488 this->matricesToPrint_[
"R"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2490 if (foo.isParameter(dataName))
2491 this->matricesToPrint_[
"D0"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2495 for (ParameterList::ConstIterator param = hieraList.begin(); param != hieraList.end(); ++param) {
2496 const std::string& paramName = hieraList.name(param);
2498 if (paramName !=
"DataToWrite" && hieraList.isSublist(paramName)) {
2499 ParameterList levelList = hieraList.sublist(paramName);
2502 if (levelList.isParameter(
"startLevel")) {
2503 startLevel = levelList.get<
int>(
"startLevel");
2504 levelList.remove(
"startLevel");
2506 int numDesiredLevel = 1;
2507 if (levelList.isParameter(
"numDesiredLevel")) {
2508 numDesiredLevel = levelList.get<
int>(
"numDesiredLevel");
2509 levelList.remove(
"numDesiredLevel");
2523 BuildFactoryMap(levelList, factoryMap, levelFactoryMap, factoryManagers);
2525 RCP<FactoryManager> m = rcp(
new FactoryManager(levelFactoryMap));
2526 if (hieraList.isParameter(
"use kokkos refactor"))
2527 m->SetKokkosRefactor(hieraList.get<
bool>(
"use kokkos refactor"));
2529 if (startLevel >= 0)
2530 this->AddFactoryManager(startLevel, numDesiredLevel, m);
2532 TEUCHOS_TEST_FOR_EXCEPTION(
true,
Exceptions::RuntimeError,
"MueLu::ParameterListInterpreter():: invalid level id");
2661template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2664 for (ParameterList::ConstIterator param = paramList.begin(); param != paramList.end(); ++param) {
2665 const std::string& paramName = paramList.name(param);
2666 const Teuchos::ParameterEntry& paramValue = paramList.entry(param);
2670 if (paramValue.isList()) {
2671 ParameterList paramList1 = Teuchos::getValue<ParameterList>(paramValue);
2672 if (paramList1.isParameter(
"factory")) {
2675 "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.");
2677 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2679 }
else if (paramList1.isParameter(
"dependency for")) {
2681 "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.");
2683 std::string factoryName = paramList1.get<std::string>(
"dependency for");
2685 RCP<const FactoryBase> factbase = factoryMapIn.find(factoryName )->second;
2687 "MueLu::ParameterListInterpreter(): could not find factory " + factoryName +
" in factory map. Did you define it before?");
2689 RCP<const Factory> factoryconst = Teuchos::rcp_dynamic_cast<const Factory>(factbase);
2690 RCP<Factory> factory = Teuchos::rcp_const_cast<Factory>(factoryconst);
2693 RCP<const ParameterList> validParamList = factory->GetValidParameterList();
2694 for (ParameterList::ConstIterator vparam = validParamList->begin(); vparam != validParamList->end(); ++vparam) {
2695 const std::string& pName = validParamList->name(vparam);
2697 if (!paramList1.isParameter(pName)) {
2702 if (validParamList->isType<RCP<const FactoryBase> >(pName)) {
2704 RCP<const FactoryBase> generatingFact = factFact_->BuildFactory(paramList1.getEntry(pName), factoryMapIn, factoryManagers);
2705 factory->SetFactory(pName, generatingFact.create_weak());
2707 }
else if (validParamList->isType<RCP<const ParameterList> >(pName)) {
2708 if (pName ==
"ParameterList") {
2713 RCP<const ParameterList> subList = Teuchos::sublist(rcp(
new ParameterList(paramList1)), pName);
2714 factory->SetParameter(pName, ParameterEntry(subList));
2717 factory->SetParameter(pName, paramList1.getEntry(pName));
2721 }
else if (paramList1.isParameter(
"group")) {
2723 std::string groupType = paramList1.get<std::string>(
"group");
2725 "group must be of type \"FactoryManager\".");
2727 ParameterList groupList = paramList1;
2728 groupList.remove(
"group");
2730 bool setKokkosRefactor =
false;
2731 bool kokkosRefactor = useKokkos_;
2732 if (groupList.isParameter(
"use kokkos refactor")) {
2733 kokkosRefactor = groupList.get<
bool>(
"use kokkos refactor");
2734 groupList.remove(
"use kokkos refactor");
2735 setKokkosRefactor =
true;
2739 BuildFactoryMap(groupList, factoryMapIn, groupFactoryMap, factoryManagers);
2743 RCP<FactoryManager> m = rcp(
new FactoryManager(groupFactoryMap));
2744 if (setKokkosRefactor)
2745 m->SetKokkosRefactor(kokkosRefactor);
2746 factoryManagers[paramName] = m;
2749 this->GetOStream(
Warnings0) <<
"Could not interpret parameter list " << paramList1 << std::endl;
2751 "XML Parameter list must either be of type \"factory\" or of type \"group\".");
2755 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2763template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2766 Matrix& A =
dynamic_cast<Matrix&
>(Op);
2767 if (A.IsFixedBlockSizeSet() && (A.GetFixedBlockSize() != blockSize_))
2768 this->GetOStream(
Warnings0) <<
"Setting matrix block size to " << blockSize_ <<
" (value of the parameter in the list) "
2769 <<
"instead of " << A.GetFixedBlockSize() <<
" (provided matrix)." << std::endl
2770 <<
"You may want to check \"number of equations\" (or \"PDE equations\" for factory style list) parameter." << std::endl;
2772 A.SetFixedBlockSize(blockSize_, dofOffset_);
2774#ifdef HAVE_MUELU_DEBUG
2775 MatrixUtils::checkLocalRowMapMatchesColMap(A);
2778 }
catch (std::bad_cast&) {
2779 this->GetOStream(
Warnings0) <<
"Skipping setting block size as the operator is not a matrix" << std::endl;
2783template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2792static bool compare(
const ParameterList& list1,
const ParameterList& list2) {
2795 for (ParameterList::ConstIterator it = list1.begin(); it != list1.end(); it++) {
2796 const std::string& name = it->first;
2797 const Teuchos::ParameterEntry& entry1 = it->second;
2799 const Teuchos::ParameterEntry* entry2 = list2.getEntryPtr(name);
2802 if (entry1.isList() && entry2->isList()) {
2803 compare(Teuchos::getValue<ParameterList>(entry1), Teuchos::getValue<ParameterList>(*entry2));
2806 if (entry1.getAny(
false) != entry2->getAny(
false))
2813static inline bool areSame(
const ParameterList& list1,
const ParameterList& list2) {
2819#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.
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 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.