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
1080 #ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1081 if (!dropParams.
isParameter(
"aggregation: drop scheme") ||
1082 (dropParams.
isParameter(
"aggregation: drop scheme") &&
1083 ((dropParams.
get<std::string>(
"aggregation: drop scheme") !=
"point-wise") && (dropParams.
get<std::string>(
"aggregation: drop scheme") !=
"cut-drop")))) {
1086 #define MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(paramList, paramName, paramType) \
1087 if (!paramList.isParameter(paramName)) { \
1088 paramList.set(paramName, MasterList::getDefault<paramType>(paramName)); \
1091 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: drop scheme", std::string);
1092 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: strength-of-connection: matrix", std::string);
1093 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: strength-of-connection: measure", std::string);
1094 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: use blocking",
bool);
1096 #undef MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST
1100 dropParams.
isParameter(
"aggregation: strength-of-connection: measure") ||
1101 dropParams.
isParameter(
"aggregation: use blocking"),
1103 "The inputs contain a mix of old and new dropping parameters:\n\n"
1104 << dropParams <<
"\n\nKeep in mind that defaults are set for old parameters, so this gets interpreted as\n\n"
1105 << dropParamsWithDefaults);
1112 if (dropParams.
isParameter(
"aggregation: drop scheme")) {
1113 std::string drop_scheme = dropParams.
get<std::string>(
"aggregation: drop scheme");
1114 if (drop_scheme ==
"block diagonal colored signed classical")
1115 manager.
SetFactory(
"Coloring Graph", dropFactory);
1117 (drop_scheme.find(
"block diagonal") != std::string::npos || drop_scheme ==
"signed classical")) {
1119 dropFactory->
SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1130 #ifndef HAVE_MUELU_MATLAB
1131 if (aggType ==
"matlab")
1132 throw std::runtime_error(
"Cannot use MATLAB aggregation - MueLu was not configured with MATLAB support.");
1135 if (aggType ==
"uncoupled") {
1164 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: coloring algorithm", std::string,
"mis2 aggregation") ||
1165 MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: coloring algorithm", std::string,
"mis2 coarsening")) {
1166 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: symmetrize graph after dropping",
bool,
false))
1169 "MIS2 algorithms require the use of a symmetrized graph. Please set \"aggregation: symmetrize graph after dropping\" to \"true\".");
1171 }
else if (aggType ==
"brick") {
1184 manager.
SetFactory(
"DofsPerNode", aggFactory);
1190 aggFactory->
SetFactory(
"Coordinates", this->GetFactoryManager(levelID - 1)->GetFactory(
"Coordinates"));
1192 }
else if (aggType ==
"classical") {
1201 std::string drop_algo = tempParams.
get<std::string>(
"aggregation: drop scheme");
1202 if (drop_algo ==
"block diagonal colored signed classical") {
1203 mapParams.
set(
"aggregation: coloring: use color graph",
true);
1223 if (drop_algo.find(
"block diagonal") != std::string::npos || drop_algo ==
"signed classical") {
1225 aggFactory->
SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1234 if (reuseType ==
"tP" && levelID) {
1239 }
else if (aggType ==
"notay") {
1250 #ifdef HAVE_MUELU_MATLAB
1251 else if (aggType ==
"matlab") {
1258 manager.
SetFactory(
"Aggregates", aggFactory);
1268 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1269 ptentParams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1270 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1271 ptentParams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1274 Ptent->SetParameterList(ptentParams);
1275 Ptent->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1276 Ptent->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1279 if (reuseType ==
"tP" && levelID) {
1280 keeps.push_back(
keep_pair(
"Nullspace", Ptent.get()));
1281 keeps.push_back(
keep_pair(
"P", Ptent.get()));
1288 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1291 int levelID, std::vector<keep_pair>& keeps)
const {
1304 std::string alg = paramList.
get(
"rap: algorithm",
"galerkin");
1305 if (alg ==
"shift" || alg ==
"non-galerkin") {
1319 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1320 RAPparams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1321 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1322 RAPparams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1329 if (!paramList.
isParameter(
"rap: triple product") &&
1330 paramList.
isType<std::string>(
"multigrid algorithm") &&
1331 paramList.
get<std::string>(
"multigrid algorithm") ==
"unsmoothed")
1332 paramList.
set(
"rap: triple product",
true);
1337 if (paramList.
isParameter(
"aggregation: allow empty prolongator columns")) {
1338 RAPparams.
set(
"CheckMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1339 RAPparams.
set(
"RepairMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1340 }
else if (defaultList.
isParameter(
"aggregation: allow empty prolongator columns")) {
1341 RAPparams.
set(
"CheckMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1342 RAPparams.
set(
"RepairMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1358 if (!this->implicitTranspose_) {
1376 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: compute aggregate qualities",
bool,
true)) {
1390 manager.
SetFactory(
"AggregateQualities", aggQualityFact);
1398 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: export visualization data",
bool,
true)) {
1427 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
1428 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
1430 if (reuseType ==
"RP" || (reuseType ==
"tP" && !filteringChangesMatrix)) {
1432 keeps.push_back(
keep_pair(
"AP reuse data", RAP.
get()));
1433 keeps.push_back(
keep_pair(
"RAP reuse data", RAP.
get()));
1436 keeps.push_back(
keep_pair(
"AP reuse data", RAPs.
get()));
1437 keeps.push_back(
keep_pair(
"RAP reuse data", RAPs.
get()));
1445 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1449 bool have_userCO =
false;
1453 if (useCoordinates_) {
1464 if (!RAP.is_null()) {
1465 RAP->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1468 RAPs->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1477 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1481 bool have_userMaterial =
false;
1483 have_userMaterial =
true;
1486 if (have_userMaterial) {
1491 materialTransferParameters.
set(
"Vector name",
"Material");
1492 materialTransferParameters.
set(
"Transfer name",
"Aggregates");
1493 materialTransferParameters.
set(
"Normalize",
true);
1497 manager.
SetFactory(
"Material", materialTransfer);
1500 if (!RAP.is_null()) {
1501 RAP->AddTransferFactory(manager.
GetFactory(
"Material"));
1504 RAPs->AddTransferFactory(manager.
GetFactory(
"Material"));
1513 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1516 FactoryManager& manager,
int levelID, std::vector<keep_pair>& )
const {
1519 if (useBlockNumber_ && (levelID > 0)) {
1522 if (!RAP.is_null() || !RAPs.is_null()) {
1524 if (multigridAlgo ==
"classical")
1530 fact->
SetFactory(VarName, this->GetFactoryManager(levelID - 1)->GetFactory(VarName));
1535 RAP->AddTransferFactory(manager.
GetFactory(VarName));
1537 RAPs->AddTransferFactory(manager.
GetFactory(VarName));
1545 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1548 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1549 if (useBlockNumber_) {
1561 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1564 int levelID, std::vector<keep_pair>& )
const {
1565 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
1566 bool have_userR =
false;
1572 if (!this->implicitTranspose_) {
1575 if (isSymmetric ==
false && (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"emin")) {
1576 this->GetOStream(
Warnings0) <<
"Switching \"problem: symmetric\" parameter to symmetric as multigrid algorithm. " << multigridAlgo <<
" is primarily supposed to be used for symmetric problems.\n\n"
1577 <<
"Please note: if you are using \"unsmoothed\" transfer operators the \"problem: symmetric\" parameter "
1578 <<
"has no real mathematical meaning, i.e. you can use it for non-symmetric\n"
1579 <<
"problems, too. With \"problem: symmetric\"=\"symmetric\" you can use implicit transpose for building "
1580 <<
"the restriction operators which may drastically reduce the amount of consumed memory." << std::endl;
1584 "Petrov-Galerkin smoothed transfer operators are only allowed for non-symmetric problems: Set \"problem: symmetric\" to false!\n"
1585 "While PG smoothed transfer operators generally would also work for symmetric problems this is an unusual use case. "
1586 "You can use the factory-based xml interface though if you need PG-AMG for symmetric problems.");
1605 if (paramList.
isParameter(
"restriction: scale nullspace") && paramList.
get<
bool>(
"restriction: scale nullspace")) {
1608 tentPlist.
set(
"Nullspace name",
"Scaled Nullspace");
1621 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1624 int levelID, std::vector<keep_pair>& keeps,
RCP<Factory>& nullSpaceFactory)
const {
1629 #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
1630 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: use subcommunicators in place",
bool, enableInPlace);
1667 "Reuse types \"tP\" and \"PR\" require \"repartition: rebalance P and R\" set to \"false\"");
1672 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: partitioner", std::string, partName);
1674 "Invalid partitioner name: \"" << partName <<
"\". Valid options: \"zoltan\", \"zoltan2\"");
1676 #ifndef HAVE_MUELU_ZOLTAN
1677 bool switched =
false;
1678 if (partName ==
"zoltan") {
1679 this->GetOStream(
Warnings0) <<
"Zoltan interface is not available, trying to switch to Zoltan2" << std::endl;
1680 partName =
"zoltan2";
1684 #ifndef HAVE_MUELU_ZOLTAN2
1685 bool switched =
false;
1686 #endif // HAVE_MUELU_ZOLTAN2
1687 #endif // HAVE_MUELU_ZOLTAN
1689 #ifndef HAVE_MUELU_ZOLTAN2
1690 if (partName ==
"zoltan2" && !switched) {
1691 this->GetOStream(
Warnings0) <<
"Zoltan2 interface is not available, trying to switch to Zoltan" << std::endl;
1692 partName =
"zoltan";
1694 #endif // HAVE_MUELU_ZOLTAN2
1696 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: node repartition level",
int, nodeRepartitionLevel);
1709 repartheurFactory->SetParameterList(repartheurParams);
1710 repartheurFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1711 manager.
SetFactory(
"number of partitions", repartheurFactory);
1712 manager.
SetFactory(
"repartition: heuristic target rows per process", repartheurFactory);
1716 if (levelID == nodeRepartitionLevel) {
1723 }
else if (partName ==
"zoltan") {
1724 #ifdef HAVE_MUELU_ZOLTAN
1729 #endif // HAVE_MUELU_ZOLTAN
1730 }
else if (partName ==
"zoltan2") {
1731 #ifdef HAVE_MUELU_ZOLTAN2
1735 partParams.
set(
"ParameterList", partpartParams);
1737 partitioner->
SetFactory(
"repartition: heuristic target rows per process",
1738 manager.
GetFactory(
"repartition: heuristic target rows per process"));
1741 #endif // HAVE_MUELU_ZOLTAN2
1746 if (useCoordinates_)
1748 manager.
SetFactory(
"Partition", partitioner);
1757 repartFactory->SetParameterList(repartParams);
1758 repartFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1759 repartFactory->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1760 repartFactory->SetFactory(
"Partition", manager.
GetFactory(
"Partition"));
1761 manager.
SetFactory(
"Importer", repartFactory);
1762 if (reuseType !=
"none" && reuseType !=
"S" && levelID)
1765 if (enableInPlace) {
1773 newA->SetParameterList(rebAcParams);
1774 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1775 newA->SetFactory(
"InPlaceMap", manager.
GetFactory(
"InPlaceMap"));
1782 newA->SetParameterList(rebAcParams);
1783 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1784 newA->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1790 newPparams.
set(
"type",
"Interpolation");
1791 if (changedPRrebalance_)
1792 newPparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1793 if (changedPRViaCopyrebalance_)
1794 newPparams.
set(
"repartition: explicit via new copy rebalance P and R",
true);
1797 newP->SetParameterList(newPparams);
1798 newP->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1799 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
1801 if (!paramList.
isParameter(
"semicoarsen: number of levels"))
1802 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1804 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"P"));
1805 if (useCoordinates_) {
1806 newP->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1810 newP->SetFactory(
"Material", manager.
GetFactory(
"Material"));
1813 if (useBlockNumber_ && (levelID > 0)) {
1814 newP->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1821 newRparams.
set(
"type",
"Restriction");
1824 if (changedPRrebalance_)
1825 newRparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1826 if (changedPRViaCopyrebalance_)
1827 newPparams.
set(
"repartition: explicit via new copy rebalance P and R",
true);
1828 if (changedImplicitTranspose_)
1829 newRparams.
set(
"transpose: use implicit", this->implicitTranspose_);
1830 newR->SetParameterList(newRparams);
1831 newR->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1832 if (!this->implicitTranspose_) {
1833 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1846 nullSpaceFactory->
SetFactory(
"Nullspace", newP);
1850 paramList.
set(
"repartition: enable",
false);
1852 this->GetOStream(
Warnings0) <<
"No repartitioning available for a serial run\n";
1854 this->GetOStream(
Warnings0) <<
"Zoltan/Zoltan2 are unavailable for repartitioning\n";
1856 #endif // defined(HAVE_MPI) && (defined(HAVE_MUELU_ZOLTAN) || defined(HAVE_MUELU_ZOLTAN2))
1863 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1866 int levelID, std::vector<keep_pair>& keeps)
const {
1867 MUELU_SET_VAR_2LIST(paramList, defaultList,
"transfers: half precision",
bool, enableLowPrecision);
1869 if (enableLowPrecision) {
1873 newPparams.
set(
"matrix key",
"P");
1874 newP->SetParameterList(newPparams);
1875 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
1878 if (!this->implicitTranspose_) {
1882 newRparams.
set(
"matrix key",
"R");
1883 newR->SetParameterList(newRparams);
1884 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1893 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1896 int , std::vector<keep_pair>& ,
RCP<Factory>& nullSpaceFactory)
const {
1900 bool have_userNS =
false;
1911 nullSpaceFactory = nullSpace;
1913 if (paramList.
isParameter(
"restriction: scale nullspace") && paramList.
get<
bool>(
"restriction: scale nullspace")) {
1915 scaledNSfactory->
SetFactory(
"Nullspace", nullSpaceFactory);
1916 manager.
SetFactory(
"Scaled Nullspace", scaledNSfactory);
1923 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1926 int , std::vector<keep_pair>& )
const {
1929 if (paramList.
isParameter(
"semicoarsen: number of levels") &&
1930 paramList.
get<
int>(
"semicoarsen: number of levels") > 0) {
1957 manager.
SetFactory(
"CoarseNumZLayers", linedetectionFactory);
1958 manager.
SetFactory(
"LineDetection_Layers", linedetectionFactory);
1959 manager.
SetFactory(
"LineDetection_VertLineIds", linedetectionFactory);
1963 manager.
SetFactory(
"Nullspace", togglePFactory);
1966 if (paramList.
isParameter(
"semicoarsen: number of levels")) {
1968 tf->SetFactory(
"Chosen P", manager.
GetFactory(
"P"));
1969 tf->AddCoordTransferFactory(semicoarsenFactory);
1974 tf->AddCoordTransferFactory(coords);
1982 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1985 int levelID, std::vector<keep_pair>& keeps)
const {
1986 #ifdef HAVE_MUELU_INTREPID2
1991 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
1992 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
1994 if (levelID >= (
int)pcoarsen_schedule.size()) {
1997 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
2003 std::string lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
2004 std::string hi = (levelID ? pcoarsen_element + std::to_string(pcoarsen_schedule[levelID - 1]) : lo);
2005 Pparams.
set(
"pcoarsen: hi basis", hi);
2006 Pparams.
set(
"pcoarsen: lo basis", lo);
2007 P->SetParameterList(Pparams);
2020 P->SetParameterList(Pparams);
2033 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2039 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
2040 Pparams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
2041 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
2042 Pparams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
2058 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
2093 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
2095 if (reuseType ==
"tP" && !filteringChangesMatrix)
2102 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2105 int , std::vector<keep_pair>& )
const {
2109 "Invalid pattern name: \"" << patternType <<
"\". Valid options: \"AkPtent\"");
2114 patternFactory->SetParameterList(patternParams);
2115 patternFactory->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2118 MUELU_SET_VAR_2LIST(paramList, defaultList,
"emin: use filtered matrix",
bool, useFiltering);
2143 patternFactory->SetFactory(
"A", filterFactory);
2146 patternFactory->SetFactory(
"A", manager.
GetFactory(
"Graph"));
2150 manager.
SetFactory(
"Ppattern", patternFactory);
2154 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
2155 constraintFactory->SetFactory(
"CoarseNullspace", manager.
GetFactory(
"Ptent"));
2156 manager.
SetFactory(
"Constraint", constraintFactory);
2162 if (reuseType ==
"emin") {
2164 Pparams.
set(
"Keep P0",
true);
2165 Pparams.
set(
"Keep Constraint0",
true);
2170 P->SetParameterList(Pparams);
2171 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2172 P->SetFactory(
"Constraint", manager.
GetFactory(
"Constraint"));
2179 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2182 int , std::vector<keep_pair>& )
const {
2184 "Implicit transpose not supported with Petrov-Galerkin smoothed transfer operators: Set \"transpose: use implicit\" to false!\n"
2185 "Petrov-Galerkin transfer operator smoothing for non-symmetric problems requires a separate handling of the restriction operator which "
2186 "does not allow the usage of implicit transpose easily.");
2190 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2197 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2205 P->SetParameterList(Pparams);
2212 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2220 P->SetParameterList(Pparams);
2227 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2230 int , std::vector<keep_pair>& )
const {
2231 #ifdef HAVE_MUELU_MATLAB
2234 P->SetParameterList(Pparams);
2235 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2243 #undef MUELU_SET_VAR_2LIST
2244 #undef MUELU_TEST_AND_SET_VAR
2245 #undef MUELU_TEST_AND_SET_PARAM_2LIST
2246 #undef MUELU_TEST_PARAM_2LIST
2247 #undef MUELU_KOKKOS_FACTORY
2251 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2256 const int maxLevels = 100;
2259 std::vector<ParameterList> paramLists;
2260 for (
int levelID = 0; levelID < maxLevels; levelID++) {
2261 std::string sublistName =
"level " +
toString(levelID);
2263 paramLists.push_back(paramList.
sublist(sublistName));
2265 paramList.
remove(sublistName);
2268 paramLists.push_back(paramList);
2270 #ifdef HAVE_MUELU_MATLAB
2272 for (
size_t i = 0; i < paramLists.size(); i++) {
2273 std::vector<std::string> customVars;
2276 std::string paramName = paramLists[i].name(it);
2279 customVars.push_back(paramName);
2283 for (
size_t j = 0; j < customVars.size(); j++)
2284 paramLists[i].
remove(customVars[j],
false);
2288 const int maxDepth = 0;
2289 for (
size_t i = 0; i < paramLists.size(); i++) {
2292 paramLists[i].validateParameters(validList, maxDepth);
2295 std::string eString = e.what();
2298 size_t nameStart = eString.find_first_of(
'"') + 1;
2299 size_t nameEnd = eString.find_first_of(
'"', nameStart);
2300 std::string name = eString.substr(nameStart, nameEnd - nameStart);
2302 size_t bestScore = 100;
2303 std::string bestName =
"";
2305 const std::string& pName = validList.
name(it);
2306 this->GetOStream(
Runtime1) <<
"| " << pName;
2307 size_t score =
LevenshteinDistance(name.c_str(), name.length(), pName.c_str(), pName.length());
2308 this->GetOStream(
Runtime1) <<
" -> " << score << std::endl;
2309 if (score < bestScore) {
2314 if (bestScore < 10 && bestName !=
"") {
2316 eString <<
"The parameter name \"" + name +
"\" is not valid. Did you mean \"" + bestName <<
"\"?\n");
2320 eString <<
"The parameter name \"" + name +
"\" is not valid.\n");
2329 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2342 blockSize_ = paramList.
sublist(
"Matrix").
get<
int>(
"PDE equations", MasterList::getDefault<int>(
"number of equations"));
2347 if (factFact_ == Teuchos::null)
2360 this->BuildFactoryMap(paramList.
sublist(
"Factories"), factoryMap, factoryMap, factoryManagers);
2379 this->numDesiredLevel_ = hieraList.
get<
int>(
"max levels");
2380 hieraList.
remove(
"max levels");
2384 this->maxCoarseSize_ = hieraList.
get<
int>(
"coarse: max size");
2385 hieraList.
remove(
"coarse: max size");
2388 if (hieraList.
isParameter(
"repartition: rebalance P and R")) {
2389 this->doPRrebalance_ = hieraList.
get<
bool>(
"repartition: rebalance P and R");
2390 hieraList.
remove(
"repartition: rebalance P and R");
2393 if (hieraList.
isParameter(
"transpose: use implicit")) {
2394 this->implicitTranspose_ = hieraList.
get<
bool>(
"transpose: use implicit");
2395 hieraList.
remove(
"transpose: use implicit");
2398 if (hieraList.
isParameter(
"fuse prolongation and update")) {
2399 this->fuseProlongationAndUpdate_ = hieraList.
get<
bool>(
"fuse prolongation and update");
2400 hieraList.
remove(
"fuse prolongation and update");
2403 if (hieraList.
isParameter(
"nullspace: suppress dimension check")) {
2404 this->suppressNullspaceDimensionCheck_ = hieraList.
get<
bool>(
"nullspace: suppress dimension check");
2405 hieraList.
remove(
"nullspace: suppress dimension check");
2409 this->sizeOfMultiVectors_ = hieraList.
get<
int>(
"number of vectors");
2410 hieraList.
remove(
"number of vectors");
2413 if (hieraList.
isSublist(
"matvec params"))
2414 this->matvecParams_ = Teuchos::parameterList(hieraList.
sublist(
"matvec params"));
2416 if (hieraList.
isParameter(
"coarse grid correction scaling factor")) {
2417 this->scalingFactor_ = hieraList.
get<
double>(
"coarse grid correction scaling factor");
2418 hieraList.
remove(
"coarse grid correction scaling factor");
2423 std::map<std::string, CycleType> cycleMap;
2427 std::string cycleType = hieraList.
get<std::string>(
"cycle type");
2429 this->Cycle_ = cycleMap[cycleType];
2432 if (hieraList.
isParameter(
"W cycle start level")) {
2433 this->WCycleStartLevel_ = hieraList.
get<
int>(
"W cycle start level");
2437 std::string vl = hieraList.
get<std::string>(
"verbosity");
2438 hieraList.
remove(
"verbosity");
2445 if (hieraList.
isParameter(
"dependencyOutputLevel"))
2446 this->graphOutputLevel_ = hieraList.
get<
int>(
"dependencyOutputLevel");
2452 if (hieraList.
isSublist(
"DataToWrite")) {
2456 std::string dataName =
"Matrices";
2458 this->matricesToPrint_[
"A"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2459 dataName =
"Prolongators";
2461 this->matricesToPrint_[
"P"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2462 dataName =
"Restrictors";
2464 this->matricesToPrint_[
"R"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2467 this->matricesToPrint_[
"D0"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2472 const std::string& paramName = hieraList.
name(param);
2474 if (paramName !=
"DataToWrite" && hieraList.
isSublist(paramName)) {
2479 startLevel = levelList.
get<
int>(
"startLevel");
2480 levelList.
remove(
"startLevel");
2482 int numDesiredLevel = 1;
2484 numDesiredLevel = levelList.
get<
int>(
"numDesiredLevel");
2485 levelList.
remove(
"numDesiredLevel");
2499 BuildFactoryMap(levelList, factoryMap, levelFactoryMap, factoryManagers);
2505 if (startLevel >= 0)
2506 this->AddFactoryManager(startLevel, numDesiredLevel, m);
2637 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2641 const std::string& paramName = paramList.
name(param);
2646 if (paramValue.
isList()) {
2647 ParameterList paramList1 = Teuchos::getValue<ParameterList>(paramValue);
2651 "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.");
2653 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2655 }
else if (paramList1.
isParameter(
"dependency for")) {
2657 "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.");
2659 std::string factoryName = paramList1.
get<std::string>(
"dependency for");
2663 "MueLu::ParameterListInterpreter(): could not find factory " + factoryName +
" in factory map. Did you define it before?");
2671 const std::string& pName = validParamList->name(vparam);
2681 factory->SetFactory(pName, generatingFact.
create_weak());
2684 if (pName ==
"ParameterList") {
2693 factory->SetParameter(pName, paramList1.
getEntry(pName));
2699 std::string groupType = paramList1.
get<std::string>(
"group");
2701 "group must be of type \"FactoryManager\".");
2704 groupList.
remove(
"group");
2706 bool setKokkosRefactor =
false;
2707 bool kokkosRefactor = useKokkos_;
2708 if (groupList.
isParameter(
"use kokkos refactor")) {
2709 kokkosRefactor = groupList.
get<
bool>(
"use kokkos refactor");
2710 groupList.
remove(
"use kokkos refactor");
2711 setKokkosRefactor =
true;
2715 BuildFactoryMap(groupList, factoryMapIn, groupFactoryMap, factoryManagers);
2720 if (setKokkosRefactor)
2722 factoryManagers[paramName] = m;
2725 this->GetOStream(
Warnings0) <<
"Could not interpret parameter list " << paramList1 << std::endl;
2727 "XML Parameter list must either be of type \"factory\" or of type \"group\".");
2731 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2739 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2742 Matrix& A =
dynamic_cast<Matrix&
>(Op);
2743 if (A.IsFixedBlockSizeSet() && (A.GetFixedBlockSize() != blockSize_))
2744 this->GetOStream(
Warnings0) <<
"Setting matrix block size to " << blockSize_ <<
" (value of the parameter in the list) "
2745 <<
"instead of " << A.GetFixedBlockSize() <<
" (provided matrix)." << std::endl
2746 <<
"You may want to check \"number of equations\" (or \"PDE equations\" for factory style list) parameter." << std::endl;
2748 A.SetFixedBlockSize(blockSize_, dofOffset_);
2750 #ifdef HAVE_MUELU_DEBUG
2751 MatrixUtils::checkLocalRowMapMatchesColMap(A);
2752 #endif // HAVE_MUELU_DEBUG
2754 }
catch (std::bad_cast&) {
2755 this->GetOStream(
Warnings0) <<
"Skipping setting block size as the operator is not a matrix" << std::endl;
2759 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2771 const std::string& name = it->first;
2778 compare(Teuchos::getValue<ParameterList>(entry1), Teuchos::getValue<ParameterList>(*entry2));
2794 #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