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>
149 hierarchyLabel_ =
"";
152 SetFactoryParameterList(paramList);
154 }
else if (paramList.
isParameter(
"MueLu preconditioner") ==
true) {
155 this->GetOStream(
Runtime0) <<
"Use facade class: " << paramList.
get<std::string>(
"MueLu preconditioner") << std::endl;
157 SetFactoryParameterList(*pp);
164 Validate(serialList);
165 SetEasyParameterList(paramList);
178 #define MUELU_SET_VAR_2LIST(paramList, defaultList, paramName, paramType, varName) \
180 if (paramList.isParameter(paramName)) \
181 varName = paramList.get<paramType>(paramName); \
182 else if (defaultList.isParameter(paramName)) \
183 varName = defaultList.get<paramType>(paramName); \
185 varName = MasterList::getDefault<paramType>(paramName);
187 #define MUELU_TEST_AND_SET_VAR(paramList, paramName, paramType, varName) \
188 (paramList.isParameter(paramName) ? varName = paramList.get<paramType>(paramName), true : false)
192 #define MUELU_TEST_AND_SET_PARAM_2LIST(paramList, defaultList, paramName, paramType, listWrite) \
194 if (paramList.isParameter(paramName)) \
195 listWrite.set(paramName, paramList.get<paramType>(paramName)); \
196 else if (defaultList.isParameter(paramName)) \
197 listWrite.set(paramName, defaultList.get<paramType>(paramName)); \
198 } catch (Teuchos::Exceptions::InvalidParameterType&) { \
199 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(true, Teuchos::Exceptions::InvalidParameterType, \
200 "Error: parameter \"" << paramName << "\" must be of type " << Teuchos::TypeNameTraits<paramType>::name()); \
203 #define MUELU_TEST_PARAM_2LIST(paramList, defaultList, paramName, paramType, cmpValue) \
204 (cmpValue == (paramList.isParameter(paramName) ? paramList.get<paramType>(paramName) : (defaultList.isParameter(paramName) ? defaultList.get<paramType>(paramName) : MasterList::getDefault<paramType>(paramName))))
206 #define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory) \
207 RCP<Factory> varName; \
209 varName = rcp(new oldFactory()); \
211 varName = rcp(new newFactory());
212 #define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory) \
214 varName = rcp(new oldFactory()); \
216 varName = rcp(new newFactory());
218 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
223 MUELU_SET_VAR_2LIST(constParamList, constParamList,
"problem: type", std::string, problemType);
224 if (problemType !=
"unknown") {
230 paramList = constParamList;
234 useKokkos_ = !Node::is_serial;
244 std::map<std::string, CycleType> cycleMap;
248 auto cycleType = paramList.
get<std::string>(
"cycle type");
250 "Invalid cycle type: \"" << cycleType <<
"\"");
251 Cycle_ = cycleMap[cycleType];
254 if (paramList.
isParameter(
"W cycle start level")) {
255 WCycleStartLevel_ = paramList.
get<
int>(
"W cycle start level");
259 this->hierarchyLabel_ = paramList.
get<std::string>(
"hierarchy label");
262 if (paramList.
isParameter(
"coarse grid correction scaling factor"))
263 scalingFactor_ = paramList.
get<
double>(
"coarse grid correction scaling factor");
265 this->maxCoarseSize_ = paramList.
get<
int>(
"coarse: max size", MasterList::getDefault<int>(
"coarse: max size"));
266 this->numDesiredLevel_ = paramList.
get<
int>(
"max levels", MasterList::getDefault<int>(
"max levels"));
267 blockSize_ = paramList.
get<
int>(
"number of equations", MasterList::getDefault<int>(
"number of equations"));
273 this->dataToKeep_ = Teuchos::getArrayFromStringParameter<std::string>(paramList,
"keep data");
276 if (paramList.
isSublist(
"export data")) {
281 this->nullspaceToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Nullspace");
283 this->coordinatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Coordinates");
285 this->materialToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Material");
287 this->aggregatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Aggregates");
288 if (printList.
isParameter(
"pcoarsen: element to node map"))
289 this->elementToNodeMapsToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"pcoarsen: element to node map");
293 const std::string& name = printList.
name(
iter);
295 if (name ==
"Nullspace" || name ==
"Coordinates" || name ==
"Material" || name ==
"Aggregates" || name ==
"pcoarsen: element to node map")
298 this->matricesToPrint_[name] = Teuchos::getArrayFromStringParameter<int>(printList, name);
311 if (outputFilename !=
"")
321 useCoordinates_ =
false;
322 useBlockNumber_ =
false;
323 if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: strength-of-connection: matrix", std::string,
"distance laplacian"))
324 useCoordinates_ =
true;
326 useBlockNumber_ =
true;
327 if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"distance laplacian") ||
330 useCoordinates_ =
true;
331 }
else if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal distance laplacian")) {
332 useCoordinates_ =
true;
333 useBlockNumber_ =
true;
334 }
else if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal") ||
335 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal classical") ||
336 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal signed classical") ||
337 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal colored signed classical") ||
338 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"signed classical")) {
339 useBlockNumber_ =
true;
340 }
else if (paramList.
isSublist(
"smoother: params")) {
341 const auto smooParamList = paramList.
sublist(
"smoother: params");
342 if (smooParamList.isParameter(
"partitioner: type") &&
343 (smooParamList.get<std::string>(
"partitioner: type") ==
"line")) {
344 useCoordinates_ =
true;
347 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
348 std::string levelStr =
"level " +
toString(levelID);
353 if (
MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"distance laplacian") ||
356 useCoordinates_ =
true;
357 }
else if (
MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal distance laplacian")) {
358 useCoordinates_ =
true;
359 useBlockNumber_ =
true;
360 }
else if (
MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal") ||
361 MUELU_TEST_PARAM_2LIST(levelList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal classical") ||
362 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal signed classical") ||
363 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"block diagonal colored signed classical") ||
364 MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"signed classical")) {
365 useBlockNumber_ =
true;
371 useMaterial_ =
false;
372 if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: distance laplacian metric", std::string,
"material")) {
381 }
else if (!paramList.
isSublist(
"repartition: params")) {
382 useCoordinates_ =
true;
385 if (repParams.
isType<std::string>(
"algorithm")) {
386 const std::string algo = repParams.
get<std::string>(
"algorithm");
387 if (algo ==
"multijagged" || algo ==
"rcb") {
388 useCoordinates_ =
true;
391 useCoordinates_ =
true;
395 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
396 std::string levelStr =
"level " +
toString(levelID);
402 if (!levelList.
isSublist(
"repartition: params")) {
403 useCoordinates_ =
true;
407 if (repParams.
isType<std::string>(
"algorithm")) {
408 const std::string algo = repParams.
get<std::string>(
"algorithm");
409 if (algo ==
"multijagged" || algo ==
"rcb") {
410 useCoordinates_ =
true;
414 useCoordinates_ =
true;
423 changedPRrebalance_ =
false;
424 changedPRViaCopyrebalance_ =
false;
426 changedPRrebalance_ =
MUELU_TEST_AND_SET_VAR(paramList,
"repartition: rebalance P and R",
bool, this->doPRrebalance_);
427 changedPRViaCopyrebalance_ =
MUELU_TEST_AND_SET_VAR(paramList,
"repartition: explicit via new copy rebalance P and R",
bool, this->doPRViaCopyrebalance_);
431 changedImplicitTranspose_ =
MUELU_TEST_AND_SET_VAR(paramList,
"transpose: use implicit",
bool, this->implicitTranspose_);
434 (void)
MUELU_TEST_AND_SET_VAR(paramList,
"fuse prolongation and update",
bool, this->fuseProlongationAndUpdate_);
437 (void)
MUELU_TEST_AND_SET_VAR(paramList,
"nullspace: suppress dimension check",
bool, this->suppressNullspaceDimensionCheck_);
439 if (paramList.
isSublist(
"matvec params"))
440 this->matvecParams_ = Teuchos::parameterList(paramList.
sublist(
"matvec params"));
449 std::vector<keep_pair> keeps0;
450 UpdateFactoryManager(paramList,
ParameterList(), *defaultManager, 0 , keeps0);
456 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
465 std::vector<keep_pair> keeps;
469 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
473 UpdateFactoryManager(levelList, paramList, *levelManager, levelID, keeps);
476 this->keep_[levelID] = keeps;
477 this->AddFactoryManager(levelID, 1, levelManager);
487 this->GetOStream(static_cast<MsgType>(
Runtime1), 0) << paramList << std::endl;
502 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
503 std::string levelStr =
"level " +
toString(levelID);
518 std::ostringstream unusedParamsStream;
520 unusedParamList.
print(unusedParamsStream, indent);
522 this->GetOStream(
Warnings1) <<
"The following parameters were not used:\n"
523 << unusedParamsStream.str() << std::endl;
533 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
536 int levelID, std::vector<keep_pair>& keeps)
const {
540 using strings = std::unordered_set<std::string>;
550 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
551 TEUCHOS_TEST_FOR_EXCEPTION(strings({
"unsmoothed",
"sa",
"pg",
"emin",
"matlab",
"pcoarsen",
"classical",
"smoothed reitzinger",
"unsmoothed reitzinger",
"replicate",
"combine"}).count(multigridAlgo) == 0,
552 Exceptions::RuntimeError,
"Unknown \"multigrid algorithm\" value: \"" << multigridAlgo <<
"\". Please consult User's Guide.");
553 #ifndef HAVE_MUELU_MATLAB
555 "Cannot use matlab for multigrid algorithm - MueLu was not configured with MATLAB support.");
557 #ifndef HAVE_MUELU_INTREPID2
559 "Cannot use IntrepidPCoarsen prolongator factory - MueLu was not configured with Intrepid support.");
564 if (reuseType ==
"none" || reuseType ==
"S" || reuseType ==
"RP" || reuseType ==
"RAP") {
567 }
else if (reuseType ==
"tP" && (multigridAlgo !=
"sa" && multigridAlgo !=
"unsmoothed")) {
569 this->GetOStream(
Warnings0) <<
"Ignoring \"tP\" reuse option as it is only compatible with \"sa\", "
570 "or \"unsmoothed\" multigrid algorithms"
573 }
else if (reuseType ==
"emin" && multigridAlgo !=
"emin") {
575 this->GetOStream(
Warnings0) <<
"Ignoring \"emin\" reuse option it is only compatible with "
576 "\"emin\" multigrid algorithm"
582 bool have_userP =
false;
587 UpdateFactoryManager_CoarseSolvers(paramList, defaultList, manager, levelID, keeps);
590 UpdateFactoryManager_Smoothers(paramList, defaultList, manager, levelID, keeps);
594 UpdateFactoryManager_BlockNumber(paramList, defaultList, manager, levelID, keeps);
597 if (multigridAlgo ==
"unsmoothed reitzinger" || multigridAlgo ==
"smoothed reitzinger")
598 UpdateFactoryManager_Reitzinger(paramList, defaultList, manager, levelID, keeps);
600 UpdateFactoryManager_Aggregation_TentativeP(paramList, defaultList, manager, levelID, keeps);
604 UpdateFactoryManager_Nullspace(paramList, defaultList, manager, levelID, keeps, nullSpaceFactory);
615 }
else if (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"unsmoothed reitzinger") {
619 }
else if (multigridAlgo ==
"classical") {
623 }
else if (multigridAlgo ==
"sa" || multigridAlgo ==
"smoothed reitzinger") {
625 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
627 }
else if (multigridAlgo ==
"emin") {
629 UpdateFactoryManager_Emin(paramList, defaultList, manager, levelID, keeps);
631 }
else if (multigridAlgo ==
"replicate") {
632 UpdateFactoryManager_Replicate(paramList, defaultList, manager, levelID, keeps);
634 }
else if (multigridAlgo ==
"combine") {
635 UpdateFactoryManager_Combine(paramList, defaultList, manager, levelID, keeps);
637 }
else if (multigridAlgo ==
"pg") {
639 UpdateFactoryManager_PG(paramList, defaultList, manager, levelID, keeps);
641 }
else if (multigridAlgo ==
"matlab") {
643 UpdateFactoryManager_Matlab(paramList, defaultList, manager, levelID, keeps);
645 }
else if (multigridAlgo ==
"pcoarsen") {
647 UpdateFactoryManager_PCoarsen(paramList, defaultList, manager, levelID, keeps);
651 UpdateFactoryManager_SemiCoarsen(paramList, defaultList, manager, levelID, keeps);
654 UpdateFactoryManager_Restriction(paramList, defaultList, manager, levelID, keeps);
657 UpdateFactoryManager_RAP(paramList, defaultList, manager, levelID, keeps);
660 UpdateFactoryManager_LocalOrdinalTransfer(
"BlockNumber", multigridAlgo, paramList, defaultList, manager, levelID, keeps);
663 UpdateFactoryManager_Coordinates(paramList, defaultList, manager, levelID, keeps);
666 UpdateFactoryManager_Material(paramList, defaultList, manager, levelID, keeps);
669 if ((reuseType ==
"RP" || reuseType ==
"RAP" || reuseType ==
"full") && levelID)
672 if (reuseType ==
"RP" && levelID) {
674 if (!this->implicitTranspose_)
677 if ((reuseType ==
"tP" || reuseType ==
"RP" || reuseType ==
"emin") && useCoordinates_ && levelID)
681 UpdateFactoryManager_Repartition(paramList, defaultList, manager, levelID, keeps, nullSpaceFactory);
684 UpdateFactoryManager_LowPrecision(paramList, defaultList, manager, levelID, keeps);
687 if ((reuseType ==
"RAP" || reuseType ==
"full") && levelID) {
689 if (!this->implicitTranspose_)
702 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
705 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
706 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
708 bool useMaxAbsDiagonalScaling =
false;
709 if (defaultList.
isParameter(
"sa: use rowsumabs diagonal scaling"))
710 useMaxAbsDiagonalScaling = defaultList.
get<
bool>(
"sa: use rowsumabs diagonal scaling");
714 bool isCustomSmoother =
717 paramList.
isSublist(
"smoother: params") || paramList.
isSublist(
"smoother: pre params") || paramList.
isSublist(
"smoother: post params") ||
723 manager.
SetFactory(
"Smoother", Teuchos::null);
725 }
else if (isCustomSmoother) {
729 #define TEST_MUTUALLY_EXCLUSIVE(arg1, arg2) \
730 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isParameter(#arg1) && paramList.isParameter(#arg2), \
731 Exceptions::InvalidArgument, "You cannot specify both \"" #arg1 "\" and \"" #arg2 "\"");
732 #define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2) \
733 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isSublist(#arg1) && paramList.isSublist(#arg2), \
734 Exceptions::InvalidArgument, "You cannot specify both \"" #arg1 "\" and \"" #arg2 "\"");
750 defaultSmootherParams.
set(
"relaxation: type",
"Symmetric Gauss-Seidel");
755 std::string preSmootherType, postSmootherType;
759 overlap = paramList.
get<
int>(
"smoother: overlap");
763 preSmootherType = paramList.
get<std::string>(
"smoother: pre type");
765 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, preSmootherTypeTmp);
766 preSmootherType = preSmootherTypeTmp;
768 if (paramList.
isParameter(
"smoother: pre overlap"))
769 overlap = paramList.
get<
int>(
"smoother: pre overlap");
771 if (paramList.
isSublist(
"smoother: pre params"))
772 preSmootherParams = paramList.
sublist(
"smoother: pre params");
773 else if (paramList.
isSublist(
"smoother: params"))
774 preSmootherParams = paramList.
sublist(
"smoother: params");
775 else if (defaultList.
isSublist(
"smoother: params"))
776 preSmootherParams = defaultList.
sublist(
"smoother: params");
777 else if (preSmootherType ==
"RELAXATION")
778 preSmootherParams = defaultSmootherParams;
780 if (preSmootherType ==
"CHEBYSHEV" && useMaxAbsDiagonalScaling)
781 preSmootherParams.
set(
"chebyshev: use rowsumabs diagonal scaling",
true);
783 #ifdef HAVE_MUELU_INTREPID2
785 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
789 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
790 auto pcoarsen_element = defaultList.
get<std::string>(
"pcoarsen: element");
792 if (levelID < (
int)pcoarsen_schedule.size()) {
794 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
795 preSmootherParams.
set(
"pcoarsen: hi basis", lo);
800 #ifdef HAVE_MUELU_MATLAB
801 if (preSmootherType ==
"matlab")
810 postSmootherType = paramList.
get<std::string>(
"smoother: post type");
812 MUELU_SET_VAR_2LIST(paramList, defaultList,
"smoother: type", std::string, postSmootherTypeTmp);
813 postSmootherType = postSmootherTypeTmp;
816 if (paramList.
isSublist(
"smoother: post params"))
817 postSmootherParams = paramList.
sublist(
"smoother: post params");
818 else if (paramList.
isSublist(
"smoother: params"))
819 postSmootherParams = paramList.
sublist(
"smoother: params");
820 else if (defaultList.
isSublist(
"smoother: params"))
821 postSmootherParams = defaultList.
sublist(
"smoother: params");
822 else if (postSmootherType ==
"RELAXATION")
823 postSmootherParams = defaultSmootherParams;
824 if (paramList.
isParameter(
"smoother: post overlap"))
825 overlap = paramList.
get<
int>(
"smoother: post overlap");
827 if (postSmootherType ==
"CHEBYSHEV" && useMaxAbsDiagonalScaling)
828 postSmootherParams.
set(
"chebyshev: use rowsumabs diagonal scaling",
true);
830 if (postSmootherType == preSmootherType &&
areSame(preSmootherParams, postSmootherParams))
831 postSmoother = preSmoother;
833 #ifdef HAVE_MUELU_INTREPID2
835 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
839 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
840 auto pcoarsen_element = defaultList.
get<std::string>(
"pcoarsen: element");
842 if (levelID < (
int)pcoarsen_schedule.size()) {
844 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
845 postSmootherParams.
set(
"pcoarsen: hi basis", lo);
850 #ifdef HAVE_MUELU_MATLAB
851 if (postSmootherType ==
"matlab")
859 if (preSmoother == postSmoother)
862 manager.
SetFactory(
"PreSmoother", preSmoother);
863 manager.
SetFactory(
"PostSmoother", postSmoother);
870 bool reuseSmoothers = (reuseType ==
"S" || reuseType !=
"none");
871 if (reuseSmoothers) {
872 auto preSmootherFactory = rcp_const_cast<
Factory>(rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"PreSmoother")));
874 if (preSmootherFactory != Teuchos::null) {
876 postSmootherFactoryParams.
set(
"keep smoother data",
true);
877 preSmootherFactory->SetParameterList(postSmootherFactoryParams);
879 keeps.push_back(
keep_pair(
"PreSmoother data", preSmootherFactory.get()));
882 auto postSmootherFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"PostSmoother")));
883 if (postSmootherFactory != Teuchos::null) {
885 postSmootherFactoryParams.
set(
"keep smoother data",
true);
886 postSmootherFactory->SetParameterList(postSmootherFactoryParams);
888 keeps.push_back(
keep_pair(
"PostSmoother data", postSmootherFactory.get()));
891 auto coarseFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<
const Factory>(manager.
GetFactory(
"CoarseSolver")));
892 if (coarseFactory != Teuchos::null) {
894 coarseFactoryParams.
set(
"keep smoother data",
true);
895 coarseFactory->SetParameterList(coarseFactoryParams);
897 keeps.push_back(
keep_pair(
"PreSmoother data", coarseFactory.get()));
901 if ((reuseType ==
"RAP" && levelID) || (reuseType ==
"full")) {
920 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
925 bool isCustomCoarseSolver =
929 manager.
SetFactory(
"CoarseSolver", Teuchos::null);
931 }
else if (isCustomCoarseSolver) {
939 overlap = paramList.
get<
int>(
"coarse: overlap");
942 if (paramList.
isSublist(
"coarse: params"))
943 coarseParams = paramList.
sublist(
"coarse: params");
944 else if (defaultList.
isSublist(
"coarse: params"))
945 coarseParams = defaultList.
sublist(
"coarse: params");
947 using strings = std::unordered_set<std::string>;
953 if (strings({
"RELAXATION",
"CHEBYSHEV",
"ILUT",
"ILU",
"RILUK",
"SCHWARZ",
"Amesos",
954 "BLOCK RELAXATION",
"BLOCK_RELAXATION",
"BLOCKRELAXATION",
955 "SPARSE BLOCK RELAXATION",
"SPARSE_BLOCK_RELAXATION",
"SPARSEBLOCKRELAXATION",
956 "LINESMOOTHING_BANDEDRELAXATION",
"LINESMOOTHING_BANDED_RELAXATION",
"LINESMOOTHING_BANDED RELAXATION",
957 "LINESMOOTHING_TRIDIRELAXATION",
"LINESMOOTHING_TRIDI_RELAXATION",
"LINESMOOTHING_TRIDI RELAXATION",
958 "LINESMOOTHING_TRIDIAGONALRELAXATION",
"LINESMOOTHING_TRIDIAGONAL_RELAXATION",
"LINESMOOTHING_TRIDIAGONAL RELAXATION",
959 "TOPOLOGICAL",
"FAST_ILU",
"FAST_IC",
"FAST_ILDL",
"HIPTMAIR"})
960 .count(coarseType)) {
963 #ifdef HAVE_MUELU_MATLAB
964 if (coarseType ==
"matlab")
978 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
981 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
997 rFactory->
SetFactory(
"D0", this->GetFactoryManager(levelID - 1)->GetFactory(
"D0"));
1009 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1012 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1013 using strings = std::unordered_set<std::string>;
1023 if (aggType ==
"classical") {
1025 manager.
SetFactory(
"UnAmalgamationInfo", amalgFact);
1032 #ifdef HAVE_MUELU_MATLAB
1037 throw std::runtime_error(
"Cannot use MATLAB evolutionary strength-of-connection - MueLu was not configured with MATLAB support.");
1039 }
else if (
MUELU_TEST_PARAM_2LIST(paramList, paramList,
"aggregation: drop scheme", std::string,
"unsupported vector smoothing")) {
1051 if (!rcp_dynamic_cast<CoalesceDropFactory>(dropFactory).
is_null())
1052 dropParams.
set(
"lightweight wrap",
true);
1062 #ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1086 #ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1087 if (!dropParams.
isParameter(
"aggregation: drop scheme") ||
1088 (dropParams.
isParameter(
"aggregation: drop scheme") &&
1089 ((dropParams.
get<std::string>(
"aggregation: drop scheme") !=
"point-wise") && (dropParams.
get<std::string>(
"aggregation: drop scheme") !=
"cut-drop")))) {
1092 #define MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(paramList, paramName, paramType) \
1093 if (!paramList.isParameter(paramName)) { \
1094 paramList.set(paramName, MasterList::getDefault<paramType>(paramName)); \
1097 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: drop scheme", std::string);
1098 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: strength-of-connection: matrix", std::string);
1099 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: strength-of-connection: measure", std::string);
1100 MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST(dropParamsWithDefaults,
"aggregation: use blocking",
bool);
1102 #undef MUELU_TEST_AND_SET_VAR_FROM_MASTERLIST
1106 dropParams.
isParameter(
"aggregation: strength-of-connection: measure") ||
1107 dropParams.
isParameter(
"aggregation: use blocking"),
1109 "The inputs contain a mix of old and new dropping parameters:\n\n"
1110 << dropParams <<
"\n\nKeep in mind that defaults are set for old parameters, so this gets interpreted as\n\n"
1111 << dropParamsWithDefaults);
1118 if (dropParams.
isParameter(
"aggregation: drop scheme")) {
1119 std::string drop_scheme = dropParams.
get<std::string>(
"aggregation: drop scheme");
1120 if (drop_scheme ==
"block diagonal colored signed classical")
1121 manager.
SetFactory(
"Coloring Graph", dropFactory);
1123 (drop_scheme.find(
"block diagonal") != std::string::npos || drop_scheme ==
"signed classical")) {
1125 dropFactory->
SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1136 #ifndef HAVE_MUELU_MATLAB
1137 if (aggType ==
"matlab")
1138 throw std::runtime_error(
"Cannot use MATLAB aggregation - MueLu was not configured with MATLAB support.");
1141 if (aggType ==
"uncoupled") {
1170 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: coloring algorithm", std::string,
"mis2 aggregation") ||
1171 MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: coloring algorithm", std::string,
"mis2 coarsening")) {
1172 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: symmetrize graph after dropping",
bool,
false))
1175 "MIS2 algorithms require the use of a symmetrized graph. Please set \"aggregation: symmetrize graph after dropping\" to \"true\".");
1177 }
else if (aggType ==
"brick") {
1190 manager.
SetFactory(
"DofsPerNode", aggFactory);
1196 aggFactory->
SetFactory(
"Coordinates", this->GetFactoryManager(levelID - 1)->GetFactory(
"Coordinates"));
1198 }
else if (aggType ==
"classical") {
1207 std::string drop_algo = tempParams.
get<std::string>(
"aggregation: drop scheme");
1208 if (drop_algo ==
"block diagonal colored signed classical") {
1209 mapParams.
set(
"aggregation: coloring: use color graph",
true);
1229 if (drop_algo.find(
"block diagonal") != std::string::npos || drop_algo ==
"signed classical") {
1231 aggFactory->
SetFactory(
"BlockNumber", this->GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1240 if (reuseType ==
"tP" && levelID) {
1245 }
else if (aggType ==
"notay") {
1256 #ifdef HAVE_MUELU_MATLAB
1257 else if (aggType ==
"matlab") {
1264 manager.
SetFactory(
"Aggregates", aggFactory);
1274 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1275 ptentParams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1276 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1277 ptentParams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1280 Ptent->SetParameterList(ptentParams);
1281 Ptent->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1282 Ptent->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1285 if (reuseType ==
"tP" && levelID) {
1286 keeps.push_back(
keep_pair(
"Nullspace", Ptent.get()));
1287 keeps.push_back(
keep_pair(
"P", Ptent.get()));
1294 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1297 int levelID, std::vector<keep_pair>& keeps)
const {
1310 std::string alg = paramList.
get(
"rap: algorithm",
"galerkin");
1311 if (alg ==
"shift" || alg ==
"non-galerkin") {
1325 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
1326 RAPparams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
1327 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
1328 RAPparams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
1335 if (!paramList.
isParameter(
"rap: triple product") &&
1336 paramList.
isType<std::string>(
"multigrid algorithm") &&
1337 paramList.
get<std::string>(
"multigrid algorithm") ==
"unsmoothed")
1338 paramList.
set(
"rap: triple product",
true);
1343 if (paramList.
isParameter(
"aggregation: allow empty prolongator columns")) {
1344 RAPparams.
set(
"CheckMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1345 RAPparams.
set(
"RepairMainDiagonal", paramList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1346 }
else if (defaultList.
isParameter(
"aggregation: allow empty prolongator columns")) {
1347 RAPparams.
set(
"CheckMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1348 RAPparams.
set(
"RepairMainDiagonal", defaultList.
get<
bool>(
"aggregation: allow empty prolongator columns"));
1364 if (!this->implicitTranspose_) {
1382 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: compute aggregate qualities",
bool,
true)) {
1396 manager.
SetFactory(
"AggregateQualities", aggQualityFact);
1404 if (
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: export visualization data",
bool,
true)) {
1433 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
1434 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
1436 if (reuseType ==
"RP" || (reuseType ==
"tP" && !filteringChangesMatrix)) {
1438 keeps.push_back(
keep_pair(
"AP reuse data", RAP.
get()));
1439 keeps.push_back(
keep_pair(
"RAP reuse data", RAP.
get()));
1442 keeps.push_back(
keep_pair(
"AP reuse data", RAPs.
get()));
1443 keeps.push_back(
keep_pair(
"RAP reuse data", RAPs.
get()));
1451 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1455 bool have_userCO =
false;
1459 if (useCoordinates_) {
1470 if (!RAP.is_null()) {
1471 RAP->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1474 RAPs->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1483 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1487 bool have_userMaterial =
false;
1489 have_userMaterial =
true;
1492 if (have_userMaterial) {
1497 materialTransferParameters.
set(
"Vector name",
"Material");
1498 materialTransferParameters.
set(
"Transfer name",
"Aggregates");
1499 materialTransferParameters.
set(
"Normalize",
true);
1503 manager.
SetFactory(
"Material", materialTransfer);
1506 if (!RAP.is_null()) {
1507 RAP->AddTransferFactory(manager.
GetFactory(
"Material"));
1510 RAPs->AddTransferFactory(manager.
GetFactory(
"Material"));
1519 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1522 FactoryManager& manager,
int levelID, std::vector<keep_pair>& )
const {
1525 if (useBlockNumber_ && (levelID > 0)) {
1528 if (!RAP.is_null() || !RAPs.is_null()) {
1530 if (multigridAlgo ==
"classical")
1536 fact->
SetFactory(VarName, this->GetFactoryManager(levelID - 1)->GetFactory(VarName));
1541 RAP->AddTransferFactory(manager.
GetFactory(VarName));
1543 RAPs->AddTransferFactory(manager.
GetFactory(VarName));
1551 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1554 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1555 if (useBlockNumber_) {
1567 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1570 int levelID, std::vector<keep_pair>& )
const {
1571 MUELU_SET_VAR_2LIST(paramList, defaultList,
"multigrid algorithm", std::string, multigridAlgo);
1572 bool have_userR =
false;
1578 if (!this->implicitTranspose_) {
1581 if (isSymmetric ==
false && (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"emin")) {
1582 this->GetOStream(
Warnings0) <<
"Switching \"problem: symmetric\" parameter to symmetric as multigrid algorithm. " << multigridAlgo <<
" is primarily supposed to be used for symmetric problems.\n\n"
1583 <<
"Please note: if you are using \"unsmoothed\" transfer operators the \"problem: symmetric\" parameter "
1584 <<
"has no real mathematical meaning, i.e. you can use it for non-symmetric\n"
1585 <<
"problems, too. With \"problem: symmetric\"=\"symmetric\" you can use implicit transpose for building "
1586 <<
"the restriction operators which may drastically reduce the amount of consumed memory." << std::endl;
1590 "Petrov-Galerkin smoothed transfer operators are only allowed for non-symmetric problems: Set \"problem: symmetric\" to false!\n"
1591 "While PG smoothed transfer operators generally would also work for symmetric problems this is an unusual use case. "
1592 "You can use the factory-based xml interface though if you need PG-AMG for symmetric problems.");
1611 if (paramList.
isParameter(
"restriction: scale nullspace") && paramList.
get<
bool>(
"restriction: scale nullspace")) {
1614 tentPlist.
set(
"Nullspace name",
"Scaled Nullspace");
1627 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1630 int levelID, std::vector<keep_pair>& keeps,
RCP<Factory>& nullSpaceFactory)
const {
1635 #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
1636 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: use subcommunicators in place",
bool, enableInPlace);
1673 "Reuse types \"tP\" and \"PR\" require \"repartition: rebalance P and R\" set to \"false\"");
1678 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: partitioner", std::string, partName);
1680 "Invalid partitioner name: \"" << partName <<
"\". Valid options: \"zoltan\", \"zoltan2\"");
1682 #ifndef HAVE_MUELU_ZOLTAN
1683 bool switched =
false;
1684 if (partName ==
"zoltan") {
1685 this->GetOStream(
Warnings0) <<
"Zoltan interface is not available, trying to switch to Zoltan2" << std::endl;
1686 partName =
"zoltan2";
1690 #ifndef HAVE_MUELU_ZOLTAN2
1691 bool switched =
false;
1692 #endif // HAVE_MUELU_ZOLTAN2
1693 #endif // HAVE_MUELU_ZOLTAN
1695 #ifndef HAVE_MUELU_ZOLTAN2
1696 if (partName ==
"zoltan2" && !switched) {
1697 this->GetOStream(
Warnings0) <<
"Zoltan2 interface is not available, trying to switch to Zoltan" << std::endl;
1698 partName =
"zoltan";
1700 #endif // HAVE_MUELU_ZOLTAN2
1702 MUELU_SET_VAR_2LIST(paramList, defaultList,
"repartition: node repartition level",
int, nodeRepartitionLevel);
1715 repartheurFactory->SetParameterList(repartheurParams);
1716 repartheurFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1717 manager.
SetFactory(
"number of partitions", repartheurFactory);
1718 manager.
SetFactory(
"repartition: heuristic target rows per process", repartheurFactory);
1722 if (levelID == nodeRepartitionLevel) {
1729 }
else if (partName ==
"zoltan") {
1730 #ifdef HAVE_MUELU_ZOLTAN
1735 #endif // HAVE_MUELU_ZOLTAN
1736 }
else if (partName ==
"zoltan2") {
1737 #ifdef HAVE_MUELU_ZOLTAN2
1741 partParams.
set(
"ParameterList", partpartParams);
1743 partitioner->
SetFactory(
"repartition: heuristic target rows per process",
1744 manager.
GetFactory(
"repartition: heuristic target rows per process"));
1747 #endif // HAVE_MUELU_ZOLTAN2
1752 if (useCoordinates_)
1754 manager.
SetFactory(
"Partition", partitioner);
1763 repartFactory->SetParameterList(repartParams);
1764 repartFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
1765 repartFactory->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
1766 repartFactory->SetFactory(
"Partition", manager.
GetFactory(
"Partition"));
1767 manager.
SetFactory(
"Importer", repartFactory);
1768 if (reuseType !=
"none" && reuseType !=
"S" && levelID)
1771 if (enableInPlace) {
1779 newA->SetParameterList(rebAcParams);
1780 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1781 newA->SetFactory(
"InPlaceMap", manager.
GetFactory(
"InPlaceMap"));
1788 newA->SetParameterList(rebAcParams);
1789 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
1790 newA->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1796 newPparams.
set(
"type",
"Interpolation");
1797 if (changedPRrebalance_)
1798 newPparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1799 if (changedPRViaCopyrebalance_)
1800 newPparams.
set(
"repartition: explicit via new copy rebalance P and R",
true);
1803 newP->SetParameterList(newPparams);
1804 newP->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1805 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
1807 if (!paramList.
isParameter(
"semicoarsen: number of levels"))
1808 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
1810 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"P"));
1811 if (useCoordinates_) {
1812 newP->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
1816 newP->SetFactory(
"Material", manager.
GetFactory(
"Material"));
1819 if (useBlockNumber_ && (levelID > 0)) {
1820 newP->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1827 newRparams.
set(
"type",
"Restriction");
1830 if (changedPRrebalance_)
1831 newRparams.
set(
"repartition: rebalance P and R", this->doPRrebalance_);
1832 if (changedPRViaCopyrebalance_)
1833 newPparams.
set(
"repartition: explicit via new copy rebalance P and R",
true);
1834 if (changedImplicitTranspose_)
1835 newRparams.
set(
"transpose: use implicit", this->implicitTranspose_);
1836 newR->SetParameterList(newRparams);
1837 newR->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
1838 if (!this->implicitTranspose_) {
1839 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1852 nullSpaceFactory->
SetFactory(
"Nullspace", newP);
1856 paramList.
set(
"repartition: enable",
false);
1858 this->GetOStream(
Warnings0) <<
"No repartitioning available for a serial run\n";
1860 this->GetOStream(
Warnings0) <<
"Zoltan/Zoltan2 are unavailable for repartitioning\n";
1862 #endif // defined(HAVE_MPI) && (defined(HAVE_MUELU_ZOLTAN) || defined(HAVE_MUELU_ZOLTAN2))
1869 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1872 int levelID, std::vector<keep_pair>& keeps)
const {
1873 MUELU_SET_VAR_2LIST(paramList, defaultList,
"transfers: half precision",
bool, enableLowPrecision);
1875 if (enableLowPrecision) {
1879 newPparams.
set(
"matrix key",
"P");
1880 newP->SetParameterList(newPparams);
1881 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
1884 if (!this->implicitTranspose_) {
1888 newRparams.
set(
"matrix key",
"R");
1889 newR->SetParameterList(newRparams);
1890 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
1899 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1902 int , std::vector<keep_pair>& ,
RCP<Factory>& nullSpaceFactory)
const {
1906 bool have_userNS =
false;
1917 nullSpaceFactory = nullSpace;
1919 if (paramList.
isParameter(
"restriction: scale nullspace") && paramList.
get<
bool>(
"restriction: scale nullspace")) {
1921 scaledNSfactory->
SetFactory(
"Nullspace", nullSpaceFactory);
1922 manager.
SetFactory(
"Scaled Nullspace", scaledNSfactory);
1929 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1932 int , std::vector<keep_pair>& )
const {
1935 if (paramList.
isParameter(
"semicoarsen: number of levels") &&
1936 paramList.
get<
int>(
"semicoarsen: number of levels") > 0) {
1963 manager.
SetFactory(
"CoarseNumZLayers", linedetectionFactory);
1964 manager.
SetFactory(
"LineDetection_Layers", linedetectionFactory);
1965 manager.
SetFactory(
"LineDetection_VertLineIds", linedetectionFactory);
1969 manager.
SetFactory(
"Nullspace", togglePFactory);
1972 if (paramList.
isParameter(
"semicoarsen: number of levels")) {
1974 tf->SetFactory(
"Chosen P", manager.
GetFactory(
"P"));
1975 tf->AddCoordTransferFactory(semicoarsenFactory);
1980 tf->AddCoordTransferFactory(coords);
1988 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1991 int levelID, std::vector<keep_pair>& keeps)
const {
1992 #ifdef HAVE_MUELU_INTREPID2
1997 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
1998 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
2000 if (levelID >= (
int)pcoarsen_schedule.size()) {
2003 UpdateFactoryManager_SA(paramList, defaultList, manager, levelID, keeps);
2009 std::string lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
2010 std::string hi = (levelID ? pcoarsen_element + std::to_string(pcoarsen_schedule[levelID - 1]) : lo);
2011 Pparams.
set(
"pcoarsen: hi basis", hi);
2012 Pparams.
set(
"pcoarsen: lo basis", lo);
2013 P->SetParameterList(Pparams);
2026 P->SetParameterList(Pparams);
2039 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2045 if (paramList.
isSublist(
"matrixmatrix: kernel params"))
2046 Pparams.
sublist(
"matrixmatrix: kernel params",
false) = paramList.
sublist(
"matrixmatrix: kernel params");
2047 if (defaultList.
isSublist(
"matrixmatrix: kernel params"))
2048 Pparams.
sublist(
"matrixmatrix: kernel params",
false) = defaultList.
sublist(
"matrixmatrix: kernel params");
2064 MUELU_SET_VAR_2LIST(paramList, defaultList,
"sa: use filtered matrix",
bool, useFiltering);
2100 bool filteringChangesMatrix = useFiltering && !
MUELU_TEST_PARAM_2LIST(paramList, defaultList,
"aggregation: drop tol",
double, 0);
2102 if (reuseType ==
"tP" && !filteringChangesMatrix)
2109 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2112 int , std::vector<keep_pair>& )
const {
2116 "Invalid pattern name: \"" << patternType <<
"\". Valid options: \"AkPtent\"");
2121 patternFactory->SetParameterList(patternParams);
2122 patternFactory->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2125 MUELU_SET_VAR_2LIST(paramList, defaultList,
"emin: use filtered matrix",
bool, useFiltering);
2150 patternFactory->SetFactory(
"A", filterFactory);
2153 patternFactory->SetFactory(
"A", manager.
GetFactory(
"Graph"));
2157 manager.
SetFactory(
"Ppattern", patternFactory);
2161 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
2162 constraintFactory->SetFactory(
"CoarseNullspace", manager.
GetFactory(
"Ptent"));
2163 manager.
SetFactory(
"Constraint", constraintFactory);
2169 if (reuseType ==
"emin") {
2171 Pparams.
set(
"Keep P0",
true);
2172 Pparams.
set(
"Keep Constraint0",
true);
2177 P->SetParameterList(Pparams);
2178 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2179 P->SetFactory(
"Constraint", manager.
GetFactory(
"Constraint"));
2186 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2189 int , std::vector<keep_pair>& )
const {
2191 "Implicit transpose not supported with Petrov-Galerkin smoothed transfer operators: Set \"transpose: use implicit\" to false!\n"
2192 "Petrov-Galerkin transfer operator smoothing for non-symmetric problems requires a separate handling of the restriction operator which "
2193 "does not allow the usage of implicit transpose easily.");
2197 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2204 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2212 P->SetParameterList(Pparams);
2219 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2228 P->SetParameterList(Pparams);
2235 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2238 int , std::vector<keep_pair>& )
const {
2239 #ifdef HAVE_MUELU_MATLAB
2242 P->SetParameterList(Pparams);
2243 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2251 #undef MUELU_SET_VAR_2LIST
2252 #undef MUELU_TEST_AND_SET_VAR
2253 #undef MUELU_TEST_AND_SET_PARAM_2LIST
2254 #undef MUELU_TEST_PARAM_2LIST
2255 #undef MUELU_KOKKOS_FACTORY
2259 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2264 const int maxLevels = 100;
2267 std::vector<ParameterList> paramLists;
2268 for (
int levelID = 0; levelID < maxLevels; levelID++) {
2269 std::string sublistName =
"level " +
toString(levelID);
2271 paramLists.push_back(paramList.
sublist(sublistName));
2273 paramList.
remove(sublistName);
2276 paramLists.push_back(paramList);
2278 #ifdef HAVE_MUELU_MATLAB
2280 for (
size_t i = 0; i < paramLists.size(); i++) {
2281 std::vector<std::string> customVars;
2284 std::string paramName = paramLists[i].name(it);
2287 customVars.push_back(paramName);
2291 for (
size_t j = 0; j < customVars.size(); j++)
2292 paramLists[i].
remove(customVars[j],
false);
2296 const int maxDepth = 0;
2297 for (
size_t i = 0; i < paramLists.size(); i++) {
2300 paramLists[i].validateParameters(validList, maxDepth);
2303 std::string eString = e.what();
2306 size_t nameStart = eString.find_first_of(
'"') + 1;
2307 size_t nameEnd = eString.find_first_of(
'"', nameStart);
2308 std::string name = eString.substr(nameStart, nameEnd - nameStart);
2310 size_t bestScore = 100;
2311 std::string bestName =
"";
2313 const std::string& pName = validList.
name(it);
2314 this->GetOStream(
Runtime1) <<
"| " << pName;
2315 size_t score =
LevenshteinDistance(name.c_str(), name.length(), pName.c_str(), pName.length());
2316 this->GetOStream(
Runtime1) <<
" -> " << score << std::endl;
2317 if (score < bestScore) {
2322 if (bestScore < 10 && bestName !=
"") {
2324 eString <<
"The parameter name \"" + name +
"\" is not valid. Did you mean \"" + bestName <<
"\"?\n");
2328 eString <<
"The parameter name \"" + name +
"\" is not valid.\n");
2337 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2350 blockSize_ = paramList.
sublist(
"Matrix").
get<
int>(
"PDE equations", MasterList::getDefault<int>(
"number of equations"));
2355 if (factFact_ == Teuchos::null)
2368 this->BuildFactoryMap(paramList.
sublist(
"Factories"), factoryMap, factoryMap, factoryManagers);
2387 this->numDesiredLevel_ = hieraList.
get<
int>(
"max levels");
2388 hieraList.
remove(
"max levels");
2392 this->maxCoarseSize_ = hieraList.
get<
int>(
"coarse: max size");
2393 hieraList.
remove(
"coarse: max size");
2396 if (hieraList.
isParameter(
"repartition: rebalance P and R")) {
2397 this->doPRrebalance_ = hieraList.
get<
bool>(
"repartition: rebalance P and R");
2398 hieraList.
remove(
"repartition: rebalance P and R");
2401 if (hieraList.
isParameter(
"transpose: use implicit")) {
2402 this->implicitTranspose_ = hieraList.
get<
bool>(
"transpose: use implicit");
2403 hieraList.
remove(
"transpose: use implicit");
2406 if (hieraList.
isParameter(
"fuse prolongation and update")) {
2407 this->fuseProlongationAndUpdate_ = hieraList.
get<
bool>(
"fuse prolongation and update");
2408 hieraList.
remove(
"fuse prolongation and update");
2411 if (hieraList.
isParameter(
"nullspace: suppress dimension check")) {
2412 this->suppressNullspaceDimensionCheck_ = hieraList.
get<
bool>(
"nullspace: suppress dimension check");
2413 hieraList.
remove(
"nullspace: suppress dimension check");
2417 this->sizeOfMultiVectors_ = hieraList.
get<
int>(
"number of vectors");
2418 hieraList.
remove(
"number of vectors");
2421 if (hieraList.
isSublist(
"matvec params"))
2422 this->matvecParams_ = Teuchos::parameterList(hieraList.
sublist(
"matvec params"));
2424 if (hieraList.
isParameter(
"coarse grid correction scaling factor")) {
2425 this->scalingFactor_ = hieraList.
get<
double>(
"coarse grid correction scaling factor");
2426 hieraList.
remove(
"coarse grid correction scaling factor");
2431 std::map<std::string, CycleType> cycleMap;
2435 std::string cycleType = hieraList.
get<std::string>(
"cycle type");
2437 this->Cycle_ = cycleMap[cycleType];
2440 if (hieraList.
isParameter(
"W cycle start level")) {
2441 this->WCycleStartLevel_ = hieraList.
get<
int>(
"W cycle start level");
2445 this->hierarchyLabel_ = hieraList.
get<std::string>(
"hierarchy label");
2449 std::string vl = hieraList.
get<std::string>(
"verbosity");
2450 hieraList.
remove(
"verbosity");
2457 if (hieraList.
isParameter(
"dependencyOutputLevel"))
2458 this->graphOutputLevel_ = hieraList.
get<
int>(
"dependencyOutputLevel");
2464 if (hieraList.
isSublist(
"DataToWrite")) {
2468 std::string dataName =
"Matrices";
2470 this->matricesToPrint_[
"A"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2471 dataName =
"Prolongators";
2473 this->matricesToPrint_[
"P"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2474 dataName =
"Restrictors";
2476 this->matricesToPrint_[
"R"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2479 this->matricesToPrint_[
"D0"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2484 const std::string& paramName = hieraList.
name(param);
2486 if (paramName !=
"DataToWrite" && hieraList.
isSublist(paramName)) {
2491 startLevel = levelList.
get<
int>(
"startLevel");
2492 levelList.
remove(
"startLevel");
2494 int numDesiredLevel = 1;
2496 numDesiredLevel = levelList.
get<
int>(
"numDesiredLevel");
2497 levelList.
remove(
"numDesiredLevel");
2511 BuildFactoryMap(levelList, factoryMap, levelFactoryMap, factoryManagers);
2517 if (startLevel >= 0)
2518 this->AddFactoryManager(startLevel, numDesiredLevel, m);
2649 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2653 const std::string& paramName = paramList.
name(param);
2658 if (paramValue.
isList()) {
2659 ParameterList paramList1 = Teuchos::getValue<ParameterList>(paramValue);
2663 "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.");
2665 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2667 }
else if (paramList1.
isParameter(
"dependency for")) {
2669 "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.");
2671 std::string factoryName = paramList1.
get<std::string>(
"dependency for");
2675 "MueLu::ParameterListInterpreter(): could not find factory " + factoryName +
" in factory map. Did you define it before?");
2683 const std::string& pName = validParamList->name(vparam);
2693 factory->SetFactory(pName, generatingFact.
create_weak());
2696 if (pName ==
"ParameterList") {
2705 factory->SetParameter(pName, paramList1.
getEntry(pName));
2711 std::string groupType = paramList1.
get<std::string>(
"group");
2713 "group must be of type \"FactoryManager\".");
2716 groupList.
remove(
"group");
2718 bool setKokkosRefactor =
false;
2719 bool kokkosRefactor = useKokkos_;
2720 if (groupList.
isParameter(
"use kokkos refactor")) {
2721 kokkosRefactor = groupList.
get<
bool>(
"use kokkos refactor");
2722 groupList.
remove(
"use kokkos refactor");
2723 setKokkosRefactor =
true;
2727 BuildFactoryMap(groupList, factoryMapIn, groupFactoryMap, factoryManagers);
2732 if (setKokkosRefactor)
2734 factoryManagers[paramName] = m;
2737 this->GetOStream(
Warnings0) <<
"Could not interpret parameter list " << paramList1 << std::endl;
2739 "XML Parameter list must either be of type \"factory\" or of type \"group\".");
2743 factoryMapOut[paramName] = factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
2751 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2754 Matrix& A =
dynamic_cast<Matrix&
>(Op);
2755 if (A.IsFixedBlockSizeSet() && (A.GetFixedBlockSize() != blockSize_))
2756 this->GetOStream(
Warnings0) <<
"Setting matrix block size to " << blockSize_ <<
" (value of the parameter in the list) "
2757 <<
"instead of " << A.GetFixedBlockSize() <<
" (provided matrix)." << std::endl
2758 <<
"You may want to check \"number of equations\" (or \"PDE equations\" for factory style list) parameter." << std::endl;
2760 A.SetFixedBlockSize(blockSize_, dofOffset_);
2762 #ifdef HAVE_MUELU_DEBUG
2763 MatrixUtils::checkLocalRowMapMatchesColMap(A);
2764 #endif // HAVE_MUELU_DEBUG
2766 }
catch (std::bad_cast&) {
2767 this->GetOStream(
Warnings0) <<
"Skipping setting block size as the operator is not a matrix" << std::endl;
2771 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2784 const std::string& name = it->first;
2791 compare(Teuchos::getValue<ParameterList>(entry1), Teuchos::getValue<ParameterList>(*entry2));
2807 #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 SetLabel(const std::string &hierarchyLabel)
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