10 #ifndef MUELU_PARAMETERLISTINTERPRETER_DEF_HPP
11 #define MUELU_PARAMETERLISTINTERPRETER_DEF_HPP
24 #include "MueLu_Hierarchy.hpp"
25 #include "MueLu_FactoryManager.hpp"
27 #include "MueLu_AggregationExportFactory.hpp"
28 #include "MueLu_AggregateQualityEstimateFactory.hpp"
29 #include "MueLu_AmalgamationFactory.hpp"
30 #include "MueLu_BrickAggregationFactory.hpp"
31 #include "MueLu_ClassicalMapFactory.hpp"
32 #include "MueLu_ClassicalPFactory.hpp"
33 #include "MueLu_CoalesceDropFactory.hpp"
34 #include "MueLu_CoarseMapFactory.hpp"
35 #include "MueLu_ConstraintFactory.hpp"
36 #include "MueLu_CoordinatesTransferFactory.hpp"
37 #include "MueLu_DirectSolver.hpp"
38 #include "MueLu_EminPFactory.hpp"
40 #include "MueLu_FacadeClassFactory.hpp"
41 #include "MueLu_FactoryFactory.hpp"
42 #include "MueLu_FilteredAFactory.hpp"
43 #include "MueLu_GenericRFactory.hpp"
44 #include "MueLu_InitialBlockNumberFactory.hpp"
45 #include "MueLu_LineDetectionFactory.hpp"
46 #include "MueLu_LocalOrdinalTransferFactory.hpp"
47 #include "MueLu_MatrixAnalysisFactory.hpp"
48 #include "MueLu_MultiVectorTransferFactory.hpp"
49 #include "MueLu_NotayAggregationFactory.hpp"
50 #include "MueLu_NullspaceFactory.hpp"
51 #include "MueLu_PatternFactory.hpp"
52 #include "MueLu_ReplicatePFactory.hpp"
53 #include "MueLu_CombinePFactory.hpp"
54 #include "MueLu_PgPFactory.hpp"
55 #include "MueLu_RAPFactory.hpp"
56 #include "MueLu_RAPShiftFactory.hpp"
57 #include "MueLu_RebalanceAcFactory.hpp"
58 #include "MueLu_RebalanceTransferFactory.hpp"
59 #include "MueLu_RepartitionFactory.hpp"
60 #include "MueLu_RepartitionHeuristicFactory.hpp"
61 #include "MueLu_ReitzingerPFactory.hpp"
62 #include "MueLu_SaPFactory.hpp"
63 #include "MueLu_ScaledNullspaceFactory.hpp"
64 #include "MueLu_SemiCoarsenPFactory.hpp"
65 #include "MueLu_SmootherFactory.hpp"
66 #include "MueLu_SmooVecCoalesceDropFactory.hpp"
67 #include "MueLu_TentativePFactory.hpp"
68 #include "MueLu_TogglePFactory.hpp"
69 #include "MueLu_ToggleCoordinatesTransferFactory.hpp"
70 #include "MueLu_TransPFactory.hpp"
71 #include "MueLu_UncoupledAggregationFactory.hpp"
72 #include "MueLu_ZoltanInterface.hpp"
73 #include "MueLu_Zoltan2Interface.hpp"
74 #include "MueLu_NodePartitionInterface.hpp"
75 #include "MueLu_LowPrecisionFactory.hpp"
77 #include "MueLu_CoalesceDropFactory_kokkos.hpp"
78 #include "MueLu_SemiCoarsenPFactory_kokkos.hpp"
79 #include "MueLu_TentativePFactory_kokkos.hpp"
81 #ifdef HAVE_MUELU_MATLAB
82 #include "../matlab/src/MueLu_MatlabSmoother_decl.hpp"
83 #include "../matlab/src/MueLu_MatlabSmoother_def.hpp"
84 #include "../matlab/src/MueLu_TwoLevelMatlabFactory_decl.hpp"
85 #include "../matlab/src/MueLu_TwoLevelMatlabFactory_def.hpp"
86 #include "../matlab/src/MueLu_SingleLevelMatlabFactory_decl.hpp"
87 #include "../matlab/src/MueLu_SingleLevelMatlabFactory_def.hpp"
90 #ifdef HAVE_MUELU_INTREPID2
91 #include "MueLu_IntrepidPCoarsenFactory.hpp"
94 #include <unordered_set>
98 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
100 : factFact_(factFact) {
102 if (facadeFact == Teuchos::null)
108 std::string filename = paramList.
get(
"xml parameter file",
"");
109 if (filename.length() != 0) {
125 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
127 : factFact_(factFact) {
129 if (facadeFact == Teuchos::null)
139 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
142 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
151 SetFactoryParameterList(paramList);
153 }
else if (paramList.
isParameter(
"MueLu preconditioner") ==
true) {
154 this->GetOStream(
Runtime0) <<
"Use facade class: " << paramList.
get<std::string>(
"MueLu preconditioner") << std::endl;
156 SetFactoryParameterList(*pp);
163 Validate(serialList);
164 SetEasyParameterList(paramList);
177 #define MUELU_SET_VAR_2LIST(paramList, defaultList, paramName, paramType, varName) \
179 if (paramList.isParameter(paramName)) \
180 varName = paramList.get<paramType>(paramName); \
181 else if (defaultList.isParameter(paramName)) \
182 varName = defaultList.get<paramType>(paramName); \
184 varName = MasterList::getDefault<paramType>(paramName);
186 #define MUELU_TEST_AND_SET_VAR(paramList, paramName, paramType, varName) \
187 (paramList.isParameter(paramName) ? varName = paramList.get<paramType>(paramName), true : false)
191 #define MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList, paramName, paramType, listWrite) \
193 if (paramList.isParameter(paramName)) \
194 listWrite.set(paramName, paramList.get<paramType>(paramName)); \
195 else if (defaultList.isParameter(paramName)) \
196 listWrite.set(paramName, defaultList.get<paramType>(paramName)); \
197 } catch (Teuchos::Exceptions::InvalidParameterType&) { \
198 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(true, Teuchos::Exceptions::InvalidParameterType, \
199 "Error: parameter \"" << paramName << "\" must be of type " << Teuchos::TypeNameTraits<paramType>::name()); \
202 #define MUELU_TEST_PARAM_2LIST(paramList, defaultList, paramName, paramType, cmpValue) \
203 (cmpValue == (paramList.isParameter(paramName) ? paramList.get<paramType>(paramName) : (defaultList.isParameter(paramName) ? defaultList.get<paramType>(paramName) : MasterList::getDefault<paramType>(paramName))))
205 #define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory) \
206 RCP<Factory> varName; \
208 varName = rcp(new oldFactory()); \
210 varName = rcp(new newFactory());
211 #define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory) \
213 varName = rcp(new oldFactory()); \
215 varName = rcp(new newFactory());
217 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
222 MUELU_SET_VAR_2LIST(constParamList, constParamList,
"problem: type", std::string, problemType);
223 if (problemType !=
"unknown") {
229 paramList = constParamList;
233 useKokkos_ = !Node::is_serial;
243 std::map<std::string, CycleType> cycleMap;
247 auto cycleType = paramList.
get<std::string>(
"cycle type");
249 "Invalid cycle type: \"" << cycleType <<
"\"");
250 Cycle_ = cycleMap[cycleType];
253 if (paramList.
isParameter(
"W cycle start level")) {
254 WCycleStartLevel_ = paramList.
get<
int>(
"W cycle start level");
257 if (paramList.
isParameter(
"coarse grid correction scaling factor"))
258 scalingFactor_ = paramList.
get<
double>(
"coarse grid correction scaling factor");
260 this->maxCoarseSize_ = paramList.
get<
int>(
"coarse: max size", MasterList::getDefault<int>(
"coarse: max size"));
261 this->numDesiredLevel_ = paramList.
get<
int>(
"max levels", MasterList::getDefault<int>(
"max levels"));
262 blockSize_ = paramList.
get<
int>(
"number of equations", MasterList::getDefault<int>(
"number of equations"));
268 this->dataToKeep_ = Teuchos::getArrayFromStringParameter<std::string>(paramList,
"keep data");
271 if (paramList.
isSublist(
"export data")) {
276 this->nullspaceToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Nullspace");
278 this->coordinatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Coordinates");
280 this->materialToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Material");
282 this->aggregatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Aggregates");
283 if (printList.
isParameter(
"pcoarsen: element to node map"))
284 this->elementToNodeMapsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"pcoarsen: element to node map");
288 const std::string& name = printList.
name(
iter);
290 if (name ==
"Nullspace" || name ==
"Coordinates" || name ==
"Material" || name ==
"Aggregates" || name ==
"pcoarsen: element to node map")
293 this->matricesToPrint_[name] = Teuchos::getArrayFromStringParameter<int>(printList, name);
306 if (outputFilename !=
"")
316 useCoordinates_ =
false;
317 useBlockNumber_ =
false;
318 if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: strength-of-connection: matrix", std::string,
"distance laplacian"))
319 useCoordinates_ =
true;
321 useBlockNumber_ =
true;
322 if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"distance laplacian") ||
325 useCoordinates_ =
true;
326 }
else if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal distance laplacian")) {
327 useCoordinates_ =
true;
328 useBlockNumber_ =
true;
329 }
else if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal") ||
330 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal classical") ||
331 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal signed classical") ||
332 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal colored signed classical") ||
333 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"signed classical")) {
334 useBlockNumber_ =
true;
335 }
else if (paramList.
isSublist(
"smoother: params")) {
336 const auto smooParamList = paramList.
sublist(
"smoother: params");
337 if (smooParamList.isParameter(
"partitioner: type") &&
338 (smooParamList.get<std::string>(
"partitioner: type") ==
"line")) {
339 useCoordinates_ =
true;
342 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
343 std::string levelStr =
"level " +
toString(levelID);
348 if (
MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"distance laplacian") ||
351 useCoordinates_ =
true;
352 }
else if (
MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal distance laplacian")) {
353 useCoordinates_ =
true;
354 useBlockNumber_ =
true;
355 }
else if (
MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal") ||
356 MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal classical") ||
357 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal signed classical") ||
358 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal colored signed classical") ||
359 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"signed classical")) {
360 useBlockNumber_ =
true;
366 useMaterial_ =
false;
367 if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: distance laplacian metric", std::string,
"material")) {
376 }
else if (!paramList.
isSublist(
"repartition: params")) {
377 useCoordinates_ =
true;
380 if (repParams.
isType<std::string>(
"algorithm")) {
381 const std::string algo = repParams.
get<std::string>(
"algorithm");
382 if (algo ==
"multijagged" || algo ==
"rcb") {
383 useCoordinates_ =
true;
386 useCoordinates_ =
true;
390 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
391 std::string levelStr =
"level " +
toString(levelID);
397 if (!levelList.
isSublist(
"repartition: params")) {
398 useCoordinates_ =
true;
402 if (repParams.
isType<std::string>(
"algorithm")) {
403 const std::string algo = repParams.
get<std::string>(
"algorithm");
404 if (algo ==
"multijagged" || algo ==
"rcb") {
405 useCoordinates_ =
true;
409 useCoordinates_ =
true;
418 changedPRrebalance_ =
false;
419 changedPRViaCopyrebalance_ =
false;
421 changedPRrebalance_ =
MUELU_TEST_AND_SET_VAR(paramList,
"repartition: rebalance P and R",
bool, this->doPRrebalance_);
422 changedPRViaCopyrebalance_ =
MUELU_TEST_AND_SET_VAR(paramList,
"repartition: explicit via new copy rebalance P and R",
bool, this->doPRViaCopyrebalance_);
426 changedImplicitTranspose_ =
MUELU_TEST_AND_SET_VAR(paramList,
"transpose: use implicit",
bool, this->implicitTranspose_);
429 (void)
MUELU_TEST_AND_SET_VAR(paramList,
"fuse prolongation and update",
bool, this->fuseProlongationAndUpdate_);
432 (void)
MUELU_TEST_AND_SET_VAR(paramList,
"nullspace: suppress dimension check",
bool, this->suppressNullspaceDimensionCheck_);
434 if (paramList.
isSublist(
"matvec params"))
435 this->matvecParams_ = Teuchos::parameterList(paramList.
sublist(
"matvec params"));
444 std::vector<keep_pair> keeps0;
445 UpdateFactoryManager(paramList,
ParameterList(), *defaultManager, 0 , keeps0);
451 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
460 std::vector<keep_pair> keeps;
464 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
468 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
471 this->keep_[levelID] = keeps;
472 this->AddFactoryManager(levelID, 1, levelManager);
482 this->GetOStream(static_cast<MsgType>(
Runtime1), 0) << paramList << std::endl;
497 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
498 std::string levelStr =
"level " +
toString(levelID);
513 std::ostringstream unusedParamsStream;
515 unusedParamList.
print(unusedParamsStream, indent);
517 this->GetOStream(
Warnings1) <<
"The following parameters were not used:\n"
518 << unusedParamsStream.str() << std::endl;
528 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
531 int levelID, std::vector<keep_pair>& keeps)
const {
535 using strings = std::unordered_set<std::string>;
545 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
546 TEUCHOS_TEST_FOR_EXCEPTION(strings({
"unsmoothed",
"sa",
"pg",
"emin",
"matlab",
"pcoarsen",
"classical",
"smoothed reitzinger",
"unsmoothed reitzinger",
"replicate",
"combine"}).count(multigridAlgo) == 0,
547 Exceptions::RuntimeError,
"Unknown \"multigrid algorithm\" value: \"" << multigridAlgo <<
"\". Please consult User's Guide.");
548 #ifndef HAVE_MUELU_MATLAB
550 "Cannot use matlab for multigrid algorithm - MueLu was not configured with MATLAB support.");
552 #ifndef HAVE_MUELU_INTREPID2
554 "Cannot use IntrepidPCoarsen prolongator factory - MueLu was not configured with Intrepid support.");
559 if (reuseType ==
"none" || reuseType ==
"S" || reuseType ==
"RP" || reuseType ==
"RAP") {
562 }
else if (reuseType ==
"tP" && (multigridAlgo !=
"sa" && multigridAlgo !=
"unsmoothed")) {
564 this->GetOStream(
Warnings0) <<
"Ignoring \"tP\" reuse option as it is only compatible with \"sa\", "
565 "or \"unsmoothed\" multigrid algorithms"
568 }
else if (reuseType ==
"emin" && multigridAlgo !=
"emin") {
570 this->GetOStream(
Warnings0) <<
"Ignoring \"emin\" reuse option it is only compatible with "
571 "\"emin\" multigrid algorithm"
577 bool have_userP =
false;
582 UpdateFactoryManager_CoarseSolvers(paramList, defaultList, manager, levelID, keeps);
585 UpdateFactoryManager_Smoothers(paramList, defaultList, manager, levelID, keeps);
589 UpdateFactoryManager_BlockNumber(paramList, defaultList, manager, levelID, keeps);
592 if (multigridAlgo ==
"unsmoothed reitzinger" || multigridAlgo ==
"smoothed reitzinger")
593 UpdateFactoryManager_Reitzinger(paramList, defaultList, manager, levelID, keeps);
595 UpdateFactoryManager_Aggregation_TentativeP(paramList, defaultList, manager, levelID, keeps);
599 UpdateFactoryManager_Nullspace(paramList, defaultList, manager, levelID, keeps, nullSpaceFactory);
610 }
else if (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"unsmoothed reitzinger") {
614 }
else if (multigridAlgo ==
"classical") {
618 }
else if (multigridAlgo ==
"sa" || multigridAlgo ==
"smoothed reitzinger") {
620 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
622 }
else if (multigridAlgo ==
"emin") {
624 UpdateFactoryManager_Emin(paramList, defaultList, manager, levelID, keeps);
626 }
else if (multigridAlgo ==
"replicate") {
627 UpdateFactoryManager_Replicate(paramList, defaultList, manager, levelID, keeps);
629 }
else if (multigridAlgo ==
"combine") {
630 UpdateFactoryManager_Combine(paramList, defaultList, manager, levelID, keeps);
632 }
else if (multigridAlgo ==
"pg") {
634 UpdateFactoryManager_PG(paramList, defaultList, manager, levelID, keeps);
636 }
else if (multigridAlgo ==
"matlab") {
638 UpdateFactoryManager_Matlab(paramList, defaultList, manager, levelID, keeps);
640 }
else if (multigridAlgo ==
"pcoarsen") {
642 UpdateFactoryManager_PCoarsen(paramList, defaultList, manager, levelID, keeps);
646 UpdateFactoryManager_SemiCoarsen(paramList, defaultList, manager, levelID, keeps);
649 UpdateFactoryManager_Restriction(paramList, defaultList, manager, levelID, keeps);
652 UpdateFactoryManager_RAP(paramList, defaultList, manager, levelID, keeps);
655 UpdateFactoryManager_LocalOrdinalTransfer(
"BlockNumber", multigridAlgo, paramList, defaultList, manager, levelID, keeps);
658 UpdateFactoryManager_Coordinates(paramList, defaultList, manager, levelID, keeps);
661 UpdateFactoryManager_Material(paramList, defaultList, manager, levelID, keeps);
664 if ((reuseType ==
"RP" || reuseType ==
"RAP" || reuseType ==
"full") && levelID)
667 if (reuseType ==
"RP" && levelID) {
669 if (!this->implicitTranspose_)
672 if ((reuseType ==
"tP" || reuseType ==
"RP" || reuseType ==
"emin") && useCoordinates_ && levelID)
676 UpdateFactoryManager_Repartition(paramList, defaultList, manager, levelID, keeps, nullSpaceFactory);
679 UpdateFactoryManager_LowPrecision(paramList, defaultList, manager, levelID, keeps);
682 if ((reuseType ==
"RAP" || reuseType ==
"full") && levelID) {
684 if (!this->implicitTranspose_)
697 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
700 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
701 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
703 bool useMaxAbsDiagonalScaling =
false;
704 if (defaultList.
isParameter(
"sa: use rowsumabs diagonal scaling"))
705 useMaxAbsDiagonalScaling = defaultList.
get<
bool>(
"sa: use rowsumabs diagonal scaling");
709 bool isCustomSmoother =
712 paramList.
isSublist(
"smoother: params") || paramList.
isSublist(
"smoother: pre params") || paramList.
isSublist(
"smoother: post params") ||
718 manager.
SetFactory(
"Smoother", Teuchos::null);
720 }
else if (isCustomSmoother) {
724 #define TEST_MUTUALLY_EXCLUSIVE(arg1, arg2) \
725 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isParameter(#arg1) && paramList.isParameter(#arg2), \
726 Exceptions::InvalidArgument, "You cannot specify both \"" #arg1 "\" and \"" #arg2 "\"");
727 #define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2) \
728 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isSublist(#arg1) && paramList.isSublist(#arg2), \
729 Exceptions::InvalidArgument, "You cannot specify both \"" #arg1 "\" and \"" #arg2 "\"");
745 defaultSmootherParams.
set(
"relaxation: type",
"Symmetric Gauss-Seidel");
750 std::string preSmootherType, postSmootherType;
754 overlap = paramList.
get<
int>(
"smoother: overlap");
758 preSmootherType = paramList.
get<std::string>(
"smoother: pre type");
760 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, preSmootherTypeTmp);
761 preSmootherType = preSmootherTypeTmp;
763 if (paramList.
isParameter(
"smoother: pre overlap"))
764 overlap = paramList.
get<
int>(
"smoother: pre overlap");
766 if (paramList.
isSublist(
"smoother: pre params"))
767 preSmootherParams = paramList.
sublist(
"smoother: pre params");
768 else if (paramList.
isSublist(
"smoother: params"))
769 preSmootherParams = paramList.
sublist(
"smoother: params");
770 else if (defaultList.
isSublist(
"smoother: params"))
771 preSmootherParams = defaultList.
sublist(
"smoother: params");
772 else if (preSmootherType ==
"RELAXATION")
773 preSmootherParams = defaultSmootherParams;
775 if (preSmootherType ==
"CHEBYSHEV" && useMaxAbsDiagonalScaling)
776 preSmootherParams.
set(
"chebyshev: use rowsumabs diagonal scaling",
true);
778 #ifdef HAVE_MUELU_INTREPID2
780 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
784 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
785 auto pcoarsen_element = defaultList.
get<std::string>(
"pcoarsen: element");
787 if (levelID < (
int)pcoarsen_schedule.size()) {
789 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
790 preSmootherParams.
set(
"pcoarsen: hi basis", lo);
795 #ifdef HAVE_MUELU_MATLAB
796 if (preSmootherType ==
"matlab")
805 postSmootherType = paramList.
get<std::string>(
"smoother: post type");
807 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, postSmootherTypeTmp);
808 postSmootherType = postSmootherTypeTmp;
811 if (paramList.
isSublist(
"smoother: post params"))
812 postSmootherParams = paramList.
sublist(
"smoother: post params");
813 else if (paramList.
isSublist(
"smoother: params"))
814 postSmootherParams = paramList.
sublist(
"smoother: params");
815 else if (defaultList.
isSublist(
"smoother: params"))
816 postSmootherParams = defaultList.
sublist(
"smoother: params");
817 else if (postSmootherType ==
"RELAXATION")
818 postSmootherParams = defaultSmootherParams;
819 if (paramList.
isParameter(
"smoother: post overlap"))
820 overlap = paramList.
get<
int>(
"smoother: post overlap");
822 if (postSmootherType ==
"CHEBYSHEV" && useMaxAbsDiagonalScaling)
823 postSmootherParams.
set(
"chebyshev: use rowsumabs diagonal scaling",
true);
825 if (postSmootherType == preSmootherType &&
areSame(preSmootherParams, postSmootherParams))
826 postSmoother = preSmoother;
828 #ifdef HAVE_MUELU_INTREPID2
830 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
834 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
835 auto pcoarsen_element = defaultList.
get<std::string>(
"pcoarsen: element");
837 if (levelID < (
int)pcoarsen_schedule.size()) {
839 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
840 postSmootherParams.
set(
"pcoarsen: hi basis", lo);
845 #ifdef HAVE_MUELU_MATLAB
846 if (postSmootherType ==
"matlab")
854 if (preSmoother == postSmoother)
857 manager.
SetFactory(
"PreSmoother", preSmoother);
858 manager.
SetFactory(
"PostSmoother", postSmoother);
865 bool reuseSmoothers = (reuseType ==
"S" || reuseType !=
"none");
866 if (reuseSmoothers) {
867 auto preSmootherFactory = rcp_const_cast<
Factory>(rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"PreSmoother")));
869 if (preSmootherFactory != Teuchos::null) {
871 postSmootherFactoryParams.
set(
"keep smoother data",
true);
872 preSmootherFactory->SetParameterList(postSmootherFactoryParams);
874 keeps.push_back(
keep_pair(
"PreSmoother data", preSmootherFactory.get()));
877 auto postSmootherFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"PostSmoother")));
878 if (postSmootherFactory != Teuchos::null) {
880 postSmootherFactoryParams.
set(
"keep smoother data",
true);
881 postSmootherFactory->SetParameterList(postSmootherFactoryParams);
883 keeps.push_back(
keep_pair(
"PostSmoother data", postSmootherFactory.get()));
886 auto coarseFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"CoarseSolver")));
887 if (coarseFactory != Teuchos::null) {
889 coarseFactoryParams.
set(
"keep smoother data",
true);
890 coarseFactory->SetParameterList(coarseFactoryParams);
892 keeps.push_back(
keep_pair(
"PreSmoother data", coarseFactory.get()));
896 if ((reuseType ==
"RAP" && levelID) || (reuseType ==
"full")) {
915 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
920 bool isCustomCoarseSolver =
924 manager.
SetFactory(
"CoarseSolver", Teuchos::null);
926 }
else if (isCustomCoarseSolver) {
934 overlap = paramList.
get<
int>(
"coarse: overlap");
937 if (paramList.
isSublist(
"coarse: params"))
938 coarseParams = paramList.
sublist(
"coarse: params");
939 else if (defaultList.
isSublist(
"coarse: params"))
940 coarseParams = defaultList.
sublist(
"coarse: params");
942 using strings = std::unordered_set<std::string>;
948 if (strings({
"RELAXATION",
"CHEBYSHEV",
"ILUT",
"ILU",
"RILUK",
"SCHWARZ",
"Amesos",
949 "BLOCK RELAXATION",
"BLOCK_RELAXATION",
"BLOCKRELAXATION",
950 "SPARSE BLOCK RELAXATION",
"SPARSE_BLOCK_RELAXATION",
"SPARSEBLOCKRELAXATION",
951 "LINESMOOTHING_BANDEDRELAXATION",
"LINESMOOTHING_BANDED_RELAXATION",
"LINESMOOTHING_BANDED RELAXATION",
952 "LINESMOOTHING_TRIDIRELAXATION",
"LINESMOOTHING_TRIDI_RELAXATION",
"LINESMOOTHING_TRIDI RELAXATION",
953 "LINESMOOTHING_TRIDIAGONALRELAXATION",
"LINESMOOTHING_TRIDIAGONAL_RELAXATION",
"LINESMOOTHING_TRIDIAGONAL RELAXATION",
954 "TOPOLOGICAL",
"FAST_ILU",
"FAST_IC",
"FAST_ILDL",
"HIPTMAIR"})
955 .count(coarseType)) {
958 #ifdef HAVE_MUELU_MATLAB
959 if (coarseType ==
"matlab")
973 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
976 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
992 rFactory->
SetFactory(
"D0", this->GetFactoryManager(levelID - 1)->GetFactory(
"D0"));
1004 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1007 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1008 using strings = std::unordered_set<std::string>;
1018 if (aggType ==
"classical") {
1020 manager.
SetFactory(
"UnAmalgamationInfo", amalgFact);
1027 #ifdef HAVE_MUELU_MATLAB
1032 throw std::runtime_error(
"Cannot use MATLAB evolutionary strength-of-connection - MueLu was not configured with MATLAB support.");
1034 }
else if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"unsupported vector smoothing")) {
1046 if (!rcp_dynamic_cast<CoalesceDropFactory>(dropFactory).
is_null())
1047 dropParams.
set(
"lightweight wrap",
true);
1057 #ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1079 #ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1080 if (!dropParams.
isParameter(
"aggregation: drop scheme") ||
1081 (dropParams.
isParameter(
"aggregation: drop scheme") &&
1082 ((dropParams.
get<std::string>(
"aggregation: drop scheme") !=
"point-wise") && (dropParams.
get<std::string>(
"aggregation: drop scheme") !=
"cut-drop")))) {
1085 #define MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(paramList, paramName, paramType) \
1086 if (!paramList.isParameter(paramName)) { \
1087 paramList.set(paramName, MasterList::getDefault<paramType>(paramName)); \
1090 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: drop scheme", std::string);
1091 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: strength-of-connection: matrix", std::string);
1092 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: strength-of-connection: measure", std::string);
1093 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: use blocking",
bool);
1095 #undef MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST
1099 dropParams.
isParameter(
"aggregation: strength-of-connection: measure") ||
1100 dropParams.
isParameter(
"aggregation: use blocking"),
1102 "The inputs contain a mix of old and new dropping parameters:\n\n"
1103 << dropParams <<
"\n\nKeep in mind that defaults are set for old parameters, so this gets interpreted as\n\n"
1104 << dropParamsWithDefaults);
1111 if (dropParams.
isParameter(
"aggregation: drop scheme")) {
1112 std::string drop_scheme = dropParams.
get<std::string>(
"aggregation: drop scheme");
1113 if (drop_scheme ==
"block diagonal colored signed classical")
1114 manager.
SetFactory(
"Coloring Graph", dropFactory);
1116 (drop_scheme.find(
"block diagonal") != std::string::npos || drop_scheme ==
"signed classical")) {
1118 dropFactory->
SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1129 #ifndef HAVE_MUELU_MATLAB
1130 if (aggType ==
"matlab")
1131 throw std::runtime_error(
"Cannot use MATLAB aggregation - MueLu was not configured with MATLAB support.");
1134 if (aggType ==
"uncoupled") {
1163 }
else if (aggType ==
"brick") {
1176 manager.
SetFactory(
"DofsPerNode", aggFactory);
1182 aggFactory->
SetFactory(
"Coordinates", this->GetFactoryManager(levelID - 1)->GetFactory(
"Coordinates"));
1184 }
else if (aggType ==
"classical") {
1193 std::string drop_algo = tempParams.
get<std::string>(
"aggregation: drop scheme");
1194 if (drop_algo ==
"block diagonal colored signed classical") {
1195 mapParams.
set(
"aggregation: coloring: use color graph",
true);
1215 if (drop_algo.find(
"block diagonal") != std::string::npos || drop_algo ==
"signed classical") {
1217 aggFactory->
SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1226 if (reuseType ==
"tP" && levelID) {
1231 }
else if (aggType ==
"notay") {
1242 #ifdef HAVE_MUELU_MATLAB
1243 else if (aggType ==
"matlab") {
1250 manager.
SetFactory(
"Aggregates", aggFactory);
1260 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1261 ptentParams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1262 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1263 ptentParams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1266 Ptent->SetParameterList(ptentParams);
1267 Ptent->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1268 Ptent->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1271 if (reuseType ==
"tP" && levelID) {
1272 keeps.push_back(
keep_pair(
"Nullspace", Ptent.get()));
1273 keeps.push_back(
keep_pair(
"P", Ptent.get()));
1280 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1283 int levelID, std::vector<keep_pair>& keeps)
const {
1296 std::string alg = paramList.
get(
"rap: algorithm",
"galerkin");
1297 if (alg ==
"shift" || alg ==
"non-galerkin") {
1311 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1312 RAPparams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1313 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1314 RAPparams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1321 if (!paramList.
isParameter(
"rap: triple product") &&
1322 paramList.
isType<std::string>(
"multigrid algorithm") &&
1323 paramList.
get<std::string>(
"multigrid algorithm") ==
"unsmoothed")
1324 paramList.
set(
"rap: triple product",
true);
1329 if (paramList.
isParameter(
"aggregation: allow empty prolongator columns")) {
1330 RAPparams.
set(
"CheckMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1331 RAPparams.
set(
"RepairMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1332 }
else if (defaultList.
isParameter(
"aggregation: allow empty prolongator columns")) {
1333 RAPparams.
set(
"CheckMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1334 RAPparams.
set(
"RepairMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1350 if (!this->implicitTranspose_) {
1368 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: compute aggregate qualities",
bool,
true)) {
1382 manager.
SetFactory(
"AggregateQualities", aggQualityFact);
1390 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: export visualization data",
bool,
true)) {
1419 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
1420 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
1422 if (reuseType ==
"RP" || (reuseType ==
"tP" && !filteringChangesMatrix)) {
1424 keeps.push_back(
keep_pair(
"AP reuse data", RAP.
get()));
1425 keeps.push_back(
keep_pair(
"RAP reuse data", RAP.
get()));
1428 keeps.push_back(
keep_pair(
"AP reuse data", RAPs.
get()));
1429 keeps.push_back(
keep_pair(
"RAP reuse data", RAPs.
get()));
1437 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1441 bool have_userCO =
false;
1445 if (useCoordinates_) {
1456 if (!RAP.is_null()) {
1457 RAP->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1460 RAPs->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1469 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1473 bool have_userMaterial =
false;
1475 have_userMaterial =
true;
1478 if (have_userMaterial) {
1483 materialTransferParameters.
set(
"Vector name",
"Material");
1484 materialTransferParameters.
set(
"Transfer name",
"Aggregates");
1485 materialTransferParameters.
set(
"Normalize",
true);
1489 manager.
SetFactory(
"Material", materialTransfer);
1492 if (!RAP.is_null()) {
1493 RAP->AddTransferFactory(manager.
GetFactory(
"Material"));
1496 RAPs->AddTransferFactory(manager.
GetFactory(
"Material"));
1505 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1508 FactoryManager& manager,
int levelID, std::vector<keep_pair>& )
const {
1511 if (useBlockNumber_ && (levelID > 0)) {
1514 if (!RAP.is_null() || !RAPs.is_null()) {
1516 if (multigridAlgo ==
"classical")
1522 fact->
SetFactory(VarName, this->GetFactoryManager(levelID - 1)->GetFactory(VarName));
1527 RAP->AddTransferFactory(manager.
GetFactory(VarName));
1529 RAPs->AddTransferFactory(manager.
GetFactory(VarName));
1537 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1540 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1541 if (useBlockNumber_) {
1553 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1556 int levelID, std::vector<keep_pair>& )
const {
1557 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
1558 bool have_userR =
false;
1564 if (!this->implicitTranspose_) {
1567 if (isSymmetric ==
false && (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"emin")) {
1568 this->GetOStream(
Warnings0) <<
"Switching \"problem: symmetric\" parameter to symmetric as multigrid algorithm. " << multigridAlgo <<
" is primarily supposed to be used for symmetric problems.\n\n"
1569 <<
"Please note: if you are using \"unsmoothed\" transfer operators the \"problem: symmetric\" parameter "
1570 <<
"has no real mathematical meaning, i.e. you can use it for non-symmetric\n"
1571 <<
"problems, too. With \"problem: symmetric\"=\"symmetric\" you can use implicit transpose for building "
1572 <<
"the restriction operators which may drastically reduce the amount of consumed memory." << std::endl;
1576 "Petrov-Galerkin smoothed transfer operators are only allowed for non-symmetric problems: Set \"problem: symmetric\" to false!\n"
1577 "While PG smoothed transfer operators generally would also work for symmetric problems this is an unusual use case. "
1578 "You can use the factory-based xml interface though if you need PG-AMG for symmetric problems.");
1597 if (paramList.
isParameter(
"restriction: scale nullspace") && paramList.
get<
bool>(
"restriction: scale nullspace")) {
1600 tentPlist.
set(
"Nullspace name",
"Scaled Nullspace");
1613 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1616 int levelID, std::vector<keep_pair>& keeps,
RCP<Factory>& nullSpaceFactory)
const {
1621 #if defined(HAVE_MPI) && (defined(HAVE_MUELU_ZOLTAN) || defined(HAVE_MUELU_ZOLTAN2)) // skip to the end, print warning, and turn off repartitioning if we don't have MPI and Zoltan/Zoltan2
1622 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: use subcommunicators in place",
bool, enableInPlace);
1659 "Reuse types \"tP\" and \"PR\" require \"repartition: rebalance P and R\" set to \"false\"");
1664 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: partitioner", std::string, partName);
1666 "Invalid partitioner name: \"" << partName <<
"\". Valid options: \"zoltan\", \"zoltan2\"");
1668 #ifndef HAVE_MUELU_ZOLTAN
1669 bool switched =
false;
1670 if (partName ==
"zoltan") {
1671 this->GetOStream(
Warnings0) <<
"Zoltan interface is not available, trying to switch to Zoltan2" << std::endl;
1672 partName =
"zoltan2";
1676 #ifndef HAVE_MUELU_ZOLTAN2
1677 bool switched =
false;
1678 #endif // HAVE_MUELU_ZOLTAN2
1679 #endif // HAVE_MUELU_ZOLTAN
1681 #ifndef HAVE_MUELU_ZOLTAN2
1682 if (partName ==
"zoltan2" && !switched) {
1683 this->GetOStream(
Warnings0) <<
"Zoltan2 interface is not available, trying to switch to Zoltan" << std::endl;
1684 partName =
"zoltan";
1686 #endif // HAVE_MUELU_ZOLTAN2
1688 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: node repartition level",
int, nodeRepartitionLevel);
1701 repartheurFactory->SetParameterList(repartheurParams);
1702 repartheurFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1703 manager.
SetFactory(
"number of partitions", repartheurFactory);
1704 manager.
SetFactory(
"repartition: heuristic target rows per process", repartheurFactory);
1708 if (levelID == nodeRepartitionLevel) {
1715 }
else if (partName ==
"zoltan") {
1716 #ifdef HAVE_MUELU_ZOLTAN
1721 #endif // HAVE_MUELU_ZOLTAN
1722 }
else if (partName ==
"zoltan2") {
1723 #ifdef HAVE_MUELU_ZOLTAN2
1727 partParams.
set(
"ParameterList", partpartParams);
1729 partitioner->
SetFactory(
"repartition: heuristic target rows per process",
1730 manager.
GetFactory(
"repartition: heuristic target rows per process"));
1733 #endif // HAVE_MUELU_ZOLTAN2
1738 if (useCoordinates_)
1740 manager.
SetFactory(
"Partition", partitioner);
1749 repartFactory->SetParameterList(repartParams);
1750 repartFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1751 repartFactory->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1752 repartFactory->SetFactory(
"Partition", manager.
GetFactory(
"Partition"));
1753 manager.
SetFactory(
"Importer", repartFactory);
1754 if (reuseType !=
"none" && reuseType !=
"S" && levelID)
1757 if (enableInPlace) {
1765 newA->SetParameterList(rebAcParams);
1766 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1767 newA->SetFactory(
"InPlaceMap", manager.
GetFactory(
"InPlaceMap"));
1774 newA->SetParameterList(rebAcParams);
1775 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1776 newA->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1782 newPparams.
set(
"type",
"Interpolation");
1783 if (changedPRrebalance_)
1784 newPparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1785 if (changedPRViaCopyrebalance_)
1786 newPparams.
set(
"repartition: explicit via new copy rebalance P and R",
true);
1788 newP->SetParameterList(newPparams);
1789 newP->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1790 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
1792 if (!paramList.
isParameter(
"semicoarsen: number of levels"))
1793 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1795 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"P"));
1796 if (useCoordinates_) {
1797 newP->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1801 newP->SetFactory(
"Material", manager.
GetFactory(
"Material"));
1804 if (useBlockNumber_ && (levelID > 0)) {
1805 newP->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1812 newRparams.
set(
"type",
"Restriction");
1814 if (changedPRrebalance_)
1815 newRparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1816 if (changedPRViaCopyrebalance_)
1817 newPparams.
set(
"repartition: explicit via new copy rebalance P and R",
true);
1818 if (changedImplicitTranspose_)
1819 newRparams.
set(
"transpose: use implicit", this->implicitTranspose_);
1820 newR->SetParameterList(newRparams);
1821 newR->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1822 if (!this->implicitTranspose_) {
1823 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1836 nullSpaceFactory->
SetFactory(
"Nullspace", newP);
1840 paramList.
set(
"repartition: enable",
false);
1842 this->GetOStream(
Warnings0) <<
"No repartitioning available for a serial run\n";
1844 this->GetOStream(
Warnings0) <<
"Zoltan/Zoltan2 are unavailable for repartitioning\n";
1846 #endif // defined(HAVE_MPI) && (defined(HAVE_MUELU_ZOLTAN) || defined(HAVE_MUELU_ZOLTAN2))
1853 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1856 int levelID, std::vector<keep_pair>& keeps)
const {
1857 MUELU_SET_VAR_2LIST(paramList, defaultList,
"transfers: half precision",
bool, enableLowPrecision);
1859 if (enableLowPrecision) {
1863 newPparams.
set(
"matrix key",
"P");
1864 newP->SetParameterList(newPparams);
1865 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
1868 if (!this->implicitTranspose_) {
1872 newRparams.
set(
"matrix key",
"R");
1873 newR->SetParameterList(newRparams);
1874 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1883 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1886 int , std::vector<keep_pair>& ,
RCP<Factory>& nullSpaceFactory)
const {
1890 bool have_userNS =
false;
1901 nullSpaceFactory = nullSpace;
1903 if (paramList.
isParameter(
"restriction: scale nullspace") && paramList.
get<
bool>(
"restriction: scale nullspace")) {
1905 scaledNSfactory->
SetFactory(
"Nullspace", nullSpaceFactory);
1906 manager.
SetFactory(
"Scaled Nullspace", scaledNSfactory);
1913 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1916 int , std::vector<keep_pair>& )
const {
1919 if (paramList.
isParameter(
"semicoarsen: number of levels") &&
1920 paramList.
get<
int>(
"semicoarsen: number of levels") > 0) {
1947 manager.
SetFactory(
"CoarseNumZLayers", linedetectionFactory);
1948 manager.
SetFactory(
"LineDetection_Layers", linedetectionFactory);
1949 manager.
SetFactory(
"LineDetection_VertLineIds", linedetectionFactory);
1953 manager.
SetFactory(
"Nullspace", togglePFactory);
1956 if (paramList.
isParameter(
"semicoarsen: number of levels")) {
1958 tf->SetFactory(
"Chosen P", manager.
GetFactory(
"P"));
1959 tf->AddCoordTransferFactory(semicoarsenFactory);
1964 tf->AddCoordTransferFactory(coords);
1972 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1975 int levelID, std::vector<keep_pair>& keeps)
const {
1976 #ifdef HAVE_MUELU_INTREPID2
1981 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
1982 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
1984 if (levelID >= (
int)pcoarsen_schedule.size()) {
1987 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
1993 std::string lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
1994 std::string hi = (levelID ? pcoarsen_element + std::to_string(pcoarsen_schedule[levelID - 1]) : lo);
1995 Pparams.
set(
"pcoarsen: hi basis", hi);
1996 Pparams.
set(
"pcoarsen: lo basis", lo);
1997 P->SetParameterList(Pparams);
2010 P->SetParameterList(Pparams);
2023 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2029 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
2030 Pparams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
2031 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
2032 Pparams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
2048 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
2082 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
2084 if (reuseType ==
"tP" && !filteringChangesMatrix)
2091 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2094 int , std::vector<keep_pair>& )
const {
2098 "Invalid pattern name: \"" << patternType <<
"\". Valid options: \"AkPtent\"");
2103 patternFactory->SetParameterList(patternParams);
2104 patternFactory->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2107 MUELU_SET_VAR_2LIST(paramList, defaultList,
"emin: use filtered matrix",
bool, useFiltering);
2131 patternFactory->SetFactory(
"A", filterFactory);
2134 patternFactory->SetFactory(
"A", manager.
GetFactory(
"Graph"));
2138 manager.
SetFactory(
"Ppattern", patternFactory);
2142 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
2143 constraintFactory->SetFactory(
"CoarseNullspace", manager.
GetFactory(
"Ptent"));
2144 manager.
SetFactory(
"Constraint", constraintFactory);
2150 if (reuseType ==
"emin") {
2152 Pparams.
set(
"Keep P0",
true);
2153 Pparams.
set(
"Keep Constraint0",
true);
2158 P->SetParameterList(Pparams);
2159 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2160 P->SetFactory(
"Constraint", manager.
GetFactory(
"Constraint"));
2167 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2170 int , std::vector<keep_pair>& )
const {
2172 "Implicit transpose not supported with Petrov-Galerkin smoothed transfer operators: Set \"transpose: use implicit\" to false!\n"
2173 "Petrov-Galerkin transfer operator smoothing for non-symmetric problems requires a separate handling of the restriction operator which "
2174 "does not allow the usage of implicit transpose easily.");
2178 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2185 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2193 P->SetParameterList(Pparams);
2200 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2208 P->SetParameterList(Pparams);
2215 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2218 int , std::vector<keep_pair>& )
const {
2219 #ifdef HAVE_MUELU_MATLAB
2222 P->SetParameterList(Pparams);
2223 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2231 #undef MUELU_SET_VAR_2LIST
2232 #undef MUELU_TEST_AND_SET_VAR
2233 #undef MUELU_TEST_AND_SET_PARAM_2LIST
2234 #undef MUELU_TEST_PARAM_2LIST
2235 #undef MUELU_KOKKOS_FACTORY
2239 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2244 const int maxLevels = 100;
2247 std::vector<ParameterList> paramLists;
2248 for (
int levelID = 0; levelID < maxLevels; levelID++) {
2249 std::string sublistName =
"level " +
toString(levelID);
2251 paramLists.push_back(paramList.
sublist(sublistName));
2253 paramList.
remove(sublistName);
2256 paramLists.push_back(paramList);
2258 #ifdef HAVE_MUELU_MATLAB
2260 for (
size_t i = 0; i < paramLists.size(); i++) {
2261 std::vector<std::string> customVars;
2264 std::string paramName = paramLists[i].name(it);
2267 customVars.push_back(paramName);
2271 for (
size_t j = 0; j < customVars.size(); j++)
2272 paramLists[i].
remove(customVars[j],
false);
2276 const int maxDepth = 0;
2277 for (
size_t i = 0; i < paramLists.size(); i++) {
2280 paramLists[i].validateParameters(validList, maxDepth);
2283 std::string eString = e.what();
2286 size_t nameStart = eString.find_first_of(
'"') + 1;
2287 size_t nameEnd = eString.find_first_of(
'"', nameStart);
2288 std::string name = eString.substr(nameStart, nameEnd - nameStart);
2290 size_t bestScore = 100;
2291 std::string bestName =
"";
2293 const std::string& pName = validList.
name(it);
2294 this->GetOStream(
Runtime1) <<
"| " << pName;
2295 size_t score =
LevenshteinDistance(name.c_str(), name.length(), pName.c_str(), pName.length());
2296 this->GetOStream(
Runtime1) <<
" -> " << score << std::endl;
2297 if (score < bestScore) {
2302 if (bestScore < 10 && bestName !=
"") {
2304 eString <<
"The parameter name \"" + name +
"\" is not valid. Did you mean \"" + bestName <<
"\"?\n");
2308 eString <<
"The parameter name \"" + name +
"\" is not valid.\n");
2317 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2330 blockSize_ = paramList.
sublist(
"Matrix").
get<
int>(
"PDE equations", MasterList::getDefault<int>(
"number of equations"));
2335 if (factFact_ == Teuchos::null)
2348 this->BuildFactoryMap(paramList.
sublist(
"Factories"), factoryMap, factoryMap, factoryManagers);
2367 this->numDesiredLevel_ = hieraList.
get<
int>(
"max levels");
2368 hieraList.
remove(
"max levels");
2372 this->maxCoarseSize_ = hieraList.
get<
int>(
"coarse: max size");
2373 hieraList.
remove(
"coarse: max size");
2376 if (hieraList.
isParameter(
"repartition: rebalance P and R")) {
2377 this->doPRrebalance_ = hieraList.
get<
bool>(
"repartition: rebalance P and R");
2378 hieraList.
remove(
"repartition: rebalance P and R");
2381 if (hieraList.
isParameter(
"transpose: use implicit")) {
2382 this->implicitTranspose_ = hieraList.
get<
bool>(
"transpose: use implicit");
2383 hieraList.
remove(
"transpose: use implicit");
2386 if (hieraList.
isParameter(
"fuse prolongation and update")) {
2387 this->fuseProlongationAndUpdate_ = hieraList.
get<
bool>(
"fuse prolongation and update");
2388 hieraList.
remove(
"fuse prolongation and update");
2391 if (hieraList.
isParameter(
"nullspace: suppress dimension check")) {
2392 this->suppressNullspaceDimensionCheck_ = hieraList.
get<
bool>(
"nullspace: suppress dimension check");
2393 hieraList.
remove(
"nullspace: suppress dimension check");
2397 this->sizeOfMultiVectors_ = hieraList.
get<
int>(
"number of vectors");
2398 hieraList.
remove(
"number of vectors");
2401 if (hieraList.
isSublist(
"matvec params"))
2402 this->matvecParams_ = Teuchos::parameterList(hieraList.
sublist(
"matvec params"));
2404 if (hieraList.
isParameter(
"coarse grid correction scaling factor")) {
2405 this->scalingFactor_ = hieraList.
get<
double>(
"coarse grid correction scaling factor");
2406 hieraList.
remove(
"coarse grid correction scaling factor");
2411 std::map<std::string, CycleType> cycleMap;
2415 std::string cycleType = hieraList.
get<std::string>(
"cycle type");
2417 this->Cycle_ = cycleMap[cycleType];
2420 if (hieraList.
isParameter(
"W cycle start level")) {
2421 this->WCycleStartLevel_ = hieraList.
get<
int>(
"W cycle start level");
2425 std::string vl = hieraList.
get<std::string>(
"verbosity");
2426 hieraList.
remove(
"verbosity");
2433 if (hieraList.
isParameter(
"dependencyOutputLevel"))
2434 this->graphOutputLevel_ = hieraList.
get<
int>(
"dependencyOutputLevel");
2440 if (hieraList.
isSublist(
"DataToWrite")) {
2444 std::string dataName =
"Matrices";
2446 this->matricesToPrint_[
"A"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2447 dataName =
"Prolongators";
2449 this->matricesToPrint_[
"P"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2450 dataName =
"Restrictors";
2452 this->matricesToPrint_[
"R"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2455 this->matricesToPrint_[
"D0"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2460 const std::string& paramName = hieraList.
name(param);
2462 if (paramName !=
"DataToWrite" && hieraList.
isSublist(paramName)) {
2467 startLevel = levelList.
get<
int>(
"startLevel");
2468 levelList.
remove(
"startLevel");
2470 int numDesiredLevel = 1;
2472 numDesiredLevel = levelList.
get<
int>(
"numDesiredLevel");
2473 levelList.
remove(
"numDesiredLevel");
2487 BuildFactoryMap(levelList, factoryMap, levelFactoryMap, factoryManagers);
2493 if (startLevel >= 0)
2494 this->AddFactoryManager(startLevel, numDesiredLevel, m);
2625 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2629 const std::string& paramName = paramList.
name(param);
2634 if (paramValue.
isList()) {
2635 ParameterList paramList1 = Teuchos::getValue<ParameterList>(paramValue);
2639 "MueLu::ParameterListInterpreter(): It seems that in the parameter lists for defining " << paramName <<
" there is both a 'factory' and 'dependency for' parameter. This is not allowed. Please remove the 'dependency for' parameter.");
2641 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2643 }
else if (paramList1.
isParameter(
"dependency for")) {
2645 "MueLu::ParameterListInterpreter(): It seems that in the parameter lists for defining " << paramName <<
" there is both a 'factory' and 'dependency for' parameter. This is not allowed.");
2647 std::string factoryName = paramList1.
get<std::string>(
"dependency for");
2651 "MueLu::ParameterListInterpreter(): could not find factory " + factoryName +
" in factory map. Did you define it before?");
2659 const std::string& pName = validParamList->name(vparam);
2669 factory->SetFactory(pName, generatingFact.
create_weak());
2672 if (pName ==
"ParameterList") {
2681 factory->SetParameter(pName, paramList1.
getEntry(pName));
2687 std::string groupType = paramList1.
get<std::string>(
"group");
2689 "group must be of type \"FactoryManager\".");
2692 groupList.
remove(
"group");
2694 bool setKokkosRefactor =
false;
2695 bool kokkosRefactor = useKokkos_;
2696 if (groupList.
isParameter(
"use kokkos refactor")) {
2697 kokkosRefactor = groupList.
get<
bool>(
"use kokkos refactor");
2698 groupList.
remove(
"use kokkos refactor");
2699 setKokkosRefactor =
true;
2703 BuildFactoryMap(groupList, factoryMapIn, groupFactoryMap, factoryManagers);
2708 if (setKokkosRefactor)
2710 factoryManagers[paramName] = m;
2713 this->GetOStream(
Warnings0) <<
"Could not interpret parameter list " << paramList1 << std::endl;
2715 "XML Parameter list must either be of type \"factory\" or of type \"group\".");
2719 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2727 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2730 Matrix& A =
dynamic_cast<Matrix&
>(Op);
2731 if (A.IsFixedBlockSizeSet() && (A.GetFixedBlockSize() != blockSize_))
2732 this->GetOStream(
Warnings0) <<
"Setting matrix block size to " << blockSize_ <<
" (value of the parameter in the list) "
2733 <<
"instead of " << A.GetFixedBlockSize() <<
" (provided matrix)." << std::endl
2734 <<
"You may want to check \"number of equations\" (or \"PDE equations\" for factory style list) parameter." << std::endl;
2736 A.SetFixedBlockSize(blockSize_, dofOffset_);
2738 #ifdef HAVE_MUELU_DEBUG
2739 MatrixUtils::checkLocalRowMapMatchesColMap(A);
2740 #endif // HAVE_MUELU_DEBUG
2742 }
catch (std::bad_cast&) {
2743 this->GetOStream(
Warnings0) <<
"Skipping setting block size as the operator is not a matrix" << std::endl;
2747 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2759 const std::string& name = it->first;
2766 compare(Teuchos::getValue<ParameterList>(entry1), Teuchos::getValue<ParameterList>(*entry2));
2782 #define MUELU_PARAMETERLISTINTERPRETER_SHORT
Important warning messages (one line)
Generic Smoother Factory for generating the smoothers of the MG hierarchy.
virtual ~ParameterListInterpreter()
Destructor.
const std::string & name() const
This class specifies the default factory that should generate some data on a Level if the data does n...
void SetupHierarchy(Hierarchy &H) const
Call the SetupHierarchy routine from the HiearchyManager object.
ParameterList & setEntry(const std::string &name, U &&entry)
static VerbLevel GetDefaultVerbLevel()
Get the default (global) verbosity level.
ConstIterator end() const
void UpdateFactoryManager_Replicate(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Reitzinger(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
Factory for determing the number of partitions for rebalancing.
#define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory)
Factory for generating coarse level map. Used by TentativePFactory.
bool is_null(const boost::shared_ptr< T > &p)
std::string toString(const T &what)
Little helper function to convert non-string types to strings.
Factory for building transfer operators based on coarsening in polynomial degree, following the Intre...
virtual void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Configuration.
Factory for building coarse grid matrices, when the matrix is of the form K+a*M. Useful when you want...
Class for generating an initial LocalOrdinal-type BlockNumber vector, based on an input paraemter for...
void UpdateFactoryManager(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
Factory that can generate other factories from.
RCP< T > create_weak() const
T & get(const std::string &name, T def_value)
Class that encapsulates external library smoothers.
size_t LevenshteinDistance(const char *s, size_t len_s, const char *t, size_t len_t)
void UpdateFactoryManager_Matlab(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
#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.
#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.
Class for transferring a vector of local ordinals from a finer level to a coarser one...
Factory for converting matrices to half precision operators.
void SetKokkosRefactor(const bool useKokkos)
Class for restricting a MultiVector from a finer to a coarser level.
One-liner description of what is happening.
ParameterListInterpreter()
Empty constructor.
void UpdateFactoryManager_LowPrecision(ParameterList ¶mList, const ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
Ordinal numParams() const
void SetCycle(CycleType Cycle)
Supports VCYCLE and WCYCLE types.
void AddTransferFactory(const RCP< const FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories in RepartitionAcFactory.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
#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)
Factory for creating a graph base on a given matrix.
void UpdateFactoryManager_SemiCoarsen(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
const RCP< const FactoryBase > GetFactory(const std::string &varName) const
Get factory associated with a particular data name.
static void DisableMultipleCheckGlobally()
std::map< std::string, RCP< FactoryManagerBase > > FactoryManagerMap
std::map< std::string, RCP< const FactoryBase > > FactoryMap
void UpdateFactoryManager_Nullspace(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps, RCP< Factory > &nullSpaceFactory) const
static void EnableTimerSync()
Factory for building tentative prolongator.
static void SetMueLuOFileStream(const std::string &filename)
#define TEST_MUTUALLY_EXCLUSIVE(arg1, arg2)
MsgType toVerbLevel(const std::string &verbLevelStr)
Class that encapsulates direct solvers. Autoselection of AmesosSmoother or Amesos2Smoother according ...
virtual void SetupOperator(Operator &A) const
Setup Operator object.
Prolongator factory performing semi-coarsening.
Factory for building restriction operators using a prolongator factory.
static RCP< Time > getNewTimer(const std::string &name)
ParameterEntry * getEntryPtr(const std::string &name)
void UpdateFactoryManager_PG(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
Teuchos::RCP< MueLu::FacadeClassFactory< Scalar, LocalOrdinal, GlobalOrdinal, Node > > facadeFact_
FacadeClass factory.
Prolongator factory that replicates 'Psubblock' matrix to create new prolongator suitable for PDE sys...
bool isParameter(const std::string &name) const
void UpdateFactoryManager_Material(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
bool remove(std::string const &name, bool throwIfNotExists=true)
void UpdateFactoryManager_Emin(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
static void SetDefaultVerbLevel(const VerbLevel defaultVerbLevel)
Set the default (global) verbosity level.
#define MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList, paramName, paramType, listWrite)
static bool compare(const ParameterList &list1, const ParameterList &list2)
virtual void SetParameterList(const Teuchos::ParameterList ¶mList)
Set parameters from a parameter list and return with default values.
static CycleType GetDefaultCycle()
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultScalar Scalar
void UpdateFactoryManager_Coordinates(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
MueLu::DefaultGlobalOrdinal GlobalOrdinal
bool isSublist(const std::string &name) const
void SetCycleStartLevel(int cycleStart)
Factory for interacting with Matlab.
Factory for interacting with Matlab.
VerbLevel GetVerbLevel() const
Get the verbosity level.
Factory for building line detection information.
params_t::ConstIterator ConstIterator
void SetFactoryParameterList(const Teuchos::ParameterList ¶mList)
Factory interpreter stuff.
Factory to export aggregation info or visualize aggregates using VTK.
Prolongator factory which allows switching between two different prolongator strategies.
Interface to Zoltan2 library.This interface provides access to partitioning methods in Zoltan2...
AmalgamationFactory for subblocks of strided map based amalgamation data.
static const RCP< const NoFactory > getRCP()
Static Get() functions.
void UpdateFactoryManager_RAP(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
ConstIterator begin() const
Factory for building the constraint operator.
void UpdateFactoryManager_Restriction(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_BlockNumber(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
Applies permutation to grid transfer operators.
Prolongator factory that replicates 'Psubblock' matrix to create new prolongator suitable for PDE sys...
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
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)
Factory for generating a very special nullspace.
const ParameterEntry & entry(ConstIterator i) const
any & getAny(bool activeQry=true)
void UpdateFactoryManager_Aggregation_TentativeP(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void AddTransferFactory(const RCP< const FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories in RepartitionAcFactory.
Factory for creating a graph based on a given matrix.
void BuildFactoryMap(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, FactoryMap &factoryMapOut, FactoryManagerMap &factoryManagers) const
Interpret "Factories" sublist.
Class that encapsulates Matlab smoothers.
This class checks matrix properties of A on current level. This factory can be plugged in everywhere ...
Partitioning within a node onlyThis interface provides partitioning within a node.
Factory for generating F/C-splitting and a coarse level map. Used by ClassicalPFactory.
void SetParameterList(const Teuchos::ParameterList ¶mList)
Set parameter list for Parameter list interpreter.
void UpdateFactoryManager_Combine(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.
void UpdateFactoryManager_SA(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void SetVerbLevel(const VerbLevel verbLevel)
Set the verbosity level of this object.
Factory for building nonzero patterns for energy minimization.
static Teuchos::RCP< Teuchos::ParameterList > GetProblemSpecificList(std::string const &problemType)
Return default parameter settings for the specified problem type.
bool isType(const std::string &name) const
Factory for building tentative prolongator.
Class for transferring coordinates from a finer level to a coarser one.
Factory for building restriction operators.
Factory for building Energy Minimization prolongators.
static bool areSame(const ParameterList &list1, const ParameterList &list2)
Helper functions to compare two paramter lists.
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
Factory for creating a graph based on a given matrix.
#define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2)
static int GetDefaultCycleStartLevel()
void Validate(const Teuchos::ParameterList ¶mList) const
void UpdateFactoryManager_PCoarsen(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void SetProlongatorScalingFactor(double scalingFactor)
Specify damping factor alpha such that x = x + alpha*P*c, where c is the coarse grid correction...
#define MUELU_TEST_PARAM_2LIST(paramList, defaultList, paramName, paramType, cmpValue)
Factory for building coarse matrices.
Exception throws to report errors in the internal logical of the program.
Factory for building filtered matrices using filtered graphs.
std::pair< std::string, const FactoryBase * > keep_pair
void UpdateFactoryManager_Repartition(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps, RCP< Factory > &nullSpaceFactory) const
Description of what is happening (more verbose)
Factory for building coarse matrices.
Factory for building Petrov-Galerkin Smoothed Aggregation prolongators.
An factory which assigns each aggregate a quality estimate. Originally developed by Napov and Notay i...
void UpdateFactoryManager_Smoothers(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
ParameterEntry & getEntry(const std::string &name)
void AddPtentFactory(const RCP< const FactoryBase > &factory)
Add a tentative prolongator factory in the end of list of prolongator factories.
Factory for building Smoothed Aggregation prolongators.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.
Prolongator factory performing semi-coarsening.
void UpdateFactoryManager_CoarseSolvers(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
#define MUELU_SET_VAR_2LIST(paramList, defaultList, paramName, paramType, varName)
void SetEasyParameterList(const Teuchos::ParameterList ¶mList)
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
void AddCoarseNullspaceFactory(const RCP< const FactoryBase > &factory)
Add a coarse nullspace factory in the end of list of coarse nullspace factories.
Factory for generating nullspace.
long ExtractNonSerializableData(const Teuchos::ParameterList &inList, Teuchos::ParameterList &serialList, Teuchos::ParameterList &nonSerialList)
Extract non-serializable data from level-specific sublists and move it to a separate parameter list...
Exception throws to report invalid user entry.
#define TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(throw_exception_test, Exception, msg)
void UpdateFactoryManager_LocalOrdinalTransfer(const std::string &VarName, const std::string &multigridAlgo, Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const