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" 98 #ifdef HAVE_MUELU_KOKKOS_REFACTOR 99 #include "MueLu_CoalesceDropFactory_kokkos.hpp" 100 #include "MueLu_CoarseMapFactory_kokkos.hpp" 101 #include "MueLu_CoordinatesTransferFactory_kokkos.hpp" 102 #include "MueLu_NullspaceFactory_kokkos.hpp" 103 #include "MueLu_SaPFactory_kokkos.hpp" 104 #include "MueLu_TentativePFactory_kokkos.hpp" 105 #include "MueLu_UncoupledAggregationFactory_kokkos.hpp" 108 #ifdef HAVE_MUELU_MATLAB 109 #include "../matlab/src/MueLu_MatlabSmoother_decl.hpp" 110 #include "../matlab/src/MueLu_MatlabSmoother_def.hpp" 111 #include "../matlab/src/MueLu_TwoLevelMatlabFactory_decl.hpp" 112 #include "../matlab/src/MueLu_TwoLevelMatlabFactory_def.hpp" 113 #include "../matlab/src/MueLu_SingleLevelMatlabFactory_decl.hpp" 114 #include "../matlab/src/MueLu_SingleLevelMatlabFactory_def.hpp" 117 #ifdef HAVE_MUELU_INTREPID2 118 #include "MueLu_IntrepidPCoarsenFactory.hpp" 121 #include <unordered_set> 125 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
128 if(facadeFact == Teuchos::null)
134 std::string filename = paramList.
get(
"xml parameter file",
"");
135 if (filename.length() != 0) {
151 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
154 if(facadeFact == Teuchos::null)
164 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
172 SetFactoryParameterList(paramList);
174 }
else if (paramList.
isParameter(
"MueLu preconditioner") ==
true) {
175 this->GetOStream(
Runtime0) <<
"Use facade class: " << paramList.
get<std::string>(
"MueLu preconditioner") << std::endl;
177 SetFactoryParameterList(*pp);
184 Validate(serialList);
185 SetEasyParameterList(paramList);
198 #define MUELU_SET_VAR_2LIST(paramList, defaultList, paramName, paramType, varName) \ 200 if (paramList.isParameter(paramName)) varName = paramList.get<paramType>(paramName); \ 201 else if (defaultList.isParameter(paramName)) varName = defaultList.get<paramType>(paramName); \ 202 else varName = MasterList::getDefault<paramType>(paramName); 204 #define MUELU_TEST_AND_SET_VAR(paramList, paramName, paramType, varName) \ 205 (paramList.isParameter(paramName) ? varName = paramList.get<paramType>(paramName), true : false) 209 #define MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList, paramName, paramType, listWrite) \ 211 if (paramList .isParameter(paramName)) listWrite.set(paramName, paramList .get<paramType>(paramName)); \ 212 else if (defaultList.isParameter(paramName)) listWrite.set(paramName, defaultList.get<paramType>(paramName)); \ 214 catch(Teuchos::Exceptions::InvalidParameterType) { \ 215 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(true, Teuchos::Exceptions::InvalidParameterType, \ 216 "Error: parameter \"" << paramName << "\" must be of type " << Teuchos::TypeNameTraits<paramType>::name()); \ 219 #define MUELU_TEST_PARAM_2LIST(paramList, defaultList, paramName, paramType, cmpValue) \ 221 paramList.isParameter(paramName) ? paramList .get<paramType>(paramName) : ( \ 222 defaultList.isParameter(paramName) ? defaultList.get<paramType>(paramName) : \ 223 MasterList::getDefault<paramType>(paramName) ) ) ) 225 #ifndef HAVE_MUELU_KOKKOS_REFACTOR 226 #define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory) \ 227 RCP<Factory> varName = rcp(new oldFactory()); 228 #define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory) \ 229 varName = rcp(new oldFactory()); 231 #define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory) \ 232 RCP<Factory> varName; \ 233 if (!useKokkos_) varName = rcp(new oldFactory()); \ 234 else varName = rcp(new newFactory()); 235 #define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory) \ 236 if (!useKokkos_) varName = rcp(new oldFactory()); \ 237 else varName = rcp(new newFactory()); 240 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
245 MUELU_SET_VAR_2LIST(constParamList, constParamList,
"problem: type", std::string, problemType);
246 if (problemType !=
"unknown") {
252 paramList = constParamList;
256 #if !defined(HAVE_MUELU_KOKKOS_REFACTOR) 258 #elif defined(HAVE_MUELU_KOKKOS_REFACTOR_USE_BY_DEFAULT) 260 tempList.
set(
"use kokkos refactor",
true);
262 useKokkos_ = useKokkos;
265 useKokkos_ = useKokkos;
275 std::map<std::string, CycleType> cycleMap;
279 auto cycleType = paramList.
get<std::string>(
"cycle type");
281 "Invalid cycle type: \"" << cycleType <<
"\"");
282 Cycle_ = cycleMap[cycleType];
285 if (paramList.
isParameter(
"coarse grid correction scaling factor"))
286 scalingFactor_ = paramList.
get<
double>(
"coarse grid correction scaling factor");
288 this->maxCoarseSize_ = paramList.
get<
int> (
"coarse: max size", MasterList::getDefault<int>(
"coarse: max size"));
289 this->numDesiredLevel_ = paramList.
get<
int> (
"max levels", MasterList::getDefault<int>(
"max levels"));
290 blockSize_ = paramList.
get<
int> (
"number of equations", MasterList::getDefault<int>(
"number of equations"));
295 if (paramList.
isSublist(
"export data")) {
299 this->matricesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"A");
301 this->prolongatorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"P");
303 this->restrictorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"R");
305 this->nullspaceToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Nullspace");
307 this->coordinatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Coordinates");
308 if (printList.
isParameter(
"pcoarsen: element to node map"))
309 this->elementToNodeMapsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"pcoarsen: element to node map");
315 std::map<std::string, MsgType> verbMap;
316 verbMap[
"none"] =
None;
317 verbMap[
"low"] =
Low;
318 verbMap[
"medium"] =
Medium;
319 verbMap[
"high"] =
High;
321 verbMap[
"test"] =
Test;
326 "Invalid verbosity level: \"" << verbosityLevel <<
"\"");
327 this->verbosity_ = verbMap[verbosityLevel];
338 useCoordinates_ =
false;
339 if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"distance laplacian") ||
342 useCoordinates_ =
true;
343 }
else if(paramList.
isSublist(
"smoother: params")) {
344 const auto smooParamList = paramList.
sublist(
"smoother: params");
345 if(smooParamList.isParameter(
"partitioner: type") &&
346 (smooParamList.get<std::string>(
"partitioner: type") ==
"line")) {
347 useCoordinates_ =
true;
350 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
351 std::string levelStr =
"level " +
toString(levelID);
356 if (
MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"distance laplacian") ||
359 useCoordinates_ =
true;
367 if (!paramList.
isSublist(
"repartition: params")) {
368 useCoordinates_ =
true;
371 if (repParams.
isType<std::string>(
"algorithm")) {
372 const std::string algo = repParams.
get<std::string>(
"algorithm");
373 if (algo ==
"multijagged" || algo ==
"rcb") {
374 useCoordinates_ =
true;
377 useCoordinates_ =
true;
381 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
382 std::string levelStr =
"level " +
toString(levelID);
388 if (!levelList.
isSublist(
"repartition: params")) {
389 useCoordinates_ =
true;
393 if (repParams.
isType<std::string>(
"algorithm")) {
394 const std::string algo = repParams.
get<std::string>(
"algorithm");
395 if (algo ==
"multijagged" || algo ==
"rcb"){
396 useCoordinates_ =
true;
400 useCoordinates_ =
true;
409 changedPRrebalance_ =
false;
411 changedPRrebalance_ =
MUELU_TEST_AND_SET_VAR(paramList,
"repartition: rebalance P and R",
bool, this->doPRrebalance_);
414 changedImplicitTranspose_ =
MUELU_TEST_AND_SET_VAR(paramList,
"transpose: use implicit",
bool, this->implicitTranspose_);
422 std::vector<keep_pair> keeps0;
423 UpdateFactoryManager(paramList,
ParameterList(), *defaultManager, 0, keeps0);
426 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
435 std::vector<keep_pair> keeps;
439 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
443 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
446 this->keep_[levelID] = keeps;
447 this->AddFactoryManager(levelID, 1, levelManager);
454 this->GetOStream(static_cast<MsgType>(
Runtime1), 0) << paramList << std::endl;
469 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
470 std::string levelStr =
"level " +
toString(levelID);
485 std::ostringstream unusedParamsStream;
487 unusedParamList.
print(unusedParamsStream, indent);
489 this->GetOStream(
Warnings1) <<
"The following parameters were not used:\n" << unusedParamsStream.str() << std::endl;
500 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
503 int levelID, std::vector<keep_pair>& keeps)
const 508 using strings = std::unordered_set<std::string>;
518 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
520 Exceptions::RuntimeError,
"Unknown \"multigrid algorithm\" value: \"" << multigridAlgo <<
"\". Please consult User's Guide.");
521 #ifndef HAVE_MUELU_MATLAB 523 "Cannot use matlab for multigrid algorithm - MueLu was not configured with MATLAB support.");
525 #ifndef HAVE_MUELU_INTREPID2 527 "Cannot use IntrepidPCoarsen prolongator factory - MueLu was not configured with Intrepid support.");
532 if (reuseType ==
"none" || reuseType ==
"S" || reuseType ==
"RP" || reuseType ==
"RAP") {
535 }
else if (reuseType ==
"tP" && (multigridAlgo !=
"sa" && multigridAlgo !=
"unsmoothed")) {
537 this->GetOStream(
Warnings0) <<
"Ignoring \"tP\" reuse option as it is only compatible with \"sa\", " 538 "or \"unsmoothed\" multigrid algorithms" << std::endl;
540 }
else if (reuseType ==
"emin" && multigridAlgo !=
"emin") {
542 this->GetOStream(
Warnings0) <<
"Ignoring \"emin\" reuse option it is only compatible with " 543 "\"emin\" multigrid algorithm" << std::endl;
548 bool have_userP =
false;
553 UpdateFactoryManager_Smoothers(paramList, defaultList, manager, levelID, keeps);
556 UpdateFactoryManager_CoarseSolvers(paramList, defaultList, manager, levelID, keeps);
559 UpdateFactoryManager_Aggregation_TentativeP(paramList, defaultList, manager, levelID, keeps);
563 UpdateFactoryManager_Nullspace(paramList, defaultList, manager, levelID, keeps, nullSpaceFactory);
574 }
else if (multigridAlgo ==
"unsmoothed") {
578 }
else if (multigridAlgo ==
"sa") {
580 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
582 }
else if (multigridAlgo ==
"emin") {
584 UpdateFactoryManager_Emin(paramList, defaultList, manager, levelID, keeps);
586 }
else if (multigridAlgo ==
"pg") {
588 UpdateFactoryManager_PG(paramList, defaultList, manager, levelID, keeps);
590 }
else if (multigridAlgo ==
"matlab") {
592 UpdateFactoryManager_Matlab(paramList, defaultList, manager, levelID, keeps);
594 }
else if (multigridAlgo ==
"pcoarsen") {
596 UpdateFactoryManager_PCoarsen(paramList, defaultList, manager, levelID, keeps);
600 UpdateFactoryManager_SemiCoarsen(paramList, defaultList, manager, levelID, keeps);
603 UpdateFactoryManager_Restriction(paramList, defaultList, manager, levelID, keeps);
606 UpdateFactoryManager_RAP(paramList, defaultList, manager, levelID, keeps);
609 UpdateFactoryManager_Coordinates(paramList, defaultList, manager, levelID, keeps);
612 if ((reuseType ==
"RP" || reuseType ==
"RAP" || reuseType ==
"full") && levelID)
615 if (reuseType ==
"RP" && levelID) {
617 if (!this->implicitTranspose_)
620 if ((reuseType ==
"tP" || reuseType ==
"RP" || reuseType ==
"emin") && useCoordinates_ && levelID)
624 UpdateFactoryManager_Repartition(paramList, defaultList, manager, levelID, keeps, nullSpaceFactory);
627 if ((reuseType ==
"RAP" || reuseType ==
"full") && levelID) {
629 if (!this->implicitTranspose_)
638 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
641 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const 643 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
648 bool isCustomSmoother =
651 paramList.
isSublist (
"smoother: params") || paramList.
isSublist (
"smoother: pre params") || paramList.
isSublist (
"smoother: post params") ||
657 manager.
SetFactory(
"Smoother", Teuchos::null);
659 }
else if (isCustomSmoother) {
663 #define TEST_MUTUALLY_EXCLUSIVE(arg1,arg2) \ 664 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isParameter(#arg1) && paramList.isParameter(#arg2), \ 665 Exceptions::InvalidArgument, "You cannot specify both \""#arg1"\" and \""#arg2"\""); 666 #define TEST_MUTUALLY_EXCLUSIVE_S(arg1,arg2) \ 667 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isSublist(#arg1) && paramList.isSublist(#arg2), \ 668 Exceptions::InvalidArgument, "You cannot specify both \""#arg1"\" and \""#arg2"\""); 684 defaultSmootherParams.
set(
"relaxation: type",
"Symmetric Gauss-Seidel");
689 std::string preSmootherType, postSmootherType;
693 overlap = paramList.
get<
int>(
"smoother: overlap");
697 preSmootherType = paramList.
get<std::string>(
"smoother: pre type");
699 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, preSmootherTypeTmp);
700 preSmootherType = preSmootherTypeTmp;
702 if (paramList.
isParameter(
"smoother: pre overlap"))
703 overlap = paramList.
get<
int>(
"smoother: pre overlap");
705 if (paramList.
isSublist(
"smoother: pre params"))
706 preSmootherParams = paramList.
sublist(
"smoother: pre params");
707 else if (paramList.
isSublist(
"smoother: params"))
708 preSmootherParams = paramList.
sublist(
"smoother: params");
709 else if (defaultList.
isSublist(
"smoother: params"))
710 preSmootherParams = defaultList.
sublist(
"smoother: params");
711 else if (preSmootherType ==
"RELAXATION")
712 preSmootherParams = defaultSmootherParams;
714 #ifdef HAVE_MUELU_INTREPID2 716 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
720 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
721 auto pcoarsen_element = defaultList.
get<std::string>(
"pcoarsen: element");
723 if (levelID < (
int)pcoarsen_schedule.size()) {
725 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
726 preSmootherParams.
set(
"pcoarsen: hi basis", lo);
731 #ifdef HAVE_MUELU_MATLAB 732 if (preSmootherType ==
"matlab")
741 postSmootherType = paramList.
get<std::string>(
"smoother: post type");
743 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, postSmootherTypeTmp);
744 postSmootherType = postSmootherTypeTmp;
747 if (paramList.
isSublist(
"smoother: post params"))
748 postSmootherParams = paramList.
sublist(
"smoother: post params");
749 else if (paramList.
isSublist(
"smoother: params"))
750 postSmootherParams = paramList.
sublist(
"smoother: params");
751 else if (defaultList.
isSublist(
"smoother: params"))
752 postSmootherParams = defaultList.
sublist(
"smoother: params");
753 else if (postSmootherType ==
"RELAXATION")
754 postSmootherParams = defaultSmootherParams;
755 if (paramList.
isParameter(
"smoother: post overlap"))
756 overlap = paramList.
get<
int>(
"smoother: post overlap");
758 if (postSmootherType == preSmootherType &&
areSame(preSmootherParams, postSmootherParams))
759 postSmoother = preSmoother;
761 #ifdef HAVE_MUELU_INTREPID2 763 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
767 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
768 auto pcoarsen_element = defaultList.
get<std::string>(
"pcoarsen: element");
770 if (levelID < (
int)pcoarsen_schedule.size()) {
772 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
773 postSmootherParams.
set(
"pcoarsen: hi basis", lo);
778 #ifdef HAVE_MUELU_MATLAB 779 if (postSmootherType ==
"matlab")
787 if (preSmoother == postSmoother)
790 manager.
SetFactory(
"PreSmoother", preSmoother);
791 manager.
SetFactory(
"PostSmoother", postSmoother);
798 bool reuseSmoothers = (reuseType ==
"S" || reuseType !=
"none");
799 if (reuseSmoothers) {
800 auto preSmootherFactory = rcp_const_cast<
Factory>(rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"PreSmoother")));
802 if (preSmootherFactory != Teuchos::null) {
804 postSmootherFactoryParams.
set(
"keep smoother data",
true);
805 preSmootherFactory->SetParameterList(postSmootherFactoryParams);
807 keeps.push_back(
keep_pair(
"PreSmoother data", preSmootherFactory.get()));
810 auto postSmootherFactory = rcp_const_cast<
Factory>(rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"PostSmoother")));
811 if (postSmootherFactory != Teuchos::null) {
813 postSmootherFactoryParams.
set(
"keep smoother data",
true);
814 postSmootherFactory->SetParameterList(postSmootherFactoryParams);
816 keeps.push_back(
keep_pair(
"PostSmoother data", postSmootherFactory.get()));
820 if (coarseFactory != Teuchos::null) {
822 coarseFactoryParams.
set(
"keep smoother data",
true);
823 coarseFactory->SetParameterList(coarseFactoryParams);
825 keeps.push_back(
keep_pair(
"PreSmoother data", coarseFactory.get()));
829 if ((reuseType ==
"RAP" && levelID) || (reuseType ==
"full")) {
848 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
851 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const 854 bool isCustomCoarseSolver =
858 this->GetOStream(
Warnings0) <<
"No coarse grid solver" << std::endl;
859 manager.
SetFactory(
"CoarseSolver", Teuchos::null);
861 }
else if (isCustomCoarseSolver) {
869 overlap = paramList.
get<
int>(
"coarse: overlap");
872 if (paramList.
isSublist(
"coarse: params"))
873 coarseParams = paramList.
sublist(
"coarse: params");
874 else if (defaultList.
isSublist(
"coarse: params"))
875 coarseParams = defaultList.
sublist(
"coarse: params");
877 using strings = std::unordered_set<std::string>;
883 if (strings({
"RELAXATION",
"CHEBYSHEV",
"ILUT",
"ILU",
"RILUK",
"SCHWARZ",
"Amesos",
884 "BLOCK RELAXATION",
"BLOCK_RELAXATION",
"BLOCKRELAXATION" ,
885 "SPARSE BLOCK RELAXATION",
"SPARSE_BLOCK_RELAXATION",
"SPARSEBLOCKRELAXATION",
886 "LINESMOOTHING_BANDEDRELAXATION",
"LINESMOOTHING_BANDED_RELAXATION",
"LINESMOOTHING_BANDED RELAXATION",
887 "LINESMOOTHING_TRIDIRELAXATION",
"LINESMOOTHING_TRIDI_RELAXATION",
"LINESMOOTHING_TRIDI RELAXATION",
888 "LINESMOOTHING_TRIDIAGONALRELAXATION",
"LINESMOOTHING_TRIDIAGONAL_RELAXATION",
"LINESMOOTHING_TRIDIAGONAL RELAXATION",
889 "TOPOLOGICAL",
"FAST_ILU",
"FAST_IC",
"FAST_ILDL"}).count(coarseType)) {
892 #ifdef HAVE_MUELU_MATLAB 893 if (coarseType ==
"matlab")
907 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
910 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const 912 using strings = std::unordered_set<std::string>;
920 #ifdef HAVE_MUELU_MATLAB 925 throw std::runtime_error(
"Cannot use MATLAB evolutionary strength-of-connection - MueLu was not configured with MATLAB support.");
930 dropParams.
set(
"lightweight wrap",
true);
947 #ifndef HAVE_MUELU_MATLAB 948 if (aggType ==
"matlab")
949 throw std::runtime_error(
"Cannot use MATLAB aggregation - MueLu was not configured with MATLAB support.");
952 if (aggType ==
"uncoupled") {
975 }
else if (aggType ==
"coupled") {
979 }
else if (aggType ==
"brick") {
991 aggFactory->
SetFactory(
"Coordinates", this->GetFactoryManager(levelID-1)->GetFactory(
"Coordinates"));
994 #ifdef HAVE_MUELU_MATLAB 995 else if(aggType ==
"matlab") {
1001 manager.
SetFactory(
"Aggregates", aggFactory);
1005 coarseMap->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1011 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1012 ptentParams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1013 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1014 ptentParams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1017 Ptent->SetParameterList(ptentParams);
1018 Ptent->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1019 Ptent->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1022 if (reuseType ==
"tP" && levelID) {
1023 keeps.push_back(
keep_pair(
"Nullspace", Ptent.get()));
1024 keeps.push_back(
keep_pair(
"P", Ptent.get()));
1031 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1034 int levelID, std::vector<keep_pair>& keeps)
const 1048 std::string alg = paramList.
get(
"rap: algorithm",
"galerkin");
1049 if (alg ==
"shift" || alg ==
"non-galerkin") {
1057 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1058 RAPparams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1059 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1060 RAPparams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1066 if (paramList.
isParameter(
"aggregation: allow empty prolongator columns")) {
1067 RAPparams.
set(
"CheckMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1068 RAPparams.
set(
"RepairMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1070 else if (defaultList.
isParameter(
"aggregation: allow empty prolongator columns")) {
1071 RAPparams.
set(
"CheckMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1072 RAPparams.
set(
"RepairMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1088 if (!this->implicitTranspose_) {
1095 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: export visualization data",
bool,
true)) {
1119 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
1120 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
1122 if (reuseType ==
"RP" || (reuseType ==
"tP" && !filteringChangesMatrix)) {
1124 keeps.push_back(
keep_pair(
"AP reuse data", RAP.
get()));
1125 keeps.push_back(
keep_pair(
"RAP reuse data", RAP.
get()));
1128 keeps.push_back(
keep_pair(
"AP reuse data", RAPs.
get()));
1129 keeps.push_back(
keep_pair(
"RAP reuse data", RAPs.
get()));
1137 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1140 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const 1142 bool have_userCO =
false;
1146 if (useCoordinates_) {
1152 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1153 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1157 if (!RAP.is_null()) {
1158 RAP->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1161 RAPs->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1170 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1173 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const 1175 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
1176 bool have_userR =
false;
1181 if (!this->implicitTranspose_) {
1184 if (isSymmetric ==
false && (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"emin")) {
1186 "Switching \"problem: symmetric\" parameter to symmetric as multigrid algorithm. " <<
1187 multigridAlgo <<
" is primarily supposed to be used for symmetric problems.\n\n" <<
1188 "Please note: if you are using \"unsmoothed\" transfer operators the \"problem: symmetric\" parameter " <<
1189 "has no real mathematical meaning, i.e. you can use it for non-symmetric\n" <<
1190 "problems, too. With \"problem: symmetric\"=\"symmetric\" you can use implicit transpose for building " <<
1191 "the restriction operators which may drastically reduce the amount of consumed memory." << std::endl;
1195 "Petrov-Galerkin smoothed transfer operators are only allowed for non-symmetric problems: Set \"problem: symmetric\" to false!\n" \
1196 "While PG smoothed transfer operators generally would also work for symmetric problems this is an unusual use case. " \
1197 "You can use the factory-based xml interface though if you need PG-AMG for symmetric problems.");
1218 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1221 int levelID, std::vector<keep_pair>& keeps,
RCP<Factory> & nullSpaceFactory)
const 1265 "Reuse types \"tP\" and \"PR\" require \"repartition: rebalance P and R\" set to \"false\"");
1270 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: partitioner", std::string, partName);
1272 "Invalid partitioner name: \"" << partName <<
"\". Valid options: \"zoltan\", \"zoltan2\"");
1274 bool switched =
false;
1276 #ifndef HAVE_MUELU_ZOLTAN 1277 if (partName ==
"zoltan") {
1278 this->GetOStream(
Warnings0) <<
"Zoltan interface is not available, trying to switch to Zoltan2" << std::endl;
1279 partName =
"zoltan2";
1283 #ifndef HAVE_MUELU_ZOLTAN2 1284 if (partName ==
"zoltan2" && !switched) {
1285 this->GetOStream(
Warnings0) <<
"Zoltan2 interface is not available, trying to switch to Zoltan" << std::endl;
1286 partName =
"zoltan";
1297 repartheurFactory->SetParameterList(repartheurParams);
1298 repartheurFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1299 manager.
SetFactory(
"number of partitions", repartheurFactory);
1303 if (partName ==
"zoltan") {
1304 #ifdef HAVE_MUELU_ZOLTAN 1310 }
else if (partName ==
"zoltan2") {
1311 #ifdef HAVE_MUELU_ZOLTAN2 1315 partParams.
set(
"ParameterList", partpartParams);
1323 if (useCoordinates_)
1325 manager.
SetFactory(
"Partition", partitioner);
1333 repartFactory->SetParameterList(repartParams);
1334 repartFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1335 repartFactory->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1336 repartFactory->SetFactory(
"Partition", manager.
GetFactory(
"Partition"));
1337 manager.
SetFactory(
"Importer", repartFactory);
1338 if (reuseType !=
"none" && reuseType !=
"S" && levelID)
1345 newA->SetParameterList(rebAcParams);
1346 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1347 newA->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1353 newPparams.
set(
"type",
"Interpolation");
1354 if (changedPRrebalance_)
1355 newPparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1357 newP-> SetParameterList(newPparams);
1358 newP-> SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1359 newP-> SetFactory(
"P", manager.
GetFactory(
"P"));
1360 if (!paramList.
isParameter(
"semicoarsen: number of levels"))
1361 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1363 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"P"));
1364 if (useCoordinates_)
1365 newP-> SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1367 if (useCoordinates_)
1373 newRparams.
set(
"type",
"Restriction");
1375 if (changedPRrebalance_)
1376 newRparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1377 if (changedImplicitTranspose_)
1378 newRparams.
set(
"transpose: use implicit", this->implicitTranspose_);
1379 newR-> SetParameterList(newRparams);
1380 newR-> SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1381 if (!this->implicitTranspose_) {
1382 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1393 nullSpaceFactory->
SetFactory(
"Nullspace", newP);
1403 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1406 int levelID, std::vector<keep_pair>& keeps,
RCP<Factory> & nullSpaceFactory)
const 1411 bool have_userNS =
false;
1416 nullSpace->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1419 nullSpaceFactory = nullSpace;
1425 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1428 int levelID, std::vector<keep_pair>& keeps)
const 1432 if (paramList.
isParameter(
"semicoarsen: number of levels") &&
1433 paramList.
get<
int>(
"semicoarsen: number of levels") > 0) {
1458 manager.
SetFactory(
"CoarseNumZLayers", linedetectionFactory);
1459 manager.
SetFactory(
"LineDetection_Layers", linedetectionFactory);
1460 manager.
SetFactory(
"LineDetection_VertLineIds", linedetectionFactory);
1464 manager.
SetFactory(
"Nullspace", togglePFactory);
1468 if (paramList.
isParameter(
"semicoarsen: number of levels")) {
1470 tf->SetFactory(
"Chosen P", manager.
GetFactory(
"P"));
1471 tf->AddCoordTransferFactory(semicoarsenFactory);
1474 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1475 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1476 tf->AddCoordTransferFactory(coords);
1485 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1488 int levelID, std::vector<keep_pair>& keeps)
const 1490 #ifdef HAVE_MUELU_INTREPID2 1495 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
1496 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
1498 if (levelID >= (
int)pcoarsen_schedule.size()) {
1501 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
1507 std::string lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
1508 std::string hi = (levelID ? pcoarsen_element + std::to_string(pcoarsen_schedule[levelID-1]) : lo);
1509 Pparams.
set(
"pcoarsen: hi basis", hi);
1510 Pparams.
set(
"pcoarsen: lo basis", lo);
1511 P->SetParameterList(Pparams);
1524 P->SetParameterList(Pparams);
1537 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1543 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1544 Pparams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1545 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1546 Pparams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1548 P->SetParameterList(Pparams);
1551 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
1568 P->SetFactory(
"A", filterFactory);
1571 P->SetFactory(
"A", manager.
GetFactory(
"Graph"));
1575 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
1578 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
1580 if (reuseType ==
"tP" && !filteringChangesMatrix)
1581 keeps.push_back(
keep_pair(
"AP reuse data", P.get()));
1587 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1590 int levelID, std::vector<keep_pair>& keeps)
const 1595 "Invalid pattern name: \"" << patternType <<
"\". Valid options: \"AkPtent\"");
1600 patternFactory->SetParameterList(patternParams);
1601 patternFactory->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
1602 manager.
SetFactory(
"Ppattern", patternFactory);
1606 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
1607 constraintFactory->SetFactory(
"CoarseNullspace", manager.
GetFactory(
"Ptent"));
1608 manager.
SetFactory(
"Constraint", constraintFactory);
1615 if (reuseType ==
"emin") {
1617 Pparams.
set(
"Keep P0",
true);
1618 Pparams.
set(
"Keep Constraint0",
true);
1620 P->SetParameterList(Pparams);
1621 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
1622 P->SetFactory(
"Constraint", manager.
GetFactory(
"Constraint"));
1629 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1632 int levelID, std::vector<keep_pair>& keeps)
const 1635 "Implicit transpose not supported with Petrov-Galerkin smoothed transfer operators: Set \"transpose: use implicit\" to false!\n" \
1636 "Petrov-Galerkin transfer operator smoothing for non-symmetric problems requires a separate handling of the restriction operator which " \
1637 "does not allow the usage of implicit transpose easily.");
1641 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
1649 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1652 int levelID, std::vector<keep_pair>& keeps)
const {
1653 #ifdef HAVE_MUELU_MATLAB 1656 P->SetParameterList(Pparams);
1657 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
1662 #undef MUELU_SET_VAR_2LIST 1663 #undef MUELU_TEST_AND_SET_VAR 1664 #undef MUELU_TEST_AND_SET_PARAM_2LIST 1665 #undef MUELU_TEST_PARAM_2LIST 1666 #undef MUELU_KOKKOS_FACTORY 1670 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1675 const int maxLevels = 100;
1678 std::vector<ParameterList> paramLists;
1679 for (
int levelID = 0; levelID < maxLevels; levelID++) {
1680 std::string sublistName =
"level " +
toString(levelID);
1682 paramLists.push_back(paramList.
sublist(sublistName));
1684 paramList.
remove(sublistName);
1687 paramLists.push_back(paramList);
1689 #ifdef HAVE_MUELU_MATLAB 1691 for (
size_t i = 0; i < paramLists.size(); i++) {
1692 std::vector<std::string> customVars;
1695 std::string paramName = paramLists[i].name(it);
1698 customVars.push_back(paramName);
1702 for (
size_t j = 0; j < customVars.size(); j++)
1703 paramLists[i].
remove(customVars[j],
false);
1707 const int maxDepth = 0;
1708 for (
size_t i = 0; i < paramLists.size(); i++) {
1711 paramLists[i].validateParameters(validList, maxDepth);
1714 std::string eString = e.what();
1717 size_t nameStart = eString.find_first_of(
'"') + 1;
1718 size_t nameEnd = eString.find_first_of(
'"', nameStart);
1719 std::string name = eString.substr(nameStart, nameEnd - nameStart);
1721 size_t bestScore = 100;
1722 std::string bestName =
"";
1724 const std::string& pName = validList.
name(it);
1725 this->GetOStream(
Runtime1) <<
"| " << pName;
1726 size_t score =
LevenshteinDistance(name.c_str(), name.length(), pName.c_str(), pName.length());
1727 this->GetOStream(
Runtime1) <<
" -> " << score << std::endl;
1728 if (score < bestScore) {
1733 if (bestScore < 10 && bestName !=
"") {
1735 eString <<
"The parameter name \"" + name +
"\" is not valid. Did you mean \"" + bestName <<
"\"?\n");
1739 eString <<
"The parameter name \"" + name +
"\" is not valid.\n");
1748 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1761 blockSize_ = paramList.
sublist(
"Matrix").
get<
int>(
"PDE equations", MasterList::getDefault<int>(
"number of equations"));
1762 dofOffset_ = paramList.
sublist(
"Matrix").
get<GlobalOrdinal>(
"DOF offset", 0);
1766 if (factFact_ == Teuchos::null)
1779 this->BuildFactoryMap(paramList.
sublist(
"Factories"), factoryMap, factoryMap, factoryManagers);
1798 this->numDesiredLevel_ = hieraList.
get<
int>(
"max levels");
1799 hieraList.
remove(
"max levels");
1803 this->maxCoarseSize_ = hieraList.
get<
int>(
"coarse: max size");
1804 hieraList.
remove(
"coarse: max size");
1807 if (hieraList.
isParameter(
"repartition: rebalance P and R")) {
1808 this->doPRrebalance_ = hieraList.
get<
bool>(
"repartition: rebalance P and R");
1809 hieraList.
remove(
"repartition: rebalance P and R");
1812 if (hieraList.
isParameter(
"transpose: use implicit")) {
1813 this->implicitTranspose_ = hieraList.
get<
bool>(
"transpose: use implicit");
1814 hieraList.
remove(
"transpose: use implicit");
1817 if (hieraList.
isParameter(
"coarse grid correction scaling factor")) {
1818 this->scalingFactor_ = hieraList.
get<
double>(
"coarse grid correction scaling factor");
1819 hieraList.
remove(
"coarse grid correction scaling factor");
1824 std::map<std::string, CycleType> cycleMap;
1828 std::string cycleType = hieraList.
get<std::string>(
"cycle type");
1830 this->Cycle_ = cycleMap[cycleType];
1834 std::map<std::string, MsgType> verbMap;
1836 verbMap[
"Errors"] =
Errors;
1853 verbMap[
"Debug"] =
Debug;
1854 verbMap[
"Test"] =
Test;
1856 verbMap[
"None"] =
None;
1857 verbMap[
"Low"] =
Low;
1858 verbMap[
"Medium"] =
Medium;
1859 verbMap[
"High"] =
High;
1862 std::string vl = hieraList.
get<std::string>(
"verbosity");
1863 hieraList.
remove(
"verbosity");
1865 if (verbMap.find(vl) != verbMap.end())
1866 this->verbosity_ = verbMap[vl];
1871 if (hieraList.
isParameter(
"dependencyOutputLevel"))
1872 this->graphOutputLevel_ = hieraList.
get<
int>(
"dependencyOutputLevel");
1878 if (hieraList.
isSublist(
"DataToWrite")) {
1882 std::string dataName =
"Matrices";
1884 this->matricesToPrint_ = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
1885 dataName =
"Prolongators";
1887 this->prolongatorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
1888 dataName =
"Restrictors";
1890 this->restrictorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
1895 const std::string & paramName = hieraList.
name(param);
1897 if (paramName !=
"DataToWrite" && hieraList.
isSublist(paramName)) {
1900 int startLevel = 0;
if(levelList.
isParameter(
"startLevel")) { startLevel = levelList.
get<
int>(
"startLevel"); levelList.
remove(
"startLevel"); }
1901 int numDesiredLevel = 1;
if(levelList.
isParameter(
"numDesiredLevel")) { numDesiredLevel = levelList.
get<
int>(
"numDesiredLevel"); levelList.
remove(
"numDesiredLevel"); }
1914 BuildFactoryMap(levelList, factoryMap, levelFactoryMap, factoryManagers);
1920 if (startLevel >= 0)
1921 this->AddFactoryManager(startLevel, numDesiredLevel, m);
2053 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2057 const std::string & paramName = paramList.
name(param);
2062 if (paramValue.
isList()) {
2063 ParameterList paramList1 = Teuchos::getValue<ParameterList>(paramValue);
2067 "MueLu::ParameterListInterpreter(): It seems that in the parameter lists for defining " << paramName <<
2068 " there is both a 'factory' and 'dependency for' parameter. This is not allowed. Please remove the 'dependency for' parameter.");
2070 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2072 }
else if (paramList1.
isParameter(
"dependency for")) {
2074 "MueLu::ParameterListInterpreter(): It seems that in the parameter lists for defining " << paramName <<
2075 " there is both a 'factory' and 'dependency for' parameter. This is not allowed.");
2077 std::string factoryName = paramList1.
get<std::string>(
"dependency for");
2081 "MueLu::ParameterListInterpreter(): could not find factory " + factoryName +
" in factory map. Did you define it before?");
2089 const std::string& pName = validParamList->name(vparam);
2099 factory->SetFactory(pName, generatingFact.
create_weak());
2102 if (pName ==
"ParameterList") {
2111 factory->SetParameter(pName, paramList1.
getEntry(pName));
2117 std::string groupType = paramList1.
get<std::string>(
"group");
2119 "group must be of type \"FactoryManager\".");
2122 groupList.
remove(
"group");
2125 BuildFactoryMap(groupList, factoryMapIn, groupFactoryMap, factoryManagers);
2131 factoryManagers[paramName] = m;
2134 this->GetOStream(
Warnings0) <<
"Could not interpret parameter list " << paramList1 << std::endl;
2136 "XML Parameter list must either be of type \"factory\" or of type \"group\".");
2140 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2148 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2151 Matrix& A =
dynamic_cast<Matrix&
>(Op);
2152 if (A.GetFixedBlockSize() != blockSize_)
2153 this->GetOStream(
Warnings0) <<
"Setting matrix block size to " << blockSize_ <<
" (value of the parameter in the list) " 2154 <<
"instead of " << A.GetFixedBlockSize() <<
" (provided matrix)." << std::endl
2155 <<
"You may want to check \"number of equations\" (or \"PDE equations\" for factory style list) parameter." << std::endl;
2157 A.SetFixedBlockSize(blockSize_, dofOffset_);
2159 }
catch (std::bad_cast& e) {
2160 this->GetOStream(
Warnings0) <<
"Skipping setting block size as the operator is not a matrix" << std::endl;
2164 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2175 const std::string& name = it->first;
2182 compare(Teuchos::getValue<ParameterList>(entry1), Teuchos::getValue<ParameterList>(*entry2));
2198 #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.
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 SetVerbLevel(const VerbLevel verbLevel)
Set the verbosity level of this object.
Factory that can generate other factories from.
void UpdateFactoryManager_CoarseSolvers(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
Print external lib objects.
static void SetDefaultVerbLevel(const VerbLevel defaultVerbLevel)
Set the default (global) verbosity level.
void UpdateFactoryManager_Smoothers(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
ConstIterator begin() 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)
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
void SetKokkosRefactor(const bool useKokkos)
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
Interpret "Factories" sublist.
void UpdateFactoryManager_SA(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 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...
bool IsParamMuemexVariable(const std::string &name)
void UpdateFactoryManager_Repartition(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps, RCP< Factory > &nullSpaceFactory) const
static VerbLevel GetDefaultVerbLevel()
Get the default (global) verbosity level.
void UpdateFactoryManager_Aggregation_TentativeP(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
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.
void UpdateFactoryManager_PG(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
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.
static RCP< Time > getNewTimer(const std::string &name)
ParameterEntry * getEntryPtr(const std::string &name)
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.
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.
void UpdateFactoryManager_Nullspace(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps, RCP< Factory > &nullSpaceFactory) const
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.
Prolongator factory which allows switching between two different prolongator strategies.
Interface to Zoltan2 library.This interface provides access to partitioning methods in Zoltan2...
void UpdateFactoryManager_SemiCoarsen(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
By default, enabled timers appears in the teuchos time monitor summary. Use this option if you do not...
bool isType(const std::string &name) const
Factory for building the constraint operator.
RCP< T > create_weak() const
void UpdateFactoryManager_Emin(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 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)
static void EnableTimerSync()
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.
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 UpdateFactoryManager_Coordinates(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.
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.
void UpdateFactoryManager_Matlab(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
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
void UpdateFactoryManager_Restriction(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) 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.
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
Description of what is happening (more verbose)
Factory for building coarse matrices.
Factory for building Petrov-Galerkin Smoothed Aggregation prolongators.
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.
#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.