46 #ifndef MUELU_PARAMETERLISTINTERPRETER_DEF_HPP 47 #define MUELU_PARAMETERLISTINTERPRETER_DEF_HPP 49 #include <Teuchos_XMLParameterListHelpers.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)
121 facadeFact_ = Teuchos::rcp(
new FacadeClassFactory());
123 facadeFact_ = facadeFact;
125 if (paramList.isParameter(
"xml parameter file")) {
126 std::string filename = paramList.get(
"xml parameter file",
"");
127 if (filename.length() != 0) {
128 TEUCHOS_TEST_FOR_EXCEPTION(comm.is_null(), Exceptions::RuntimeError,
"xml parameter file requires a valid comm");
130 ParameterList paramList2 = paramList;
131 Teuchos::updateParametersFromXmlFileAndBroadcast(filename, Teuchos::Ptr<Teuchos::ParameterList>(¶mList2), *comm);
132 SetParameterList(paramList2);
135 SetParameterList(paramList);
139 SetParameterList(paramList);
143 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
145 if(facadeFact == Teuchos::null)
150 ParameterList paramList;
151 Teuchos::updateParametersFromXmlFileAndBroadcast(xmlFileName, Teuchos::Ptr<ParameterList>(¶mList), comm);
155 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
161 if (paramList.isSublist(
"Hierarchy")) {
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;
165 Teuchos::RCP<ParameterList> pp = facadeFact_->SetParameterList(paramList);
167 SetFactoryParameterList(*pp);
171 ParameterList serialList, nonSerialList;
174 Validate(serialList);
175 SetEasyParameterList(paramList);
183 static inline bool areSame(
const ParameterList& list1,
const ParameterList& list2);
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>
232 ParameterList paramList;
234 MUELU_SET_VAR_2LIST(constParamList, constParamList,
"problem: type", std::string, problemType);
235 if (problemType !=
"unknown") {
237 paramList.setParameters(constParamList);
241 paramList = constParamList;
245 if (paramList.isParameter(
"cycle type")) {
246 std::map<std::string,CycleType> cycleMap;
250 std::string cycleType = paramList.get<std::string>(
"cycle type");
251 TEUCHOS_TEST_FOR_EXCEPTION(cycleMap.count(cycleType) == 0,
Exceptions::RuntimeError,
"Invalid cycle type: \"" << cycleType <<
"\"");
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")) {
263 ParameterList printList = paramList.sublist(
"export data");
265 if (printList.isParameter(
"A"))
266 this->matricesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"A");
267 if (printList.isParameter(
"P"))
268 this->prolongatorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"P");
269 if (printList.isParameter(
"R"))
270 this->restrictorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"R");
271 if (printList.isParameter(
"Nullspace"))
272 this->nullspaceToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Nullspace");
273 if (printList.isParameter(
"Coordinates"))
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);
313 if (paramList.isSublist(levelStr)) {
314 const ParameterList& levelList = paramList.sublist(levelStr);
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_);
338 defaultManager->SetVerbLevel(this->verbosity_);
341 std::vector<keep_pair> keeps0;
342 UpdateFactoryManager(paramList, ParameterList(), *defaultManager, 0, keeps0);
345 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
351 RCP<FactoryManager> levelManager = rcp(
new FactoryManager(*defaultManager));
352 levelManager->SetVerbLevel(defaultManager->GetVerbLevel());
354 std::vector<keep_pair> keeps;
355 if (paramList.isSublist(
"level " +
toString(levelID))) {
357 ParameterList& levelList = paramList.sublist(
"level " +
toString(levelID),
true);
358 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
361 ParameterList levelList;
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;
377 ParameterList unusedParamList;
380 for (ParameterList::ConstIterator it = paramList.begin(); it != paramList.end(); it++) {
381 const ParameterEntry& entry = paramList.entry(it);
383 if (!entry.isList() && !entry.isUsed())
384 unusedParamList.setEntry(paramList.name(it), entry);
388 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
389 std::string levelStr =
"level " +
toString(levelID);
391 if (paramList.isSublist(levelStr)) {
392 const ParameterList& levelList = paramList.sublist(levelStr);
394 for (ParameterList::ConstIterator itr = levelList.begin(); itr != levelList.end(); ++itr) {
395 const ParameterEntry& entry = levelList.entry(itr);
397 if (!entry.isList() && !entry.isUsed())
398 unusedParamList.sublist(levelStr).setEntry(levelList.name(itr), entry);
403 if (unusedParamList.numParams() > 0) {
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>
417 const ParameterList& defaultList,
FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
422 if (paramList.numParams() == 0 && defaultList.numParams() > 0)
423 paramList = ParameterList(defaultList);
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;
459 if (paramList.isParameter(
"A") && !paramList.get<RCP<Matrix> > (
"A") .is_null()) have_userA =
true;
460 if (paramList.isParameter(
"P") && !paramList.get<RCP<Matrix> > (
"P") .is_null()) have_userP =
true;
461 if (paramList.isParameter(
"R") && !paramList.get<RCP<Matrix> > (
"R") .is_null()) have_userR =
true;
462 if (paramList.isParameter(
"Nullspace") && !paramList.get<RCP<MultiVector> >(
"Nullspace") .is_null()) have_userNS =
true;
463 if (paramList.isParameter(
"Coordinates") && !paramList.get<RCP<MultiVector> >(
"Coordinates").is_null()) have_userCO =
true;
467 bool isCustomSmoother =
468 paramList.isParameter(
"smoother: pre or post") ||
469 paramList.isParameter(
"smoother: type") || paramList.isParameter(
"smoother: pre type") || paramList.isParameter(
"smoother: post type") ||
470 paramList.isSublist (
"smoother: params") || paramList.isSublist (
"smoother: pre params") || paramList.isSublist (
"smoother: post params") ||
471 paramList.isParameter(
"smoother: sweeps") || paramList.isParameter(
"smoother: pre sweeps") || paramList.isParameter(
"smoother: post sweeps") ||
472 paramList.isParameter(
"smoother: overlap") || paramList.isParameter(
"smoother: pre overlap") || paramList.isParameter(
"smoother: post overlap");
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"\""); 496 TEUCHOS_TEST_FOR_EXCEPTION(
PreOrPost ==
"both" && (paramList.isParameter(
"smoother: pre type") != paramList.isParameter(
"smoother: post type")),
501 ParameterList defaultSmootherParams;
502 defaultSmootherParams.set(
"relaxation: type",
"Symmetric Gauss-Seidel");
503 defaultSmootherParams.set(
"relaxation: sweeps", Teuchos::OrdinalTraits<LO>::one());
504 defaultSmootherParams.set(
"relaxation: damping factor", Teuchos::ScalarTraits<Scalar>::one());
506 RCP<SmootherFactory> preSmoother = Teuchos::null, postSmoother = Teuchos::null;
507 std::string preSmootherType, postSmootherType;
508 ParameterList preSmootherParams, postSmootherParams;
510 if (paramList.isParameter(
"smoother: overlap"))
511 overlap = paramList.get<
int>(
"smoother: overlap");
514 if (paramList.isParameter(
"smoother: pre type")) {
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")
540 if (paramList.isParameter(
"smoother: post type"))
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 =
582 paramList.isParameter(
"coarse: type") ||
583 paramList.isParameter(
"coarse: params");
585 this->GetOStream(
Warnings0) <<
"No coarse grid solver" << std::endl;
586 manager.
SetFactory(
"CoarseSolver", Teuchos::null);
588 }
else if (isCustomCoarseSolver) {
595 if (paramList.isParameter(
"coarse: overlap"))
596 overlap = paramList.get<
int>(
"coarse: overlap");
598 ParameterList coarseParams;
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");
604 RCP<SmootherPrototype> coarseSmoother;
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")
614 coarseSmoother = rcp(
new TrilinosSmoother(coarseType, coarseParams, overlap));
616 #ifdef HAVE_MUELU_MATLAB 617 if (coarseType ==
"matlab")
621 coarseSmoother = rcp(
new DirectSolver(coarseType, coarseParams));
630 bool reuseSmoothers = (reuseType ==
"S" || reuseType !=
"none");
631 if (reuseSmoothers) {
632 RCP<Factory> preSmootherFactory = Teuchos::rcp_const_cast<
Factory>(Teuchos::rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"PreSmoother")));
633 if (preSmootherFactory != Teuchos::null) {
634 ParameterList postSmootherFactoryParams;
635 postSmootherFactoryParams.set(
"keep smoother data",
true);
636 preSmootherFactory->SetParameterList(postSmootherFactoryParams);
638 keeps.push_back(
keep_pair(
"PreSmoother data", preSmootherFactory.get()));
641 RCP<Factory> postSmootherFactory = Teuchos::rcp_const_cast<
Factory>(Teuchos::rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"PostSmoother")));
642 if (postSmootherFactory != Teuchos::null) {
643 ParameterList postSmootherFactoryParams;
644 postSmootherFactoryParams.set(
"keep smoother data",
true);
645 postSmootherFactory->SetParameterList(postSmootherFactoryParams);
647 keeps.push_back(
keep_pair(
"PostSmoother data", postSmootherFactory.get()));
650 RCP<Factory> coarseFactory = Teuchos::rcp_const_cast<
Factory>(Teuchos::rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"CoarseSolver")));
651 if (coarseFactory != Teuchos::null) {
652 ParameterList coarseFactoryParams;
653 coarseFactoryParams.set(
"keep smoother data",
true);
654 coarseFactory->SetParameterList(coarseFactoryParams);
656 keeps.push_back(
keep_pair(
"PreSmoother data", coarseFactory.get()));
660 if ((reuseType ==
"RAP" && levelID) || (reuseType ==
"full")) {
677 RCP<Factory> dropFactory;
680 #ifdef HAVE_MUELU_MATLAB 682 ParameterList socParams = paramList.sublist(
"strength-of-connection: params");
683 dropFactory->SetParameterList(socParams);
685 throw std::runtime_error(
"Cannot use MATLAB evolutionary strength-of-connection - MueLu was not configured with MATLAB support.");
689 ParameterList dropParams;
690 dropParams.set(
"lightweight wrap",
true);
694 dropFactory->SetParameterList(dropParams);
700 TEUCHOS_TEST_FOR_EXCEPTION(aggType !=
"uncoupled" && aggType !=
"coupled" && aggType !=
"brick" && aggType !=
"matlab",
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.");
706 RCP<Factory> aggFactory;
707 if (aggType ==
"uncoupled") {
709 ParameterList aggParams;
720 aggFactory->SetParameterList(aggParams);
722 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
723 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
724 }
else if (aggType ==
"coupled") {
726 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
727 }
else if (aggType ==
"brick") {
729 ParameterList aggParams;
733 aggFactory->SetParameterList(aggParams);
738 aggFactory->SetFactory(
"Coordinates", this->GetFactoryManager(levelID-1)->GetFactory(
"Coordinates"));
741 #ifdef HAVE_MUELU_MATLAB 742 else if(aggType ==
"matlab") {
743 ParameterList aggParams = paramList.sublist(
"aggregation: params");
745 aggFactory->SetParameterList(aggParams);
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") {
790 ParameterList Pparams;
792 P->SetParameterList(Pparams);
797 ParameterList fParams;
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\"");
820 ParameterList patternParams;
822 patternFactory->SetParameterList(patternParams);
823 patternFactory->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
824 manager.
SetFactory(
"Ppattern", patternFactory);
828 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
829 constraintFactory->SetFactory(
"CoarseNullspace", manager.
GetFactory(
"Ptent"));
830 manager.
SetFactory(
"Constraint", constraintFactory);
834 ParameterList Pparams;
837 if (reuseType ==
"emin") {
839 Pparams.set(
"Keep P0",
true);
840 Pparams.set(
"Keep Constraint0",
true);
842 P->SetParameterList(Pparams);
843 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
844 P->SetFactory(
"Constraint", manager.
GetFactory(
"Constraint"));
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.");
855 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
858 #ifdef HAVE_MUELU_MATLAB 859 else if(multigridAlgo ==
"matlab") {
860 ParameterList Pparams = paramList.sublist(
"transfer: params");
862 P->SetParameterList(Pparams);
863 P->SetFactory(
"P",manager.
GetFactory(
"Ptent"));
869 RCP<SemiCoarsenPFactory> semicoarsenFactory = Teuchos::null;
870 if (paramList.isParameter(
"semicoarsen: number of levels") &&
871 paramList.get<
int>(
"semicoarsen: number of levels") > 0) {
873 ParameterList togglePParams;
874 ParameterList semicoarsenPParams;
875 ParameterList linedetectionParams;
885 linedetectionFactory->SetParameterList(linedetectionParams);
886 semicoarsenFactory->SetParameterList(semicoarsenPParams);
887 togglePFactory->SetParameterList(togglePParams);
888 togglePFactory->AddCoarseNullspaceFactory(semicoarsenFactory);
889 togglePFactory->AddProlongatorFactory(semicoarsenFactory);
890 togglePFactory->AddPtentFactory(semicoarsenFactory);
891 togglePFactory->AddCoarseNullspaceFactory(manager.
GetFactory(
"Ptent"));
892 togglePFactory->AddProlongatorFactory(manager.
GetFactory(
"P"));
893 togglePFactory->AddPtentFactory(manager.
GetFactory(
"Ptent"));
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.");
940 ParameterList RAPparams;
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"));
952 catch(Teuchos::Exceptions::InvalidParameterType) {
953 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(
true, Teuchos::Exceptions::InvalidParameterType,
954 "Error: parameter \"aggregation: allow empty prolongator columns\" must be of type " << Teuchos::TypeNameTraits<bool>::name());
956 RAP->SetParameterList(RAPparams);
957 RAP->SetFactory(
"P", manager.
GetFactory(
"P"));
958 if (!this->implicitTranspose_)
959 RAP->SetFactory(
"R", manager.
GetFactory(
"R"));
961 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: export visualization data",
bool,
true)) {
963 ParameterList aggExportParams;
971 aggExport->SetParameterList(aggExportParams);
972 aggExport->SetFactory(
"DofsPerNode", manager.
GetFactory(
"DofsPerNode"));
973 RAP->AddTransferFactory(aggExport);
977 if (reuseType ==
"RP" || (reuseType ==
"tP" && !filteringChangesMatrix)) {
978 keeps.push_back(
keep_pair(
"AP reuse data", RAP.get()));
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")) {
996 tf->SetFactory(
"Chosen P", manager.
GetFactory(
"P"));
997 tf->AddCoordTransferFactory(semicoarsenFactory);
998 tf->AddCoordTransferFactory(coords);
1002 RAP->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
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\"");
1068 ParameterList repartheurParams;
1072 repartheurFactory->SetParameterList(repartheurParams);
1073 repartheurFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1074 manager.
SetFactory(
"number of partitions", repartheurFactory);
1077 RCP<Factory> partitioner;
1078 if (partName ==
"zoltan") {
1079 #ifdef HAVE_MUELU_ZOLTAN 1085 }
else if (partName ==
"zoltan2") {
1086 #ifdef HAVE_MUELU_ZOLTAN2 1088 ParameterList partParams;
1089 RCP<const ParameterList> partpartParams = rcp(
new ParameterList(paramList.sublist(
"repartition: params",
false)));
1090 partParams.set(
"ParameterList", partpartParams);
1091 partitioner->SetParameterList(partParams);
1096 partitioner->SetFactory(
"A", manager.
GetFactory(
"A"));
1097 partitioner->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1098 partitioner->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1099 manager.
SetFactory(
"Partition", partitioner);
1103 ParameterList repartParams;
1107 repartFactory->SetParameterList(repartParams);
1108 repartFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1109 repartFactory->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1110 repartFactory->SetFactory(
"Partition", manager.
GetFactory(
"Partition"));
1111 manager.
SetFactory(
"Importer", repartFactory);
1112 if (reuseType !=
"none" && reuseType !=
"S" && levelID)
1117 ParameterList rebAcParams;
1119 newA->SetParameterList(rebAcParams);
1120 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1121 newA->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1126 ParameterList newPparams;
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"));
1144 ParameterList newRparams;
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_) {
1154 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
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>
1185 ParameterList paramList = constParamList;
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);
1194 if (paramList.isSublist(sublistName)) {
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;
1207 for(Teuchos::ParameterList::ConstIterator it = paramLists[i].begin(); it != paramLists[i].end(); it++) {
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);
1226 }
catch (
const Teuchos::Exceptions::InvalidParameterName& e) {
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 =
"";
1236 for (ParameterList::ConstIterator it = validList.begin(); it != validList.end(); it++) {
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 !=
"") {
1247 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameterName,
1248 eString <<
"The parameter name \"" + name +
"\" is not valid. Did you mean \"" + bestName <<
"\"?\n");
1251 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameterName,
1252 eString <<
"The parameter name \"" + name +
"\" is not valid.\n");
1261 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1265 ParameterList paramList = constParamList;
1272 if (paramList.isSublist(
"Matrix")) {
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)
1290 if (paramList.isSublist(
"Factories"))
1291 this->BuildFactoryMap(paramList.sublist(
"Factories"), factoryMap, factoryMap, factoryManagers);
1305 if (paramList.isSublist(
"Hierarchy")) {
1306 ParameterList hieraList = paramList.sublist(
"Hierarchy");
1309 if (hieraList.isParameter(
"max levels")) {
1310 this->numDesiredLevel_ = hieraList.get<
int>(
"max levels");
1311 hieraList.remove(
"max levels");
1314 if (hieraList.isParameter(
"coarse: max size")) {
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;
1357 if (hieraList.isParameter(
"verbosity")) {
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];
1364 TEUCHOS_TEST_FOR_EXCEPTION(
true,
Exceptions::RuntimeError,
"MueLu::ParameterListInterpreter():: invalid verbosity level");
1367 if (hieraList.isParameter(
"dependencyOutputLevel"))
1368 this->graphOutputLevel_ = hieraList.get<
int>(
"dependencyOutputLevel");
1371 if (hieraList.isParameter(
"reuse"))
1374 if (hieraList.isSublist(
"DataToWrite")) {
1377 ParameterList foo = hieraList.sublist(
"DataToWrite");
1378 std::string dataName =
"Matrices";
1379 if (foo.isParameter(dataName))
1380 this->matricesToPrint_ = Teuchos::getArrayFromStringParameter<int>(foo,dataName);
1381 dataName =
"Prolongators";
1382 if (foo.isParameter(dataName))
1383 this->prolongatorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(foo,dataName);
1384 dataName =
"Restrictors";
1385 if (foo.isParameter(dataName))
1386 this->restrictorsToPrint_ = Teuchos::getArrayFromStringParameter<int>(foo,dataName);
1390 for (ParameterList::ConstIterator param = hieraList.begin(); param != hieraList.end(); ++param) {
1391 const std::string & paramName = hieraList.name(param);
1393 if (paramName !=
"DataToWrite" && hieraList.isSublist(paramName)) {
1394 ParameterList levelList = hieraList.sublist(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);
1412 RCP<FactoryManagerBase> m = rcp(
new FactoryManager(levelFactoryMap));
1414 if (startLevel >= 0)
1415 this->AddFactoryManager(startLevel, numDesiredLevel, m);
1417 TEUCHOS_TEST_FOR_EXCEPTION(
true,
Exceptions::RuntimeError,
"MueLu::ParameterListInterpreter():: invalid level id");
1436 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1439 for (ParameterList::ConstIterator param = paramList.begin(); param != paramList.end(); ++param) {
1440 const std::string & paramName = paramList.name(param);
1441 const Teuchos::ParameterEntry & paramValue = paramList.entry(param);
1448 if (paramValue.isList()) {
1449 ParameterList paramList1 = Teuchos::getValue<ParameterList>(paramValue);
1450 if (paramList1.isParameter(
"factory")) {
1451 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
1453 }
else if (paramList1.isParameter(
"group")) {
1454 std::string groupType = paramList1.get<std::string>(
"group");
1455 TEUCHOS_TEST_FOR_EXCEPTION(groupType!=
"FactoryManager",
Exceptions::RuntimeError,
"group must be of type \"FactoryManager\".");
1457 ParameterList groupList = paramList1;
1458 groupList.remove(
"group");
1461 BuildFactoryMap(groupList, factoryMapIn, groupFactoryMap, factoryManagers);
1465 RCP<FactoryManagerBase> m = rcp(
new FactoryManager(groupFactoryMap));
1467 factoryManagers[paramName] = m;
1470 this->GetOStream(
Warnings0) <<
"Could not interpret parameter list " << paramList1 << std::endl;
1471 TEUCHOS_TEST_FOR_EXCEPTION(
false,
Exceptions::RuntimeError,
"XML Parameter list must either be of type \"factory\" or of type \"group\".");
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>
1505 static bool compare(
const ParameterList& list1,
const ParameterList& list2) {
1508 for (ParameterList::ConstIterator it = list1.begin(); it != list1.end(); it++) {
1509 const std::string& name = it->first;
1510 const Teuchos::ParameterEntry& entry1 = it->second;
1512 const Teuchos::ParameterEntry *entry2 = list2.getEntryPtr(name);
1515 if (entry1.isList() && entry2->isList()) {
1516 compare(Teuchos::getValue<ParameterList>(entry1), Teuchos::getValue<ParameterList>(*entry2));
1519 if (entry1.getAny(
false) != entry2->getAny(
false))
1526 static inline bool areSame(
const ParameterList& list1,
const ParameterList& list2) {
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.
std::string toString(const T &what)
Little helper function to convert non-string types to strings.
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.
Class that encapsulates external library smoothers.
static void DisableMultipleCheckGlobally()
#define MUELU_TEST_AND_SET_VAR(paramList, paramName, paramType, varName)
Factory for building permutation matrix that can be be used to shuffle data (matrices, vectors) among processes.
Print additional debugging information.
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.
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)
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.
Teuchos::RCP< MueLu::FacadeClassFactory< Scalar, LocalOrdinal, GlobalOrdinal, Node > > facadeFact_
FacadeClass factory.
Important warning messages (more verbose)
Print statistics that do not involve significant additional computation.
#define MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList, paramName, paramType, listWrite)
static bool compare(const ParameterList &list1, const ParameterList &list2)
static CycleType GetDefaultCycle()
void UpdateFactoryManager(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
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 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.
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.
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.
static bool areSame(const ParameterList &list1, const ParameterList &list2)
Helper functions to compare two paramter lists.
#define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2)
#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.
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.
Factory for generating nullspace.
long ExtractNonSerializableData(const Teuchos::ParameterList &inList, Teuchos::ParameterList &serialList, Teuchos::ParameterList &nonSerialList)
Exception throws to report invalid user entry.
static const RCP< const NoFactory > getRCP()
Static Get() functions.