46 #ifndef MUELU_MLPARAMETERLISTINTERPRETER_DEF_HPP 47 #define MUELU_MLPARAMETERLISTINTERPRETER_DEF_HPP 49 #include <Teuchos_XMLParameterListHelpers.hpp> 52 #if defined(HAVE_MUELU_ML) && defined(HAVE_MUELU_EPETRA) 53 #include <ml_ValidateParameters.h> 56 #include <Xpetra_Matrix.hpp> 57 #include <Xpetra_MatrixUtils.hpp> 58 #include <Xpetra_MultiVector.hpp> 59 #include <Xpetra_MultiVectorFactory.hpp> 60 #include <Xpetra_Operator.hpp> 65 #include "MueLu_Hierarchy.hpp" 66 #include "MueLu_FactoryManager.hpp" 68 #include "MueLu_TentativePFactory.hpp" 69 #include "MueLu_SaPFactory.hpp" 70 #include "MueLu_PgPFactory.hpp" 71 #include "MueLu_AmalgamationFactory.hpp" 72 #include "MueLu_TransPFactory.hpp" 73 #include "MueLu_GenericRFactory.hpp" 74 #include "MueLu_SmootherPrototype.hpp" 75 #include "MueLu_SmootherFactory.hpp" 76 #include "MueLu_TrilinosSmoother.hpp" 78 #include "MueLu_DirectSolver.hpp" 79 #include "MueLu_HierarchyUtils.hpp" 80 #include "MueLu_RAPFactory.hpp" 81 #include "MueLu_CoalesceDropFactory.hpp" 82 #include "MueLu_CoupledAggregationFactory.hpp" 83 #include "MueLu_UncoupledAggregationFactory.hpp" 84 #include "MueLu_HybridAggregationFactory.hpp" 85 #include "MueLu_NullspaceFactory.hpp" 88 #ifdef HAVE_MUELU_KOKKOS_REFACTOR 89 #include "MueLu_CoalesceDropFactory_kokkos.hpp" 93 #include "MueLu_SaPFactory_kokkos.hpp" 94 #include "MueLu_TentativePFactory_kokkos.hpp" 95 #include "MueLu_UncoupledAggregationFactory_kokkos.hpp" 98 #if defined(HAVE_MUELU_ISORROPIA) && defined(HAVE_MPI) 99 #include "MueLu_IsorropiaInterface.hpp" 100 #include "MueLu_RepartitionHeuristicFactory.hpp" 101 #include "MueLu_RepartitionFactory.hpp" 102 #include "MueLu_RebalanceTransferFactory.hpp" 103 #include "MueLu_RepartitionInterface.hpp" 104 #include "MueLu_RebalanceAcFactory.hpp" 114 #define MUELU_READ_PARAM(paramList, paramStr, varType, defaultValue, varName) \ 115 varType varName = defaultValue; if (paramList.isParameter(paramStr)) varName = paramList.get<varType>(paramStr); 118 #define MUELU_COPY_PARAM(paramList, paramStr, varType, defaultValue, outParamList, outParamStr) \ 119 if (paramList.isParameter(paramStr)) \ 120 outParamList.set(outParamStr, paramList.get<varType>(paramStr)); \ 121 else outParamList.set(outParamStr, static_cast<varType>(defaultValue)); \ 125 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
126 MLParameterListInterpreter<Scalar, LocalOrdinal, GlobalOrdinal, Node>::MLParameterListInterpreter(Teuchos::ParameterList & paramList, Teuchos::RCP<
const Teuchos::Comm<int> > comm, std::vector<RCP<FactoryBase> > factoryList) : nullspace_(NULL), xcoord_(NULL), ycoord_(NULL), zcoord_(NULL),TransferFacts_(factoryList), blksize_(1) {
128 if (paramList.isParameter(
"xml parameter file")){
129 std::string filename = paramList.get(
"xml parameter file",
"");
130 if (filename.length() != 0) {
132 Teuchos::ParameterList paramList2 = paramList;
133 Teuchos::updateParametersFromXmlFileAndBroadcast(filename, Teuchos::Ptr<Teuchos::ParameterList>(¶mList2),*comm);
134 paramList2.remove(
"xml parameter file");
144 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
146 Teuchos::RCP<Teuchos::ParameterList> paramList = Teuchos::getParametersFromXmlFile(xmlFileName);
150 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
152 Teuchos::ParameterList paramList = paramList_in;
165 MUELU_READ_PARAM(paramList,
"aggregation: type", std::string,
"Uncoupled", agg_type);
167 MUELU_READ_PARAM(paramList,
"aggregation: damping factor",
double, (
double)4/(
double)3, agg_damping);
169 MUELU_READ_PARAM(paramList,
"aggregation: nodes per aggregate",
int, 1, minPerAgg);
170 MUELU_READ_PARAM(paramList,
"aggregation: keep Dirichlet bcs",
bool,
false, bKeepDirichletBcs);
171 MUELU_READ_PARAM(paramList,
"aggregation: max neighbours already aggregated",
int, 0, maxNbrAlreadySelected);
172 MUELU_READ_PARAM(paramList,
"aggregation: aux: enable",
bool,
false, agg_use_aux);
173 MUELU_READ_PARAM(paramList,
"aggregation: aux: threshold",
double,
false, agg_aux_thresh);
175 MUELU_READ_PARAM(paramList,
"null space: type", std::string,
"default vectors", nullspaceType);
176 MUELU_READ_PARAM(paramList,
"null space: dimension",
int, -1, nullspaceDim);
177 MUELU_READ_PARAM(paramList,
"null space: vectors",
double*, NULL, nullspaceVec);
179 MUELU_READ_PARAM(paramList,
"energy minimization: enable",
bool,
false, bEnergyMinimization);
181 MUELU_READ_PARAM(paramList,
"RAP: fix diagonal",
bool,
false, bFixDiagonal);
194 ParameterList paramListWithSubList;
196 paramList = paramListWithSubList;
199 bool setKokkosRefactor =
false;
200 bool useKokkosRefactor;
201 #if !defined(HAVE_MUELU_KOKKOS_REFACTOR) 202 useKokkosRefactor =
false;
204 # ifdef HAVE_MUELU_SERIAL 205 if (
typeid(
Node).name() ==
typeid(Kokkos::Compat::KokkosSerialWrapperNode).name())
206 useKokkosRefactor =
false;
208 # ifdef HAVE_MUELU_OPENMP 209 if (
typeid(
Node).name() ==
typeid(Kokkos::Compat::KokkosOpenMPWrapperNode).name())
210 useKokkosRefactor =
true;
212 # ifdef HAVE_MUELU_CUDA 213 if (
typeid(
Node).name() ==
typeid(Kokkos::Compat::KokkosCudaWrapperNode).name())
214 useKokkosRefactor =
true;
217 if (paramList.isType<
bool>(
"use kokkos refactor")) {
218 useKokkosRefactor = paramList.get<
bool>(
"use kokkos refactor");
219 setKokkosRefactor =
true;
220 paramList.remove(
"use kokkos refactor");
228 bool validate = paramList.get(
"ML validate parameter list",
true);
231 #if defined(HAVE_MUELU_ML) && defined(HAVE_MUELU_EPETRA) 233 int depth = paramList.get(
"ML validate depth", 5);
235 "ERROR: ML's Teuchos::ParameterList contains incorrect parameter!");
238 this->GetOStream(
Warnings0) <<
"Warning: MueLu_ENABLE_ML=OFF. The parameter list cannot be validated." << std::endl;
239 paramList.set(
"ML validate parameter list",
false);
241 #endif // HAVE_MUELU_ML 247 blksize_ = nDofsPerNode;
253 if (verbosityLevel == 0) eVerbLevel =
None;
254 if (verbosityLevel >= 1) eVerbLevel =
Low;
255 if (verbosityLevel >= 5) eVerbLevel =
Medium;
256 if (verbosityLevel >= 10) eVerbLevel =
High;
257 if (verbosityLevel >= 11) eVerbLevel =
Extreme;
258 if (verbosityLevel >= 42) eVerbLevel =
Test;
259 this->verbosity_ = eVerbLevel;
263 "MueLu::MLParameterListInterpreter::SetParameterList(): parameter \"aggregation: type\": only 'Uncoupled' or 'Coupled' aggregation is supported.");
266 RCP<Factory> dropFact;
267 #ifdef HAVE_MUELU_KOKKOS_REFACTOR 268 if(useKokkosRefactor)
269 dropFact = rcp(
new CoalesceDropFactory_kokkos() );
275 dropFact->SetParameter(
"aggregation: drop scheme",Teuchos::ParameterEntry(std::string(
"distance laplacian")));
276 dropFact->SetParameter(
"aggregation: drop tol",Teuchos::ParameterEntry(agg_aux_thresh));
279 RCP<Factory> AggFact = Teuchos::null;
280 if (agg_type ==
"Uncoupled") {
282 RCP<Factory> MyUncoupledAggFact;
283 #ifdef HAVE_MUELU_KOKKOS_REFACTOR 284 if(useKokkosRefactor) {
285 MyUncoupledAggFact = rcp(
new UncoupledAggregationFactory_kokkos() );
291 MyUncoupledAggFact->SetFactory(
"Graph", dropFact);
292 MyUncoupledAggFact->SetFactory(
"DofsPerNode", dropFact);
293 MyUncoupledAggFact->SetParameter(
"aggregation: preserve Dirichlet points", Teuchos::ParameterEntry(bKeepDirichletBcs));
294 MyUncoupledAggFact->SetParameter(
"aggregation: ordering", Teuchos::ParameterEntry(std::string(
"natural")));
295 MyUncoupledAggFact->SetParameter(
"aggregation: max selected neighbors", Teuchos::ParameterEntry(maxNbrAlreadySelected));
296 MyUncoupledAggFact->SetParameter(
"aggregation: min agg size", Teuchos::ParameterEntry(minPerAgg));
298 AggFact = MyUncoupledAggFact;
301 #ifdef HAVE_MUELU_KOKKOS_REFACTOR 302 if(useKokkosRefactor) {
303 AggFact = rcp(
new UncoupledAggregationFactory_kokkos() );
306 CoupledAggFact2->SetMinNodesPerAggregate(minPerAgg);
307 CoupledAggFact2->SetMaxNeighAlreadySelected(maxNbrAlreadySelected);
308 CoupledAggFact2->SetOrdering(
"natural");
309 CoupledAggFact2->SetPhase3AggCreation(0.5);
310 CoupledAggFact2->SetFactory(
"Graph", dropFact);
311 CoupledAggFact2->SetFactory(
"DofsPerNode", dropFact);
312 AggFact = CoupledAggFact2;
317 CoupledAggFact2->SetMinNodesPerAggregate(minPerAgg);
318 CoupledAggFact2->SetMaxNeighAlreadySelected(maxNbrAlreadySelected);
319 CoupledAggFact2->SetOrdering(
"natural");
320 CoupledAggFact2->SetPhase3AggCreation(0.5);
321 CoupledAggFact2->SetFactory(
"Graph", dropFact);
322 CoupledAggFact2->SetFactory(
"DofsPerNode", dropFact);
323 AggFact = CoupledAggFact2;
326 if (verbosityLevel > 3) {
327 std::ostringstream oss;
328 oss <<
"========================= Aggregate option summary =========================" << std::endl;
329 oss <<
"min Nodes per aggregate : " << minPerAgg << std::endl;
330 oss <<
"min # of root nbrs already aggregated : " << maxNbrAlreadySelected << std::endl;
331 oss <<
"aggregate ordering : natural" << std::endl;
332 oss <<
"=============================================================================" << std::endl;
333 this->GetOStream(
Runtime1) << oss.str();
338 RCP<Factory> PtentFact;
339 #ifdef HAVE_MUELU_KOKKOS_REFACTOR 340 if(useKokkosRefactor)
341 PtentFact = rcp(
new TentativePFactory_kokkos() );
345 if (agg_damping == 0.0 && bEnergyMinimization ==
false) {
349 }
else if (agg_damping != 0.0 && bEnergyMinimization ==
false) {
351 RCP<Factory> SaPFact;
352 #ifdef HAVE_MUELU_KOKKOS_REFACTOR 353 if(useKokkosRefactor)
354 SaPFact = rcp(
new SaPFactory_kokkos() );
358 SaPFact->SetParameter(
"sa: damping factor", ParameterEntry(agg_damping));
361 }
else if (bEnergyMinimization ==
true) {
367 RCP<RAPFactory> AcFact = rcp(
new RAPFactory() );
368 AcFact->SetParameter(
"RepairMainDiagonal", Teuchos::ParameterEntry(bFixDiagonal));
369 for (
size_t i = 0; i<TransferFacts_.size(); i++) {
370 AcFact->AddTransferFactory(TransferFacts_[i]);
376 #if defined(HAVE_MUELU_ISORROPIA) && defined(HAVE_MPI) 377 Teuchos::RCP<Factory> RebalancedPFact = Teuchos::null;
378 Teuchos::RCP<Factory> RebalancedRFact = Teuchos::null;
379 Teuchos::RCP<Factory> RepartitionFact = Teuchos::null;
380 Teuchos::RCP<RebalanceAcFactory> RebalancedAFact = Teuchos::null;
383 if (bDoRepartition == 1) {
386 RFact->SetFactory(
"P", PFact);
388 AcFact->SetFactory(
"P", PFact);
389 AcFact->SetFactory(
"R", RFact);
393 rebAmalgFact->SetFactory(
"A", AcFact);
395 MUELU_READ_PARAM(paramList,
"repartition: max min ratio",
double, 1.3, maxminratio);
396 MUELU_READ_PARAM(paramList,
"repartition: min per proc",
int, 512, minperproc);
401 Teuchos::ParameterList paramListRepFact;
402 paramListRepFact.set(
"repartition: min rows per proc", minperproc);
403 paramListRepFact.set(
"repartition: max imbalance", maxminratio);
404 RepartitionHeuristicFact->SetParameterList(paramListRepFact);
406 RepartitionHeuristicFact->SetFactory(
"A", AcFact);
410 isoInterface->SetFactory(
"A", AcFact);
411 isoInterface->SetFactory(
"number of partitions", RepartitionHeuristicFact);
412 isoInterface->SetFactory(
"UnAmalgamationInfo", rebAmalgFact);
416 repInterface->SetFactory(
"A", AcFact);
417 repInterface->SetFactory(
"number of partitions", RepartitionHeuristicFact);
418 repInterface->SetFactory(
"AmalgamatedPartition", isoInterface);
423 RepartitionFact->SetFactory(
"A", AcFact);
424 RepartitionFact->SetFactory(
"number of partitions", RepartitionHeuristicFact);
425 RepartitionFact->SetFactory(
"Partition", repInterface);
429 RebalancedPFact->SetParameter(
"type", Teuchos::ParameterEntry(std::string(
"Interpolation")));
430 RebalancedPFact->SetFactory(
"P", PFact);
431 RebalancedPFact->SetFactory(
"Nullspace", PtentFact);
432 RebalancedPFact->SetFactory(
"Importer", RepartitionFact);
435 RebalancedRFact->SetParameter(
"type", Teuchos::ParameterEntry(std::string(
"Restriction")));
436 RebalancedRFact->SetFactory(
"R", RFact);
437 RebalancedRFact->SetFactory(
"Importer", RepartitionFact);
441 RebalancedAFact->SetFactory(
"A", AcFact);
443 #else // #ifdef HAVE_MUELU_ISORROPIA 457 if (nullspaceType !=
"default vectors") {
458 TEUCHOS_TEST_FOR_EXCEPTION(nullspaceType !=
"pre-computed",
Exceptions::RuntimeError,
"MueLu::MLParameterListInterpreter: no valid nullspace (no pre-computed null space). error.");
459 TEUCHOS_TEST_FOR_EXCEPTION(nullspaceDim == -1,
Exceptions::RuntimeError,
"MueLu::MLParameterListInterpreter: no valid nullspace (nullspace dim == -1). error.");
460 TEUCHOS_TEST_FOR_EXCEPTION(nullspaceVec == NULL,
Exceptions::RuntimeError,
"MueLu::MLParameterListInterpreter: no valid nullspace (nullspace == NULL). You have to provide a valid fine-level nullspace in \'null space: vectors\'");
462 nullspaceDim_ = nullspaceDim;
463 nullspace_ = nullspaceVec;
466 Teuchos::RCP<NullspaceFactory> nspFact = Teuchos::rcp(
new NullspaceFactory(
"Nullspace"));
467 nspFact->SetFactory(
"Nullspace", PtentFact);
482 this->numDesiredLevel_ = maxLevels;
483 this->maxCoarseSize_ = maxCoarseSize;
488 ParameterList& coarseList = paramList.sublist(
"coarse: list");
490 if (!coarseList.isParameter(
"smoother: type"))
491 coarseList.set(
"smoother: type",
"Amesos-KLU");
492 RCP<SmootherFactory> coarseFact = GetSmootherFactory(coarseList, Teuchos::null);
503 for (
int levelID=0; levelID < maxLevels; levelID++) {
510 if (setKokkosRefactor)
511 manager->SetKokkosRefactor(useKokkosRefactor);
521 ParameterList levelSmootherParam =
GetMLSubList(paramList,
"smoother", levelID);
526 RCP<SmootherFactory> smootherFact = GetSmootherFactory(levelSmootherParam, Teuchos::null);
528 manager->SetFactory(
"Smoother", smootherFact);
535 manager->SetFactory(
"CoarseSolver", coarseFact);
536 manager->SetFactory(
"Graph", dropFact);
537 manager->SetFactory(
"Aggregates", AggFact);
538 manager->SetFactory(
"DofsPerNode", dropFact);
539 manager->SetFactory(
"Ptent", PtentFact);
541 #if defined(HAVE_MUELU_ISORROPIA) && defined(HAVE_MPI) 542 if (bDoRepartition == 1) {
543 manager->SetFactory(
"A", RebalancedAFact);
544 manager->SetFactory(
"P", RebalancedPFact);
545 manager->SetFactory(
"R", RebalancedRFact);
546 manager->SetFactory(
"Nullspace", RebalancedPFact);
547 manager->SetFactory(
"Importer", RepartitionFact);
549 #endif // #ifdef HAVE_MUELU_ISORROPIA 550 manager->SetFactory(
"Nullspace", nspFact);
551 manager->SetFactory(
"A", AcFact);
552 manager->SetFactory(
"P", PFact);
553 manager->SetFactory(
"R", RFact);
554 #if defined(HAVE_MUELU_ISORROPIA) && defined(HAVE_MPI) 558 this->AddFactoryManager(levelID, 1, manager);
563 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
567 if (nullspace_ != NULL) {
568 RCP<Level> fineLevel = H.
GetLevel(0);
569 RCP<Operator> Op = fineLevel->Get<RCP<Operator> >(
"A");
570 RCP<Matrix> A = rcp_dynamic_cast<Matrix>(Op);
572 const RCP<const Map> rowMap = fineLevel->Get< RCP<Matrix> >(
"A")->getRowMap();
573 RCP<MultiVector> nullspace = MultiVectorFactory::Build(rowMap, nullspaceDim_,
true);
575 for (
size_t i=0; i < Teuchos::as<size_t>(nullspaceDim_); i++) {
576 Teuchos::ArrayRCP<Scalar> nullspacei = nullspace->getDataNonConst(i);
577 const size_t myLength = nullspace->getLocalLength();
579 for (
size_t j = 0; j < myLength; j++) {
580 nullspacei[j] = nullspace_[i*myLength + j];
584 fineLevel->Set(
"Nullspace", nullspace);
589 size_t num_coords = 0;
590 double * coordPTR[3];
592 coordPTR[0] = xcoord_;
595 coordPTR[1] = ycoord_;
598 coordPTR[2] = zcoord_;
604 Teuchos::RCP<Level> fineLevel = H.
GetLevel(0);
605 Teuchos::RCP<Operator> Op = fineLevel->Get<RCP<Operator> >(
"A");
606 Teuchos::RCP<Matrix> A = rcp_dynamic_cast<Matrix>(Op);
608 const Teuchos::RCP<const Map> rowMap = fineLevel->Get< RCP<Matrix> >(
"A")->getRowMap();
609 Teuchos::RCP<MultiVector> coordinates = MultiVectorFactory::Build(rowMap, num_coords,
true);
611 for (
size_t i=0; i < num_coords; i++) {
612 Teuchos::ArrayRCP<Scalar> coordsi = coordinates->getDataNonConst(i);
613 const size_t myLength = coordinates->getLocalLength();
614 for (
size_t j = 0; j < myLength; j++) {
615 coordsi[j] = coordPTR[0][j];
618 fineLevel->Set(
"Coordinates",coordinates);
626 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
627 RCP<MueLu::SmootherFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
630 const RCP<FactoryBase> & AFact)
632 typedef Teuchos::ScalarTraits<Scalar> STS;
635 std::string type =
"symmetric Gauss-Seidel";
657 if (paramList.isParameter(
"smoother: type")) type = paramList.get<std::string>(
"smoother: type");
658 TEUCHOS_TEST_FOR_EXCEPTION(type.empty(),
Exceptions::RuntimeError,
"MueLu::MLParameterListInterpreter: no \"smoother: type\" in the smoother parameter list" << std::endl << paramList);
664 RCP<SmootherPrototype> smooProto;
665 std::string ifpackType;
666 Teuchos::ParameterList smootherParamList;
668 if (type ==
"Jacobi" || type ==
"Gauss-Seidel" || type ==
"symmetric Gauss-Seidel") {
669 if (type ==
"symmetric Gauss-Seidel") type =
"Symmetric Gauss-Seidel";
671 ifpackType =
"RELAXATION";
672 smootherParamList.set(
"relaxation: type", type);
674 MUELU_COPY_PARAM(paramList,
"smoother: sweeps",
int, 2, smootherParamList,
"relaxation: sweeps");
675 MUELU_COPY_PARAM(paramList,
"smoother: damping factor",
Scalar, one, smootherParamList,
"relaxation: damping factor");
678 smooProto->SetFactory(
"A", AFact);
680 }
else if (type ==
"Chebyshev" || type ==
"MLS") {
682 ifpackType =
"CHEBYSHEV";
684 MUELU_COPY_PARAM(paramList,
"smoother: sweeps",
int, 2, smootherParamList,
"chebyshev: degree");
685 if (paramList.isParameter(
"smoother: MLS alpha")) {
686 MUELU_COPY_PARAM(paramList,
"smoother: MLS alpha",
double, 20, smootherParamList,
"chebyshev: ratio eigenvalue");
688 MUELU_COPY_PARAM(paramList,
"smoother: Chebyshev alpha",
double, 20, smootherParamList,
"chebyshev: ratio eigenvalue");
693 smooProto->SetFactory(
"A", AFact);
695 }
else if (type ==
"IFPACK") {
697 #if defined(HAVE_MUELU_EPETRA) && defined(HAVE_MUELU_IFPACK) 698 ifpackType = paramList.get<std::string>(
"smoother: ifpack type");
700 if (ifpackType ==
"ILU") {
703 if (paramList.isParameter(
"smoother: ifpack level-of-fill"))
704 smootherParamList.set(
"fact: level-of-fill", Teuchos::as<int>(paramList.get<
double>(
"smoother: ifpack level-of-fill")));
705 else smootherParamList.set(
"fact: level-of-fill", as<int>(0));
707 MUELU_COPY_PARAM(paramList,
"smoother: ifpack overlap",
int, 2, smootherParamList,
"partitioner: overlap");
711 MueLu::GetIfpackSmoother<Scalar, LocalOrdinal, GlobalOrdinal, Node> (ifpackType,
713 paramList.get<
int> (
"smoother: ifpack overlap"));
714 smooProto->SetFactory(
"A", AFact);
716 TEUCHOS_TEST_FOR_EXCEPTION(
true,
Exceptions::RuntimeError,
"MueLu::MLParameterListInterpreter: unknown ML smoother type " + type +
" (IFPACK) not supported by MueLu. Only ILU is supported.");
719 TEUCHOS_TEST_FOR_EXCEPTION(
true,
Exceptions::RuntimeError,
"MueLu::MLParameterListInterpreter: MueLu compiled without Ifpack support");
722 }
else if (type.length() > strlen(
"Amesos") && type.substr(0, strlen(
"Amesos")) ==
"Amesos") {
723 std::string solverType = type.substr(strlen(
"Amesos")+1);
727 const int validatorSize = 5;
728 std::string validator[validatorSize] = {
"Superlu",
"Superludist",
"KLU",
"UMFPACK",
"MUMPS"};
729 for (
int i=0; i < validatorSize; i++) {
if (validator[i] == solverType) valid =
true; }
730 TEUCHOS_TEST_FOR_EXCEPTION(!valid,
Exceptions::RuntimeError,
"MueLu::MLParameterListInterpreter: unknown smoother type. '" << type <<
"' not supported.");
733 std::transform(solverType.begin()+1, solverType.end(), solverType.begin()+1,
::tolower);
735 smooProto = Teuchos::rcp(
new DirectSolver(solverType, Teuchos::ParameterList()) );
736 smooProto->SetFactory(
"A", AFact);
740 TEUCHOS_TEST_FOR_EXCEPTION(
true,
Exceptions::RuntimeError,
"MueLu::MLParameterListInterpreter: unknown smoother type. '" << type <<
"' not supported by MueLu.");
743 TEUCHOS_TEST_FOR_EXCEPTION(smooProto == Teuchos::null,
Exceptions::RuntimeError,
"MueLu::MLParameterListInterpreter: no smoother prototype. fatal error.");
752 MUELU_READ_PARAM(paramList,
"smoother: pre or post", std::string,
"both", preOrPost);
753 if (preOrPost ==
"both") {
754 SmooFact->SetSmootherPrototypes(smooProto, smooProto);
755 }
else if (preOrPost ==
"pre") {
756 SmooFact->SetSmootherPrototypes(smooProto, Teuchos::null);
757 }
else if (preOrPost ==
"post") {
758 SmooFact->SetSmootherPrototypes(Teuchos::null, smooProto);
764 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
767 TEUCHOS_TEST_FOR_EXCEPTION(Teuchos::rcp_dynamic_cast<TwoLevelFactoryBase>(factory) == Teuchos::null,
Exceptions::BadCast,
"Transfer factory is not derived from TwoLevelFactoryBase. Since transfer factories will be handled by the RAPFactory they have to be derived from TwoLevelFactoryBase!");
768 TransferFacts_.push_back(factory);
771 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
773 return TransferFacts_.size();
776 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
779 Matrix& A =
dynamic_cast<Matrix&
>(Op);
780 if (A.GetFixedBlockSize() != blksize_)
781 this->GetOStream(
Warnings0) <<
"Setting matrix block size to " << blksize_ <<
" (value of the parameter in the list) " 782 <<
"instead of " << A.GetFixedBlockSize() <<
" (provided matrix)." << std::endl;
784 A.SetFixedBlockSize(blksize_);
786 #ifdef HAVE_MUELU_DEBUG 787 MatrixUtils::checkLocalRowMapMatchesColMap(A);
788 #endif // HAVE_MUELU_DEBUG 790 }
catch (std::bad_cast& e) {
791 this->GetOStream(
Warnings0) <<
"Skipping setting block size as the operator is not a matrix" << std::endl;
797 #define MUELU_MLPARAMETERLISTINTERPRETER_SHORT Important warning messages (one line)
Generic Smoother Factory for generating the smoothers of the MG hierarchy.
Exception indicating invalid cast attempted.
This class specifies the default factory that should generate some data on a Level if the data does n...
void MergeParameterList(const Teuchos::ParameterList &source, Teuchos::ParameterList &dest, bool overWrite)
: merge two parameter lists
virtual void SetupOperator(Operator &Op) const
Setup Operator object.
MLParameterListInterpreter()
Constructor.
Factory for determing the number of partitions for rebalancing.
RCP< Level > & GetLevel(const int levelID=0)
Retrieve a certain level from hierarchy.
Class that encapsulates external library smoothers.
Interface to IsorropiaInterface to Isorropia allowing to access other rebalancing/repartitioning algo...
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
Factory for building permutation matrix that can be be used to shuffle data (matrices, vectors) among processes.
std::string tolower(const std::string &str)
Namespace for MueLu classes and methods.
#define MUELU_READ_PARAM(paramList, paramStr, varType, defaultValue, varName)
const Teuchos::ParameterList & GetMLSubList(const Teuchos::ParameterList ¶mList, const std::string &type, int levelID)
void AddTransferFactory(const RCP< FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories for RAPFactory.
Factory for building tentative prolongator.
Class that encapsulates direct solvers. Autoselection of AmesosSmoother or Amesos2Smoother according ...
Factory for coarsening a graph with uncoupled aggregation.
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
Factory for building restriction operators using a prolongator factory.
void CreateSublists(const ParameterList &List, ParameterList &newList)
MueLu::DefaultScalar Scalar
static RCP< SmootherFactory > GetSmootherFactory(const Teuchos::ParameterList ¶mList, const RCP< FactoryBase > &AFact=Teuchos::null)
Read smoother options and build the corresponding smoother factory.
Teuchos::RCP< Teuchos::ParameterList > ExtractSetOfParameters(const Teuchos::ParameterList ¶mList, const std::string &str)
AmalgamationFactory for subblocks of strided map based amalgamation data.
size_t NumTransferFactories() const
Returns number of transfer factories.
Applies permutation to grid transfer operators.
Factory for creating a graph base on a given matrix.
Helper class which transforms an "AmalgamatedPartition" array to an unamalgamated "Partition"...
void SetParameterList(const Teuchos::ParameterList ¶mList)
Factory for building restriction operators.
Factory for building coarse matrices.
Exception throws to report errors in the internal logical of the program.
Description of what is happening (more verbose)
Factory for building coarse matrices.
#define MUELU_COPY_PARAM(paramList, paramStr, varType, defaultValue, outParamList, outParamStr)
Factory for building Petrov-Galerkin Smoothed Aggregation prolongators.
Factory for building Smoothed Aggregation prolongators.
Factory for building uncoupled aggregates.
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
Factory for generating nullspace.