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 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: coloring algorithm", std::string,
"mis2 aggregation") ||
1164 MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: coloring algorithm", std::string,
"mis2 coarsening")) {
1165 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: symmetrize graph after dropping",
bool,
false))
1168 "MIS2 algorithms require the use of a symmetrized graph. Please set \"aggregation: symmetrize graph after dropping\" to \"true\".");
1170 }
else if (aggType ==
"brick") {
1183 manager.
SetFactory(
"DofsPerNode", aggFactory);
1189 aggFactory->
SetFactory(
"Coordinates", this->GetFactoryManager(levelID - 1)->GetFactory(
"Coordinates"));
1191 }
else if (aggType ==
"classical") {
1200 std::string drop_algo = tempParams.
get<std::string>(
"aggregation: drop scheme");
1201 if (drop_algo ==
"block diagonal colored signed classical") {
1202 mapParams.
set(
"aggregation: coloring: use color graph",
true);
1222 if (drop_algo.find(
"block diagonal") != std::string::npos || drop_algo ==
"signed classical") {
1224 aggFactory->
SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1233 if (reuseType ==
"tP" && levelID) {
1238 }
else if (aggType ==
"notay") {
1249 #ifdef HAVE_MUELU_MATLAB
1250 else if (aggType ==
"matlab") {
1257 manager.
SetFactory(
"Aggregates", aggFactory);
1267 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1268 ptentParams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1269 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1270 ptentParams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1273 Ptent->SetParameterList(ptentParams);
1274 Ptent->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1275 Ptent->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1278 if (reuseType ==
"tP" && levelID) {
1279 keeps.push_back(
keep_pair(
"Nullspace", Ptent.get()));
1280 keeps.push_back(
keep_pair(
"P", Ptent.get()));
1287 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1290 int levelID, std::vector<keep_pair>& keeps)
const {
1303 std::string alg = paramList.
get(
"rap: algorithm",
"galerkin");
1304 if (alg ==
"shift" || alg ==
"non-galerkin") {
1318 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1319 RAPparams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1320 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1321 RAPparams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1328 if (!paramList.
isParameter(
"rap: triple product") &&
1329 paramList.
isType<std::string>(
"multigrid algorithm") &&
1330 paramList.
get<std::string>(
"multigrid algorithm") ==
"unsmoothed")
1331 paramList.
set(
"rap: triple product",
true);
1336 if (paramList.
isParameter(
"aggregation: allow empty prolongator columns")) {
1337 RAPparams.
set(
"CheckMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1338 RAPparams.
set(
"RepairMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1339 }
else if (defaultList.
isParameter(
"aggregation: allow empty prolongator columns")) {
1340 RAPparams.
set(
"CheckMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1341 RAPparams.
set(
"RepairMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1357 if (!this->implicitTranspose_) {
1375 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: compute aggregate qualities",
bool,
true)) {
1389 manager.
SetFactory(
"AggregateQualities", aggQualityFact);
1397 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: export visualization data",
bool,
true)) {
1426 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
1427 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
1429 if (reuseType ==
"RP" || (reuseType ==
"tP" && !filteringChangesMatrix)) {
1431 keeps.push_back(
keep_pair(
"AP reuse data", RAP.
get()));
1432 keeps.push_back(
keep_pair(
"RAP reuse data", RAP.
get()));
1435 keeps.push_back(
keep_pair(
"AP reuse data", RAPs.
get()));
1436 keeps.push_back(
keep_pair(
"RAP reuse data", RAPs.
get()));
1444 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1448 bool have_userCO =
false;
1452 if (useCoordinates_) {
1463 if (!RAP.is_null()) {
1464 RAP->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1467 RAPs->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1476 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1480 bool have_userMaterial =
false;
1482 have_userMaterial =
true;
1485 if (have_userMaterial) {
1490 materialTransferParameters.
set(
"Vector name",
"Material");
1491 materialTransferParameters.
set(
"Transfer name",
"Aggregates");
1492 materialTransferParameters.
set(
"Normalize",
true);
1496 manager.
SetFactory(
"Material", materialTransfer);
1499 if (!RAP.is_null()) {
1500 RAP->AddTransferFactory(manager.
GetFactory(
"Material"));
1503 RAPs->AddTransferFactory(manager.
GetFactory(
"Material"));
1512 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1515 FactoryManager& manager,
int levelID, std::vector<keep_pair>& )
const {
1518 if (useBlockNumber_ && (levelID > 0)) {
1521 if (!RAP.is_null() || !RAPs.is_null()) {
1523 if (multigridAlgo ==
"classical")
1529 fact->
SetFactory(VarName, this->GetFactoryManager(levelID - 1)->GetFactory(VarName));
1534 RAP->AddTransferFactory(manager.
GetFactory(VarName));
1536 RAPs->AddTransferFactory(manager.
GetFactory(VarName));
1544 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1547 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1548 if (useBlockNumber_) {
1560 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1563 int levelID, std::vector<keep_pair>& )
const {
1564 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
1565 bool have_userR =
false;
1571 if (!this->implicitTranspose_) {
1574 if (isSymmetric ==
false && (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"emin")) {
1575 this->GetOStream(
Warnings0) <<
"Switching \"problem: symmetric\" parameter to symmetric as multigrid algorithm. " << multigridAlgo <<
" is primarily supposed to be used for symmetric problems.\n\n"
1576 <<
"Please note: if you are using \"unsmoothed\" transfer operators the \"problem: symmetric\" parameter "
1577 <<
"has no real mathematical meaning, i.e. you can use it for non-symmetric\n"
1578 <<
"problems, too. With \"problem: symmetric\"=\"symmetric\" you can use implicit transpose for building "
1579 <<
"the restriction operators which may drastically reduce the amount of consumed memory." << std::endl;
1583 "Petrov-Galerkin smoothed transfer operators are only allowed for non-symmetric problems: Set \"problem: symmetric\" to false!\n"
1584 "While PG smoothed transfer operators generally would also work for symmetric problems this is an unusual use case. "
1585 "You can use the factory-based xml interface though if you need PG-AMG for symmetric problems.");
1604 if (paramList.
isParameter(
"restriction: scale nullspace") && paramList.
get<
bool>(
"restriction: scale nullspace")) {
1607 tentPlist.
set(
"Nullspace name",
"Scaled Nullspace");
1620 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1623 int levelID, std::vector<keep_pair>& keeps,
RCP<Factory>& nullSpaceFactory)
const {
1628 #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
1629 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: use subcommunicators in place",
bool, enableInPlace);
1666 "Reuse types \"tP\" and \"PR\" require \"repartition: rebalance P and R\" set to \"false\"");
1671 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: partitioner", std::string, partName);
1673 "Invalid partitioner name: \"" << partName <<
"\". Valid options: \"zoltan\", \"zoltan2\"");
1675 #ifndef HAVE_MUELU_ZOLTAN
1676 bool switched =
false;
1677 if (partName ==
"zoltan") {
1678 this->GetOStream(
Warnings0) <<
"Zoltan interface is not available, trying to switch to Zoltan2" << std::endl;
1679 partName =
"zoltan2";
1683 #ifndef HAVE_MUELU_ZOLTAN2
1684 bool switched =
false;
1685 #endif // HAVE_MUELU_ZOLTAN2
1686 #endif // HAVE_MUELU_ZOLTAN
1688 #ifndef HAVE_MUELU_ZOLTAN2
1689 if (partName ==
"zoltan2" && !switched) {
1690 this->GetOStream(
Warnings0) <<
"Zoltan2 interface is not available, trying to switch to Zoltan" << std::endl;
1691 partName =
"zoltan";
1693 #endif // HAVE_MUELU_ZOLTAN2
1695 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: node repartition level",
int, nodeRepartitionLevel);
1708 repartheurFactory->SetParameterList(repartheurParams);
1709 repartheurFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1710 manager.
SetFactory(
"number of partitions", repartheurFactory);
1711 manager.
SetFactory(
"repartition: heuristic target rows per process", repartheurFactory);
1715 if (levelID == nodeRepartitionLevel) {
1722 }
else if (partName ==
"zoltan") {
1723 #ifdef HAVE_MUELU_ZOLTAN
1728 #endif // HAVE_MUELU_ZOLTAN
1729 }
else if (partName ==
"zoltan2") {
1730 #ifdef HAVE_MUELU_ZOLTAN2
1734 partParams.
set(
"ParameterList", partpartParams);
1736 partitioner->
SetFactory(
"repartition: heuristic target rows per process",
1737 manager.
GetFactory(
"repartition: heuristic target rows per process"));
1740 #endif // HAVE_MUELU_ZOLTAN2
1745 if (useCoordinates_)
1747 manager.
SetFactory(
"Partition", partitioner);
1756 repartFactory->SetParameterList(repartParams);
1757 repartFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1758 repartFactory->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1759 repartFactory->SetFactory(
"Partition", manager.
GetFactory(
"Partition"));
1760 manager.
SetFactory(
"Importer", repartFactory);
1761 if (reuseType !=
"none" && reuseType !=
"S" && levelID)
1764 if (enableInPlace) {
1772 newA->SetParameterList(rebAcParams);
1773 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1774 newA->SetFactory(
"InPlaceMap", manager.
GetFactory(
"InPlaceMap"));
1781 newA->SetParameterList(rebAcParams);
1782 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1783 newA->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1789 newPparams.
set(
"type",
"Interpolation");
1790 if (changedPRrebalance_)
1791 newPparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1792 if (changedPRViaCopyrebalance_)
1793 newPparams.
set(
"repartition: explicit via new copy rebalance P and R",
true);
1796 newP->SetParameterList(newPparams);
1797 newP->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1798 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
1800 if (!paramList.
isParameter(
"semicoarsen: number of levels"))
1801 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1803 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"P"));
1804 if (useCoordinates_) {
1805 newP->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1809 newP->SetFactory(
"Material", manager.
GetFactory(
"Material"));
1812 if (useBlockNumber_ && (levelID > 0)) {
1813 newP->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1820 newRparams.
set(
"type",
"Restriction");
1823 if (changedPRrebalance_)
1824 newRparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1825 if (changedPRViaCopyrebalance_)
1826 newPparams.
set(
"repartition: explicit via new copy rebalance P and R",
true);
1827 if (changedImplicitTranspose_)
1828 newRparams.
set(
"transpose: use implicit", this->implicitTranspose_);
1829 newR->SetParameterList(newRparams);
1830 newR->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1831 if (!this->implicitTranspose_) {
1832 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1845 nullSpaceFactory->
SetFactory(
"Nullspace", newP);
1849 paramList.
set(
"repartition: enable",
false);
1851 this->GetOStream(
Warnings0) <<
"No repartitioning available for a serial run\n";
1853 this->GetOStream(
Warnings0) <<
"Zoltan/Zoltan2 are unavailable for repartitioning\n";
1855 #endif // defined(HAVE_MPI) && (defined(HAVE_MUELU_ZOLTAN) || defined(HAVE_MUELU_ZOLTAN2))
1862 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1865 int levelID, std::vector<keep_pair>& keeps)
const {
1866 MUELU_SET_VAR_2LIST(paramList, defaultList,
"transfers: half precision",
bool, enableLowPrecision);
1868 if (enableLowPrecision) {
1872 newPparams.
set(
"matrix key",
"P");
1873 newP->SetParameterList(newPparams);
1874 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
1877 if (!this->implicitTranspose_) {
1881 newRparams.
set(
"matrix key",
"R");
1882 newR->SetParameterList(newRparams);
1883 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1892 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1895 int , std::vector<keep_pair>& ,
RCP<Factory>& nullSpaceFactory)
const {
1899 bool have_userNS =
false;
1910 nullSpaceFactory = nullSpace;
1912 if (paramList.
isParameter(
"restriction: scale nullspace") && paramList.
get<
bool>(
"restriction: scale nullspace")) {
1914 scaledNSfactory->
SetFactory(
"Nullspace", nullSpaceFactory);
1915 manager.
SetFactory(
"Scaled Nullspace", scaledNSfactory);
1922 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1925 int , std::vector<keep_pair>& )
const {
1928 if (paramList.
isParameter(
"semicoarsen: number of levels") &&
1929 paramList.
get<
int>(
"semicoarsen: number of levels") > 0) {
1956 manager.
SetFactory(
"CoarseNumZLayers", linedetectionFactory);
1957 manager.
SetFactory(
"LineDetection_Layers", linedetectionFactory);
1958 manager.
SetFactory(
"LineDetection_VertLineIds", linedetectionFactory);
1962 manager.
SetFactory(
"Nullspace", togglePFactory);
1965 if (paramList.
isParameter(
"semicoarsen: number of levels")) {
1967 tf->SetFactory(
"Chosen P", manager.
GetFactory(
"P"));
1968 tf->AddCoordTransferFactory(semicoarsenFactory);
1973 tf->AddCoordTransferFactory(coords);
1981 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1984 int levelID, std::vector<keep_pair>& keeps)
const {
1985 #ifdef HAVE_MUELU_INTREPID2
1990 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
1991 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
1993 if (levelID >= (
int)pcoarsen_schedule.size()) {
1996 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
2002 std::string lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
2003 std::string hi = (levelID ? pcoarsen_element + std::to_string(pcoarsen_schedule[levelID - 1]) : lo);
2004 Pparams.
set(
"pcoarsen: hi basis", hi);
2005 Pparams.
set(
"pcoarsen: lo basis", lo);
2006 P->SetParameterList(Pparams);
2019 P->SetParameterList(Pparams);
2032 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2038 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
2039 Pparams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
2040 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
2041 Pparams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
2057 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
2091 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
2093 if (reuseType ==
"tP" && !filteringChangesMatrix)
2100 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2103 int , std::vector<keep_pair>& )
const {
2107 "Invalid pattern name: \"" << patternType <<
"\". Valid options: \"AkPtent\"");
2112 patternFactory->SetParameterList(patternParams);
2113 patternFactory->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2116 MUELU_SET_VAR_2LIST(paramList, defaultList,
"emin: use filtered matrix",
bool, useFiltering);
2140 patternFactory->SetFactory(
"A", filterFactory);
2143 patternFactory->SetFactory(
"A", manager.
GetFactory(
"Graph"));
2147 manager.
SetFactory(
"Ppattern", patternFactory);
2151 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
2152 constraintFactory->SetFactory(
"CoarseNullspace", manager.
GetFactory(
"Ptent"));
2153 manager.
SetFactory(
"Constraint", constraintFactory);
2159 if (reuseType ==
"emin") {
2161 Pparams.
set(
"Keep P0",
true);
2162 Pparams.
set(
"Keep Constraint0",
true);
2167 P->SetParameterList(Pparams);
2168 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2169 P->SetFactory(
"Constraint", manager.
GetFactory(
"Constraint"));
2176 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2179 int , std::vector<keep_pair>& )
const {
2181 "Implicit transpose not supported with Petrov-Galerkin smoothed transfer operators: Set \"transpose: use implicit\" to false!\n"
2182 "Petrov-Galerkin transfer operator smoothing for non-symmetric problems requires a separate handling of the restriction operator which "
2183 "does not allow the usage of implicit transpose easily.");
2187 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2194 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2202 P->SetParameterList(Pparams);
2209 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2217 P->SetParameterList(Pparams);
2224 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2227 int , std::vector<keep_pair>& )
const {
2228 #ifdef HAVE_MUELU_MATLAB
2231 P->SetParameterList(Pparams);
2232 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2240 #undef MUELU_SET_VAR_2LIST
2241 #undef MUELU_TEST_AND_SET_VAR
2242 #undef MUELU_TEST_AND_SET_PARAM_2LIST
2243 #undef MUELU_TEST_PARAM_2LIST
2244 #undef MUELU_KOKKOS_FACTORY
2248 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2253 const int maxLevels = 100;
2256 std::vector<ParameterList> paramLists;
2257 for (
int levelID = 0; levelID < maxLevels; levelID++) {
2258 std::string sublistName =
"level " +
toString(levelID);
2260 paramLists.push_back(paramList.
sublist(sublistName));
2262 paramList.
remove(sublistName);
2265 paramLists.push_back(paramList);
2267 #ifdef HAVE_MUELU_MATLAB
2269 for (
size_t i = 0; i < paramLists.size(); i++) {
2270 std::vector<std::string> customVars;
2273 std::string paramName = paramLists[i].name(it);
2276 customVars.push_back(paramName);
2280 for (
size_t j = 0; j < customVars.size(); j++)
2281 paramLists[i].
remove(customVars[j],
false);
2285 const int maxDepth = 0;
2286 for (
size_t i = 0; i < paramLists.size(); i++) {
2289 paramLists[i].validateParameters(validList, maxDepth);
2292 std::string eString = e.what();
2295 size_t nameStart = eString.find_first_of(
'"') + 1;
2296 size_t nameEnd = eString.find_first_of(
'"', nameStart);
2297 std::string name = eString.substr(nameStart, nameEnd - nameStart);
2299 size_t bestScore = 100;
2300 std::string bestName =
"";
2302 const std::string& pName = validList.
name(it);
2303 this->GetOStream(
Runtime1) <<
"| " << pName;
2304 size_t score =
LevenshteinDistance(name.c_str(), name.length(), pName.c_str(), pName.length());
2305 this->GetOStream(
Runtime1) <<
" -> " << score << std::endl;
2306 if (score < bestScore) {
2311 if (bestScore < 10 && bestName !=
"") {
2313 eString <<
"The parameter name \"" + name +
"\" is not valid. Did you mean \"" + bestName <<
"\"?\n");
2317 eString <<
"The parameter name \"" + name +
"\" is not valid.\n");
2326 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2339 blockSize_ = paramList.
sublist(
"Matrix").
get<
int>(
"PDE equations", MasterList::getDefault<int>(
"number of equations"));
2344 if (factFact_ == Teuchos::null)
2357 this->BuildFactoryMap(paramList.
sublist(
"Factories"), factoryMap, factoryMap, factoryManagers);
2376 this->numDesiredLevel_ = hieraList.
get<
int>(
"max levels");
2377 hieraList.
remove(
"max levels");
2381 this->maxCoarseSize_ = hieraList.
get<
int>(
"coarse: max size");
2382 hieraList.
remove(
"coarse: max size");
2385 if (hieraList.
isParameter(
"repartition: rebalance P and R")) {
2386 this->doPRrebalance_ = hieraList.
get<
bool>(
"repartition: rebalance P and R");
2387 hieraList.
remove(
"repartition: rebalance P and R");
2390 if (hieraList.
isParameter(
"transpose: use implicit")) {
2391 this->implicitTranspose_ = hieraList.
get<
bool>(
"transpose: use implicit");
2392 hieraList.
remove(
"transpose: use implicit");
2395 if (hieraList.
isParameter(
"fuse prolongation and update")) {
2396 this->fuseProlongationAndUpdate_ = hieraList.
get<
bool>(
"fuse prolongation and update");
2397 hieraList.
remove(
"fuse prolongation and update");
2400 if (hieraList.
isParameter(
"nullspace: suppress dimension check")) {
2401 this->suppressNullspaceDimensionCheck_ = hieraList.
get<
bool>(
"nullspace: suppress dimension check");
2402 hieraList.
remove(
"nullspace: suppress dimension check");
2406 this->sizeOfMultiVectors_ = hieraList.
get<
int>(
"number of vectors");
2407 hieraList.
remove(
"number of vectors");
2410 if (hieraList.
isSublist(
"matvec params"))
2411 this->matvecParams_ = Teuchos::parameterList(hieraList.
sublist(
"matvec params"));
2413 if (hieraList.
isParameter(
"coarse grid correction scaling factor")) {
2414 this->scalingFactor_ = hieraList.
get<
double>(
"coarse grid correction scaling factor");
2415 hieraList.
remove(
"coarse grid correction scaling factor");
2420 std::map<std::string, CycleType> cycleMap;
2424 std::string cycleType = hieraList.
get<std::string>(
"cycle type");
2426 this->Cycle_ = cycleMap[cycleType];
2429 if (hieraList.
isParameter(
"W cycle start level")) {
2430 this->WCycleStartLevel_ = hieraList.
get<
int>(
"W cycle start level");
2434 std::string vl = hieraList.
get<std::string>(
"verbosity");
2435 hieraList.
remove(
"verbosity");
2442 if (hieraList.
isParameter(
"dependencyOutputLevel"))
2443 this->graphOutputLevel_ = hieraList.
get<
int>(
"dependencyOutputLevel");
2449 if (hieraList.
isSublist(
"DataToWrite")) {
2453 std::string dataName =
"Matrices";
2455 this->matricesToPrint_[
"A"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2456 dataName =
"Prolongators";
2458 this->matricesToPrint_[
"P"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2459 dataName =
"Restrictors";
2461 this->matricesToPrint_[
"R"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2464 this->matricesToPrint_[
"D0"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2469 const std::string& paramName = hieraList.
name(param);
2471 if (paramName !=
"DataToWrite" && hieraList.
isSublist(paramName)) {
2476 startLevel = levelList.
get<
int>(
"startLevel");
2477 levelList.
remove(
"startLevel");
2479 int numDesiredLevel = 1;
2481 numDesiredLevel = levelList.
get<
int>(
"numDesiredLevel");
2482 levelList.
remove(
"numDesiredLevel");
2496 BuildFactoryMap(levelList, factoryMap, levelFactoryMap, factoryManagers);
2502 if (startLevel >= 0)
2503 this->AddFactoryManager(startLevel, numDesiredLevel, m);
2634 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2638 const std::string& paramName = paramList.
name(param);
2643 if (paramValue.
isList()) {
2644 ParameterList paramList1 = Teuchos::getValue<ParameterList>(paramValue);
2648 "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.");
2650 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2652 }
else if (paramList1.
isParameter(
"dependency for")) {
2654 "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.");
2656 std::string factoryName = paramList1.
get<std::string>(
"dependency for");
2660 "MueLu::ParameterListInterpreter(): could not find factory " + factoryName +
" in factory map. Did you define it before?");
2668 const std::string& pName = validParamList->name(vparam);
2678 factory->SetFactory(pName, generatingFact.
create_weak());
2681 if (pName ==
"ParameterList") {
2690 factory->SetParameter(pName, paramList1.
getEntry(pName));
2696 std::string groupType = paramList1.
get<std::string>(
"group");
2698 "group must be of type \"FactoryManager\".");
2701 groupList.
remove(
"group");
2703 bool setKokkosRefactor =
false;
2704 bool kokkosRefactor = useKokkos_;
2705 if (groupList.
isParameter(
"use kokkos refactor")) {
2706 kokkosRefactor = groupList.
get<
bool>(
"use kokkos refactor");
2707 groupList.
remove(
"use kokkos refactor");
2708 setKokkosRefactor =
true;
2712 BuildFactoryMap(groupList, factoryMapIn, groupFactoryMap, factoryManagers);
2717 if (setKokkosRefactor)
2719 factoryManagers[paramName] = m;
2722 this->GetOStream(
Warnings0) <<
"Could not interpret parameter list " << paramList1 << std::endl;
2724 "XML Parameter list must either be of type \"factory\" or of type \"group\".");
2728 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2736 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2739 Matrix& A =
dynamic_cast<Matrix&
>(Op);
2740 if (A.IsFixedBlockSizeSet() && (A.GetFixedBlockSize() != blockSize_))
2741 this->GetOStream(
Warnings0) <<
"Setting matrix block size to " << blockSize_ <<
" (value of the parameter in the list) "
2742 <<
"instead of " << A.GetFixedBlockSize() <<
" (provided matrix)." << std::endl
2743 <<
"You may want to check \"number of equations\" (or \"PDE equations\" for factory style list) parameter." << std::endl;
2745 A.SetFixedBlockSize(blockSize_, dofOffset_);
2747 #ifdef HAVE_MUELU_DEBUG
2748 MatrixUtils::checkLocalRowMapMatchesColMap(A);
2749 #endif // HAVE_MUELU_DEBUG
2751 }
catch (std::bad_cast&) {
2752 this->GetOStream(
Warnings0) <<
"Skipping setting block size as the operator is not a matrix" << std::endl;
2756 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2768 const std::string& name = it->first;
2775 compare(Teuchos::getValue<ParameterList>(entry1), Teuchos::getValue<ParameterList>(*entry2));
2791 #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