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_RebalanceAcFactory.hpp" 83 #include "MueLu_RebalanceTransferFactory.hpp" 84 #include "MueLu_RepartitionFactory.hpp" 85 #include "MueLu_SaPFactory.hpp" 86 #include "MueLu_SemiCoarsenPFactory.hpp" 87 #include "MueLu_SmootherFactory.hpp" 88 #include "MueLu_TentativePFactory.hpp" 89 #include "MueLu_TogglePFactory.hpp" 90 #include "MueLu_ToggleCoordinatesTransferFactory.hpp" 91 #include "MueLu_TransPFactory.hpp" 92 #include "MueLu_UncoupledAggregationFactory.hpp" 93 #include "MueLu_ZoltanInterface.hpp" 94 #include "MueLu_Zoltan2Interface.hpp" 96 #ifdef HAVE_MUELU_KOKKOS_REFACTOR 97 #include "MueLu_CoalesceDropFactory_kokkos.hpp" 98 #include "MueLu_CoarseMapFactory_kokkos.hpp" 99 #include "MueLu_CoordinatesTransferFactory_kokkos.hpp" 100 #include "MueLu_FilteredAFactory_kokkos.hpp" 101 #include "MueLu_NullspaceFactory_kokkos.hpp" 102 #include "MueLu_SaPFactory_kokkos.hpp" 103 #include "MueLu_TentativePFactory_kokkos.hpp" 104 #include "MueLu_UncoupledAggregationFactory_kokkos.hpp" 107 #ifdef HAVE_MUELU_MATLAB 108 #include "../matlab/src/MueLu_MatlabSmoother_decl.hpp" 109 #include "../matlab/src/MueLu_MatlabSmoother_def.hpp" 110 #include "../matlab/src/MueLu_TwoLevelMatlabFactory_decl.hpp" 111 #include "../matlab/src/MueLu_TwoLevelMatlabFactory_def.hpp" 112 #include "../matlab/src/MueLu_SingleLevelMatlabFactory_decl.hpp" 113 #include "../matlab/src/MueLu_SingleLevelMatlabFactory_def.hpp" 118 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
120 if(facadeFact == Teuchos::null)
126 std::string filename = paramList.
get(
"xml parameter file",
"");
127 if (filename.length() != 0) {
143 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
145 if(facadeFact == Teuchos::null)
155 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
162 SetFactoryParameterList(paramList);
163 }
else if (paramList.
isParameter(
"MueLu preconditioner") ==
true) {
164 this->GetOStream(
Runtime0) <<
"Use facade class: " << paramList.
get<std::string>(
"MueLu preconditioner") << std::endl;
167 SetFactoryParameterList(*pp);
174 Validate(serialList);
175 SetEasyParameterList(paramList);
188 #define MUELU_SET_VAR_2LIST(paramList, defaultList, paramName, paramType, varName) \ 190 if (paramList.isParameter(paramName)) varName = paramList.get<paramType>(paramName); \ 191 else if (defaultList.isParameter(paramName)) varName = defaultList.get<paramType>(paramName); \ 192 else varName = MasterList::getDefault<paramType>(paramName); 194 #define MUELU_TEST_AND_SET_VAR(paramList, paramName, paramType, varName) \ 195 (paramList.isParameter(paramName) ? varName = paramList.get<paramType>(paramName), true : false) 199 #define MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList, paramName, paramType, listWrite) \ 201 if (paramList .isParameter(paramName)) listWrite.set(paramName, paramList .get<paramType>(paramName)); \ 202 else if (defaultList.isParameter(paramName)) listWrite.set(paramName, defaultList.get<paramType>(paramName)); \ 204 catch(Teuchos::Exceptions::InvalidParameterType) { \ 205 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(true, Teuchos::Exceptions::InvalidParameterType, \ 206 "Error: parameter \"" << paramName << "\" must be of type " << Teuchos::TypeNameTraits<paramType>::name()); \ 209 #define MUELU_TEST_PARAM_2LIST(paramList, defaultList, paramName, paramType, cmpValue) \ 211 paramList.isParameter(paramName) ? paramList .get<paramType>(paramName) : ( \ 212 defaultList.isParameter(paramName) ? defaultList.get<paramType>(paramName) : \ 213 MasterList::getDefault<paramType>(paramName) ) ) ) 215 #ifndef HAVE_MUELU_KOKKOS_REFACTOR 216 #define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory) \ 217 RCP<Factory> varName = rcp(new oldFactory()); 218 #define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory) \ 219 varName = rcp(new oldFactory()); 221 #define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory) \ 222 RCP<Factory> varName; \ 223 if (!useKokkos) varName = rcp(new oldFactory()); \ 224 else varName = rcp(new newFactory()); 225 #define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory) \ 226 if (!useKokkos) varName = rcp(new oldFactory()); \ 227 else varName = rcp(new newFactory()); 230 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
234 MUELU_SET_VAR_2LIST(constParamList, constParamList,
"problem: type", std::string, problemType);
235 if (problemType !=
"unknown") {
241 paramList = constParamList;
246 std::map<std::string,CycleType> cycleMap;
250 std::string cycleType = paramList.
get<std::string>(
"cycle type");
252 Cycle_ = cycleMap[cycleType];
255 this->maxCoarseSize_ = paramList.
get<
int> (
"coarse: max size", MasterList::getDefault<int>(
"coarse: max size"));
256 this->numDesiredLevel_ = paramList.
get<
int> (
"max levels", MasterList::getDefault<int>(
"max levels"));
257 blockSize_ = paramList.
get<
int> (
"number of equations", MasterList::getDefault<int>(
"number of equations"));
262 if (paramList.
isSublist(
"export data")) {
266 this->matricesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"A");
268 this->prolongatorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"P");
270 this->restrictorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"R");
272 this->nullspaceToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Nullspace");
274 this->coordinatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Coordinates");
280 std::map<std::string,MsgType> verbMap;
281 verbMap[
"none"] =
None;
282 verbMap[
"low"] =
Low;
283 verbMap[
"medium"] =
Medium;
284 verbMap[
"high"] =
High;
286 verbMap[
"test"] =
Test;
291 "Invalid verbosity level: \"" << verbosityLevel <<
"\"");
292 this->verbosity_ = verbMap[verbosityLevel];
302 useCoordinates_ =
false;
304 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"distance laplacian") ||
307 useCoordinates_ =
true;
310 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
311 std::string levelStr =
"level " +
toString(levelID);
317 MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"distance laplacian") ||
320 useCoordinates_ =
true;
328 changedPRrebalance_ =
false;
330 changedPRrebalance_ =
MUELU_TEST_AND_SET_VAR(paramList,
"repartition: rebalance P and R",
bool, this->doPRrebalance_);
333 changedImplicitTranspose_ =
MUELU_TEST_AND_SET_VAR(paramList,
"transpose: use implicit",
bool, this->implicitTranspose_);
341 std::vector<keep_pair> keeps0;
342 UpdateFactoryManager(paramList,
ParameterList(), *defaultManager, 0, keeps0);
345 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
354 std::vector<keep_pair> keeps;
358 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
362 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
365 this->keep_[levelID] = keeps;
366 this->AddFactoryManager(levelID, 1, levelManager);
373 this->GetOStream(static_cast<MsgType>(
Runtime1), 0) << paramList << std::endl;
388 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
389 std::string levelStr =
"level " +
toString(levelID);
404 std::ostringstream unusedParamsStream;
406 unusedParamList.
print(unusedParamsStream, indent);
408 this->GetOStream(
Warnings1) <<
"The following parameters were not used:\n" << unusedParamsStream.str() << std::endl;
415 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
426 TEUCHOS_TEST_FOR_EXCEPTION(reuseType !=
"none" && reuseType !=
"tP" && reuseType !=
"RP" && reuseType !=
"emin" && reuseType !=
"RAP" && reuseType !=
"full" && reuseType !=
"S",
429 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
430 TEUCHOS_TEST_FOR_EXCEPTION(multigridAlgo !=
"unsmoothed" && multigridAlgo !=
"sa" && multigridAlgo !=
"pg" && multigridAlgo !=
"emin" && multigridAlgo !=
"matlab",
431 Exceptions::RuntimeError,
"Unknown \"multigrid algorithm\" value: \"" << multigridAlgo <<
"\". Please consult User's Guide.");
432 #ifndef HAVE_MUELU_MATLAB 434 "Cannot use matlab for multigrid algorithm - MueLu was not configured with MATLAB support.");
436 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
437 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
441 if (reuseType ==
"none" || reuseType ==
"S" || reuseType ==
"RP" || reuseType ==
"RAP") {
444 }
else if (reuseType ==
"tP" && (multigridAlgo !=
"sa" && multigridAlgo !=
"unsmoothed")) {
446 this->GetOStream(
Warnings0) <<
"Ignoring \"tP\" reuse option as it is only compatible with \"sa\", or \"unsmoothed\" multigrid algorithms" << std::endl;
448 }
else if (reuseType ==
"emin" && multigridAlgo !=
"emin") {
450 this->GetOStream(
Warnings0) <<
"Ignoring \"emin\" reuse option it is only compatible with \"emin\" multigrid algorithm" << std::endl;
458 bool have_userA =
false, have_userP =
false, have_userR =
false, have_userNS =
false, have_userCO =
false;
467 bool isCustomSmoother =
470 paramList.
isSublist (
"smoother: params") || paramList.
isSublist (
"smoother: pre params") || paramList.
isSublist (
"smoother: post params") ||
475 manager.
SetFactory(
"Smoother", Teuchos::null);
477 }
else if (isCustomSmoother) {
481 #define TEST_MUTUALLY_EXCLUSIVE(arg1,arg2) \ 482 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isParameter(#arg1) && paramList.isParameter(#arg2), \ 483 Exceptions::InvalidArgument, "You cannot specify both \""#arg1"\" and \""#arg2"\""); 484 #define TEST_MUTUALLY_EXCLUSIVE_S(arg1,arg2) \ 485 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isSublist(#arg1) && paramList.isSublist(#arg2), \ 486 Exceptions::InvalidArgument, "You cannot specify both \""#arg1"\" and \""#arg2"\""); 502 defaultSmootherParams.
set(
"relaxation: type",
"Symmetric Gauss-Seidel");
507 std::string preSmootherType, postSmootherType;
511 overlap = paramList.
get<
int>(
"smoother: overlap");
515 preSmootherType = paramList.
get<std::string>(
"smoother: pre type");
517 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, preSmootherTypeTmp);
518 preSmootherType = preSmootherTypeTmp;
520 if (paramList.
isParameter(
"smoother: pre overlap"))
521 overlap = paramList.
get<
int>(
"smoother: pre overlap");
523 if (paramList.
isSublist(
"smoother: pre params"))
524 preSmootherParams = paramList.
sublist(
"smoother: pre params");
525 else if (paramList.
isSublist(
"smoother: params"))
526 preSmootherParams = paramList.
sublist(
"smoother: params");
527 else if (defaultList.
isSublist(
"smoother: params"))
528 preSmootherParams = defaultList.
sublist(
"smoother: params");
529 else if (preSmootherType ==
"RELAXATION")
530 preSmootherParams = defaultSmootherParams;
531 #ifdef HAVE_MUELU_MATLAB 532 if(preSmootherType ==
"matlab")
541 postSmootherType = paramList.
get<std::string>(
"smoother: post type");
543 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, postSmootherTypeTmp);
544 postSmootherType = postSmootherTypeTmp;
547 if (paramList.
isSublist(
"smoother: post params"))
548 postSmootherParams = paramList.
sublist(
"smoother: post params");
549 else if (paramList.
isSublist(
"smoother: params"))
550 postSmootherParams = paramList.
sublist(
"smoother: params");
551 else if (defaultList.
isSublist(
"smoother: params"))
552 postSmootherParams = defaultList.
sublist(
"smoother: params");
553 else if (postSmootherType ==
"RELAXATION")
554 postSmootherParams = defaultSmootherParams;
555 if (paramList.
isParameter(
"smoother: post overlap"))
556 overlap = paramList.
get<
int>(
"smoother: post overlap");
558 if (postSmootherType == preSmootherType &&
areSame(preSmootherParams, postSmootherParams))
559 postSmoother = preSmoother;
561 #ifdef HAVE_MUELU_MATLAB 562 if(postSmootherType ==
"matlab")
571 if (preSmoother == postSmoother)
574 manager.
SetFactory(
"PreSmoother", preSmoother);
575 manager.
SetFactory(
"PostSmoother", postSmoother);
581 bool isCustomCoarseSolver =
585 this->GetOStream(
Warnings0) <<
"No coarse grid solver" << std::endl;
586 manager.
SetFactory(
"CoarseSolver", Teuchos::null);
588 }
else if (isCustomCoarseSolver) {
596 overlap = paramList.
get<
int>(
"coarse: overlap");
599 if (paramList.
isSublist(
"coarse: params"))
600 coarseParams = paramList.
sublist(
"coarse: params");
601 else if (defaultList.
isSublist(
"coarse: params"))
602 coarseParams = defaultList.
sublist(
"coarse: params");
608 if (coarseType ==
"RELAXATION" || coarseType ==
"CHEBYSHEV" ||
609 coarseType ==
"ILUT" || coarseType ==
"ILU" || coarseType ==
"RILUK" || coarseType ==
"SCHWARZ" ||
610 coarseType ==
"Amesos" ||
611 coarseType ==
"LINESMOOTHING_BANDEDRELAXATION" ||
612 coarseType ==
"LINESMOOTHING_BANDED_RELAXATION" ||
613 coarseType ==
"LINESMOOTHING_BANDED RELAXATION")
616 #ifdef HAVE_MUELU_MATLAB 617 if (coarseType ==
"matlab")
630 bool reuseSmoothers = (reuseType ==
"S" || reuseType !=
"none");
631 if (reuseSmoothers) {
633 if (preSmootherFactory != Teuchos::null) {
635 postSmootherFactoryParams.
set(
"keep smoother data",
true);
638 keeps.push_back(
keep_pair(
"PreSmoother data", preSmootherFactory.
get()));
642 if (postSmootherFactory != Teuchos::null) {
644 postSmootherFactoryParams.
set(
"keep smoother data",
true);
647 keeps.push_back(
keep_pair(
"PostSmoother data", postSmootherFactory.
get()));
651 if (coarseFactory != Teuchos::null) {
653 coarseFactoryParams.
set(
"keep smoother data",
true);
656 keeps.push_back(
keep_pair(
"PreSmoother data", coarseFactory.
get()));
660 if ((reuseType ==
"RAP" && levelID) || (reuseType ==
"full")) {
680 #ifdef HAVE_MUELU_MATLAB 685 throw std::runtime_error(
"Cannot use MATLAB evolutionary strength-of-connection - MueLu was not configured with MATLAB support.");
690 dropParams.
set(
"lightweight wrap",
true);
702 #ifndef HAVE_MUELU_MATLAB 703 if(aggType ==
"matlab")
704 throw std::runtime_error(
"Cannot use MATLAB aggregation - MueLu was not configured with MATLAB support.");
707 if (aggType ==
"uncoupled") {
724 }
else if (aggType ==
"coupled") {
727 }
else if (aggType ==
"brick") {
738 aggFactory->
SetFactory(
"Coordinates", this->GetFactoryManager(levelID-1)->GetFactory(
"Coordinates"));
741 #ifdef HAVE_MUELU_MATLAB 742 else if(aggType ==
"matlab") {
752 coarseMap->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
757 Ptent->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
758 Ptent->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
762 if (reuseType ==
"tP" && levelID) {
763 keeps.push_back(
keep_pair(
"Nullspace", Ptent.get()));
764 keeps.push_back(
keep_pair(
"P", Ptent.get()));
770 nullSpace->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
775 TEUCHOS_TEST_FOR_EXCEPTION(multigridAlgo !=
"unsmoothed" && multigridAlgo !=
"sa" && multigridAlgo !=
"pg" && multigridAlgo !=
"emin" && multigridAlgo !=
"matlab",
776 Exceptions::RuntimeError,
"Unknown multigrid algorithm: \"" << multigridAlgo <<
"\". Please consult User's Guide.");
777 #ifndef HAVE_MUELU_MATLAB 779 "Cannot use MATLAB prolongator factory - MueLu was not configured with MATLAB support.");
784 }
else if (multigridAlgo ==
"unsmoothed") {
787 }
else if (multigridAlgo ==
"sa") {
792 P->SetParameterList(Pparams);
801 filterFactory->SetParameterList(fParams);
802 filterFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
804 filterFactory->SetFactory(
"Filtering", manager.
GetFactory(
"Graph"));
805 P->SetFactory(
"A", filterFactory);
808 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
811 if (reuseType ==
"tP" && !filteringChangesMatrix)
812 keeps.push_back(
keep_pair(
"AP reuse data", P.get()));
814 }
else if (multigridAlgo ==
"emin") {
817 "Invalid pattern name: \"" << patternType <<
"\". Valid options: \"AkPtent\"");
824 manager.
SetFactory(
"Ppattern", patternFactory);
830 manager.
SetFactory(
"Constraint", constraintFactory);
837 if (reuseType ==
"emin") {
839 Pparams.
set(
"Keep P0",
true);
840 Pparams.
set(
"Keep Constraint0",
true);
847 }
else if (multigridAlgo ==
"pg") {
849 "Implicit transpose not supported with Petrov-Galerkin smoothed transfer operators: Set \"transpose: use implicit\" to false!\n" \
850 "Petrov-Galerkin transfer operator smoothing for non-symmetric problems requires a separate handling of the restriction operator which " \
851 "does not allow the usage of implicit transpose easily.");
858 #ifdef HAVE_MUELU_MATLAB 859 else if(multigridAlgo ==
"matlab") {
862 P->SetParameterList(Pparams);
863 P->SetFactory(
"P",manager.
GetFactory(
"Ptent"));
870 if (paramList.
isParameter(
"semicoarsen: number of levels") &&
871 paramList.
get<
int>(
"semicoarsen: number of levels") > 0) {
895 manager.
SetFactory(
"CoarseNumZLayers", linedetectionFactory);
896 manager.
SetFactory(
"LineDetection_Layers", linedetectionFactory);
897 manager.
SetFactory(
"LineDetection_VertLineIds", linedetectionFactory);
901 manager.
SetFactory(
"Nullspace", togglePFactory);
905 if (!this->implicitTranspose_) {
907 if (isSymmetric ==
false && (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"emin")) {
908 this->GetOStream(
Warnings0) <<
"Switching \"problem: symmetric\" parameter to symmetric as multigrid algorithm. " << multigridAlgo <<
" is primarily supposed to be used for symmetric problems." << std::endl << std::endl;
909 this->GetOStream(
Warnings0) <<
"Please note: if you are using \"unsmoothed\" transfer operators the \"problem: symmetric\" parameter has no real mathematical meaning, i.e. you can use it for non-symmetric" << std::endl;
910 this->GetOStream(
Warnings0) <<
"problems, too. With \"problem: symmetric\"=\"symmetric\" you can use implicit transpose for building the restriction operators which may drastically reduce the amount of consumed memory." << std::endl;
914 "Petrov-Galerkin smoothed transfer operators are only allowed for non-symmetric problems: Set \"problem: symmetric\" to false!\n" \
915 "While PG smoothed transfer operators generally would also work for symmetric problems this is an unusual use case. " \
916 "You can use the factory-based xml interface though if you need PG-AMG for symmetric problems.");
943 if (paramList .isParameter(
"aggregation: allow empty prolongator columns")) {
944 RAPparams.
set(
"CheckMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
945 RAPparams.
set(
"RepairMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
947 else if (defaultList.
isParameter(
"aggregation: allow empty prolongator columns")) {
948 RAPparams.
set(
"CheckMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
949 RAPparams.
set(
"RepairMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
958 if (!this->implicitTranspose_)
961 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: export visualization data",
bool,
true)) {
977 if (reuseType ==
"RP" || (reuseType ==
"tP" && !filteringChangesMatrix)) {
979 keeps.push_back(
keep_pair(
"RAP reuse data", RAP.
get()));
984 if (useCoordinates_) {
990 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
991 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
994 if (paramList.
isParameter(
"semicoarsen: number of levels")) {
1006 if ((reuseType ==
"RP" || reuseType ==
"RAP" || reuseType ==
"full") && levelID)
1009 if (reuseType ==
"RP" && levelID) {
1011 if (!this->implicitTranspose_)
1014 if ((reuseType ==
"tP" || reuseType ==
"RP" || reuseType ==
"emin") && useCoordinates_ && levelID)
1057 "Reuse types \"tP\" and \"PR\" require \"repartition: rebalance P and R\" set to \"false\"");
1062 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: partitioner", std::string, partName);
1064 "Invalid partitioner name: \"" << partName <<
"\". Valid options: \"zoltan\", \"zoltan2\"");
1074 manager.
SetFactory(
"number of partitions", repartheurFactory);
1078 if (partName ==
"zoltan") {
1079 #ifdef HAVE_MUELU_ZOLTAN 1085 }
else if (partName ==
"zoltan2") {
1086 #ifdef HAVE_MUELU_ZOLTAN2 1090 partParams.
set(
"ParameterList", partpartParams);
1099 manager.
SetFactory(
"Partition", partitioner);
1111 manager.
SetFactory(
"Importer", repartFactory);
1112 if (reuseType !=
"none" && reuseType !=
"S" && levelID)
1127 newPparams.
set(
"type",
"Interpolation");
1128 if (changedPRrebalance_)
1129 newPparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1131 newP-> SetParameterList(newPparams);
1132 newP-> SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1133 newP-> SetFactory(
"P", manager.
GetFactory(
"P"));
1134 if (!paramList.
isParameter(
"semicoarsen: number of levels"))
1135 newP-> SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1137 newP-> SetFactory(
"Nullspace", manager.
GetFactory(
"P"));
1138 newP-> SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1145 newRparams.
set(
"type",
"Restriction");
1147 if (changedPRrebalance_)
1148 newRparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1149 if (changedImplicitTranspose_)
1150 newRparams.
set(
"transpose: use implicit", this->implicitTranspose_);
1151 newR-> SetParameterList(newRparams);
1152 newR-> SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1153 if (!this->implicitTranspose_) {
1164 nullSpace->SetFactory(
"Nullspace", newP);
1169 if ((reuseType ==
"RAP" || reuseType ==
"full") && levelID) {
1171 if (!this->implicitTranspose_)
1176 #undef MUELU_SET_VAR_2LIST 1177 #undef MUELU_TEST_AND_SET_VAR 1178 #undef MUELU_TEST_AND_SET_PARAM_2LIST 1179 #undef MUELU_TEST_PARAM_2LIST 1183 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1188 const int maxLevels = 100;
1191 std::vector<ParameterList> paramLists;
1192 for (
int levelID = 0; levelID < maxLevels; levelID++) {
1193 std::string sublistName =
"level " +
toString(levelID);
1195 paramLists.push_back(paramList.
sublist(sublistName));
1197 paramList.
remove(sublistName);
1200 paramLists.push_back(paramList);
1203 #ifdef HAVE_MUELU_MATLAB 1204 for (
size_t i = 0; i < paramLists.size(); i++) {
1205 std::vector<std::string> customVars;
1208 std::string paramName = paramLists[i].name(it);
1211 customVars.push_back(paramName);
1215 for (
size_t j = 0; j < customVars.size(); j++)
1216 paramLists[i].
remove(customVars[j],
false);
1220 const int maxDepth = 0;
1221 for (
size_t i = 0; i < paramLists.size(); i++) {
1224 paramLists[i].validateParameters(validList, maxDepth);
1227 std::string eString = e.what();
1230 size_t nameStart = eString.find_first_of(
'"') + 1;
1231 size_t nameEnd = eString.find_first_of(
'"', nameStart);
1232 std::string name = eString.substr(nameStart, nameEnd - nameStart);
1234 int bestScore = 100;
1235 std::string bestName =
"";
1237 const std::string& pName = validList.
name(it);
1238 this->GetOStream(
Runtime1) <<
"| " << pName;
1239 int score =
LevenshteinDistance(name.c_str(), name.length(), pName.c_str(), pName.length());
1240 this->GetOStream(
Runtime1) <<
" -> " << score << std::endl;
1241 if (score < bestScore) {
1246 if (bestScore < 10 && bestName !=
"") {
1248 eString <<
"The parameter name \"" + name +
"\" is not valid. Did you mean \"" + bestName <<
"\"?\n");
1252 eString <<
"The parameter name \"" + name +
"\" is not valid.\n");
1261 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1273 blockSize_ = paramList.
sublist(
"Matrix").
get<
int>(
"PDE equations", MasterList::getDefault<int>(
"number of equations"));
1274 dofOffset_ = paramList.
sublist(
"Matrix").
get<GlobalOrdinal>(
"DOF offset", 0);
1278 if (factFact_ == Teuchos::null)
1291 this->BuildFactoryMap(paramList.
sublist(
"Factories"), factoryMap, factoryMap, factoryManagers);
1310 this->numDesiredLevel_ = hieraList.
get<
int>(
"max levels");
1311 hieraList.
remove(
"max levels");
1315 this->maxCoarseSize_ = hieraList.
get<
int>(
"coarse: max size");
1316 hieraList.
remove(
"coarse: max size");
1319 if (hieraList.
isParameter(
"repartition: rebalance P and R")) {
1320 this->doPRrebalance_ = hieraList.
get<
bool>(
"repartition: rebalance P and R");
1321 hieraList.
remove(
"repartition: rebalance P and R");
1324 if (hieraList.
isParameter(
"transpose: use implicit")) {
1325 this->implicitTranspose_ = hieraList.
get<
bool>(
"transpose: use implicit");
1326 hieraList.
remove(
"transpose: use implicit");
1330 std::map<std::string,MsgType> verbMap;
1332 verbMap[
"Errors"] =
Errors;
1349 verbMap[
"Debug"] =
Debug;
1350 verbMap[
"Test"] =
Test;
1352 verbMap[
"None"] =
None;
1353 verbMap[
"Low"] =
Low;
1354 verbMap[
"Medium"] =
Medium;
1355 verbMap[
"High"] =
High;
1358 std::string vl = hieraList.
get<std::string>(
"verbosity");
1359 hieraList.
remove(
"verbosity");
1361 if (verbMap.find(vl) != verbMap.end())
1362 this->verbosity_ = verbMap[vl];
1367 if (hieraList.
isParameter(
"dependencyOutputLevel"))
1368 this->graphOutputLevel_ = hieraList.
get<
int>(
"dependencyOutputLevel");
1374 if (hieraList.
isSublist(
"DataToWrite")) {
1378 std::string dataName =
"Matrices";
1380 this->matricesToPrint_ = Teuchos::getArrayFromStringParameter<int>(foo,dataName);
1381 dataName =
"Prolongators";
1383 this->prolongatorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(foo,dataName);
1384 dataName =
"Restrictors";
1386 this->restrictorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(foo,dataName);
1391 const std::string & paramName = hieraList.
name(param);
1393 if (paramName !=
"DataToWrite" && hieraList.
isSublist(paramName)) {
1396 int startLevel = 0;
if(levelList.
isParameter(
"startLevel")) { startLevel = levelList.
get<
int>(
"startLevel"); levelList.
remove(
"startLevel"); }
1397 int numDesiredLevel = 1;
if(levelList.
isParameter(
"numDesiredLevel")) { numDesiredLevel = levelList.
get<
int>(
"numDesiredLevel"); levelList.
remove(
"numDesiredLevel"); }
1410 BuildFactoryMap(levelList, factoryMap, levelFactoryMap, factoryManagers);
1414 if (startLevel >= 0)
1415 this->AddFactoryManager(startLevel, numDesiredLevel, m);
1436 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1440 const std::string & paramName = paramList.
name(param);
1448 if (paramValue.
isList()) {
1449 ParameterList paramList1 = Teuchos::getValue<ParameterList>(paramValue);
1451 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
1454 std::string groupType = paramList1.
get<std::string>(
"group");
1458 groupList.
remove(
"group");
1461 BuildFactoryMap(groupList, factoryMapIn, groupFactoryMap, factoryManagers);
1467 factoryManagers[paramName] = m;
1470 this->GetOStream(
Warnings0) <<
"Could not interpret parameter list " << paramList1 << std::endl;
1475 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
1483 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1486 Matrix& A =
dynamic_cast<Matrix&
>(Op);
1487 if (A.GetFixedBlockSize() != blockSize_)
1488 this->GetOStream(
Warnings0) <<
"Setting matrix block size to " << blockSize_ <<
" (value of the parameter in the list) " 1489 <<
"instead of " << A.GetFixedBlockSize() <<
" (provided matrix)." << std::endl
1490 <<
"You may want to check \"number of equations\" (or \"PDE equations\" for factory style list) parameter." << std::endl;
1492 A.SetFixedBlockSize(blockSize_, dofOffset_);
1494 }
catch (std::bad_cast& e) {
1495 this->GetOStream(
Warnings0) <<
"Skipping setting block size as the operator is not a matrix" << std::endl;
1499 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1509 const std::string& name = it->first;
1516 compare(Teuchos::getValue<ParameterList>(entry1), Teuchos::getValue<ParameterList>(*entry2));
1532 #define MUELU_PARAMETERLISTINTERPRETER_SHORT Important warning messages (one line)
Generic Smoother Factory for generating the smoothers of the MG hierarchy.
This class specifies the default factory that should generate some data on a Level if the data does n...
High level timing information (use Teuchos::TimeMonitor::summarize() to print)
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.
void SetVerbLevel(const VerbLevel verbLevel)
Set the verbosity level of this object.
Factory that can generate other factories from.
int LevenshteinDistance(const char *s, size_t len_s, const char *t, size_t len_t)
Print external lib objects.
static void SetDefaultVerbLevel(const VerbLevel defaultVerbLevel)
Set the default (global) verbosity level.
ConstIterator begin() const
T & get(const std::string &name, T def_value)
Class that encapsulates external library smoothers.
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)
const ParameterEntry & entry(ConstIterator i) const
#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.
bool isSublist(const std::string &name) const
Print additional debugging information.
Ordinal numParams() const
One-liner description of what is happening.
ParameterListInterpreter()
Empty constructor.
void BuildFactoryMap(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, FactoryMap &factoryMapOut, FactoryManagerMap &factoryManagers) const
virtual void SetupOperator(Operator &A) const
Setup Operator object.
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.
Namespace for MueLu classes and methods.
#define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory)
Interface to Zoltan library.This interface provides access to partitioning methods in Zoltan...
void AddCoordTransferFactory(const RCP< const FactoryBase > &factory)
Add a coordinate transfer factory in the end of list of coordinate transfer factories.
bool IsParamMuemexVariable(const std::string &name)
static VerbLevel GetDefaultVerbLevel()
Get the default (global) verbosity level.
std::map< std::string, RCP< FactoryManagerBase > > FactoryManagerMap
std::map< std::string, RCP< const FactoryBase > > FactoryMap
Print skeleton for the run, i.e. factory calls and used parameters.
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 SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
Prolongator factory performing semi-coarsening.
Factory for building restriction operators using a prolongator factory.
ParameterEntry * getEntryPtr(const std::string &name)
Teuchos::RCP< MueLu::FacadeClassFactory< Scalar, LocalOrdinal, GlobalOrdinal, Node > > facadeFact_
FacadeClass factory.
ParameterList & setEntry(const std::string &name, const ParameterEntry &entry)
ConstIterator end() const
Important warning messages (more verbose)
Print statistics that do not involve significant additional computation.
bool remove(std::string const &name, bool throwIfNotExists=true)
#define MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList, paramName, paramType, listWrite)
static bool compare(const ParameterList &list1, const ParameterList &list2)
static CycleType GetDefaultCycle()
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void UpdateFactoryManager(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
virtual void SetParameterList(const ParameterList ¶mList)
Set parameters from a parameter list and return with default values.
Detailed timing information (use Teuchos::TimeMonitor::summarize() to print)
Factory for interacting with Matlab.
Factory for interacting with Matlab.
Factory for building line detection information.
params_t::ConstIterator ConstIterator
void Validate(const Teuchos::ParameterList ¶mList) const
void SetFactoryParameterList(const Teuchos::ParameterList ¶mList)
Factory interpreter stuff.
Factory to export aggregation info or visualize aggregates using VTK.
Interface to Zoltan2 library.This interface provides access to partitioning methods in Zoltan2...
Prolongator factory which allows switching between two different prolongator strategies.
By default, enabled timers appears in the teuchos time monitor summary. Use this option if you do not...
Factory for building the constraint operator.
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< const FactoryBase > GetFactory(const std::string &varName) const
Get factory associated with a particular data name.
const std::string & name() const
any & getAny(bool activeQry=true)
Timers that are enabled (using Timings0/Timings1) will be printed during the execution.
void SetupHierarchy(Hierarchy &H) const
Call the SetupHierarchy routine from the HiearchyManager object.
Record timing information level by level. Must be used in combinaison with Timings0/Timings1.
Factory for creating a graph base on a given matrix.
Class that encapsulates Matlab smoothers.
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.
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.
Class for transferring coordinates from a finer level to a coarser one.
Factory for building restriction operators.
Factory for building Energy Minimization prolongators.
bool isParameter(const std::string &name) const
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="")
VerbLevel GetVerbLevel() const
Get the verbosity level.
#define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2)
virtual void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Configuration.
#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
Description of what is happening (more verbose)
Factory for building coarse matrices.
Factory for building Petrov-Galerkin Smoothed Aggregation prolongators.
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.Input/output of SaPFactory
Factory for building uncoupled aggregates.
static Teuchos::RCP< const Teuchos::ParameterList > List()
Return a "master" list of all valid parameters and their default values.
#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)
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.