46 #ifndef MUELU_PARAMETERLISTINTERPRETER_DEF_HPP
47 #define MUELU_PARAMETERLISTINTERPRETER_DEF_HPP
59 #include "MueLu_Hierarchy.hpp"
60 #include "MueLu_FactoryManager.hpp"
62 #include "MueLu_AggregationExportFactory.hpp"
63 #include "MueLu_BrickAggregationFactory.hpp"
64 #include "MueLu_CoalesceDropFactory.hpp"
65 #include "MueLu_CoarseMapFactory.hpp"
66 #include "MueLu_ConstraintFactory.hpp"
67 #include "MueLu_CoordinatesTransferFactory.hpp"
68 #include "MueLu_CoupledAggregationFactory.hpp"
69 #include "MueLu_DirectSolver.hpp"
70 #include "MueLu_EminPFactory.hpp"
72 #include "MueLu_FacadeClassFactory.hpp"
73 #include "MueLu_FactoryFactory.hpp"
74 #include "MueLu_FilteredAFactory.hpp"
75 #include "MueLu_GenericRFactory.hpp"
76 #include "MueLu_LineDetectionFactory.hpp"
78 #include "MueLu_NullspaceFactory.hpp"
79 #include "MueLu_PatternFactory.hpp"
80 #include "MueLu_PgPFactory.hpp"
81 #include "MueLu_RAPFactory.hpp"
82 #include "MueLu_RAPShiftFactory.hpp"
83 #include "MueLu_RebalanceAcFactory.hpp"
84 #include "MueLu_RebalanceTransferFactory.hpp"
85 #include "MueLu_RepartitionFactory.hpp"
86 #include "MueLu_SaPFactory.hpp"
87 #include "MueLu_SemiCoarsenPFactory.hpp"
88 #include "MueLu_SmootherFactory.hpp"
89 #include "MueLu_TentativePFactory.hpp"
90 #include "MueLu_TogglePFactory.hpp"
91 #include "MueLu_ToggleCoordinatesTransferFactory.hpp"
92 #include "MueLu_TransPFactory.hpp"
93 #include "MueLu_UncoupledAggregationFactory.hpp"
94 #include "MueLu_HybridAggregationFactory.hpp"
95 #include "MueLu_ZoltanInterface.hpp"
96 #include "MueLu_Zoltan2Interface.hpp"
97 #include "MueLu_NodePartitionInterface.hpp"
99 #ifdef HAVE_MUELU_KOKKOS_REFACTOR
100 #include "MueLu_CoalesceDropFactory_kokkos.hpp"
101 #include "MueLu_CoarseMapFactory_kokkos.hpp"
102 #include "MueLu_CoordinatesTransferFactory_kokkos.hpp"
103 #include "MueLu_NullspaceFactory_kokkos.hpp"
104 #include "MueLu_SaPFactory_kokkos.hpp"
105 #include "MueLu_TentativePFactory_kokkos.hpp"
106 #include "MueLu_UncoupledAggregationFactory_kokkos.hpp"
109 #ifdef HAVE_MUELU_MATLAB
110 #include "../matlab/src/MueLu_MatlabSmoother_decl.hpp"
111 #include "../matlab/src/MueLu_MatlabSmoother_def.hpp"
112 #include "../matlab/src/MueLu_TwoLevelMatlabFactory_decl.hpp"
113 #include "../matlab/src/MueLu_TwoLevelMatlabFactory_def.hpp"
114 #include "../matlab/src/MueLu_SingleLevelMatlabFactory_decl.hpp"
115 #include "../matlab/src/MueLu_SingleLevelMatlabFactory_def.hpp"
118 #ifdef HAVE_MUELU_INTREPID2
119 #include "MueLu_IntrepidPCoarsenFactory.hpp"
122 #include <unordered_set>
126 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
129 if(facadeFact == Teuchos::null)
135 std::string filename = paramList.
get(
"xml parameter file",
"");
136 if (filename.length() != 0) {
152 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
155 if(facadeFact == Teuchos::null)
165 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
173 SetFactoryParameterList(paramList);
175 }
else if (paramList.
isParameter(
"MueLu preconditioner") ==
true) {
176 this->GetOStream(
Runtime0) <<
"Use facade class: " << paramList.
get<std::string>(
"MueLu preconditioner") << std::endl;
178 SetFactoryParameterList(*pp);
185 Validate(serialList);
186 SetEasyParameterList(paramList);
199 #define MUELU_SET_VAR_2LIST(paramList, defaultList, paramName, paramType, varName) \
201 if (paramList.isParameter(paramName)) varName = paramList.get<paramType>(paramName); \
202 else if (defaultList.isParameter(paramName)) varName = defaultList.get<paramType>(paramName); \
203 else varName = MasterList::getDefault<paramType>(paramName);
205 #define MUELU_TEST_AND_SET_VAR(paramList, paramName, paramType, varName) \
206 (paramList.isParameter(paramName) ? varName = paramList.get<paramType>(paramName), true : false)
210 #define MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList, paramName, paramType, listWrite) \
212 if (paramList .isParameter(paramName)) listWrite.set(paramName, paramList .get<paramType>(paramName)); \
213 else if (defaultList.isParameter(paramName)) listWrite.set(paramName, defaultList.get<paramType>(paramName)); \
215 catch(Teuchos::Exceptions::InvalidParameterType) { \
216 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(true, Teuchos::Exceptions::InvalidParameterType, \
217 "Error: parameter \"" << paramName << "\" must be of type " << Teuchos::TypeNameTraits<paramType>::name()); \
220 #define MUELU_TEST_PARAM_2LIST(paramList, defaultList, paramName, paramType, cmpValue) \
222 paramList.isParameter(paramName) ? paramList .get<paramType>(paramName) : ( \
223 defaultList.isParameter(paramName) ? defaultList.get<paramType>(paramName) : \
224 MasterList::getDefault<paramType>(paramName) ) ) )
226 #ifndef HAVE_MUELU_KOKKOS_REFACTOR
227 #define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory) \
228 RCP<Factory> varName = rcp(new oldFactory());
229 #define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory) \
230 varName = rcp(new oldFactory());
232 #define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory) \
233 RCP<Factory> varName; \
234 if (!useKokkos_) varName = rcp(new oldFactory()); \
235 else varName = rcp(new newFactory());
236 #define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory) \
237 if (!useKokkos_) varName = rcp(new oldFactory()); \
238 else varName = rcp(new newFactory());
241 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
246 MUELU_SET_VAR_2LIST(constParamList, constParamList,
"problem: type", std::string, problemType);
247 if (problemType !=
"unknown") {
253 paramList = constParamList;
257 #if !defined(HAVE_MUELU_KOKKOS_REFACTOR)
259 #elif defined(HAVE_MUELU_KOKKOS_REFACTOR_USE_BY_DEFAULT)
261 tempList.
set(
"use kokkos refactor",
true);
263 useKokkos_ = useKokkos;
266 useKokkos_ = useKokkos;
272 Factory::EnableTimerSync();
276 std::map<std::string, CycleType> cycleMap;
280 auto cycleType = paramList.
get<std::string>(
"cycle type");
282 "Invalid cycle type: \"" << cycleType <<
"\"");
283 Cycle_ = cycleMap[cycleType];
286 if (paramList.
isParameter(
"coarse grid correction scaling factor"))
287 scalingFactor_ = paramList.
get<
double>(
"coarse grid correction scaling factor");
289 this->maxCoarseSize_ = paramList.
get<
int> (
"coarse: max size", MasterList::getDefault<int>(
"coarse: max size"));
290 this->numDesiredLevel_ = paramList.
get<
int> (
"max levels", MasterList::getDefault<int>(
"max levels"));
291 blockSize_ = paramList.
get<
int> (
"number of equations", MasterList::getDefault<int>(
"number of equations"));
296 if (paramList.
isSublist(
"export data")) {
300 this->matricesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"A");
302 this->prolongatorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"P");
304 this->restrictorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"R");
306 this->nullspaceToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Nullspace");
308 this->coordinatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Coordinates");
309 if (printList.
isParameter(
"pcoarsen: element to node map"))
310 this->elementToNodeMapsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"pcoarsen: element to node map");
316 std::map<std::string, MsgType> verbMap;
317 verbMap[
"none"] =
None;
318 verbMap[
"low"] =
Low;
319 verbMap[
"medium"] =
Medium;
320 verbMap[
"high"] =
High;
322 verbMap[
"test"] =
Test;
327 "Invalid verbosity level: \"" << verbosityLevel <<
"\"");
328 this->verbosity_ = verbMap[verbosityLevel];
339 useCoordinates_ =
false;
340 if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"distance laplacian") ||
343 useCoordinates_ =
true;
344 }
else if(paramList.
isSublist(
"smoother: params")) {
345 const auto smooParamList = paramList.
sublist(
"smoother: params");
346 if(smooParamList.isParameter(
"partitioner: type") &&
347 (smooParamList.get<std::string>(
"partitioner: type") ==
"line")) {
348 useCoordinates_ =
true;
351 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
352 std::string levelStr =
"level " +
toString(levelID);
357 if (
MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"distance laplacian") ||
360 useCoordinates_ =
true;
368 if (!paramList.
isSublist(
"repartition: params")) {
369 useCoordinates_ =
true;
372 if (repParams.
isType<std::string>(
"algorithm")) {
373 const std::string algo = repParams.
get<std::string>(
"algorithm");
374 if (algo ==
"multijagged" || algo ==
"rcb") {
375 useCoordinates_ =
true;
378 useCoordinates_ =
true;
382 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
383 std::string levelStr =
"level " +
toString(levelID);
389 if (!levelList.
isSublist(
"repartition: params")) {
390 useCoordinates_ =
true;
394 if (repParams.
isType<std::string>(
"algorithm")) {
395 const std::string algo = repParams.
get<std::string>(
"algorithm");
396 if (algo ==
"multijagged" || algo ==
"rcb"){
397 useCoordinates_ =
true;
401 useCoordinates_ =
true;
410 changedPRrebalance_ =
false;
412 changedPRrebalance_ =
MUELU_TEST_AND_SET_VAR(paramList,
"repartition: rebalance P and R",
bool, this->doPRrebalance_);
415 changedImplicitTranspose_ =
MUELU_TEST_AND_SET_VAR(paramList,
"transpose: use implicit",
bool, this->implicitTranspose_);
423 std::vector<keep_pair> keeps0;
424 UpdateFactoryManager(paramList,
ParameterList(), *defaultManager, 0, keeps0);
427 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
436 std::vector<keep_pair> keeps;
440 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
444 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
447 this->keep_[levelID] = keeps;
448 this->AddFactoryManager(levelID, 1, levelManager);
455 this->GetOStream(static_cast<MsgType>(
Runtime1), 0) << paramList << std::endl;
470 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
471 std::string levelStr =
"level " +
toString(levelID);
486 std::ostringstream unusedParamsStream;
488 unusedParamList.
print(unusedParamsStream, indent);
490 this->GetOStream(
Warnings1) <<
"The following parameters were not used:\n" << unusedParamsStream.str() << std::endl;
501 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
504 int levelID, std::vector<keep_pair>& keeps)
const
509 using strings = std::unordered_set<std::string>;
519 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
521 Exceptions::RuntimeError,
"Unknown \"multigrid algorithm\" value: \"" << multigridAlgo <<
"\". Please consult User's Guide.");
522 #ifndef HAVE_MUELU_MATLAB
524 "Cannot use matlab for multigrid algorithm - MueLu was not configured with MATLAB support.");
526 #ifndef HAVE_MUELU_INTREPID2
528 "Cannot use IntrepidPCoarsen prolongator factory - MueLu was not configured with Intrepid support.");
533 if (reuseType ==
"none" || reuseType ==
"S" || reuseType ==
"RP" || reuseType ==
"RAP") {
536 }
else if (reuseType ==
"tP" && (multigridAlgo !=
"sa" && multigridAlgo !=
"unsmoothed")) {
538 this->GetOStream(
Warnings0) <<
"Ignoring \"tP\" reuse option as it is only compatible with \"sa\", "
539 "or \"unsmoothed\" multigrid algorithms" << std::endl;
541 }
else if (reuseType ==
"emin" && multigridAlgo !=
"emin") {
543 this->GetOStream(
Warnings0) <<
"Ignoring \"emin\" reuse option it is only compatible with "
544 "\"emin\" multigrid algorithm" << std::endl;
549 bool have_userP =
false;
554 UpdateFactoryManager_Smoothers(paramList, defaultList, manager, levelID, keeps);
557 UpdateFactoryManager_CoarseSolvers(paramList, defaultList, manager, levelID, keeps);
560 UpdateFactoryManager_Aggregation_TentativeP(paramList, defaultList, manager, levelID, keeps);
564 UpdateFactoryManager_Nullspace(paramList, defaultList, manager, levelID, keeps, nullSpaceFactory);
575 }
else if (multigridAlgo ==
"unsmoothed") {
579 }
else if (multigridAlgo ==
"sa") {
581 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
583 }
else if (multigridAlgo ==
"emin") {
585 UpdateFactoryManager_Emin(paramList, defaultList, manager, levelID, keeps);
587 }
else if (multigridAlgo ==
"pg") {
589 UpdateFactoryManager_PG(paramList, defaultList, manager, levelID, keeps);
591 }
else if (multigridAlgo ==
"matlab") {
593 UpdateFactoryManager_Matlab(paramList, defaultList, manager, levelID, keeps);
595 }
else if (multigridAlgo ==
"pcoarsen") {
597 UpdateFactoryManager_PCoarsen(paramList, defaultList, manager, levelID, keeps);
601 UpdateFactoryManager_SemiCoarsen(paramList, defaultList, manager, levelID, keeps);
604 UpdateFactoryManager_Restriction(paramList, defaultList, manager, levelID, keeps);
607 UpdateFactoryManager_RAP(paramList, defaultList, manager, levelID, keeps);
610 UpdateFactoryManager_Coordinates(paramList, defaultList, manager, levelID, keeps);
613 if ((reuseType ==
"RP" || reuseType ==
"RAP" || reuseType ==
"full") && levelID)
616 if (reuseType ==
"RP" && levelID) {
618 if (!this->implicitTranspose_)
621 if ((reuseType ==
"tP" || reuseType ==
"RP" || reuseType ==
"emin") && useCoordinates_ && levelID)
625 UpdateFactoryManager_Repartition(paramList, defaultList, manager, levelID, keeps, nullSpaceFactory);
628 if ((reuseType ==
"RAP" || reuseType ==
"full") && levelID) {
630 if (!this->implicitTranspose_)
639 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
642 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const
644 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
649 bool isCustomSmoother =
652 paramList.
isSublist (
"smoother: params") || paramList.
isSublist (
"smoother: pre params") || paramList.
isSublist (
"smoother: post params") ||
658 manager.
SetFactory(
"Smoother", Teuchos::null);
660 }
else if (isCustomSmoother) {
664 #define TEST_MUTUALLY_EXCLUSIVE(arg1,arg2) \
665 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isParameter(#arg1) && paramList.isParameter(#arg2), \
666 Exceptions::InvalidArgument, "You cannot specify both \""#arg1"\" and \""#arg2"\"");
667 #define TEST_MUTUALLY_EXCLUSIVE_S(arg1,arg2) \
668 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isSublist(#arg1) && paramList.isSublist(#arg2), \
669 Exceptions::InvalidArgument, "You cannot specify both \""#arg1"\" and \""#arg2"\"");
685 defaultSmootherParams.
set(
"relaxation: type",
"Symmetric Gauss-Seidel");
690 std::string preSmootherType, postSmootherType;
694 overlap = paramList.
get<
int>(
"smoother: overlap");
698 preSmootherType = paramList.
get<std::string>(
"smoother: pre type");
700 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, preSmootherTypeTmp);
701 preSmootherType = preSmootherTypeTmp;
703 if (paramList.
isParameter(
"smoother: pre overlap"))
704 overlap = paramList.
get<
int>(
"smoother: pre overlap");
706 if (paramList.
isSublist(
"smoother: pre params"))
707 preSmootherParams = paramList.
sublist(
"smoother: pre params");
708 else if (paramList.
isSublist(
"smoother: params"))
709 preSmootherParams = paramList.
sublist(
"smoother: params");
710 else if (defaultList.
isSublist(
"smoother: params"))
711 preSmootherParams = defaultList.
sublist(
"smoother: params");
712 else if (preSmootherType ==
"RELAXATION")
713 preSmootherParams = defaultSmootherParams;
715 #ifdef HAVE_MUELU_INTREPID2
717 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
721 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
722 auto pcoarsen_element = defaultList.
get<std::string>(
"pcoarsen: element");
724 if (levelID < (
int)pcoarsen_schedule.size()) {
726 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
727 preSmootherParams.
set(
"pcoarsen: hi basis", lo);
732 #ifdef HAVE_MUELU_MATLAB
733 if (preSmootherType ==
"matlab")
742 postSmootherType = paramList.
get<std::string>(
"smoother: post type");
744 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, postSmootherTypeTmp);
745 postSmootherType = postSmootherTypeTmp;
748 if (paramList.
isSublist(
"smoother: post params"))
749 postSmootherParams = paramList.
sublist(
"smoother: post params");
750 else if (paramList.
isSublist(
"smoother: params"))
751 postSmootherParams = paramList.
sublist(
"smoother: params");
752 else if (defaultList.
isSublist(
"smoother: params"))
753 postSmootherParams = defaultList.
sublist(
"smoother: params");
754 else if (postSmootherType ==
"RELAXATION")
755 postSmootherParams = defaultSmootherParams;
756 if (paramList.
isParameter(
"smoother: post overlap"))
757 overlap = paramList.
get<
int>(
"smoother: post overlap");
759 if (postSmootherType == preSmootherType &&
areSame(preSmootherParams, postSmootherParams))
760 postSmoother = preSmoother;
762 #ifdef HAVE_MUELU_INTREPID2
764 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
768 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
769 auto pcoarsen_element = defaultList.
get<std::string>(
"pcoarsen: element");
771 if (levelID < (
int)pcoarsen_schedule.size()) {
773 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
774 postSmootherParams.
set(
"pcoarsen: hi basis", lo);
779 #ifdef HAVE_MUELU_MATLAB
780 if (postSmootherType ==
"matlab")
788 if (preSmoother == postSmoother)
791 manager.
SetFactory(
"PreSmoother", preSmoother);
792 manager.
SetFactory(
"PostSmoother", postSmoother);
799 bool reuseSmoothers = (reuseType ==
"S" || reuseType !=
"none");
800 if (reuseSmoothers) {
801 auto preSmootherFactory = rcp_const_cast<
Factory>(rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"PreSmoother")));
803 if (preSmootherFactory != Teuchos::null) {
805 postSmootherFactoryParams.
set(
"keep smoother data",
true);
806 preSmootherFactory->SetParameterList(postSmootherFactoryParams);
808 keeps.push_back(
keep_pair(
"PreSmoother data", preSmootherFactory.get()));
811 auto postSmootherFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"PostSmoother")));
812 if (postSmootherFactory != Teuchos::null) {
814 postSmootherFactoryParams.
set(
"keep smoother data",
true);
815 postSmootherFactory->SetParameterList(postSmootherFactoryParams);
817 keeps.push_back(
keep_pair(
"PostSmoother data", postSmootherFactory.get()));
820 auto coarseFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"CoarseSolver")));
821 if (coarseFactory != Teuchos::null) {
823 coarseFactoryParams.
set(
"keep smoother data",
true);
824 coarseFactory->SetParameterList(coarseFactoryParams);
826 keeps.push_back(
keep_pair(
"PreSmoother data", coarseFactory.get()));
830 if ((reuseType ==
"RAP" && levelID) || (reuseType ==
"full")) {
849 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
855 bool isCustomCoarseSolver =
859 this->GetOStream(
Warnings0) <<
"No coarse grid solver" << std::endl;
860 manager.
SetFactory(
"CoarseSolver", Teuchos::null);
862 }
else if (isCustomCoarseSolver) {
870 overlap = paramList.
get<
int>(
"coarse: overlap");
873 if (paramList.
isSublist(
"coarse: params"))
874 coarseParams = paramList.
sublist(
"coarse: params");
875 else if (defaultList.
isSublist(
"coarse: params"))
876 coarseParams = defaultList.
sublist(
"coarse: params");
878 using strings = std::unordered_set<std::string>;
884 if (strings({
"RELAXATION",
"CHEBYSHEV",
"ILUT",
"ILU",
"RILUK",
"SCHWARZ",
"Amesos",
885 "BLOCK RELAXATION",
"BLOCK_RELAXATION",
"BLOCKRELAXATION" ,
886 "SPARSE BLOCK RELAXATION",
"SPARSE_BLOCK_RELAXATION",
"SPARSEBLOCKRELAXATION",
887 "LINESMOOTHING_BANDEDRELAXATION",
"LINESMOOTHING_BANDED_RELAXATION",
"LINESMOOTHING_BANDED RELAXATION",
888 "LINESMOOTHING_TRIDIRELAXATION",
"LINESMOOTHING_TRIDI_RELAXATION",
"LINESMOOTHING_TRIDI RELAXATION",
889 "LINESMOOTHING_TRIDIAGONALRELAXATION",
"LINESMOOTHING_TRIDIAGONAL_RELAXATION",
"LINESMOOTHING_TRIDIAGONAL RELAXATION",
890 "TOPOLOGICAL",
"FAST_ILU",
"FAST_IC",
"FAST_ILDL"}).count(coarseType)) {
893 #ifdef HAVE_MUELU_MATLAB
894 if (coarseType ==
"matlab")
908 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
911 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const
913 using strings = std::unordered_set<std::string>;
921 #ifdef HAVE_MUELU_MATLAB
926 throw std::runtime_error(
"Cannot use MATLAB evolutionary strength-of-connection - MueLu was not configured with MATLAB support.");
931 dropParams.
set(
"lightweight wrap",
true);
948 #ifndef HAVE_MUELU_MATLAB
949 if (aggType ==
"matlab")
950 throw std::runtime_error(
"Cannot use MATLAB aggregation - MueLu was not configured with MATLAB support.");
953 if (aggType ==
"uncoupled") {
977 }
else if (aggType ==
"coupled") {
981 }
else if (aggType ==
"brick") {
993 aggFactory->
SetFactory(
"Coordinates", this->GetFactoryManager(levelID-1)->GetFactory(
"Coordinates"));
996 #ifdef HAVE_MUELU_MATLAB
997 else if(aggType ==
"matlab") {
1003 manager.
SetFactory(
"Aggregates", aggFactory);
1007 coarseMap->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1013 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1014 ptentParams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1015 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1016 ptentParams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1019 Ptent->SetParameterList(ptentParams);
1020 Ptent->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1021 Ptent->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1024 if (reuseType ==
"tP" && levelID) {
1025 keeps.push_back(
keep_pair(
"Nullspace", Ptent.get()));
1026 keeps.push_back(
keep_pair(
"P", Ptent.get()));
1033 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1036 int , std::vector<keep_pair>& keeps)
const
1050 std::string alg = paramList.
get(
"rap: algorithm",
"galerkin");
1051 if (alg ==
"shift" || alg ==
"non-galerkin") {
1063 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1064 RAPparams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1065 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1066 RAPparams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1072 if (paramList.
isParameter(
"aggregation: allow empty prolongator columns")) {
1073 RAPparams.
set(
"CheckMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1074 RAPparams.
set(
"RepairMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1076 else if (defaultList.
isParameter(
"aggregation: allow empty prolongator columns")) {
1077 RAPparams.
set(
"CheckMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1078 RAPparams.
set(
"RepairMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1094 if (!this->implicitTranspose_) {
1101 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: export visualization data",
bool,
true)) {
1125 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
1126 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
1128 if (reuseType ==
"RP" || (reuseType ==
"tP" && !filteringChangesMatrix)) {
1130 keeps.push_back(
keep_pair(
"AP reuse data", RAP.
get()));
1131 keeps.push_back(
keep_pair(
"RAP reuse data", RAP.
get()));
1134 keeps.push_back(
keep_pair(
"AP reuse data", RAPs.
get()));
1135 keeps.push_back(
keep_pair(
"RAP reuse data", RAPs.
get()));
1143 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1148 bool have_userCO =
false;
1152 if (useCoordinates_) {
1158 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1159 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1163 if (!RAP.is_null()) {
1164 RAP->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1167 RAPs->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1176 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1181 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
1182 bool have_userR =
false;
1187 if (!this->implicitTranspose_) {
1190 if (isSymmetric ==
false && (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"emin")) {
1192 "Switching \"problem: symmetric\" parameter to symmetric as multigrid algorithm. " <<
1193 multigridAlgo <<
" is primarily supposed to be used for symmetric problems.\n\n" <<
1194 "Please note: if you are using \"unsmoothed\" transfer operators the \"problem: symmetric\" parameter " <<
1195 "has no real mathematical meaning, i.e. you can use it for non-symmetric\n" <<
1196 "problems, too. With \"problem: symmetric\"=\"symmetric\" you can use implicit transpose for building " <<
1197 "the restriction operators which may drastically reduce the amount of consumed memory." << std::endl;
1201 "Petrov-Galerkin smoothed transfer operators are only allowed for non-symmetric problems: Set \"problem: symmetric\" to false!\n" \
1202 "While PG smoothed transfer operators generally would also work for symmetric problems this is an unusual use case. " \
1203 "You can use the factory-based xml interface though if you need PG-AMG for symmetric problems.");
1224 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1227 int levelID, std::vector<keep_pair>& keeps,
RCP<Factory> & nullSpaceFactory)
const
1232 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: node repartition level",
int,nodeRepartitionLevel);
1272 "Reuse types \"tP\" and \"PR\" require \"repartition: rebalance P and R\" set to \"false\"");
1277 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: partitioner", std::string, partName);
1279 "Invalid partitioner name: \"" << partName <<
"\". Valid options: \"zoltan\", \"zoltan2\"");
1281 bool switched =
false;
1283 #ifndef HAVE_MUELU_ZOLTAN
1284 if (partName ==
"zoltan") {
1285 this->GetOStream(
Warnings0) <<
"Zoltan interface is not available, trying to switch to Zoltan2" << std::endl;
1286 partName =
"zoltan2";
1290 #ifndef HAVE_MUELU_ZOLTAN2
1291 if (partName ==
"zoltan2" && !switched) {
1292 this->GetOStream(
Warnings0) <<
"Zoltan2 interface is not available, trying to switch to Zoltan" << std::endl;
1293 partName =
"zoltan";
1305 repartheurFactory->SetParameterList(repartheurParams);
1306 repartheurFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1307 manager.
SetFactory(
"number of partitions", repartheurFactory);
1308 manager.
SetFactory(
"repartition: heuristic target rows per process", repartheurFactory);
1312 if (levelID == nodeRepartitionLevel) {
1324 else if (partName ==
"zoltan") {
1325 #ifdef HAVE_MUELU_ZOLTAN
1331 }
else if (partName ==
"zoltan2") {
1332 #ifdef HAVE_MUELU_ZOLTAN2
1336 partParams.
set(
"ParameterList", partpartParams);
1338 partitioner->
SetFactory(
"repartition: heuristic target rows per process",
1339 manager.
GetFactory(
"repartition: heuristic target rows per process"));
1347 if (useCoordinates_)
1349 manager.
SetFactory(
"Partition", partitioner);
1357 repartFactory->SetParameterList(repartParams);
1358 repartFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1359 repartFactory->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1360 repartFactory->SetFactory(
"Partition", manager.
GetFactory(
"Partition"));
1361 manager.
SetFactory(
"Importer", repartFactory);
1362 if (reuseType !=
"none" && reuseType !=
"S" && levelID)
1369 newA->SetParameterList(rebAcParams);
1370 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1371 newA->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1377 newPparams.
set(
"type",
"Interpolation");
1378 if (changedPRrebalance_)
1379 newPparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1381 newP-> SetParameterList(newPparams);
1382 newP-> SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1383 newP-> SetFactory(
"P", manager.
GetFactory(
"P"));
1384 if (!paramList.
isParameter(
"semicoarsen: number of levels"))
1385 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1387 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"P"));
1388 if (useCoordinates_)
1389 newP-> SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1391 if (useCoordinates_)
1397 newRparams.
set(
"type",
"Restriction");
1399 if (changedPRrebalance_)
1400 newRparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1401 if (changedImplicitTranspose_)
1402 newRparams.
set(
"transpose: use implicit", this->implicitTranspose_);
1403 newR-> SetParameterList(newRparams);
1404 newR-> SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1405 if (!this->implicitTranspose_) {
1406 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1417 nullSpaceFactory->
SetFactory(
"Nullspace", newP);
1427 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1430 int , std::vector<keep_pair>& ,
RCP<Factory> & nullSpaceFactory)
const
1435 bool have_userNS =
false;
1440 nullSpace->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1443 nullSpaceFactory = nullSpace;
1449 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1452 int , std::vector<keep_pair>& )
const
1456 if (paramList.
isParameter(
"semicoarsen: number of levels") &&
1457 paramList.
get<
int>(
"semicoarsen: number of levels") > 0) {
1482 manager.
SetFactory(
"CoarseNumZLayers", linedetectionFactory);
1483 manager.
SetFactory(
"LineDetection_Layers", linedetectionFactory);
1484 manager.
SetFactory(
"LineDetection_VertLineIds", linedetectionFactory);
1488 manager.
SetFactory(
"Nullspace", togglePFactory);
1492 if (paramList.
isParameter(
"semicoarsen: number of levels")) {
1494 tf->SetFactory(
"Chosen P", manager.
GetFactory(
"P"));
1495 tf->AddCoordTransferFactory(semicoarsenFactory);
1498 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1499 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1500 tf->AddCoordTransferFactory(coords);
1509 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1512 int levelID, std::vector<keep_pair>& keeps)
const
1514 #ifdef HAVE_MUELU_INTREPID2
1519 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
1520 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
1522 if (levelID >= (
int)pcoarsen_schedule.size()) {
1525 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
1531 std::string lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
1532 std::string hi = (levelID ? pcoarsen_element + std::to_string(pcoarsen_schedule[levelID-1]) : lo);
1533 Pparams.
set(
"pcoarsen: hi basis", hi);
1534 Pparams.
set(
"pcoarsen: lo basis", lo);
1535 P->SetParameterList(Pparams);
1548 P->SetParameterList(Pparams);
1561 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1567 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1568 Pparams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1569 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1570 Pparams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1572 P->SetParameterList(Pparams);
1575 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
1592 P->SetFactory(
"A", filterFactory);
1595 P->SetFactory(
"A", manager.
GetFactory(
"Graph"));
1599 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
1602 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
1604 if (reuseType ==
"tP" && !filteringChangesMatrix)
1605 keeps.push_back(
keep_pair(
"AP reuse data", P.get()));
1611 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1614 int , std::vector<keep_pair>& )
const
1619 "Invalid pattern name: \"" << patternType <<
"\". Valid options: \"AkPtent\"");
1624 patternFactory->SetParameterList(patternParams);
1625 patternFactory->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
1626 manager.
SetFactory(
"Ppattern", patternFactory);
1630 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
1631 constraintFactory->SetFactory(
"CoarseNullspace", manager.
GetFactory(
"Ptent"));
1632 manager.
SetFactory(
"Constraint", constraintFactory);
1639 if (reuseType ==
"emin") {
1641 Pparams.
set(
"Keep P0",
true);
1642 Pparams.
set(
"Keep Constraint0",
true);
1644 P->SetParameterList(Pparams);
1645 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
1646 P->SetFactory(
"Constraint", manager.
GetFactory(
"Constraint"));
1653 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1656 int , std::vector<keep_pair>& )
const
1659 "Implicit transpose not supported with Petrov-Galerkin smoothed transfer operators: Set \"transpose: use implicit\" to false!\n" \
1660 "Petrov-Galerkin transfer operator smoothing for non-symmetric problems requires a separate handling of the restriction operator which " \
1661 "does not allow the usage of implicit transpose easily.");
1665 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
1673 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1676 int , std::vector<keep_pair>& )
const {
1677 #ifdef HAVE_MUELU_MATLAB
1680 P->SetParameterList(Pparams);
1681 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
1689 #undef MUELU_SET_VAR_2LIST
1690 #undef MUELU_TEST_AND_SET_VAR
1691 #undef MUELU_TEST_AND_SET_PARAM_2LIST
1692 #undef MUELU_TEST_PARAM_2LIST
1693 #undef MUELU_KOKKOS_FACTORY
1697 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1702 const int maxLevels = 100;
1705 std::vector<ParameterList> paramLists;
1706 for (
int levelID = 0; levelID < maxLevels; levelID++) {
1707 std::string sublistName =
"level " +
toString(levelID);
1709 paramLists.push_back(paramList.
sublist(sublistName));
1711 paramList.
remove(sublistName);
1714 paramLists.push_back(paramList);
1716 #ifdef HAVE_MUELU_MATLAB
1718 for (
size_t i = 0; i < paramLists.size(); i++) {
1719 std::vector<std::string> customVars;
1722 std::string paramName = paramLists[i].name(it);
1725 customVars.push_back(paramName);
1729 for (
size_t j = 0; j < customVars.size(); j++)
1730 paramLists[i].
remove(customVars[j],
false);
1734 const int maxDepth = 0;
1735 for (
size_t i = 0; i < paramLists.size(); i++) {
1738 paramLists[i].validateParameters(validList, maxDepth);
1741 std::string eString = e.what();
1744 size_t nameStart = eString.find_first_of(
'"') + 1;
1745 size_t nameEnd = eString.find_first_of(
'"', nameStart);
1746 std::string name = eString.substr(nameStart, nameEnd - nameStart);
1748 size_t bestScore = 100;
1749 std::string bestName =
"";
1751 const std::string& pName = validList.
name(it);
1752 this->GetOStream(
Runtime1) <<
"| " << pName;
1753 size_t score =
LevenshteinDistance(name.c_str(), name.length(), pName.c_str(), pName.length());
1754 this->GetOStream(
Runtime1) <<
" -> " << score << std::endl;
1755 if (score < bestScore) {
1760 if (bestScore < 10 && bestName !=
"") {
1762 eString <<
"The parameter name \"" + name +
"\" is not valid. Did you mean \"" + bestName <<
"\"?\n");
1766 eString <<
"The parameter name \"" + name +
"\" is not valid.\n");
1775 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1788 blockSize_ = paramList.
sublist(
"Matrix").
get<
int>(
"PDE equations", MasterList::getDefault<int>(
"number of equations"));
1789 dofOffset_ = paramList.
sublist(
"Matrix").
get<GlobalOrdinal>(
"DOF offset", 0);
1793 if (factFact_ == Teuchos::null)
1806 this->BuildFactoryMap(paramList.
sublist(
"Factories"), factoryMap, factoryMap, factoryManagers);
1825 this->numDesiredLevel_ = hieraList.
get<
int>(
"max levels");
1826 hieraList.
remove(
"max levels");
1830 this->maxCoarseSize_ = hieraList.
get<
int>(
"coarse: max size");
1831 hieraList.
remove(
"coarse: max size");
1834 if (hieraList.
isParameter(
"repartition: rebalance P and R")) {
1835 this->doPRrebalance_ = hieraList.
get<
bool>(
"repartition: rebalance P and R");
1836 hieraList.
remove(
"repartition: rebalance P and R");
1839 if (hieraList.
isParameter(
"transpose: use implicit")) {
1840 this->implicitTranspose_ = hieraList.
get<
bool>(
"transpose: use implicit");
1841 hieraList.
remove(
"transpose: use implicit");
1844 if (hieraList.
isParameter(
"coarse grid correction scaling factor")) {
1845 this->scalingFactor_ = hieraList.
get<
double>(
"coarse grid correction scaling factor");
1846 hieraList.
remove(
"coarse grid correction scaling factor");
1851 std::map<std::string, CycleType> cycleMap;
1855 std::string cycleType = hieraList.
get<std::string>(
"cycle type");
1857 this->Cycle_ = cycleMap[cycleType];
1861 std::map<std::string, MsgType> verbMap;
1863 verbMap[
"Errors"] =
Errors;
1880 verbMap[
"Debug"] =
Debug;
1881 verbMap[
"Test"] =
Test;
1883 verbMap[
"None"] =
None;
1884 verbMap[
"Low"] =
Low;
1885 verbMap[
"Medium"] =
Medium;
1886 verbMap[
"High"] =
High;
1889 std::string vl = hieraList.
get<std::string>(
"verbosity");
1890 hieraList.
remove(
"verbosity");
1892 if (verbMap.find(vl) != verbMap.end())
1893 this->verbosity_ = verbMap[vl];
1898 if (hieraList.
isParameter(
"dependencyOutputLevel"))
1899 this->graphOutputLevel_ = hieraList.
get<
int>(
"dependencyOutputLevel");
1905 if (hieraList.
isSublist(
"DataToWrite")) {
1909 std::string dataName =
"Matrices";
1911 this->matricesToPrint_ = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
1912 dataName =
"Prolongators";
1914 this->prolongatorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
1915 dataName =
"Restrictors";
1917 this->restrictorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
1922 const std::string & paramName = hieraList.
name(param);
1924 if (paramName !=
"DataToWrite" && hieraList.
isSublist(paramName)) {
1927 int startLevel = 0;
if(levelList.
isParameter(
"startLevel")) { startLevel = levelList.
get<
int>(
"startLevel"); levelList.
remove(
"startLevel"); }
1928 int numDesiredLevel = 1;
if(levelList.
isParameter(
"numDesiredLevel")) { numDesiredLevel = levelList.
get<
int>(
"numDesiredLevel"); levelList.
remove(
"numDesiredLevel"); }
1941 BuildFactoryMap(levelList, factoryMap, levelFactoryMap, factoryManagers);
1947 if (startLevel >= 0)
1948 this->AddFactoryManager(startLevel, numDesiredLevel, m);
2080 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2084 const std::string & paramName = paramList.
name(param);
2089 if (paramValue.
isList()) {
2090 ParameterList paramList1 = Teuchos::getValue<ParameterList>(paramValue);
2094 "MueLu::ParameterListInterpreter(): It seems that in the parameter lists for defining " << paramName <<
2095 " there is both a 'factory' and 'dependency for' parameter. This is not allowed. Please remove the 'dependency for' parameter.");
2097 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2099 }
else if (paramList1.
isParameter(
"dependency for")) {
2101 "MueLu::ParameterListInterpreter(): It seems that in the parameter lists for defining " << paramName <<
2102 " there is both a 'factory' and 'dependency for' parameter. This is not allowed.");
2104 std::string factoryName = paramList1.
get<std::string>(
"dependency for");
2108 "MueLu::ParameterListInterpreter(): could not find factory " + factoryName +
" in factory map. Did you define it before?");
2116 const std::string& pName = validParamList->name(vparam);
2126 factory->SetFactory(pName, generatingFact.
create_weak());
2129 if (pName ==
"ParameterList") {
2138 factory->SetParameter(pName, paramList1.
getEntry(pName));
2144 std::string groupType = paramList1.
get<std::string>(
"group");
2146 "group must be of type \"FactoryManager\".");
2149 groupList.
remove(
"group");
2152 BuildFactoryMap(groupList, factoryMapIn, groupFactoryMap, factoryManagers);
2158 factoryManagers[paramName] = m;
2161 this->GetOStream(
Warnings0) <<
"Could not interpret parameter list " << paramList1 << std::endl;
2163 "XML Parameter list must either be of type \"factory\" or of type \"group\".");
2167 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2175 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2178 Matrix& A =
dynamic_cast<Matrix&
>(Op);
2179 if (A.GetFixedBlockSize() != blockSize_)
2180 this->GetOStream(
Warnings0) <<
"Setting matrix block size to " << blockSize_ <<
" (value of the parameter in the list) "
2181 <<
"instead of " << A.GetFixedBlockSize() <<
" (provided matrix)." << std::endl
2182 <<
"You may want to check \"number of equations\" (or \"PDE equations\" for factory style list) parameter." << std::endl;
2184 A.SetFixedBlockSize(blockSize_, dofOffset_);
2186 }
catch (std::bad_cast& e) {
2187 this->GetOStream(
Warnings0) <<
"Skipping setting block size as the operator is not a matrix" << std::endl;
2191 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2202 const std::string& name = it->first;
2209 compare(Teuchos::getValue<ParameterList>(entry1), Teuchos::getValue<ParameterList>(*entry2));
2225 #define MUELU_PARAMETERLISTINTERPRETER_SHORT
Important warning messages (one line)
Generic Smoother Factory for generating the smoothers of the MG hierarchy.
const std::string & name() const
This class specifies the default factory that should generate some data on a Level if the data does n...
void SetupHierarchy(Hierarchy &H) const
Call the SetupHierarchy routine from the HiearchyManager object.
High level timing information (use Teuchos::TimeMonitor::summarize() to print)
static VerbLevel GetDefaultVerbLevel()
Get the default (global) verbosity level.
ConstIterator end() const
Factory for determing the number of partitions for rebalancing.
#define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory)
Factory for generating coarse level map. Used by TentativePFactory.
bool is_null(const boost::shared_ptr< T > &p)
std::string toString(const T &what)
Little helper function to convert non-string types to strings.
Factory for building transfer operators based on coarsening in polynomial degree, following the Intre...
Factory for building coarse grid matrices, when the matrix is of the form K+a*M. Useful when you want...
void UpdateFactoryManager(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
Factory that can generate other factories from.
Print external lib objects.
RCP< T > create_weak() const
T & get(const std::string &name, T def_value)
Class that encapsulates external library smoothers.
size_t LevenshteinDistance(const char *s, size_t len_s, const char *t, size_t len_t)
void UpdateFactoryManager_Matlab(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
static void DisableMultipleCheckGlobally()
#define MUELU_TEST_AND_SET_VAR(paramList, paramName, paramType, varName)
void AddProlongatorFactory(const RCP< const FactoryBase > &factory)
Add a prolongator factory in the end of list of prolongator factories.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Factory for building permutation matrix that can be be used to shuffle data (matrices, vectors) among processes.
void SetKokkosRefactor(const bool useKokkos)
Print additional debugging information.
One-liner description of what is happening.
ParameterListInterpreter()
Empty constructor.
Ordinal numParams() const
void SetCycle(CycleType Cycle)
Supports VCYCLE and WCYCLE types.
void AddTransferFactory(const RCP< const FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories in RepartitionAcFactory.
#define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory)
Interface to Zoltan library.This interface provides access to partitioning methods in Zoltan...
bool IsParamMuemexVariable(const std::string &name)
void UpdateFactoryManager_SemiCoarsen(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
const RCP< const FactoryBase > GetFactory(const std::string &varName) const
Get factory associated with a particular data name.
std::map< std::string, RCP< FactoryManagerBase > > FactoryManagerMap
std::map< std::string, RCP< const FactoryBase > > FactoryMap
void UpdateFactoryManager_Nullspace(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps, RCP< Factory > &nullSpaceFactory) const
Factory for building tentative prolongator.
#define TEST_MUTUALLY_EXCLUSIVE(arg1, arg2)
Class that encapsulates direct solvers. Autoselection of AmesosSmoother or Amesos2Smoother according ...
Factory for coarsening a graph with uncoupled aggregation.
virtual void SetupOperator(Operator &A) const
Setup Operator object.
Prolongator factory performing semi-coarsening.
Factory for building restriction operators using a prolongator factory.
static RCP< Time > getNewTimer(const std::string &name)
ParameterEntry * getEntryPtr(const std::string &name)
void UpdateFactoryManager_PG(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.
ParameterList & setEntry(const std::string &name, const ParameterEntry &entry)
Important warning messages (more verbose)
bool isParameter(const std::string &name) const
Print statistics that do not involve significant additional computation.
bool remove(std::string const &name, bool throwIfNotExists=true)
void UpdateFactoryManager_Emin(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
static void SetDefaultVerbLevel(const VerbLevel defaultVerbLevel)
Set the default (global) verbosity level.
#define MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList, paramName, paramType, listWrite)
static bool compare(const ParameterList &list1, const ParameterList &list2)
virtual void SetParameterList(const Teuchos::ParameterList ¶mList)
Set parameters from a parameter list and return with default values.
static CycleType GetDefaultCycle()
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void UpdateFactoryManager_Coordinates(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
bool isSublist(const std::string &name) const
Detailed timing information (use Teuchos::TimeMonitor::summarize() to print)
Factory for interacting with Matlab.
Factory for interacting with Matlab.
VerbLevel GetVerbLevel() const
Get the verbosity level.
Factory for building line detection information.
params_t::ConstIterator ConstIterator
void SetFactoryParameterList(const Teuchos::ParameterList ¶mList)
Factory interpreter stuff.
Factory to export aggregation info or visualize aggregates using VTK.
Prolongator factory which allows switching between two different prolongator strategies.
Interface to Zoltan2 library.This interface provides access to partitioning methods in Zoltan2...
By default, enabled timers appears in the teuchos time monitor summary. Use this option if you do not...
void UpdateFactoryManager_RAP(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
ConstIterator begin() const
Factory for building the constraint operator.
void UpdateFactoryManager_Restriction(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
Applies permutation to grid transfer operators.
ParameterList & setParameters(const ParameterList &source)
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Set Factory.
const RCP< FactoryBase > GetFactoryNonConst(const std::string &varName)
Get factory associated with a particular data name (NONCONST version)
const ParameterEntry & entry(ConstIterator i) const
any & getAny(bool activeQry=true)
void UpdateFactoryManager_Aggregation_TentativeP(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
Timers that are enabled (using Timings0/Timings1) will be printed during the execution.
void AddTransferFactory(const RCP< const FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories in RepartitionAcFactory.
Record timing information level by level. Must be used in combinaison with Timings0/Timings1.
Factory for creating a graph base on a given matrix.
void BuildFactoryMap(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, FactoryMap &factoryMapOut, FactoryManagerMap &factoryManagers) const
Interpret "Factories" sublist.
Class that encapsulates Matlab smoothers.
Partitioning within a node onlyThis interface provides partitioning within a node.
void SetParameterList(const Teuchos::ParameterList ¶mList)
Set parameter list for Parameter list interpreter.
Class for transferring coordinates from a finer level to a coarser one.
void UpdateFactoryManager_SA(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void SetVerbLevel(const VerbLevel verbLevel)
Set the verbosity level of this object.
virtual void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)=0
Configuration.
Factory for building nonzero patterns for energy minimization.
static Teuchos::RCP< Teuchos::ParameterList > GetProblemSpecificList(std::string const &problemType)
Return default parameter settings for the specified problem type.
bool isType(const std::string &name) const
Class for transferring coordinates from a finer level to a coarser one.
Factory for building restriction operators.
Factory for building Energy Minimization prolongators.
static bool areSame(const ParameterList &list1, const ParameterList &list2)
Helper functions to compare two paramter lists.
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
#define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2)
void Validate(const Teuchos::ParameterList ¶mList) const
void UpdateFactoryManager_PCoarsen(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void SetProlongatorScalingFactor(double scalingFactor)
Specify damping factor alpha such that x = x + alpha*P*c, where c is the coarse grid correction...
#define MUELU_TEST_PARAM_2LIST(paramList, defaultList, paramName, paramType, cmpValue)
Print class parameters (more parameters, more verbose)
Factory for building coarse matrices.
Exception throws to report errors in the internal logical of the program.
Factory for building filtered matrices using filtered graphs.
std::pair< std::string, const FactoryBase * > keep_pair
void UpdateFactoryManager_Repartition(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps, RCP< Factory > &nullSpaceFactory) const
Description of what is happening (more verbose)
Factory for building coarse matrices.
Factory for building Petrov-Galerkin Smoothed Aggregation prolongators.
void UpdateFactoryManager_Smoothers(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
ParameterEntry & getEntry(const std::string &name)
void AddPtentFactory(const RCP< const FactoryBase > &factory)
Add a tentative prolongator factory in the end of list of prolongator factories.
Factory for building Smoothed Aggregation prolongators.
Factory for building uncoupled aggregates.
static Teuchos::RCP< const Teuchos::ParameterList > List()
Return a "master" list of all valid parameters and their default values.
void UpdateFactoryManager_CoarseSolvers(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
#define MUELU_SET_VAR_2LIST(paramList, defaultList, paramName, paramType, varName)
void SetEasyParameterList(const Teuchos::ParameterList ¶mList)
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
void AddCoarseNullspaceFactory(const RCP< const FactoryBase > &factory)
Add a coarse nullspace factory in the end of list of coarse nullspace factories.
Factory for generating nullspace.
long ExtractNonSerializableData(const Teuchos::ParameterList &inList, Teuchos::ParameterList &serialList, Teuchos::ParameterList &nonSerialList)
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
Exception throws to report invalid user entry.
#define TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(throw_exception_test, Exception, msg)
static const RCP< const NoFactory > getRCP()
Static Get() functions.