10#ifndef MUELU_PARAMETERLISTINTERPRETER_DEF_HPP
11#define MUELU_PARAMETERLISTINTERPRETER_DEF_HPP
13#include <Teuchos_XMLParameterListHelpers.hpp>
15#include <Xpetra_Matrix.hpp>
16#include <Xpetra_MatrixUtils.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_EdgeProlongatorPatternFactory.hpp"
39#include "MueLu_EminPFactory.hpp"
41#include "MueLu_FacadeClassFactory.hpp"
42#include "MueLu_FactoryFactory.hpp"
43#include "MueLu_FilteredAFactory.hpp"
44#include "MueLu_GenericRFactory.hpp"
45#include "MueLu_InitialBlockNumberFactory.hpp"
46#include "MueLu_LineDetectionFactory.hpp"
47#include "MueLu_LocalOrdinalTransferFactory.hpp"
48#include "MueLu_MatrixAnalysisFactory.hpp"
49#include "MueLu_MatrixTransferFactory.hpp"
50#include "MueLu_MultiVectorTransferFactory.hpp"
51#include "MueLu_NotayAggregationFactory.hpp"
52#include "MueLu_NullspaceFactory.hpp"
53#include "MueLu_PatternFactory.hpp"
54#include "MueLu_ReplicatePFactory.hpp"
55#include "MueLu_CombinePFactory.hpp"
56#include "MueLu_PgPFactory.hpp"
57#include "MueLu_RAPFactory.hpp"
58#include "MueLu_RAPShiftFactory.hpp"
59#include "MueLu_RebalanceAcFactory.hpp"
60#include "MueLu_RebalanceTransferFactory.hpp"
61#include "MueLu_RepartitionFactory.hpp"
62#include "MueLu_RepartitionHeuristicFactory.hpp"
63#include "MueLu_ReitzingerPFactory.hpp"
64#include "MueLu_SaPFactory.hpp"
65#include "MueLu_ScaledNullspaceFactory.hpp"
66#include "MueLu_SemiCoarsenPFactory.hpp"
67#include "MueLu_SmootherFactory.hpp"
68#include "MueLu_SmooVecCoalesceDropFactory.hpp"
69#include "MueLu_TentativePFactory.hpp"
70#include "MueLu_TogglePFactory.hpp"
71#include "MueLu_ToggleCoordinatesTransferFactory.hpp"
72#include "MueLu_TransPFactory.hpp"
73#include "MueLu_UncoupledAggregationFactory.hpp"
74#include "MueLu_ZoltanInterface.hpp"
75#include "MueLu_Zoltan2Interface.hpp"
76#include "MueLu_NodePartitionInterface.hpp"
77#include "MueLu_LowPrecisionFactory.hpp"
79#include "MueLu_CoalesceDropFactory_kokkos.hpp"
80#include "MueLu_SemiCoarsenPFactory_kokkos.hpp"
81#include "MueLu_TentativePFactory_kokkos.hpp"
82#include "Teuchos_Assert.hpp"
84#ifdef HAVE_MUELU_MATLAB
85#include "../matlab/src/MueLu_MatlabSmoother_decl.hpp"
86#include "../matlab/src/MueLu_MatlabSmoother_def.hpp"
87#include "../matlab/src/MueLu_TwoLevelMatlabFactory_decl.hpp"
88#include "../matlab/src/MueLu_TwoLevelMatlabFactory_def.hpp"
89#include "../matlab/src/MueLu_SingleLevelMatlabFactory_decl.hpp"
90#include "../matlab/src/MueLu_SingleLevelMatlabFactory_def.hpp"
98#if defined(HAVE_MUELU_INTREPID2) && defined(HAVE_MUELU_EXPERIMENTAL)
99#include "MueLu_IntrepidPCoarsenFactory.hpp"
104#include <unordered_set>
108template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
110 : factFact_(factFact) {
111 SetMinvAProjectionVariables(paramList);
112 RCP<Teuchos::TimeMonitor> tM = rcp(
new Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(std::string(
"MueLu: ParameterListInterpreter (ParameterList)"))));
113 if (facadeFact == Teuchos::null)
114 facadeFact_ = Teuchos::rcp(
new FacadeClassFactory());
116 facadeFact_ = facadeFact;
118 if (paramList.isParameter(
"xml parameter file")) {
119 std::string filename = paramList.get(
"xml parameter file",
"");
120 if (filename.length() != 0) {
121 TEUCHOS_TEST_FOR_EXCEPTION(comm.is_null(), Exceptions::RuntimeError,
"xml parameter file requires a valid comm");
123 ParameterList paramList2 = paramList;
124 Teuchos::updateParametersFromXmlFileAndBroadcast(filename, Teuchos::Ptr<Teuchos::ParameterList>(¶mList2), *comm);
125 SetParameterList(paramList2);
128 SetParameterList(paramList);
132 SetParameterList(paramList);
136template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
139 RCP<Teuchos::TimeMonitor> tM = rcp(
new Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(std::string(
"MueLu: ParameterListInterpreter (XML)"))));
140 if (facadeFact == Teuchos::null)
145 ParameterList paramList;
146 Teuchos::updateParametersFromXmlFileAndBroadcast(xmlFileName, Teuchos::Ptr<ParameterList>(¶mList), comm);
151template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
154template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
163 if (paramList.isSublist(
"Hierarchy")) {
166 }
else if (paramList.isParameter(
"MueLu preconditioner") ==
true) {
167 this->
GetOStream(
Runtime0) <<
"Use facade class: " << paramList.get<std::string>(
"MueLu preconditioner") << std::endl;
168 Teuchos::RCP<ParameterList> pp =
facadeFact_->SetParameterList(paramList);
173 ParameterList serialList, nonSerialList;
179 if (paramList.isParameter(
"aggregation: strength-of-connection: matrix") && (paramList.get<std::string>(
"aggregation: strength-of-connection: matrix") ==
"MinvA") && paramList.isSublist(
"user data")) {
182 bool Minv_Supplied =
false, M_Supplied =
false, MinvA_Supplied =
false;
183 const Teuchos::ParameterList& userList = paramList.sublist(
"user data");
184 if (userList.isParameter(
"M")) M_Supplied =
true;
185 if (userList.isParameter(
"Minv")) Minv_Supplied =
true;
186 if (userList.isParameter(
"MinvA")) MinvA_Supplied =
true;
188 if (paramList.isSublist(
"project auxiliary matrices")) {
189 auto projectList = paramList.sublist(
"project auxiliary matrices");
190 TEUCHOS_TEST_FOR_EXCEPTION(projectList.isParameter(
"M") && !M_Supplied,
Exceptions::Incompatible,
"MueLu_CreateXpetraPreconditioner: Must supply M as it is listed in the project auxiliary matrices sublist");
191 TEUCHOS_TEST_FOR_EXCEPTION(projectList.isParameter(
"Minv") && (projectList.get(
"Minv",
"") ==
"NoFactory") && !Minv_Supplied,
Exceptions::Incompatible,
192 "MueLu_CreateXpetraPreconditioner: Must supply Minv as NoFactory is listed as supplier of Minv in the project auxiliary matrices sublist");
193 TEUCHOS_TEST_FOR_EXCEPTION(projectList.isParameter(
"MinvA") && (projectList.get(
"MinvA",
"") ==
"NoFactory") && !MinvA_Supplied,
Exceptions::Incompatible,
194 "MueLu_CreateXpetraPreconditioner: Must supply MinvA as NoFactory is listed as supplier of MinvA in the project auxiliary matrices sublist");
196 TEUCHOS_TEST_FOR_EXCEPTION(!M_Supplied && !Minv_Supplied,
Exceptions::Incompatible,
"MueLu_CreateXpetraPreconditioner: Must supply M or Minv when 'aggregation: strength-of-connection: matrix'= MinvA and sublist('project auxiliary matrices') not supplied.");
205static inline bool areSame(
const ParameterList& list1,
const ParameterList& list2);
210template <
class paramType>
211static inline paramType
set_var_2list(
const Teuchos::ParameterList& paramList,
const Teuchos::ParameterList& defaultList,
const std::string& paramName) {
212 if (paramList.isParameter(paramName))
213 return paramList.get<paramType>(paramName);
214 else if (defaultList.isParameter(paramName))
215 return defaultList.get<paramType>(paramName);
220template <
class paramType>
221static inline bool test_and_set_var(
const Teuchos::ParameterList& paramList,
const std::string& paramName, paramType& varName) {
222 if (paramList.isParameter(paramName)) {
223 varName = paramList.get<paramType>(paramName);
229template <
class paramType>
230static inline void test_and_set_param_2list(
const Teuchos::ParameterList& paramList,
const Teuchos::ParameterList& defaultList,
const std::string& paramName, Teuchos::ParameterList& listWrite) {
232 if (paramList.isParameter(paramName))
233 listWrite.set(paramName, paramList.get<paramType>(paramName));
234 else if (defaultList.isParameter(paramName))
235 listWrite.set(paramName, defaultList.get<paramType>(paramName));
236 }
catch (Teuchos::Exceptions::InvalidParameterType&) {
237 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(
true, Teuchos::Exceptions::InvalidParameterType,
238 "Error: parameter \"" << paramName <<
"\" must be of type " << Teuchos::TypeNameTraits<paramType>::name());
242template <
class paramType>
244 if (!paramList.isParameter(paramName)) {
249template <
class paramType>
250static inline bool test_param_2list(
const Teuchos::ParameterList& paramList,
const Teuchos::ParameterList& defaultList,
const std::string& paramName,
const paramType& cmpValue) {
254#define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory) \
255 RCP<Factory> varName; \
257 varName = rcp(new oldFactory()); \
259 varName = rcp(new newFactory());
260#define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory) \
262 varName = rcp(new oldFactory()); \
264 varName = rcp(new newFactory());
266template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
268 needCoordinates(
const Teuchos::ParameterList& paramList, Teuchos::RCP<const Teuchos::ParameterList> defaultList,
int maxLevel) {
269 if (defaultList.is_null())
270 defaultList = Teuchos::rcpFromRef(paramList);
274 if (paramList.isSublist(
"Hierarchy")) {
293 if (paramList.isSublist(
"smoother: params")) {
294 const auto smooParamList = paramList.sublist(
"smoother: params");
295 if (smooParamList.isParameter(
"partitioner: type") &&
296 (smooParamList.get<std::string>(
"partitioner: type") ==
"line")) {
307 }
else if (!paramList.isSublist(
"repartition: params")) {
310 const ParameterList& repParams = paramList.sublist(
"repartition: params");
311 if (repParams.isType<std::string>(
"algorithm")) {
312 const std::string algo = repParams.get<std::string>(
"algorithm");
313 if (algo ==
"multijagged" || algo ==
"rcb") {
324 for (
int levelID = 0; levelID < maxLevel; levelID++) {
325 std::string levelStr =
"level " +
toString(levelID);
327 if (paramList.isSublist(levelStr)) {
328 const ParameterList& levelList = paramList.sublist(levelStr);
339template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
341 if (defaultList.is_null())
342 defaultList = Teuchos::rcpFromRef(paramList);
346 if (paramList.isSublist(
"Hierarchy")) {
363 for (
int levelID = 0; levelID < maxLevel; levelID++) {
364 std::string levelStr =
"level " +
toString(levelID);
366 if (paramList.isSublist(levelStr)) {
367 const ParameterList& levelList = paramList.sublist(levelStr);
378template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
380 needMaterial(
const Teuchos::ParameterList& paramList, Teuchos::RCP<const Teuchos::ParameterList> defaultList,
int maxLevel) {
381 if (defaultList.is_null())
382 defaultList = Teuchos::rcpFromRef(paramList);
386 if (paramList.isSublist(
"Hierarchy")) {
396 for (
int levelID = 0; levelID < maxLevel; levelID++) {
397 std::string levelStr =
"level " +
toString(levelID);
399 if (paramList.isSublist(levelStr)) {
400 const ParameterList& levelList = paramList.sublist(levelStr);
411template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
413 needMass(
const Teuchos::ParameterList& paramList, Teuchos::RCP<const Teuchos::ParameterList> defaultList,
int maxLevel) {
414 if (defaultList.is_null())
415 defaultList = Teuchos::rcpFromRef(paramList);
417 bool useMass_ =
false;
419 if (paramList.isSublist(
"Hierarchy")) {
428 if ((!useMass_) && (maxLevel > 0)) {
429 for (
int levelID = 0; levelID < maxLevel; levelID++) {
430 std::string levelStr =
"level " +
toString(levelID);
432 if (paramList.isSublist(levelStr)) {
433 const ParameterList& levelList = paramList.sublist(levelStr);
435 useMass_ |=
needMass(levelList, Teuchos::rcpFromRef(paramList), 0);
444template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
446 requiredAndOptionalUserData(
const Teuchos::ParameterList& paramList, Teuchos::RCP<const Teuchos::ParameterList> defaultList,
int maxLevel) {
447 std::set<std::string> requiredUserData;
449 requiredUserData.insert(
"Coordinates");
451 requiredUserData.insert(
"BlockNumber");
453 requiredUserData.insert(
"Material");
455 std::set<std::string> optionalUserData;
456 optionalUserData.insert(
"Nullspace");
457 optionalUserData.insert(
"M");
458 optionalUserData.insert(
"Minv");
459 optionalUserData.insert(
"MinvA");
461 optionalUserData.insert(
"pcoarsen: element to node map");
462 optionalUserData.insert(
"Node Comm");
463 optionalUserData.insert(
"DualNodeID2PrimalNodeID");
464 optionalUserData.insert(
"Primal interface DOF map");
465 optionalUserData.insert(
"dropMap1");
466 optionalUserData.insert(
"dropMap2");
468 return std::make_pair(requiredUserData, optionalUserData);
471template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
474 ParameterList paramList;
478 if (constParamList.isSublist(
"project auxiliary matrices")) {
479 auto projectList = constParamList.sublist(
"project auxiliary matrices");
481 if (projectList.isParameter(
"M")) {
486 if (projectList.isParameter(
"Minv")) {
491 if (projectList.isParameter(
"MinvA")) {
502template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
505 ParameterList paramList;
508 if (problemType !=
"unknown") {
510 paramList.setParameters(constParamList);
514 paramList = constParamList;
527 if (paramList.isParameter(
"cycle type")) {
528 std::map<std::string, CycleType> cycleMap;
532 auto cycleType = paramList.get<std::string>(
"cycle type");
534 "Invalid cycle type: \"" << cycleType <<
"\"");
535 Cycle_ = cycleMap[cycleType];
538 if (paramList.isParameter(
"W cycle start level")) {
542 if (paramList.isParameter(
"hierarchy label")) {
546 if (paramList.isParameter(
"coarse grid correction scaling factor"))
547 scalingFactor_ = paramList.get<
double>(
"coarse grid correction scaling factor");
556 if (paramList.isParameter(
"keep data"))
557 this->
dataToKeep_ = Teuchos::getArrayFromStringParameter<std::string>(paramList,
"keep data");
560 if (paramList.isSublist(
"export data")) {
561 ParameterList printList = paramList.sublist(
"export data");
564 if (printList.isParameter(
"Nullspace"))
565 this->
nullspaceToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Nullspace");
566 if (printList.isParameter(
"Coordinates"))
567 this->
coordinatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Coordinates");
568 if (printList.isParameter(
"Material"))
569 this->
materialToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Material");
570 if (printList.isParameter(
"Aggregates"))
571 this->
aggregatesToPrint_ = Teuchos::getArrayFromStringParameter<int>(printList,
"Aggregates");
572 if (printList.isParameter(
"pcoarsen: element to node map"))
576 for (
auto iter = printList.begin(); iter != printList.end(); iter++) {
577 const std::string& name = printList.name(iter);
579 if (name ==
"Nullspace" || name ==
"Coordinates" || name ==
"Material" || name ==
"Aggregates" || name ==
"pcoarsen: element to node map")
582 this->
matricesToPrint_[name] = Teuchos::getArrayFromStringParameter<int>(printList, name);
595 if (outputFilename !=
"")
626 if (paramList.isSublist(
"matvec params"))
627 this->
matvecParams_ = Teuchos::parameterList(paramList.sublist(
"matvec params"));
632 defaultManager->SetVerbLevel(this->
verbosity_);
633 defaultManager->SetKokkosRefactor(
useKokkos_);
636 std::vector<keep_pair> keeps0;
643 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
649 RCP<FactoryManager> levelManager = rcp(
new FactoryManager(*defaultManager));
650 levelManager->SetVerbLevel(defaultManager->GetVerbLevel());
652 std::vector<keep_pair> keeps;
653 if (paramList.isSublist(
"level " +
toString(levelID))) {
655 ParameterList& levelList = paramList.sublist(
"level " +
toString(levelID),
true );
659 ParameterList levelList;
663 this->
keep_[levelID] = keeps;
678 ParameterList unusedParamList;
681 for (ParameterList::ConstIterator it = paramList.begin(); it != paramList.end(); it++) {
682 const ParameterEntry& entry = paramList.entry(it);
684 if (!entry.isList() && !entry.isUsed())
685 unusedParamList.setEntry(paramList.name(it), entry);
689 for (
int levelID = 0; levelID < this->numDesiredLevel_; levelID++) {
690 std::string levelStr =
"level " +
toString(levelID);
692 if (paramList.isSublist(levelStr)) {
693 const ParameterList& levelList = paramList.sublist(levelStr);
695 for (ParameterList::ConstIterator itr = levelList.begin(); itr != levelList.end(); ++itr) {
696 const ParameterEntry& entry = levelList.entry(itr);
698 if (!entry.isList() && !entry.isUsed())
699 unusedParamList.sublist(levelStr).setEntry(levelList.name(itr), entry);
704 if (unusedParamList.numParams() > 0) {
705 std::ostringstream unusedParamsStream;
707 unusedParamList.print(unusedParamsStream, indent);
710 << unusedParamsStream.str() << std::endl;
720template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
723 int levelID, std::vector<keep_pair>& keeps)
const {
727 using strings = std::unordered_set<std::string>;
730 if (paramList.numParams() == 0 && defaultList.numParams() > 0)
731 paramList = ParameterList(defaultList);
734 TEUCHOS_TEST_FOR_EXCEPTION(strings({
"none",
"tP",
"RP",
"emin",
"RAP",
"full",
"S"}).count(reuseType) == 0,
738 TEUCHOS_TEST_FOR_EXCEPTION(strings({
"unsmoothed",
"sa",
"pg",
"emin",
"matlab",
"pcoarsen",
"classical",
"smoothed reitzinger",
"unsmoothed reitzinger",
"emin reitzinger",
"replicate",
"combine"}).count(multigridAlgo) == 0,
739 Exceptions::RuntimeError,
"Unknown \"multigrid algorithm\" value: \"" << multigridAlgo <<
"\". Please consult User's Guide.");
740#ifndef HAVE_MUELU_MATLAB
742 "Cannot use matlab for multigrid algorithm - MueLu was not configured with MATLAB support.");
744#ifndef HAVE_MUELU_INTREPID2
746 "Cannot use IntrepidPCoarsen prolongator factory - MueLu was not configured with Intrepid support.");
751 if (reuseType ==
"none" || reuseType ==
"S" || reuseType ==
"RP" || reuseType ==
"RAP") {
754 }
else if (reuseType ==
"tP" && (multigridAlgo !=
"sa" && multigridAlgo !=
"unsmoothed")) {
756 this->
GetOStream(
Warnings0) <<
"Ignoring \"tP\" reuse option as it is only compatible with \"sa\", "
757 "or \"unsmoothed\" multigrid algorithms"
760 }
else if (reuseType ==
"emin" && multigridAlgo !=
"emin") {
762 this->
GetOStream(
Warnings0) <<
"Ignoring \"emin\" reuse option it is only compatible with "
763 "\"emin\" multigrid algorithm"
769 bool have_userP =
false;
770 if (paramList.isParameter(
"P") && !paramList.get<RCP<Matrix>>(
"P").is_null())
784 if (multigridAlgo ==
"unsmoothed reitzinger" || multigridAlgo ==
"smoothed reitzinger")
786 else if (multigridAlgo ==
"emin reitzinger")
792 RCP<Factory> nullSpaceFactory;
804 }
else if (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"unsmoothed reitzinger") {
808 }
else if (multigridAlgo ==
"classical") {
812 }
else if (multigridAlgo ==
"sa" || multigridAlgo ==
"smoothed reitzinger") {
816 }
else if (multigridAlgo ==
"emin") {
820 }
else if (multigridAlgo ==
"emin reitzinger") {
823 }
else if (multigridAlgo ==
"replicate") {
826 }
else if (multigridAlgo ==
"combine") {
829 }
else if (multigridAlgo ==
"pg") {
833 }
else if (multigridAlgo ==
"matlab") {
837 }
else if (multigridAlgo ==
"pcoarsen") {
851 if (multigridAlgo ==
"smoothed reitzinger") {
854 auto useEdgeMatrixForSmoothing =
set_var_2list<bool>(paramList, defaultList,
"sa: use edge matrix for smoothing");
855 if ((saDampingFactor != 0.0) && !useEdgeMatrixForSmoothing)
869 if ((reuseType ==
"RP" || reuseType ==
"RAP" || reuseType ==
"full") && levelID)
872 if (reuseType ==
"RP" && levelID) {
877 if ((reuseType ==
"tP" || reuseType ==
"RP" || reuseType ==
"emin") &&
useCoordinates_ && levelID)
885 if (socMatrix ==
"MinvA") {
894 std::string MinvFactory =
"CoalesceDrop";
895 std::string MinvAFactory =
"CoalesceDrop";
896 if (paramList.isSublist(
"project auxiliary matrices")) {
897 auto projectList = paramList.sublist(
"project auxiliary matrices");
898 if (projectList.isParameter(
"M")) {
899 TEUCHOS_TEST_FOR_EXCEPTION(projectList.get(
"M",
"") !=
"NoFactory",
Exceptions::InvalidArgument,
"Must specify \"NoFactory\" when projecting M");
901 if (projectList.isParameter(
"Minv")) {
902 MinvFactory = projectList.get(
"Minv",
"");
903 TEUCHOS_TEST_FOR_EXCEPTION((MinvFactory !=
"NoFactory") && (MinvFactory !=
"CoalesceDrop"),
Exceptions::InvalidArgument,
"Must specify \"NoFactory\" or \"CoalesceDrop\"");
905 if (projectList.isParameter(
"MinvA")) {
906 MinvAFactory = projectList.get(
"MinvA",
"");
907 TEUCHOS_TEST_FOR_EXCEPTION((MinvAFactory !=
"NoFactory") && (MinvAFactory !=
"CoalesceDrop"),
Exceptions::InvalidArgument,
"Must specify \"NoFactory\" or \"CoalesceDrop\"");
927 if ((levelID > 0) || (MinvAFactory ==
"NoFactory"))
935 if ((levelID > 0) || (MinvFactory ==
"NoFactory"))
948 if ((reuseType ==
"RAP" || reuseType ==
"full") && levelID) {
963template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
966 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
969 auto useMaxAbsDiagonalScaling =
set_var_2list<bool>(paramList, defaultList,
"sa: use rowsumabs diagonal scaling");
973 bool isCustomSmoother =
974 paramList.isParameter(
"smoother: pre or post") ||
975 paramList.isParameter(
"smoother: type") || paramList.isParameter(
"smoother: pre type") || paramList.isParameter(
"smoother: post type") ||
976 paramList.isSublist(
"smoother: params") || paramList.isSublist(
"smoother: pre params") || paramList.isSublist(
"smoother: post params") ||
977 paramList.isParameter(
"smoother: sweeps") || paramList.isParameter(
"smoother: pre sweeps") || paramList.isParameter(
"smoother: post sweeps") ||
978 paramList.isParameter(
"smoother: overlap") || paramList.isParameter(
"smoother: pre overlap") || paramList.isParameter(
"smoother: post overlap");
982 manager.
SetFactory(
"Smoother", Teuchos::null);
984 }
else if (isCustomSmoother) {
988#define TEST_MUTUALLY_EXCLUSIVE(arg1, arg2) \
989 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isParameter(#arg1) && paramList.isParameter(#arg2), \
990 Exceptions::InvalidArgument, "You cannot specify both \"" #arg1 "\" and \"" #arg2 "\"");
991#define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2) \
992 TEUCHOS_TEST_FOR_EXCEPTION(paramList.isSublist(#arg1) && paramList.isSublist(#arg2), \
993 Exceptions::InvalidArgument, "You cannot specify both \"" #arg1 "\" and \"" #arg2 "\"");
1003 TEUCHOS_TEST_FOR_EXCEPTION(
PreOrPost ==
"both" && (paramList.isParameter(
"smoother: pre type") != paramList.isParameter(
"smoother: post type")),
1008 ParameterList defaultSmootherParams;
1009 defaultSmootherParams.set(
"relaxation: type",
"Symmetric Gauss-Seidel");
1010 defaultSmootherParams.set(
"relaxation: sweeps", Teuchos::OrdinalTraits<LO>::one());
1011 defaultSmootherParams.set(
"relaxation: damping factor", Teuchos::ScalarTraits<Scalar>::one());
1013 RCP<SmootherFactory> preSmoother = Teuchos::null, postSmoother = Teuchos::null;
1014 std::string preSmootherType, postSmootherType;
1015 ParameterList preSmootherParams, postSmootherParams;
1017 auto setChebyshevSettings = [&](
const std::string& smootherType, Teuchos::ParameterList& smootherParams) {
1018 auto upperCaseSmootherType = smootherType;
1019 std::transform(smootherType.begin(), smootherType.end(), upperCaseSmootherType.begin(), ::toupper);
1020 if (upperCaseSmootherType !=
"CHEBYSHEV")
return;
1022 if (smootherParams.isParameter(
"chebyshev: use rowsumabs diagonal scaling")) {
1023 bool useMaxAbsDiagonalScalingCheby = smootherParams.get<
bool>(
"chebyshev: use rowsumabs diagonal scaling");
1024 TEUCHOS_TEST_FOR_EXCEPTION(useMaxAbsDiagonalScaling != useMaxAbsDiagonalScalingCheby,
1025 Exceptions::RuntimeError,
"'chebyshev: use rowsumabs diagonal scaling' (" << std::boolalpha << useMaxAbsDiagonalScalingCheby <<
") must match 'sa: use rowsumabs diagonal scaling' (" << std::boolalpha << useMaxAbsDiagonalScaling <<
")\n");
1027 if (useMaxAbsDiagonalScaling)
1028 smootherParams.set(
"chebyshev: use rowsumabs diagonal scaling", useMaxAbsDiagonalScaling);
1032 if (paramList.isParameter(
"smoother: overlap"))
1033 overlap = paramList.get<
int>(
"smoother: overlap");
1036 if (paramList.isParameter(
"smoother: pre type")) {
1037 preSmootherType = paramList.get<std::string>(
"smoother: pre type");
1040 preSmootherType = preSmootherTypeTmp;
1042 if (paramList.isParameter(
"smoother: pre overlap"))
1043 overlap = paramList.get<
int>(
"smoother: pre overlap");
1045 if (paramList.isSublist(
"smoother: pre params"))
1046 preSmootherParams = paramList.sublist(
"smoother: pre params");
1047 else if (paramList.isSublist(
"smoother: params"))
1048 preSmootherParams = paramList.sublist(
"smoother: params");
1049 else if (defaultList.isSublist(
"smoother: params"))
1050 preSmootherParams = defaultList.sublist(
"smoother: params");
1051 else if (preSmootherType ==
"RELAXATION")
1052 preSmootherParams = defaultSmootherParams;
1054 setChebyshevSettings(preSmootherType, preSmootherParams);
1056#if defined(HAVE_MUELU_INTREPID2) && defined(HAVE_MUELU_EXPERIMENTAL)
1058 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
1059 defaultList.isParameter(
"pcoarsen: schedule") && defaultList.isParameter(
"pcoarsen: element")) {
1062 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
1063 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
1065 if (levelID < (
int)pcoarsen_schedule.size()) {
1067 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
1068 preSmootherParams.set(
"pcoarsen: hi basis", lo);
1073#ifdef HAVE_MUELU_MATLAB
1074 if (preSmootherType ==
"matlab")
1078#ifdef HAVE_MUELU_TEKO
1079 if (preSmootherType ==
"teko")
1087 if (paramList.isParameter(
"smoother: post type"))
1088 postSmootherType = paramList.get<std::string>(
"smoother: post type");
1091 postSmootherType = postSmootherTypeTmp;
1094 if (paramList.isSublist(
"smoother: post params"))
1095 postSmootherParams = paramList.sublist(
"smoother: post params");
1096 else if (paramList.isSublist(
"smoother: params"))
1097 postSmootherParams = paramList.sublist(
"smoother: params");
1098 else if (defaultList.isSublist(
"smoother: params"))
1099 postSmootherParams = defaultList.sublist(
"smoother: params");
1100 else if (postSmootherType ==
"RELAXATION")
1101 postSmootherParams = defaultSmootherParams;
1102 if (paramList.isParameter(
"smoother: post overlap"))
1103 overlap = paramList.get<
int>(
"smoother: post overlap");
1105 setChebyshevSettings(postSmootherType, postSmootherParams);
1107 if (postSmootherType == preSmootherType &&
areSame(preSmootherParams, postSmootherParams))
1108 postSmoother = preSmoother;
1110#if defined(HAVE_MUELU_INTREPID2) && defined(HAVE_MUELU_EXPERIMENTAL)
1112 if (multigridAlgo ==
"pcoarsen" && preSmootherType ==
"TOPOLOGICAL" &&
1113 defaultList.isParameter(
"pcoarsen: schedule") && defaultList.isParameter(
"pcoarsen: element")) {
1116 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
1117 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
1119 if (levelID < (
int)pcoarsen_schedule.size()) {
1121 auto lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
1122 postSmootherParams.set(
"pcoarsen: hi basis", lo);
1127#ifdef HAVE_MUELU_MATLAB
1128 if (postSmootherType ==
"matlab")
1132#ifdef HAVE_MUELU_TEKO
1133 if (postSmootherType ==
"teko")
1141 if (preSmoother == postSmoother)
1144 manager.
SetFactory(
"PreSmoother", preSmoother);
1145 manager.
SetFactory(
"PostSmoother", postSmoother);
1152 bool reuseSmoothers = (reuseType ==
"S" || reuseType !=
"none");
1153 if (reuseSmoothers) {
1154 auto preSmootherFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<const Factory>(manager.
GetFactory(
"PreSmoother")));
1156 if (preSmootherFactory != Teuchos::null) {
1157 ParameterList postSmootherFactoryParams;
1158 postSmootherFactoryParams.set(
"keep smoother data",
true);
1159 preSmootherFactory->SetParameterList(postSmootherFactoryParams);
1161 keeps.push_back(
keep_pair(
"PreSmoother data", preSmootherFactory.get()));
1164 auto postSmootherFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<const Factory>(manager.
GetFactory(
"PostSmoother")));
1165 if (postSmootherFactory != Teuchos::null) {
1166 ParameterList postSmootherFactoryParams;
1167 postSmootherFactoryParams.set(
"keep smoother data",
true);
1168 postSmootherFactory->SetParameterList(postSmootherFactoryParams);
1170 keeps.push_back(
keep_pair(
"PostSmoother data", postSmootherFactory.get()));
1173 auto coarseFactory = rcp_const_cast<Factory>(rcp_dynamic_cast<const Factory>(manager.
GetFactory(
"CoarseSolver")));
1174 if (coarseFactory != Teuchos::null) {
1175 ParameterList coarseFactoryParams;
1176 coarseFactoryParams.set(
"keep smoother data",
true);
1177 coarseFactory->SetParameterList(coarseFactoryParams);
1179 keeps.push_back(
keep_pair(
"PreSmoother data", coarseFactory.get()));
1183 if ((reuseType ==
"RAP" && levelID) || (reuseType ==
"full")) {
1202template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1207 bool isCustomCoarseSolver =
1208 paramList.isParameter(
"coarse: type") ||
1209 paramList.isParameter(
"coarse: params");
1211 manager.
SetFactory(
"CoarseSolver", Teuchos::null);
1213 }
else if (isCustomCoarseSolver) {
1220 if (paramList.isParameter(
"coarse: overlap"))
1221 overlap = paramList.get<
int>(
"coarse: overlap");
1223 ParameterList coarseParams;
1224 if (paramList.isSublist(
"coarse: params"))
1225 coarseParams = paramList.sublist(
"coarse: params");
1226 else if (defaultList.isSublist(
"coarse: params"))
1227 coarseParams = defaultList.sublist(
"coarse: params");
1229 using strings = std::unordered_set<std::string>;
1231 RCP<SmootherPrototype> coarseSmoother;
1235 if (strings({
"RELAXATION",
"CHEBYSHEV",
"ILUT",
"ILU",
"RILUK",
"SCHWARZ",
"Amesos",
1236 "BLOCK RELAXATION",
"BLOCK_RELAXATION",
"BLOCKRELAXATION",
1237 "SPARSE BLOCK RELAXATION",
"SPARSE_BLOCK_RELAXATION",
"SPARSEBLOCKRELAXATION",
1238 "LINESMOOTHING_BANDEDRELAXATION",
"LINESMOOTHING_BANDED_RELAXATION",
"LINESMOOTHING_BANDED RELAXATION",
1239 "LINESMOOTHING_TRIDIRELAXATION",
"LINESMOOTHING_TRIDI_RELAXATION",
"LINESMOOTHING_TRIDI RELAXATION",
1240 "LINESMOOTHING_TRIDIAGONALRELAXATION",
"LINESMOOTHING_TRIDIAGONAL_RELAXATION",
"LINESMOOTHING_TRIDIAGONAL RELAXATION",
1241 "TOPOLOGICAL",
"FAST_ILU",
"FAST_IC",
"FAST_ILDL",
"HIPTMAIR"})
1242 .count(coarseType)) {
1243 coarseSmoother = rcp(
new TrilinosSmoother(coarseType, coarseParams, overlap));
1245#ifdef HAVE_MUELU_MATLAB
1246 if (coarseType ==
"matlab")
1250#ifdef HAVE_MUELU_TEKO
1251 if (coarseType ==
"teko")
1255 coarseSmoother = rcp(
new DirectSolver(coarseType, coarseParams));
1265template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1268 FactoryManager& manager,
int levelID, std::vector<keep_pair>& )
const {
1269 ParameterList rParams;
1276 rFactory->SetParameterList(rParams);
1284 rFactory->SetFactory(
"D0", this->
GetFactoryManager(levelID - 1)->GetFactory(
"D0"));
1296template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1299 int levelID, std::vector<keep_pair>& )
const {
1300 ParameterList rParams;
1307 rFactory->SetParameterList(rParams);
1315 rFactory->SetFactory(
"D0", this->
GetFactoryManager(levelID - 1)->GetFactory(
"D0"));
1327 manager.
SetFactory(
"Ppattern", patternFactory);
1331 ParameterList constraintParams;
1332 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
1334 constraintParams.set(
"emin: constraint type",
"maxwell");
1335 constraintFactory->SetParameterList(constraintParams);
1336 manager.
SetFactory(
"Constraint", constraintFactory);
1342 ParameterList Pparams;
1345 if (reuseType ==
"emin") {
1347 Pparams.set(
"Keep P0",
true);
1348 Pparams.set(
"Keep Constraint0",
true);
1350 P->SetParameterList(Pparams);
1351 P->SetFactory(
"P", constraintFactory);
1352 P->SetFactory(
"Constraint", constraintFactory);
1359template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1362 FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
1363 using strings = std::unordered_set<std::string>;
1368 TEUCHOS_TEST_FOR_EXCEPTION(!strings({
"uncoupled",
"coupled",
"brick",
"matlab",
"notay",
"classical"}).count(aggType),
1372 RCP<AmalgamationFactory> amalgFact;
1373 if (aggType ==
"classical") {
1375 manager.
SetFactory(
"UnAmalgamationInfo", amalgFact);
1379 RCP<Factory> dropFactory;
1382#ifdef HAVE_MUELU_MATLAB
1384 ParameterList socParams = paramList.sublist(
"strength-of-connection: params");
1385 dropFactory->SetParameterList(socParams);
1387 throw std::runtime_error(
"Cannot use MATLAB evolutionary strength-of-connection - MueLu was not configured with MATLAB support.");
1391 ParameterList dropParams;
1397 dropFactory->SetParameterList(dropParams);
1400 ParameterList dropParams;
1401 if (!rcp_dynamic_cast<CoalesceDropFactory>(dropFactory).is_null())
1402 dropParams.set(
"lightweight wrap",
true);
1416#ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1441#ifdef HAVE_MUELU_COALESCEDROP_ALLOW_OLD_PARAMETERS
1442 if (!dropParams.isParameter(
"aggregation: drop scheme") ||
1443 (dropParams.isParameter(
"aggregation: drop scheme") &&
1444 ((dropParams.get<std::string>(
"aggregation: drop scheme") !=
"point-wise") && (dropParams.get<std::string>(
"aggregation: drop scheme") !=
"cut-drop")))) {
1445 Teuchos::ParameterList dropParamsWithDefaults(dropParams);
1453 TEUCHOS_TEST_FOR_EXCEPTION(dropParams.isParameter(
"aggregation: strength-of-connection: matrix") ||
1454 dropParams.isParameter(
"aggregation: strength-of-connection: measure") ||
1455 dropParams.isParameter(
"aggregation: use blocking"),
1456 Teuchos::Exceptions::InvalidParameterType,
1457 "The inputs contain a mix of old and new dropping parameters:\n\n"
1458 << dropParams <<
"\n\nKeep in mind that defaults are set for old parameters, so this gets interpreted as\n\n"
1459 << dropParamsWithDefaults);
1463 if (!amalgFact.is_null())
1464 dropFactory->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
1466 if (dropParams.isParameter(
"aggregation: drop scheme")) {
1467 std::string drop_scheme = dropParams.get<std::string>(
"aggregation: drop scheme");
1468 if (drop_scheme ==
"block diagonal colored signed classical")
1469 manager.
SetFactory(
"Coloring Graph", dropFactory);
1471 (drop_scheme.find(
"block diagonal") != std::string::npos || drop_scheme ==
"signed classical")) {
1473 dropFactory->SetFactory(
"BlockNumber", this->
GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1475 dropFactory->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1480 if (dropParams.isParameter(
"aggregation: strength-of-connection: matrix") && dropParams.get<std::string>(
"aggregation: strength-of-connection: matrix") ==
"MinvA") {
1488 if ((socMatrix ==
"MinvA") && (paramList.isSublist(
"project auxiliary matrices"))) {
1489 auto projectList = paramList.sublist(
"project auxiliary matrices");
1490 dropParams.set(
"project auxiliary matrices", projectList);
1492 dropFactory->SetParameterList(dropParams);
1497#ifndef HAVE_MUELU_MATLAB
1498 if (aggType ==
"matlab")
1499 throw std::runtime_error(
"Cannot use MATLAB aggregation - MueLu was not configured with MATLAB support.");
1501 RCP<Factory> aggFactory;
1502 if (aggType ==
"uncoupled") {
1504 ParameterList aggParams;
1524 aggFactory->SetParameterList(aggParams);
1526 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
1527 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1535 TEUCHOS_TEST_FOR_EXCEPTION(
true,
1537 "MIS2 algorithms require the use of a symmetrized graph. Please set \"aggregation: symmetrize graph after dropping\" to either \"strong wins\" or set it to \"weak wins\" with \"aggregation: dropping may create Dirichlet\" set to \"true\".");
1539 }
else if (aggType ==
"brick") {
1541 ParameterList aggParams;
1548 aggFactory->SetParameterList(aggParams);
1552 manager.
SetFactory(
"DofsPerNode", aggFactory);
1558 aggFactory->SetFactory(
"Coordinates", this->
GetFactoryManager(levelID - 1)->GetFactory(
"Coordinates"));
1560 }
else if (aggType ==
"classical") {
1563 ParameterList mapParams;
1567 ParameterList tempParams;
1569 std::string drop_algo = tempParams.get<std::string>(
"aggregation: drop scheme");
1570 if (drop_algo ==
"block diagonal colored signed classical") {
1571 mapParams.set(
"aggregation: coloring: use color graph",
true);
1572 mapFact->SetFactory(
"Coloring Graph", manager.
GetFactory(
"Coloring Graph"));
1574 mapFact->SetParameterList(mapParams);
1575 mapFact->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1576 mapFact->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
1582 ParameterList aggParams;
1585 aggFactory->SetParameterList(aggParams);
1586 aggFactory->SetFactory(
"FC Splitting", manager.
GetFactory(
"FC Splitting"));
1587 aggFactory->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1588 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
1589 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1591 if (drop_algo.find(
"block diagonal") != std::string::npos || drop_algo ==
"signed classical") {
1593 aggFactory->SetFactory(
"BlockNumber", this->
GetFactoryManager(levelID - 1)->GetFactory(
"BlockNumber"));
1595 aggFactory->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
1602 if (reuseType ==
"tP" && levelID) {
1604 keeps.push_back(
keep_pair(
"Ptent", aggFactory.get()));
1607 }
else if (aggType ==
"notay") {
1609 ParameterList aggParams;
1614 aggFactory->SetParameterList(aggParams);
1615 aggFactory->SetFactory(
"DofsPerNode", manager.
GetFactory(
"Graph"));
1616 aggFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1618#ifdef HAVE_MUELU_MATLAB
1619 else if (aggType ==
"matlab") {
1620 ParameterList aggParams = paramList.sublist(
"aggregation: params");
1622 aggFactory->SetParameterList(aggParams);
1626 manager.
SetFactory(
"Aggregates", aggFactory);
1630 coarseMap->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1635 ParameterList ptentParams;
1636 if (paramList.isSublist(
"matrixmatrix: kernel params"))
1637 ptentParams.sublist(
"matrixmatrix: kernel params",
false) = paramList.sublist(
"matrixmatrix: kernel params");
1638 if (defaultList.isSublist(
"matrixmatrix: kernel params"))
1639 ptentParams.sublist(
"matrixmatrix: kernel params",
false) = defaultList.sublist(
"matrixmatrix: kernel params");
1643 Ptent->SetParameterList(ptentParams);
1644 Ptent->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1645 Ptent->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1648 if (reuseType ==
"tP" && levelID) {
1649 keeps.push_back(
keep_pair(
"Nullspace", Ptent.get()));
1650 keeps.push_back(
keep_pair(
"P", Ptent.get()));
1657template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1660 int , std::vector<keep_pair>& keeps)
const {
1661 if (paramList.isParameter(
"A") && !paramList.get<RCP<Matrix>>(
"A").is_null()) {
1667 ParameterList RAPparams;
1669 RCP<RAPFactory> RAP;
1670 RCP<RAPShiftFactory> RAPs;
1673 std::string alg = paramList.get(
"rap: algorithm",
"galerkin");
1674 if (alg ==
"shift" || alg ==
"non-galerkin") {
1688 if (paramList.isSublist(
"matrixmatrix: kernel params"))
1689 RAPparams.sublist(
"matrixmatrix: kernel params",
false) = paramList.sublist(
"matrixmatrix: kernel params");
1690 if (defaultList.isSublist(
"matrixmatrix: kernel params"))
1691 RAPparams.sublist(
"matrixmatrix: kernel params",
false) = defaultList.sublist(
"matrixmatrix: kernel params");
1698 if (!paramList.isParameter(
"rap: triple product") &&
1699 paramList.isType<std::string>(
"multigrid algorithm") &&
1700 paramList.get<std::string>(
"multigrid algorithm") ==
"unsmoothed")
1701 paramList.set(
"rap: triple product",
true);
1706 if (paramList.isParameter(
"aggregation: allow empty prolongator columns")) {
1707 RAPparams.set(
"CheckMainDiagonal", paramList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1708 RAPparams.set(
"RepairMainDiagonal", paramList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1709 }
else if (defaultList.isParameter(
"aggregation: allow empty prolongator columns")) {
1710 RAPparams.set(
"CheckMainDiagonal", defaultList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1711 RAPparams.set(
"RepairMainDiagonal", defaultList.get<
bool>(
"aggregation: allow empty prolongator columns"));
1714 }
catch (Teuchos::Exceptions::InvalidParameterType&) {
1715 TEUCHOS_TEST_FOR_EXCEPTION_PURE_MSG(
true, Teuchos::Exceptions::InvalidParameterType,
1716 "Error: parameter \"aggregation: allow empty prolongator columns\" must be of type " << Teuchos::TypeNameTraits<bool>::name());
1719 if (!RAP.is_null()) {
1720 RAP->SetParameterList(RAPparams);
1721 RAP->SetFactory(
"P", manager.
GetFactory(
"P"));
1723 RAPs->SetParameterList(RAPparams);
1724 RAPs->SetFactory(
"P", manager.
GetFactory(
"P"));
1729 RAP->SetFactory(
"R", manager.
GetFactory(
"R"));
1731 RAPs->SetFactory(
"R", manager.
GetFactory(
"R"));
1739 RAP->AddTransferFactory(matrixAnalysisFact);
1741 RAPs->AddTransferFactory(matrixAnalysisFact);
1747 ParameterList aggQualityParams;
1756 aggQualityFact->SetParameterList(aggQualityParams);
1757 aggQualityFact->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1758 aggQualityFact->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1759 manager.
SetFactory(
"AggregateQualities", aggQualityFact);
1762 RAP->AddTransferFactory(aggQualityFact);
1764 RAPs->AddTransferFactory(aggQualityFact);
1769 ParameterList aggExportParams;
1779 aggExport->SetParameterList(aggExportParams);
1780 aggExport->SetFactory(
"AggregateQualities", manager.
GetFactory(
"AggregateQualities"));
1781 aggExport->SetFactory(
"DofsPerNode", manager.
GetFactory(
"DofsPerNode"));
1782 aggExport->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1783 aggExport->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
1786 RAP->AddTransferFactory(aggExport);
1788 RAPs->AddTransferFactory(aggExport);
1796 auto useFiltering =
set_var_2list<bool>(paramList, defaultList,
"sa: use filtered matrix");
1797 bool filteringChangesMatrix = useFiltering && !
test_param_2list<double>(paramList, defaultList,
"aggregation: drop tol", 0);
1799 if (reuseType ==
"RP" || (reuseType ==
"tP" && !filteringChangesMatrix)) {
1800 if (!RAP.is_null()) {
1801 keeps.push_back(
keep_pair(
"AP reuse data", RAP.get()));
1802 keeps.push_back(
keep_pair(
"RAP reuse data", RAP.get()));
1805 keeps.push_back(
keep_pair(
"AP reuse data", RAPs.get()));
1806 keeps.push_back(
keep_pair(
"RAP reuse data", RAPs.get()));
1814template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1818 bool have_userCO =
false;
1819 if (paramList.isParameter(
"Coordinates") && !paramList.get<RCP<MultiVector>>(
"Coordinates").is_null())
1828 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1829 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1832 auto RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(manager.
GetFactory(
"A")));
1833 if (!RAP.is_null()) {
1834 RAP->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1836 auto RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(manager.
GetFactory(
"A")));
1837 RAPs->AddTransferFactory(manager.
GetFactory(
"Coordinates"));
1846template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1850 bool have_userMaterial =
false;
1851 if (paramList.isParameter(
"Material") && !paramList.get<RCP<MultiVector>>(
"Material").is_null())
1852 have_userMaterial =
true;
1855 if (have_userMaterial) {
1859 ParameterList materialTransferParameters;
1860 materialTransferParameters.set(
"Vector name",
"Material");
1861 materialTransferParameters.set(
"Transfer name",
"Aggregates");
1862 materialTransferParameters.set(
"Normalize",
true);
1863 materialTransfer->SetParameterList(materialTransferParameters);
1864 materialTransfer->SetFactory(
"Transfer factory", manager.
GetFactory(
"Aggregates"));
1865 materialTransfer->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1866 manager.
SetFactory(
"Material", materialTransfer);
1868 auto RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(manager.
GetFactory(
"A")));
1869 if (!RAP.is_null()) {
1870 RAP->AddTransferFactory(manager.
GetFactory(
"Material"));
1872 auto RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(manager.
GetFactory(
"A")));
1873 RAPs->AddTransferFactory(manager.
GetFactory(
"Material"));
1882template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1885 FactoryManager& manager,
int levelID, std::vector<keep_pair>& )
const {
1889 auto RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(manager.
GetFactory(
"A")));
1890 auto RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(manager.
GetFactory(
"A")));
1891 if (!RAP.is_null() || !RAPs.is_null()) {
1893 if (multigridAlgo ==
"classical")
1894 fact->SetFactory(
"P Graph", manager.
GetFactory(
"P Graph"));
1896 fact->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
1897 fact->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
1899 fact->SetFactory(VarName, this->
GetFactoryManager(levelID - 1)->GetFactory(VarName));
1904 RAP->AddTransferFactory(manager.
GetFactory(VarName));
1906 RAPs->AddTransferFactory(manager.
GetFactory(VarName));
1914template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1917 FactoryManager& manager,
int levelID, std::vector<keep_pair>& )
const {
1922 else if (levelID > 0) {
1924 auto RebalAc = rcp_const_cast<RebalanceAcFactory>(rcp_dynamic_cast<const RebalanceAcFactory>(Afact));
1925 RCP<RAPFactory> RAP;
1926 RCP<RAPShiftFactory> RAPs;
1927 if (!RebalAc.is_null()) {
1928 auto Afact2 = RebalAc->GetFactory(
"A");
1929 RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(Afact2));
1930 RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(Afact2));
1932 RAP = rcp_const_cast<RAPFactory>(rcp_dynamic_cast<const RAPFactory>(Afact));
1933 RAPs = rcp_const_cast<RAPShiftFactory>(rcp_dynamic_cast<const RAPShiftFactory>(Afact));
1936 if (!RAP.is_null() || !RAPs.is_null()) {
1939 ParameterList transferParameters;
1940 transferParameters.set(
"Matrix name", VarName);
1942 mtf->SetParameterList(transferParameters);
1944 if (!RAP.is_null()) {
1945 mtf->SetFactory(
"P", RAP->GetFactory(
"P"));
1947 mtf->SetFactory(
"R", RAP->GetFactory(
"R"));
1948 RAP->AddTransferFactory(mtf);
1950 mtf->SetFactory(
"P", RAPs->GetFactory(
"P"));
1952 mtf->SetFactory(
"R", RAPs->GetFactory(
"R"));
1953 RAPs->AddTransferFactory(mtf);
1957 if (!enableRepart) {
1961 Teuchos::ParameterList rebalParams;
1962 rebalParams.set(
"Matrix name", VarName);
1963 auto useSubCommInPlace =
set_var_2list<bool>(paramList, defaultList,
"repartition: use subcommunicators in place");
1964 rebalParams.set(
"repartition: use subcommunicators in place", useSubCommInPlace);
1965 if (useSubCommInPlace) {
1966 auto inPlaceMapFact = manager.
GetFactory(
"InPlaceMap");
1967 rebalFact->SetFactory(
"InPlaceMap", inPlaceMapFact);
1969 TEUCHOS_ASSERT(!RebalAc.is_null());
1970 RCP<const FactoryBase> importerFact;
1971 importerFact = RebalAc->GetFactory(
"Importer");
1972 rebalFact->SetFactory(
"Importer", importerFact);
1973 RebalAc->AddRebalanceFactory(rebalFact);
1976 rebalFact->SetParameterList(rebalParams);
1977 rebalFact->SetFactory(
"A", mtf);
1988template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1993 ParameterList myParams;
1996 fact->SetParameterList(myParams);
2004template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2007 int , std::vector<keep_pair>& )
const {
2009 bool have_userR =
false;
2010 if (paramList.isParameter(
"R") && !paramList.get<RCP<Matrix>>(
"R").is_null())
2018 if (isSymmetric ==
false && (multigridAlgo ==
"unsmoothed" || multigridAlgo ==
"emin")) {
2019 this->
GetOStream(
Warnings0) <<
"Switching \"problem: symmetric\" parameter to symmetric as multigrid algorithm. " << multigridAlgo <<
" is primarily supposed to be used for symmetric problems.\n\n"
2020 <<
"Please note: if you are using \"unsmoothed\" transfer operators the \"problem: symmetric\" parameter "
2021 <<
"has no real mathematical meaning, i.e. you can use it for non-symmetric\n"
2022 <<
"problems, too. With \"problem: symmetric\"=\"symmetric\" you can use implicit transpose for building "
2023 <<
"the restriction operators which may drastically reduce the amount of consumed memory." << std::endl;
2027 "Petrov-Galerkin smoothed transfer operators are only allowed for non-symmetric problems: Set \"problem: symmetric\" to false!\n"
2028 "While PG smoothed transfer operators generally would also work for symmetric problems this is an unusual use case. "
2029 "You can use the factory-based xml interface though if you need PG-AMG for symmetric problems.");
2048 if (paramList.isParameter(
"restriction: scale nullspace") && paramList.get<
bool>(
"restriction: scale nullspace")) {
2050 Teuchos::ParameterList tentPlist;
2051 tentPlist.set(
"Nullspace name",
"Scaled Nullspace");
2052 tentPFactory->SetParameterList(tentPlist);
2053 tentPFactory->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
2054 tentPFactory->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
2057 R->SetFactory(
"P", tentPFactory);
2064template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2067 int levelID, std::vector<keep_pair>& keeps, RCP<Factory>& nullSpaceFactory)
const {
2072#if defined(HAVE_MPI) && (defined(HAVE_MUELU_ZOLTAN) || defined(HAVE_MUELU_ZOLTAN2))
2073 auto enableInPlace =
set_var_2list<bool>(paramList, defaultList,
"repartition: use subcommunicators in place");
2110 "Reuse types \"tP\" and \"PR\" require \"repartition: rebalance P and R\" set to \"false\"");
2117 "Invalid partitioner name: \"" << partName <<
"\". Valid options: \"zoltan\", \"zoltan2\"");
2119#ifndef HAVE_MUELU_ZOLTAN
2120 bool switched =
false;
2121 if (partName ==
"zoltan") {
2122 this->
GetOStream(
Warnings0) <<
"Zoltan interface is not available, trying to switch to Zoltan2" << std::endl;
2123 partName =
"zoltan2";
2127#ifndef HAVE_MUELU_ZOLTAN2
2128 bool switched =
false;
2132#ifndef HAVE_MUELU_ZOLTAN2
2133 if (partName ==
"zoltan2" && !switched) {
2134 this->
GetOStream(
Warnings0) <<
"Zoltan2 interface is not available, trying to switch to Zoltan" << std::endl;
2135 partName =
"zoltan";
2139 auto nodeRepartitionLevel =
set_var_2list<int>(paramList, defaultList,
"repartition: node repartition level");
2143 ParameterList repartheurParams;
2152 repartheurFactory->SetParameterList(repartheurParams);
2153 repartheurFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
2154 manager.
SetFactory(
"number of partitions", repartheurFactory);
2155 manager.
SetFactory(
"repartition: heuristic target rows per process", repartheurFactory);
2158 RCP<Factory> partitioner;
2159 if (levelID == nodeRepartitionLevel) {
2162 ParameterList partParams;
2164 partitioner->SetParameterList(partParams);
2165 partitioner->SetFactory(
"Node Comm", manager.
GetFactory(
"Node Comm"));
2166 }
else if (partName ==
"zoltan") {
2167#ifdef HAVE_MUELU_ZOLTAN
2173 }
else if (partName ==
"zoltan2") {
2174#ifdef HAVE_MUELU_ZOLTAN2
2176 ParameterList partParams;
2177 RCP<const ParameterList> partpartParams = rcp(
new ParameterList(paramList.sublist(
"repartition: params",
false)));
2178 partParams.set(
"ParameterList", partpartParams);
2179 partitioner->SetParameterList(partParams);
2180 partitioner->SetFactory(
"repartition: heuristic target rows per process",
2181 manager.
GetFactory(
"repartition: heuristic target rows per process"));
2187 partitioner->SetFactory(
"A", manager.
GetFactory(
"A"));
2188 partitioner->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
2190 partitioner->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
2191 manager.
SetFactory(
"Partition", partitioner);
2195 ParameterList repartParams;
2200 repartFactory->SetParameterList(repartParams);
2201 repartFactory->SetFactory(
"A", manager.
GetFactory(
"A"));
2202 repartFactory->SetFactory(
"number of partitions", manager.
GetFactory(
"number of partitions"));
2203 repartFactory->SetFactory(
"Partition", manager.
GetFactory(
"Partition"));
2204 manager.
SetFactory(
"Importer", repartFactory);
2205 if (reuseType !=
"none" && reuseType !=
"S" && levelID)
2208 if (enableInPlace) {
2213 ParameterList rebAcParams;
2216 newA->SetParameterList(rebAcParams);
2217 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
2218 newA->SetFactory(
"InPlaceMap", manager.
GetFactory(
"InPlaceMap"));
2223 ParameterList rebAcParams;
2225 newA->SetParameterList(rebAcParams);
2226 newA->SetFactory(
"A", manager.
GetFactory(
"A"));
2227 newA->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
2232 ParameterList newPparams;
2233 newPparams.set(
"type",
"Interpolation");
2235 newPparams.set(
"repartition: rebalance P and R", this->
doPRrebalance_);
2237 newPparams.set(
"repartition: explicit via new copy rebalance P and R",
true);
2240 newP->SetParameterList(newPparams);
2241 newP->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
2242 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
2244 if (!paramList.isParameter(
"semicoarsen: number of levels"))
2245 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
2247 newP->SetFactory(
"Nullspace", manager.
GetFactory(
"P"));
2249 newP->SetFactory(
"Coordinates", manager.
GetFactory(
"Coordinates"));
2253 newP->SetFactory(
"Material", manager.
GetFactory(
"Material"));
2257 newP->SetFactory(
"BlockNumber", manager.
GetFactory(
"BlockNumber"));
2263 ParameterList newRparams;
2264 newRparams.set(
"type",
"Restriction");
2268 newRparams.set(
"repartition: rebalance P and R", this->
doPRrebalance_);
2270 newPparams.set(
"repartition: explicit via new copy rebalance P and R",
true);
2273 newR->SetParameterList(newRparams);
2274 newR->SetFactory(
"Importer", manager.
GetFactory(
"Importer"));
2276 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
2287 ParameterList newNullparams;
2289 nullSpaceFactory->SetFactory(
"Nullspace", newP);
2290 nullSpaceFactory->SetParameterList(newNullparams);
2293 paramList.set(
"repartition: enable",
false);
2306template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2309 int , std::vector<keep_pair>& )
const {
2310 auto enableLowPrecision =
set_var_2list<bool>(paramList, defaultList,
"transfers: half precision");
2312 if (enableLowPrecision) {
2315 ParameterList newPparams;
2316 newPparams.set(
"matrix key",
"P");
2317 newP->SetParameterList(newPparams);
2318 newP->SetFactory(
"P", manager.
GetFactory(
"P"));
2324 ParameterList newRparams;
2325 newRparams.set(
"matrix key",
"R");
2326 newR->SetParameterList(newRparams);
2327 newR->SetFactory(
"R", manager.
GetFactory(
"R"));
2336template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2339 int , std::vector<keep_pair>& , RCP<Factory>& nullSpaceFactory)
const {
2343 bool have_userNS =
false;
2344 if (paramList.isParameter(
"Nullspace") && !paramList.get<RCP<MultiVector>>(
"Nullspace").is_null())
2348 ParameterList newNullparams;
2350 nullSpace->SetParameterList(newNullparams);
2351 nullSpace->SetFactory(
"Nullspace", manager.
GetFactory(
"Ptent"));
2354 nullSpaceFactory = nullSpace;
2356 if (paramList.isParameter(
"restriction: scale nullspace") && paramList.get<
bool>(
"restriction: scale nullspace")) {
2358 scaledNSfactory->SetFactory(
"Nullspace", nullSpaceFactory);
2359 manager.
SetFactory(
"Scaled Nullspace", scaledNSfactory);
2366template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2369 int , std::vector<keep_pair>& )
const {
2371 RCP<Factory> semicoarsenFactory = Teuchos::null;
2372 if (paramList.isParameter(
"semicoarsen: number of levels") &&
2373 paramList.get<
int>(
"semicoarsen: number of levels") > 0) {
2374 ParameterList togglePParams;
2375 ParameterList semicoarsenPParams;
2376 ParameterList linedetectionParams;
2389 linedetectionFactory->SetParameterList(linedetectionParams);
2390 semicoarsenFactory->SetParameterList(semicoarsenPParams);
2391 togglePFactory->SetParameterList(togglePParams);
2393 togglePFactory->AddCoarseNullspaceFactory(semicoarsenFactory);
2394 togglePFactory->AddProlongatorFactory(semicoarsenFactory);
2395 togglePFactory->AddPtentFactory(semicoarsenFactory);
2396 togglePFactory->AddCoarseNullspaceFactory(manager.
GetFactory(
"Ptent"));
2397 togglePFactory->AddProlongatorFactory(manager.
GetFactory(
"P"));
2398 togglePFactory->AddPtentFactory(manager.
GetFactory(
"Ptent"));
2400 manager.
SetFactory(
"CoarseNumZLayers", linedetectionFactory);
2401 manager.
SetFactory(
"LineDetection_Layers", linedetectionFactory);
2402 manager.
SetFactory(
"LineDetection_VertLineIds", linedetectionFactory);
2406 manager.
SetFactory(
"Nullspace", togglePFactory);
2409 if (paramList.isParameter(
"semicoarsen: number of levels") &&
2410 paramList.get<
int>(
"semicoarsen: number of levels") > 0) {
2412 tf->SetFactory(
"Chosen P", manager.
GetFactory(
"P"));
2413 tf->AddCoordTransferFactory(semicoarsenFactory);
2416 coords->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
2417 coords->SetFactory(
"CoarseMap", manager.
GetFactory(
"CoarseMap"));
2418 tf->AddCoordTransferFactory(coords);
2426template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2429 int levelID, std::vector<keep_pair>& keeps)
const {
2430#if defined(HAVE_MUELU_INTREPID2) && defined(HAVE_MUELU_EXPERIMENTAL)
2432 if (defaultList.isParameter(
"pcoarsen: schedule") && defaultList.isParameter(
"pcoarsen: element")) {
2435 auto pcoarsen_schedule = Teuchos::getArrayFromStringParameter<int>(defaultList,
"pcoarsen: schedule");
2436 auto pcoarsen_element = defaultList.get<std::string>(
"pcoarsen: element");
2438 if (levelID >= (
int)pcoarsen_schedule.size()) {
2441 std::string multigridAlgo =
"SA";
2446 ParameterList Pparams;
2448 std::string lo = pcoarsen_element + std::to_string(pcoarsen_schedule[levelID]);
2449 std::string hi = (levelID ? pcoarsen_element + std::to_string(pcoarsen_schedule[levelID - 1]) : lo);
2450 Pparams.set(
"pcoarsen: hi basis", hi);
2451 Pparams.set(
"pcoarsen: lo basis", lo);
2452 P->SetParameterList(Pparams);
2461 ParameterList Pparams;
2465 P->SetParameterList(Pparams);
2478template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2480 UpdateFactoryManager_SA(std::string& multigridAlgo, ParameterList& paramList,
const ParameterList& defaultList,
FactoryManager& manager,
int levelID, std::vector<keep_pair>& keeps)
const {
2483 ParameterList Pparams;
2484 if (paramList.isSublist(
"matrixmatrix: kernel params"))
2485 Pparams.sublist(
"matrixmatrix: kernel params",
false) = paramList.sublist(
"matrixmatrix: kernel params");
2486 if (defaultList.isSublist(
"matrixmatrix: kernel params"))
2487 Pparams.sublist(
"matrixmatrix: kernel params",
false) = defaultList.sublist(
"matrixmatrix: kernel params");
2502 if ((multigridAlgo ==
"smoothed reitzinger") && (levelID > 0)) {
2503 Pparams.set(
"sa: maxwell1 smoothing",
true);
2504 auto useEdgeMatrixForSmoothing =
set_var_2list<bool>(paramList, defaultList,
"sa: use edge matrix for smoothing");
2505 if (!useEdgeMatrixForSmoothing && (!Pparams.isType<
double>(
"sa: damping factor") || (Pparams.get<
double>(
"sa: damping factor") != 0.0)))
2506 P->SetFactory(
"CurlCurl", this->
GetFactoryManager(levelID - 1)->GetFactory(
"CurlCurl"));
2509 P->SetParameterList(Pparams);
2512 auto useFiltering =
set_var_2list<bool>(paramList, defaultList,
"sa: use filtered matrix");
2520 ParameterList fParams;
2531 filterFactory->SetParameterList(fParams);
2532 filterFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
2533 filterFactory->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
2534 filterFactory->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
2536 filterFactory->SetFactory(
"Filtering", manager.
GetFactory(
"Graph"));
2538 P->SetFactory(
"A", filterFactory);
2541 P->SetFactory(
"A", manager.
GetFactory(
"Graph"));
2545 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2548 bool filteringChangesMatrix = useFiltering && !
test_param_2list<double>(paramList, defaultList,
"aggregation: drop tol", 0);
2550 if (reuseType ==
"tP" && !filteringChangesMatrix)
2551 keeps.push_back(
keep_pair(
"AP reuse data", P.get()));
2557template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2560 int , std::vector<keep_pair>& )
const {
2564 "Invalid pattern name: \"" << patternType <<
"\". Valid options: \"AkPtent\"");
2567 ParameterList patternParams;
2569 patternFactory->SetParameterList(patternParams);
2570 patternFactory->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2573 auto useFiltering =
set_var_2list<bool>(paramList, defaultList,
"emin: use filtered matrix");
2581 ParameterList fParams;
2591 filterFactory->SetParameterList(fParams);
2592 filterFactory->SetFactory(
"Graph", manager.
GetFactory(
"Graph"));
2593 filterFactory->SetFactory(
"Aggregates", manager.
GetFactory(
"Aggregates"));
2594 filterFactory->SetFactory(
"UnAmalgamationInfo", manager.
GetFactory(
"UnAmalgamationInfo"));
2596 filterFactory->SetFactory(
"Filtering", manager.
GetFactory(
"Graph"));
2598 patternFactory->SetFactory(
"A", filterFactory);
2601 patternFactory->SetFactory(
"A", manager.
GetFactory(
"Graph"));
2605 manager.
SetFactory(
"Ppattern", patternFactory);
2609 Teuchos::ParameterList constraintParams;
2611 constraintParams.set(
"emin: constraint type",
"nullspace");
2612 constraintFactory->SetFactory(
"Ppattern", manager.
GetFactory(
"Ppattern"));
2613 constraintFactory->SetFactory(
"CoarseNullspace", manager.
GetFactory(
"Ptent"));
2614 manager.
SetFactory(
"Constraint", constraintFactory);
2617 ParameterList Pparams;
2620 if (reuseType ==
"emin") {
2622 Pparams.set(
"Keep P0",
true);
2623 Pparams.set(
"Keep Constraint0",
true);
2628 P->SetParameterList(Pparams);
2629 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2630 P->SetFactory(
"Constraint", manager.
GetFactory(
"Constraint"));
2637template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2640 int , std::vector<keep_pair>& )
const {
2642 "Implicit transpose not supported with Petrov-Galerkin smoothed transfer operators: Set \"transpose: use implicit\" to false!\n"
2643 "Petrov-Galerkin transfer operator smoothing for non-symmetric problems requires a separate handling of the restriction operator which "
2644 "does not allow the usage of implicit transpose easily.");
2648 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2655template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2660 ParameterList Pparams;
2663 P->SetParameterList(Pparams);
2670template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2675 ParameterList Pparams;
2679 P->SetParameterList(Pparams);
2686template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2689 int , std::vector<keep_pair>& )
const {
2690#ifdef HAVE_MUELU_MATLAB
2691 ParameterList Pparams = paramList.sublist(
"transfer: params");
2693 P->SetParameterList(Pparams);
2694 P->SetFactory(
"P", manager.
GetFactory(
"Ptent"));
2702#undef MUELU_KOKKOS_FACTORY
2706template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2708 ParameterList paramList = constParamList;
2711 const int maxLevels = 100;
2714 std::vector<ParameterList> paramLists;
2715 for (
int levelID = 0; levelID < maxLevels; levelID++) {
2716 std::string sublistName =
"level " +
toString(levelID);
2717 if (paramList.isSublist(sublistName)) {
2718 paramLists.push_back(paramList.sublist(sublistName));
2720 paramList.remove(sublistName);
2723 paramLists.push_back(paramList);
2725#ifdef HAVE_MUELU_MATLAB
2727 for (
size_t i = 0; i < paramLists.size(); i++) {
2728 std::vector<std::string> customVars;
2730 for (Teuchos::ParameterList::ConstIterator it = paramLists[i].begin(); it != paramLists[i].end(); it++) {
2731 std::string paramName = paramLists[i].name(it);
2734 customVars.push_back(paramName);
2738 for (
size_t j = 0; j < customVars.size(); j++)
2739 paramLists[i].remove(customVars[j],
false);
2743 const int maxDepth = 0;
2744 for (
size_t i = 0; i < paramLists.size(); i++) {
2747 paramLists[i].validateParameters(validList, maxDepth);
2749 }
catch (
const Teuchos::Exceptions::InvalidParameterName& e) {
2750 std::string eString = e.what();
2753 size_t nameStart = eString.find_first_of(
'"') + 1;
2754 size_t nameEnd = eString.find_first_of(
'"', nameStart);
2755 std::string name = eString.substr(nameStart, nameEnd - nameStart);
2757 size_t bestScore = 100;
2758 std::string bestName =
"";
2759 for (ParameterList::ConstIterator it = validList.begin(); it != validList.end(); it++) {
2760 const std::string& pName = validList.name(it);
2762 size_t score =
LevenshteinDistance(name.c_str(), name.length(), pName.c_str(), pName.length());
2764 if (score < bestScore) {
2769 if (bestScore < 10 && bestName !=
"") {
2770 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameterName,
2771 eString <<
"The parameter name \"" + name +
"\" is not valid. Did you mean \"" + bestName <<
"\"?\n");
2774 TEUCHOS_TEST_FOR_EXCEPTION(
true, Teuchos::Exceptions::InvalidParameterName,
2775 eString <<
"The parameter name \"" + name +
"\" is not valid.\n");
2784template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
2789 ParameterList paramList = constParamList;
2796 if (paramList.isSublist(
"Matrix")) {
2814 if (paramList.isSublist(
"Factories"))
2815 this->
BuildFactoryMap(paramList.sublist(
"Factories"), factoryMap, factoryMap, factoryManagers);
2829 if (paramList.isSublist(
"Hierarchy")) {
2830 ParameterList hieraList = paramList.sublist(
"Hierarchy");
2833 if (hieraList.isParameter(
"max levels")) {
2835 hieraList.remove(
"max levels");
2838 if (hieraList.isParameter(
"coarse: max size")) {
2840 hieraList.remove(
"coarse: max size");
2843 if (hieraList.isParameter(
"repartition: rebalance P and R")) {
2844 this->
doPRrebalance_ = hieraList.get<
bool>(
"repartition: rebalance P and R");
2845 hieraList.remove(
"repartition: rebalance P and R");
2848 if (hieraList.isParameter(
"transpose: use implicit")) {
2850 hieraList.remove(
"transpose: use implicit");
2853 if (hieraList.isParameter(
"fuse prolongation and update")) {
2855 hieraList.remove(
"fuse prolongation and update");
2858 if (hieraList.isParameter(
"nullspace: suppress dimension check")) {
2860 hieraList.remove(
"nullspace: suppress dimension check");
2863 if (hieraList.isParameter(
"number of vectors")) {
2865 hieraList.remove(
"number of vectors");
2868 if (hieraList.isSublist(
"matvec params"))
2869 this->
matvecParams_ = Teuchos::parameterList(hieraList.sublist(
"matvec params"));
2871 if (hieraList.isParameter(
"coarse grid correction scaling factor")) {
2872 this->
scalingFactor_ = hieraList.get<
double>(
"coarse grid correction scaling factor");
2873 hieraList.remove(
"coarse grid correction scaling factor");
2877 if (hieraList.isParameter(
"cycle type")) {
2878 std::map<std::string, CycleType> cycleMap;
2882 std::string cycleType = hieraList.get<std::string>(
"cycle type");
2883 TEUCHOS_TEST_FOR_EXCEPTION(cycleMap.count(cycleType) == 0,
Exceptions::RuntimeError,
"Invalid cycle type: \"" << cycleType <<
"\"");
2884 this->
Cycle_ = cycleMap[cycleType];
2887 if (hieraList.isParameter(
"W cycle start level")) {
2891 if (hieraList.isParameter(
"hierarchy label")) {
2892 this->
hierarchyLabel_ = hieraList.get<std::string>(
"hierarchy label");
2895 if (hieraList.isParameter(
"verbosity")) {
2896 std::string vl = hieraList.get<std::string>(
"verbosity");
2897 hieraList.remove(
"verbosity");
2901 if (hieraList.isParameter(
"output filename"))
2904 if (hieraList.isParameter(
"dependencyOutputLevel"))
2908 if (hieraList.isParameter(
"reuse"))
2911 if (hieraList.isSublist(
"DataToWrite")) {
2914 ParameterList foo = hieraList.sublist(
"DataToWrite");
2915 std::string dataName =
"Matrices";
2916 if (foo.isParameter(dataName))
2917 this->
matricesToPrint_[
"A"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2918 dataName =
"Prolongators";
2919 if (foo.isParameter(dataName))
2920 this->
matricesToPrint_[
"P"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2921 dataName =
"Restrictors";
2922 if (foo.isParameter(dataName))
2923 this->
matricesToPrint_[
"R"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2925 if (foo.isParameter(dataName))
2926 this->
matricesToPrint_[
"D0"] = Teuchos::getArrayFromStringParameter<int>(foo, dataName);
2930 for (ParameterList::ConstIterator param = hieraList.begin(); param != hieraList.end(); ++param) {
2931 const std::string& paramName = hieraList.name(param);
2933 if (paramName !=
"DataToWrite" && hieraList.isSublist(paramName)) {
2934 ParameterList levelList = hieraList.sublist(paramName);
2937 if (levelList.isParameter(
"startLevel")) {
2938 startLevel = levelList.get<
int>(
"startLevel");
2939 levelList.remove(
"startLevel");
2941 int numDesiredLevel = 1;
2942 if (levelList.isParameter(
"numDesiredLevel")) {
2943 numDesiredLevel = levelList.get<
int>(
"numDesiredLevel");
2944 levelList.remove(
"numDesiredLevel");
2958 BuildFactoryMap(levelList, factoryMap, levelFactoryMap, factoryManagers);
2960 RCP<FactoryManager> m = rcp(
new FactoryManager(levelFactoryMap));
2961 if (hieraList.isParameter(
"use kokkos refactor"))
2962 m->SetKokkosRefactor(hieraList.get<
bool>(
"use kokkos refactor"));
2964 if (startLevel >= 0)
2967 TEUCHOS_TEST_FOR_EXCEPTION(
true,
Exceptions::RuntimeError,
"MueLu::ParameterListInterpreter():: invalid level id");
3096template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
3099 for (ParameterList::ConstIterator param = paramList.begin(); param != paramList.end(); ++param) {
3100 const std::string& paramName = paramList.name(param);
3101 const Teuchos::ParameterEntry& paramValue = paramList.entry(param);
3105 if (paramValue.isList()) {
3106 ParameterList paramList1 = Teuchos::getValue<ParameterList>(paramValue);
3107 if (paramList1.isParameter(
"factory")) {
3110 "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.");
3112 factoryMapOut[paramName] =
factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
3114 }
else if (paramList1.isParameter(
"dependency for")) {
3116 "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.");
3118 std::string factoryName = paramList1.get<std::string>(
"dependency for");
3120 RCP<const FactoryBase> factbase = factoryMapIn.find(factoryName )->second;
3122 "MueLu::ParameterListInterpreter(): could not find factory " + factoryName +
" in factory map. Did you define it before?");
3124 RCP<const Factory> factoryconst = Teuchos::rcp_dynamic_cast<const Factory>(factbase);
3125 RCP<Factory> factory = Teuchos::rcp_const_cast<Factory>(factoryconst);
3128 RCP<const ParameterList> validParamList = factory->GetValidParameterList();
3129 for (ParameterList::ConstIterator vparam = validParamList->begin(); vparam != validParamList->end(); ++vparam) {
3130 const std::string& pName = validParamList->name(vparam);
3132 if (!paramList1.isParameter(pName)) {
3137 if (validParamList->isType<RCP<const FactoryBase>>(pName)) {
3139 RCP<const FactoryBase> generatingFact =
factFact_->BuildFactory(paramList1.getEntry(pName), factoryMapIn, factoryManagers);
3140 factory->SetFactory(pName, generatingFact.create_weak());
3142 }
else if (validParamList->isType<RCP<const ParameterList>>(pName)) {
3143 if (pName ==
"ParameterList") {
3148 RCP<const ParameterList> subList = Teuchos::sublist(rcp(
new ParameterList(paramList1)), pName);
3149 factory->SetParameter(pName, ParameterEntry(subList));
3152 factory->SetParameter(pName, paramList1.getEntry(pName));
3156 }
else if (paramList1.isParameter(
"group")) {
3158 std::string groupType = paramList1.get<std::string>(
"group");
3160 "group must be of type \"FactoryManager\".");
3162 ParameterList groupList = paramList1;
3163 groupList.remove(
"group");
3165 bool setKokkosRefactor =
false;
3167 if (groupList.isParameter(
"use kokkos refactor")) {
3168 kokkosRefactor = groupList.get<
bool>(
"use kokkos refactor");
3169 groupList.remove(
"use kokkos refactor");
3170 setKokkosRefactor =
true;
3174 BuildFactoryMap(groupList, factoryMapIn, groupFactoryMap, factoryManagers);
3178 RCP<FactoryManager> m = rcp(
new FactoryManager(groupFactoryMap));
3179 if (setKokkosRefactor)
3180 m->SetKokkosRefactor(kokkosRefactor);
3181 factoryManagers[paramName] = m;
3184 this->
GetOStream(
Warnings0) <<
"Could not interpret parameter list " << paramList1 << std::endl;
3186 "XML Parameter list must either be of type \"factory\" or of type \"group\".");
3190 factoryMapOut[paramName] =
factFact_->BuildFactory(paramValue, factoryMapIn, factoryManagers);
3198template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
3201 Matrix& A =
dynamic_cast<Matrix&
>(Op);
3202 if (A.IsFixedBlockSizeSet() && (A.GetFixedBlockSize() !=
blockSize_))
3204 <<
"instead of " << A.GetFixedBlockSize() <<
" (provided matrix)." << std::endl
3205 <<
"You may want to check \"number of equations\" (or \"PDE equations\" for factory style list) parameter." << std::endl;
3211 MatrixUtils::checkLocalRowMapMatchesColMap(A);
3213 }
catch (std::bad_cast&) {
3214 this->
GetOStream(
Warnings0) <<
"Skipping setting block size as the operator is not a matrix" << std::endl;
3218template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
3227static bool compare(
const ParameterList& list1,
const ParameterList& list2) {
3230 for (ParameterList::ConstIterator it = list1.begin(); it != list1.end(); it++) {
3231 const std::string& name = it->first;
3232 const Teuchos::ParameterEntry& entry1 = it->second;
3234 const Teuchos::ParameterEntry* entry2 = list2.getEntryPtr(name);
3237 if (entry1.isList() && entry2->isList()) {
3238 compare(Teuchos::getValue<ParameterList>(entry1), Teuchos::getValue<ParameterList>(*entry2));
3241 if (entry1.getAny(
false) != entry2->getAny(
false))
3248static inline bool areSame(
const ParameterList& list1,
const ParameterList& list2) {
3254#define MUELU_PARAMETERLISTINTERPRETER_SHORT
#define TEST_MUTUALLY_EXCLUSIVE_S(arg1, arg2)
#define MUELU_KOKKOS_FACTORY_NO_DECL(varName, oldFactory, newFactory)
#define MUELU_KOKKOS_FACTORY(varName, oldFactory, newFactory)
#define TEST_MUTUALLY_EXCLUSIVE(arg1, arg2)
MueLu::DefaultGlobalOrdinal GlobalOrdinal
An factory which assigns each aggregate a quality estimate. Originally developed by Napov and Notay i...
Factory to export aggregation info or visualize aggregates using VTK.
AmalgamationFactory for subblocks of strided map based amalgamation data.
static bool debug()
Whether MueLu is in debug mode.
Factory for generating F/C-splitting and a coarse level map. Used by ClassicalPFactory.
Factory for creating a graph based on a given matrix.
Factory for creating a graph based on a given matrix.
Factory for generating coarse level map. Used by TentativePFactory.
Prolongator factory that replicates 'Psubblock' matrix to create new prolongator suitable for PDE sys...
Factory for building the constraint operator.
Class for transferring coordinates from a finer level to a coarser one.
Class that encapsulates direct solvers. Autoselection of AmesosSmoother or Amesos2Smoother according ...
Factory for building Energy Minimization prolongators.
Exception throws to report incompatible objects (like maps).
Exception throws to report invalid user entry.
Exception throws to report errors in the internal logical of the program.
Factory that can generate other factories from.
static void EnableTimerSync()
static void DisableMultipleCheckGlobally()
This class specifies the default factory that should generate some data on a Level if the data does n...
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Set Factory.
const RCP< const FactoryBase > GetFactory(const std::string &varName) const
Get factory associated with a particular data name.
const RCP< FactoryBase > GetFactoryNonConst(const std::string &varName)
Get factory associated with a particular data name (NONCONST version).
Factory for building filtered matrices using filtered graphs.
Factory for building restriction operators using a prolongator factory.
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
static CycleType GetDefaultCycle()
void SetCycleStartLevel(int cycleStart)
void SetLabel(const std::string &hierarchyLabel)
static int GetDefaultCycleStartLevel()
void SetCycle(CycleType Cycle)
Supports VCYCLE and WCYCLE types.
void SetProlongatorScalingFactor(double scalingFactor)
Specify damping factor alpha such that x = x + alpha*P*c, where c is the coarse grid correction.
Teuchos::RCP< Teuchos::ParameterList > matvecParams_
Teuchos::Array< int > elementToNodeMapsToPrint_
Teuchos::Array< int > nullspaceToPrint_
bool doPRViaCopyrebalance_
std::map< int, std::vector< keep_pair > > keep_
std::map< std::string, Teuchos::Array< int > > matricesToPrint_
Teuchos::Array< int > materialToPrint_
bool suppressNullspaceDimensionCheck_
RCP< FactoryManagerBase > GetFactoryManager(int levelID) const
void AddFactoryManager(int startLevel, int numDesiredLevel, RCP< FactoryManagerBase > manager)
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
Xpetra::global_size_t maxCoarseSize_
Teuchos::Array< std::string > dataToKeep_
bool fuseProlongationAndUpdate_
Teuchos::Array< int > coordinatesToPrint_
Teuchos::Array< int > aggregatesToPrint_
Class for generating an initial LocalOrdinal-type BlockNumber vector, based on an input paraemter for...
Factory for building transfer operators based on coarsening in polynomial degree, following the Intre...
Factory for building line detection information.
Class for transferring a vector of local ordinals from a finer level to a coarser one,...
Factory for converting matrices to half precision operators.
static Teuchos::RCP< Teuchos::ParameterList > GetProblemSpecificList(std::string const &problemType)
Return default parameter settings for the specified problem type.
static const T & getDefault(const std::string &name)
Returns default value on the "master" list for a parameter with the specified name and type.
static Teuchos::RCP< const Teuchos::ParameterList > List()
Return a "master" list of all valid parameters and their default values.
Class that encapsulates Matlab smoothers.
This class checks matrix properties of A on current level. This factory can be plugged in everywhere ...
Class for restricting a Matrix from a finer to a coarser level.
Class for restricting a MultiVector from a finer to a coarser level.
static const RCP< const NoFactory > getRCP()
Static Get() functions.
Partitioning within a node only.
Factory for generating nullspace.
bool changedImplicitTranspose_
void UpdateFactoryManager_Nullspace(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps, RCP< Factory > &nullSpaceFactory) const
void UpdateFactoryManager_Reitzinger(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
bool changedPRrebalance_
Easy interpreter stuff.
void UpdateFactoryManager_RAP(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Smoothers(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void SetMinvAProjectionVariables(const Teuchos::ParameterList ¶mList)
void UpdateFactoryManager_SA(std::string &multigridAlgo, Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Aggregation_TentativeP(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void SetEasyParameterList(const Teuchos::ParameterList ¶mList)
GlobalOrdinal dofOffset_
global offset variable describing offset of DOFs in operator
void UpdateFactoryManager_MatrixTransfer(const std::string &VarName, Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_EminReitzinger(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Coordinates(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
int blockSize_
block size of matrix (fixed block size)
void BuildFactoryMap(const Teuchos::ParameterList ¶mList, const FactoryMap &factoryMapIn, FactoryMap &factoryMapOut, FactoryManagerMap &factoryManagers) const
Interpret "Factories" sublist.
int WCycleStartLevel_
in case of W-cycle, level on which cycle should start
void UpdateFactoryManager_Restriction(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
virtual void SetupOperator(Operator &A) const
Setup Operator object.
void UpdateFactoryManager_Replicate(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_LowPrecision(ParameterList ¶mList, const ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
std::string hierarchyLabel_
name of hierarchy (for user convenience), printed in summary
void UpdateFactoryManager_PCoarsen(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.
ParameterListInterpreter()
Empty constructor.
std::pair< std::string, const FactoryBase * > keep_pair
void UpdateFactoryManager_PG(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void SetParameterList(const Teuchos::ParameterList ¶mList)
Set parameter list for Parameter list interpreter.
void UpdateFactoryManager_Material(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void Validate(const Teuchos::ParameterList ¶mList) const
void UpdateFactoryManager_Emin(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Combine(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
double scalingFactor_
prolongator scaling factor
CycleType Cycle_
multigrid cycle type (V-cycle or W-cycle)
static bool needMaterial(const Teuchos::ParameterList ¶mList, Teuchos::RCP< const Teuchos::ParameterList > defaultList=Teuchos::null, int maxLevel=0)
void UpdateFactoryManager_Matlab(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
std::map< std::string, RCP< FactoryManagerBase > > FactoryManagerMap
virtual ~ParameterListInterpreter()
Destructor.
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
static bool needMass(const Teuchos::ParameterList ¶mList, Teuchos::RCP< const Teuchos::ParameterList > defaultList=Teuchos::null, int maxLevel=0)
Teuchos::RCP< FactoryFactory > factFact_
Internal factory for factories.
static bool needBlockNumber(const Teuchos::ParameterList ¶mList, Teuchos::RCP< const Teuchos::ParameterList > defaultList=Teuchos::null, int maxLevel=0)
bool changedPRViaCopyrebalance_
void UpdateFactoryManager_SemiCoarsen(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
void UpdateFactoryManager(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
std::map< std::string, RCP< const FactoryBase > > FactoryMap
void SetupHierarchy(Hierarchy &H) const
Call the SetupHierarchy routine from the HiearchyManager object.
void SetFactoryParameterList(const Teuchos::ParameterList ¶mList)
Factory interpreter stuff.
static bool needCoordinates(const Teuchos::ParameterList ¶mList, Teuchos::RCP< const Teuchos::ParameterList > defaultList=Teuchos::null, int maxLevel=0)
void UpdateFactoryManager_CoarseSolvers(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
static std::pair< std::set< std::string >, std::set< std::string > > requiredAndOptionalUserData(const Teuchos::ParameterList ¶mList, Teuchos::RCP< const Teuchos::ParameterList > defaultList=Teuchos::null, int maxLevel=0)
void UpdateFactoryManager_Repartition(Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps, RCP< Factory > &nullSpaceFactory) const
Factory for building nonzero patterns for energy minimization.
Factory for building Petrov-Galerkin Smoothed Aggregation prolongators.
Factory for building coarse matrices.
Factory for building coarse grid matrices, when the matrix is of the form K+a*M. Useful when you want...
Factory for building coarse matrices.
Applies permutation to grid transfer operators.
Factory for building tentative prolongator.
Factory for building permutation matrix that can be be used to shuffle data (matrices,...
Factory for determing the number of partitions for rebalancing.
Prolongator factory that replicates 'Psubblock' matrix to create new prolongator suitable for PDE sys...
Factory for building Smoothed Aggregation prolongators.
Factory for generating a very special nullspace.
Prolongator factory performing semi-coarsening.
Prolongator factory performing semi-coarsening.
Factory for interacting with Matlab.
Factory for creating a graph base on a given matrix.
Generic Smoother Factory for generating the smoothers of the MG hierarchy.
Interface to block smoothers in Teko package.
Factory for building tentative prolongator.
Class for transferring coordinates from a finer level to a coarser one.
Prolongator factory which allows switching between two different prolongator strategies.
Factory for building restriction operators.
Class that encapsulates external library smoothers.
Factory for interacting with Matlab.
Factory for building uncoupled aggregates.
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
static VerbLevel GetDefaultVerbLevel()
Get the default (global) verbosity level.
static void SetDefaultVerbLevel(const VerbLevel defaultVerbLevel)
Set the default (global) verbosity level.
static void SetMueLuOFileStream(const std::string &filename)
Interface to Zoltan2 library.
Interface to Zoltan library.
Namespace for MueLu classes and methods.
bool IsParamMuemexVariable(const std::string &name)
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.
@ Warnings0
Important warning messages (one line).
@ Runtime0
One-liner description of what is happening.
@ Runtime1
Description of what is happening (more verbose).
@ Warnings1
Additional warnings.
size_t LevenshteinDistance(const char *s, size_t len_s, const char *t, size_t len_t)
static bool test_and_set_var(const Teuchos::ParameterList ¶mList, const std::string ¶mName, paramType &varName)
MsgType toVerbLevel(const std::string &verbLevelStr)
static void test_and_set_param_2list(const Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, const std::string ¶mName, Teuchos::ParameterList &listWrite)
static bool areSame(const ParameterList &list1, const ParameterList &list2)
Helper functions to compare two paramter lists.
static bool compare(const ParameterList &list1, const ParameterList &list2)
static void test_and_set_var_from_masterlist(Teuchos::ParameterList ¶mList, const std::string ¶mName)
std::string toString(const T &what)
Little helper function to convert non-string types to strings.
static paramType set_var_2list(const Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, const std::string ¶mName)
static bool test_param_2list(const Teuchos::ParameterList ¶mList, const Teuchos::ParameterList &defaultList, const std::string ¶mName, const paramType &cmpValue)