MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_AdaptiveSaMLParameterListInterpreter_def.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// MueLu: A package for multigrid based preconditioning
4//
5// Copyright 2012 NTESS and the MueLu contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10/*
11 * MueLu_AdaptiveSaMLParamterListInterpreter_def.hpp
12 *
13 * Created on: Jan 28, 2013
14 * Author: tobias
15 */
16
17#ifndef MUELU_ADAPTIVESAMLPARAMETERLISTINTERPRETER_DEF_HPP_
18#define MUELU_ADAPTIVESAMLPARAMETERLISTINTERPRETER_DEF_HPP_
19
20#include <Teuchos_XMLParameterListHelpers.hpp>
21
22#include "MueLu_ConfigDefs.hpp"
23#if defined(HAVE_MUELU_ML) && defined(HAVE_MUELU_EPETRA)
24#include <ml_ValidateParameters.h>
25#endif
26
27#include <Xpetra_Matrix.hpp>
28#include <Xpetra_MultiVector.hpp>
29#include <Xpetra_MultiVectorFactory.hpp>
30#include <Xpetra_Operator.hpp>
31#include <Xpetra_IO.hpp>
32
34
35#include "MueLu_Level.hpp"
36#include "MueLu_Hierarchy.hpp"
37#include "MueLu_FactoryManager.hpp"
38
39#include "MueLu_TentativePFactory.hpp"
40#include "MueLu_SaPFactory.hpp"
41#include "MueLu_PgPFactory.hpp"
42#include "MueLu_TransPFactory.hpp"
43#include "MueLu_GenericRFactory.hpp"
44#include "MueLu_SmootherPrototype.hpp"
45#include "MueLu_SmootherFactory.hpp"
46#include "MueLu_TrilinosSmoother.hpp"
47#include "MueLu_HierarchyUtils.hpp"
48#include "MueLu_RAPFactory.hpp"
49#include "MueLu_CoalesceDropFactory.hpp"
50#include "MueLu_UncoupledAggregationFactory.hpp"
51#include "MueLu_NullspaceFactory.hpp"
53#include "MueLu_ParameterListInterpreter.hpp"
54
55//#include "MueLu_Utilities.hpp"
56
58
59// Note: do not add options that are only recognized by MueLu.
60
61// TODO: this parameter list interpreter should force MueLu to use default ML parameters
62// - Ex: smoother sweep=2 by default for ML
63
64// Read a parameter value from a parameter list and store it into a variable named 'varName'
65#define MUELU_READ_PARAM(paramList, paramStr, varType, defaultValue, varName) \
66 varType varName = defaultValue; \
67 if (paramList.isParameter(paramStr)) varName = paramList.get<varType>(paramStr);
68
69// Read a parameter value from a paraeter list and copy it into a new parameter list (with another parameter name)
70#define MUELU_COPY_PARAM(paramList, paramStr, varType, defaultValue, outParamList, outParamStr) \
71 if (paramList.isParameter(paramStr)) \
72 outParamList.set<varType>(outParamStr, paramList.get<varType>(paramStr)); \
73 else \
74 outParamList.set<varType>(outParamStr, defaultValue);
75
76namespace MueLu {
77
78namespace AdaptiveDetails {
79template <class SC, class LO, class GO, class NO>
80Teuchos::RCP<MueLu::SmootherFactory<SC, LO, GO, NO> > getSmoother(Teuchos::ParameterList& list) {
82 ParameterListInterpreter interpreter(list);
83 return Teuchos::rcp_const_cast<SF>(Teuchos::rcp_dynamic_cast<const SF>(interpreter.GetFactoryManager(0)->GetFactory("Smoother")));
84}
85} // namespace AdaptiveDetails
86
87template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
89 : TransferFacts_(factoryList)
90 , blksize_(1) {
91 SetParameterList(paramList);
92}
93
94template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
96 : nullspace_(NULL)
97 , TransferFacts_(factoryList)
98 , blksize_(1) {
99 Teuchos::RCP<Teuchos::ParameterList> paramList = Teuchos::getParametersFromXmlFile(xmlFileName);
100 SetParameterList(*paramList);
101}
102
103template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
105 Teuchos::ParameterList paramList = paramList_in;
106
107 RCP<Teuchos::FancyOStream> out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); // TODO: use internal out (GetOStream())
108
109 //
110 // Read top-level of the parameter list
111 //
112
113 // hard-coded default values == ML defaults according to the manual
114 MUELU_READ_PARAM(paramList, "ML output", int, 0, verbosityLevel);
115 MUELU_READ_PARAM(paramList, "max levels", int, 10, maxLevels);
116 MUELU_READ_PARAM(paramList, "PDE equations", int, 1, nDofsPerNode);
117
118 MUELU_READ_PARAM(paramList, "coarse: max size", int, 128, maxCoarseSize);
119
120 MUELU_READ_PARAM(paramList, "aggregation: type", std::string, "Uncoupled", agg_type);
121 // MUELU_READ_PARAM(paramList, "aggregation: threshold", double, 0.0, agg_threshold);
122 MUELU_READ_PARAM(paramList, "aggregation: damping factor", double, (double)4 / (double)3, agg_damping);
123 // MUELU_READ_PARAM(paramList, "aggregation: smoothing sweeps", int, 1, agg_smoothingsweeps);
124 MUELU_READ_PARAM(paramList, "aggregation: nodes per aggregate", int, 1, minPerAgg);
125
126 MUELU_READ_PARAM(paramList, "null space: type", std::string, "default vectors", nullspaceType);
127 MUELU_READ_PARAM(paramList, "null space: dimension", int, -1, nullspaceDim); // TODO: ML default not in documentation
128 MUELU_READ_PARAM(paramList, "null space: vectors", double*, NULL, nullspaceVec); // TODO: ML default not in documentation
129
130 MUELU_READ_PARAM(paramList, "energy minimization: enable", bool, false, bEnergyMinimization);
131
132 //
133 // Move smoothers/aggregation/coarse parameters to sublists
134 //
135
136 // ML allows to have level-specific smoothers/aggregation/coarse parameters at the top level of the list or/and defined in sublists:
137 // See also: ML Guide section 6.4.1, MueLu::CreateSublists, ML_CreateSublists
138 ParameterList paramListWithSubList;
139 MueLu::CreateSublists(paramList, paramListWithSubList);
140 paramList = paramListWithSubList; // swap
141
142 // std::cout << std::endl << "Parameter list after CreateSublists" << std::endl;
143 // std::cout << paramListWithSubList << std::endl;
144
145 int maxNbrAlreadySelected = 0;
146
147 // Matrix option
148 this->blksize_ = nDofsPerNode;
149
150 // Translate verbosity parameter
151 Teuchos::EVerbosityLevel eVerbLevel = Teuchos::VERB_NONE;
152 if (verbosityLevel == 0) eVerbLevel = Teuchos::VERB_NONE;
153 if (verbosityLevel > 0) eVerbLevel = Teuchos::VERB_LOW;
154 if (verbosityLevel > 4) eVerbLevel = Teuchos::VERB_MEDIUM;
155 if (verbosityLevel > 7) eVerbLevel = Teuchos::VERB_HIGH;
156 if (verbosityLevel > 9) eVerbLevel = Teuchos::VERB_EXTREME;
157
158 TEUCHOS_TEST_FOR_EXCEPTION(agg_type != "Uncoupled", Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter::Setup(): parameter \"aggregation: type\": only 'Uncoupled' aggregation is supported.");
159
160 // Create MueLu factories
161 // RCP<NullspaceFactory> nspFact = rcp(new NullspaceFactory());
162 RCP<CoalesceDropFactory> dropFact = rcp(new CoalesceDropFactory());
163 // dropFact->SetVerbLevel(toMueLuVerbLevel(eVerbLevel));
164
165 // Uncoupled aggregation
166 RCP<UncoupledAggregationFactory> AggFact = rcp(new UncoupledAggregationFactory());
167 AggFact->SetMinNodesPerAggregate(minPerAgg); // TODO should increase if run anything other than 1D
168 AggFact->SetMaxNeighAlreadySelected(maxNbrAlreadySelected);
169 AggFact->SetOrdering("natural");
170
171 if (verbosityLevel > 3) { // TODO fix me: Setup is a static function: we cannot use GetOStream without an object...
172 *out << "========================= Aggregate option summary =========================" << std::endl;
173 *out << "min Nodes per aggregate : " << minPerAgg << std::endl;
174 *out << "min # of root nbrs already aggregated : " << maxNbrAlreadySelected << std::endl;
175 *out << "aggregate ordering : natural" << std::endl;
176 *out << "=============================================================================" << std::endl;
177 }
178
179 RCP<Factory> PFact;
180 RCP<Factory> RFact;
181 RCP<Factory> PtentFact = rcp(new TentativePFactory());
182 if (agg_damping == 0.0 && bEnergyMinimization == false) {
183 // tentative prolongation operator (PA-AMG)
184 PFact = PtentFact;
185 RFact = rcp(new TransPFactory());
186 } else if (agg_damping != 0.0 && bEnergyMinimization == false) {
187 // smoothed aggregation (SA-AMG)
188 RCP<SaPFactory> SaPFact = rcp(new SaPFactory());
189 SaPFact->SetParameter("sa: damping factor", ParameterEntry(agg_damping));
190 PFact = SaPFact;
191 RFact = rcp(new TransPFactory());
192 } else if (bEnergyMinimization == true) {
193 // Petrov Galerkin PG-AMG smoothed aggregation (energy minimization in ML)
194 PFact = rcp(new PgPFactory());
195 RFact = rcp(new GenericRFactory());
196 }
197
198 RCP<RAPFactory> AcFact = rcp(new RAPFactory());
199 for (size_t i = 0; i < TransferFacts_.size(); i++) {
200 AcFact->AddTransferFactory(TransferFacts_[i]); // THIS WILL BE REPLACED with a call to the MLParamterListInterpreter
201 }
202
203 //
204 // Nullspace factory
205 //
206
207 // Set fine level nullspace
208 // extract pre-computed nullspace from ML parameter list
209 // store it in nullspace_ and nullspaceDim_
210 if (nullspaceType != "default vectors") {
211 TEUCHOS_TEST_FOR_EXCEPTION(nullspaceType != "pre-computed", Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: no valid nullspace (no pre-computed null space). error.");
212 TEUCHOS_TEST_FOR_EXCEPTION(nullspaceDim == -1, Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: no valid nullspace (nullspace dim == -1). error.");
213 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\'");
214
215 nullspaceDim_ = nullspaceDim;
216 nullspace_ = nullspaceVec;
217 }
218
219 Teuchos::RCP<NullspaceFactory> nspFact = Teuchos::rcp(new NullspaceFactory());
220 nspFact->SetFactory("Nullspace", PtentFact);
221
222 //
223 // Hierarchy + FactoryManager
224 //
225
226 // Hierarchy options
227 this->SetVerbLevel(toMueLuVerbLevel(eVerbLevel));
228 this->numDesiredLevel_ = maxLevels;
229 this->maxCoarseSize_ = maxCoarseSize;
230
231 // init smoother
232 RCP<SmootherFactory> initSmootherFact = Teuchos::null;
233 if (paramList.isSublist("init smoother")) {
234 ParameterList& initList = paramList.sublist("init smoother"); // TODO move this before for loop
235 initSmootherFact = AdaptiveDetails::getSmoother<SC, LO, GO, NO>(initList);
236 } else {
237 std::string ifpackType = "RELAXATION";
238 Teuchos::ParameterList smootherParamList;
239 smootherParamList.set("relaxation: type", "symmetric Gauss-Seidel");
240 smootherParamList.set("smoother: sweeps", 1);
241 smootherParamList.set("smoother: damping factor", 1.0);
242 RCP<SmootherPrototype> smooProto = rcp(new TrilinosSmoother(ifpackType, smootherParamList, 0));
243
244 initSmootherFact = rcp(new SmootherFactory());
245 initSmootherFact->SetSmootherPrototypes(smooProto, smooProto);
246 }
247
248 //
249 // Coarse Smoother
250 //
251 ParameterList& coarseList = paramList.sublist("coarse: list");
252 // coarseList.get("smoother: type", "Amesos-KLU"); // set default
253 RCP<SmootherFactory> coarseFact = AdaptiveDetails::getSmoother<SC, LO, GO, NO>(coarseList);
254
255 // Smoothers Top Level Parameters
256
257 RCP<ParameterList> topLevelSmootherParam = ExtractSetOfParameters(paramList, "smoother");
258 // std::cout << std::endl << "Top level smoother parameters:" << std::endl;
259 // std::cout << *topLevelSmootherParam << std::endl;
260
261 //
262
263 // Prepare factory managers
264 // TODO: smootherFact can be reuse accross level if same parameters/no specific parameterList
265
266 for (int levelID = 0; levelID < maxLevels; levelID++) {
267 //
268 // Level FactoryManager
269 //
270
271 RCP<FactoryManager> manager = rcp(new FactoryManager());
272 RCP<FactoryManager> initmanager = rcp(new FactoryManager());
273
274 //
275 // Smoothers
276 //
277
278 {
279 // Merge level-specific parameters with global parameters. level-specific parameters takes precedence.
280 // TODO: unit-test this part alone
281
282 ParameterList levelSmootherParam = GetMLSubList(paramList, "smoother", levelID); // copy
283 MergeParameterList(*topLevelSmootherParam, levelSmootherParam, false); /* false = do no overwrite levelSmootherParam parameters by topLevelSmootherParam parameters */
284 // std::cout << std::endl << "Merged List for level " << levelID << std::endl;
285 // std::cout << levelSmootherParam << std::endl;
286
287 // RCP<SmootherFactory> smootherFact = this->GetSmootherFactory(levelSmootherParam); // TODO: missing AFact input arg.
288 RCP<SmootherFactory> smootherFact = AdaptiveDetails::getSmoother<SC, LO, GO, NO>(levelSmootherParam);
289 manager->SetFactory("Smoother", smootherFact);
290 smootherFact->DisableMultipleCallCheck();
291
292 initmanager->SetFactory("Smoother", initSmootherFact);
293 initmanager->SetFactory("CoarseSolver", initSmootherFact);
294 initSmootherFact->DisableMultipleCallCheck();
295 }
296
297 //
298 // Misc
299 //
300
301 Teuchos::rcp_dynamic_cast<PFactory>(PFact)->DisableMultipleCallCheck();
302 Teuchos::rcp_dynamic_cast<PFactory>(PtentFact)->DisableMultipleCallCheck();
303 Teuchos::rcp_dynamic_cast<TwoLevelFactoryBase>(RFact)->DisableMultipleCallCheck();
304 Teuchos::rcp_dynamic_cast<SingleLevelFactoryBase>(coarseFact)->DisableMultipleCallCheck();
305 Teuchos::rcp_dynamic_cast<SingleLevelFactoryBase>(dropFact)->DisableMultipleCallCheck();
306 Teuchos::rcp_dynamic_cast<SingleLevelFactoryBase>(AggFact)->DisableMultipleCallCheck();
307 Teuchos::rcp_dynamic_cast<TwoLevelFactoryBase>(AcFact)->DisableMultipleCallCheck();
308 Teuchos::rcp_dynamic_cast<SingleLevelFactoryBase>(nspFact)->DisableMultipleCallCheck();
309
310 manager->SetFactory("CoarseSolver", coarseFact); // TODO: should not be done in the loop
311 manager->SetFactory("Graph", dropFact);
312 manager->SetFactory("Aggregates", AggFact);
313 manager->SetFactory("DofsPerNode", dropFact);
314 manager->SetFactory("A", AcFact);
315 manager->SetFactory("P", PFact);
316 manager->SetFactory("Ptent", PtentFact);
317 manager->SetFactory("R", RFact);
318 manager->SetFactory("Nullspace", nspFact);
319
320 // initmanager->SetFactory("CoarseSolver", coarseFact);
321 initmanager->SetFactory("Graph", dropFact);
322 initmanager->SetFactory("Aggregates", AggFact);
323 initmanager->SetFactory("DofsPerNode", dropFact);
324 initmanager->SetFactory("A", AcFact);
325 initmanager->SetFactory("P", PtentFact); // use nonsmoothed transfers
326 initmanager->SetFactory("Ptent", PtentFact);
327 initmanager->SetFactory("R", RFact);
328 initmanager->SetFactory("Nullspace", nspFact);
329
330 this->AddFactoryManager(levelID, 1, manager);
331 this->AddInitFactoryManager(levelID, 1, initmanager);
332 } // for (level loop)
333}
334
335template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
337 TEUCHOS_TEST_FOR_EXCEPTION(!H.GetLevel(0)->IsAvailable("A"), Exceptions::RuntimeError, "No fine level operator");
338
339 RCP<Level> l = H.GetLevel(0);
340 RCP<Operator> Op = l->Get<RCP<Operator> >("A");
341 SetupOperator(*Op); // use overloaded SetupMatrix routine
342 this->SetupExtra(H);
343
344 // Setup Hierarchy
345 H.SetMaxCoarseSize(this->maxCoarseSize_); // TODO
346
347 int levelID = 0;
348 int lastLevelID = this->numDesiredLevel_ - 1;
349 bool isLastLevel = false;
350
351 while (!isLastLevel) {
352 bool r = H.Setup(levelID,
353 InitLvlMngr(levelID - 1, lastLevelID),
354 InitLvlMngr(levelID, lastLevelID),
355 InitLvlMngr(levelID + 1, lastLevelID));
356
357 isLastLevel = r || (levelID == lastLevelID);
358 levelID++;
359 }
360}
361
362template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
364 // set fine level null space
365 // usually this null space is provided from outside (by the user) using
366 // the ML parameter lists.
367 if (this->nullspace_ != NULL) {
368 RCP<Level> fineLevel = H.GetLevel(0);
369 const RCP<const Map> rowMap = fineLevel->Get<RCP<Matrix> >("A")->getRowMap();
370 RCP<MultiVector> nullspace = MultiVectorFactory::Build(rowMap, nullspaceDim_, true);
371
372 for (size_t i = 0; i < Teuchos::as<size_t>(nullspaceDim_); i++) {
373 Teuchos::ArrayRCP<Scalar> nullspacei = nullspace->getDataNonConst(i);
374 const size_t myLength = nullspace->getLocalLength();
375
376 for (size_t j = 0; j < myLength; j++) {
377 nullspacei[j] = nullspace_[i * myLength + j];
378 }
379 }
380
381 fineLevel->Set("Nullspace", nullspace);
382 }
383
384 // keep aggregates
385 H.Keep("Aggregates", HierarchyManager::GetFactoryManager(0)->GetFactory("Aggregates").get());
386
388
389 // build hierarchy for initialization
390 SetupInitHierarchy(H);
391
392 {
393 // do some iterations with the built hierarchy to improve the null space
394 Teuchos::RCP<MueLu::Level> Finest = H.GetLevel(0); // get finest level,MueLu::NoFactory::get()
395 Teuchos::RCP<MultiVector> nspVector2 = Finest->Get<Teuchos::RCP<MultiVector> >("Nullspace");
396
397 Xpetra::IO<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Write("orig_nsp.vec", *nspVector2);
398
399 RCP<Matrix> Op = Finest->Get<RCP<Matrix> >("A");
400 Xpetra::IO<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Write("A.mat", *Op);
401
402 Teuchos::RCP<MultiVector> homogRhsVec = MultiVectorFactory::Build(nspVector2->getMap(), nspVector2->getNumVectors(), true);
403 homogRhsVec->putScalar(0.0);
404
405 // do 1 multigrid cycle for improving the null space by "solving"
406 // A B_f = 0
407 // where A is the system matrix and B_f the fine level null space vectors
408 H.Iterate(*homogRhsVec, *nspVector2, 1, false);
409
410 // store improved fine level null space
411 Finest->Set("Nullspace", nspVector2);
412
413 Xpetra::IO<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Write("new_nsp.vec", *nspVector2);
414
415 // H.Delete("CoarseSolver", init_levelManagers_[0]->GetFactory("CoarseSolver").get());
416 }
417
418 {
419 // do some clean up.
420 // remove all old default factories. Build new ones for the second build.
421 // this is a little bit tricky to understand
422 for (size_t k = 0; k < HierarchyManager::getNumFactoryManagers(); k++) {
424 // Teuchos::rcp_dynamic_cast<const SingleLevelFactoryBase>(HierarchyManager::GetFactoryManager(k)->GetFactory("Smoother"))->DisableMultipleCallCheck(); // after changing to MLParamterListInterpreter functions
425 }
426 // not sure about this. i only need it if Smoother is defined explicitely (not using default smoother)
427 // need this: otherwise RAPFactory::Build is complaining on level 0
428 // and TentativePFactory::Build is complaining on level 1
429 Teuchos::rcp_dynamic_cast<const TwoLevelFactoryBase>(HierarchyManager::GetFactoryManager(0)->GetFactory("A"))->DisableMultipleCallCheck();
430 Teuchos::rcp_dynamic_cast<const TwoLevelFactoryBase>(HierarchyManager::GetFactoryManager(1)->GetFactory("P"))->DisableMultipleCallCheck();
431 Teuchos::rcp_dynamic_cast<const TwoLevelFactoryBase>(HierarchyManager::GetFactoryManager(1)->GetFactory("Ptent"))->DisableMultipleCallCheck();
432
434 }
435}
436
437template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
439 // check if it's a TwoLevelFactoryBase based transfer factory
440 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!");
441 TransferFacts_.push_back(factory);
442}
443
444template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
448
449template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
451 try {
452 Matrix& A = dynamic_cast<Matrix&>(Op);
453 if (A.IsFixedBlockSizeSet() && (A.GetFixedBlockSize() != blksize_))
454 this->GetOStream(Warnings0) << "Setting matrix block size to " << blksize_ << " (value of the parameter in the list) "
455 << "instead of " << A.GetFixedBlockSize() << " (provided matrix)." << std::endl;
456
457 A.SetFixedBlockSize(blksize_);
458
459 } catch (std::bad_cast& e) {
460 this->GetOStream(Warnings0) << "Skipping setting block size as the operator is not a matrix" << std::endl;
461 }
462}
463
464} // namespace MueLu
465
466#endif /* MUELU_ADAPTIVESAMLPARAMETERLISTINTERPRETER_DEF_HPP_ */
#define MUELU_READ_PARAM(paramList, paramStr, varType, defaultValue, varName)
size_t NumTransferFactories() const
Returns number of transfer factories.
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
void AddTransferFactory(const RCP< FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories for RAPFactory.
Factory for creating a graph based on a given matrix.
Exception indicating invalid cast attempted.
Exception throws to report errors in the internal logical of the program.
This class specifies the default factory that should generate some data on a Level if the data does n...
Factory for building restriction operators using a prolongator factory.
RCP< FactoryManagerBase > GetFactoryManager(int levelID) const
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
size_t getNumFactoryManagers() const
returns number of factory managers stored in levelManagers_ vector.
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
RCP< Level > & GetLevel(const int levelID=0)
Retrieve a certain level from hierarchy.
bool Setup(int coarseLevelID, const RCP< const FactoryManagerBase > fineLevelManager, const RCP< const FactoryManagerBase > coarseLevelManager, const RCP< const FactoryManagerBase > nextLevelManager=Teuchos::null)
Multi-level setup phase: build a new level of the hierarchy.
ConvergenceStatus Iterate(const MultiVector &B, MultiVector &X, ConvData conv=ConvData(), bool InitialGuessIsZero=false, LO startLevel=0)
Apply the multigrid preconditioner.
void SetMaxCoarseSize(Xpetra::global_size_t maxCoarseSize)
void Keep(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Call Level::Keep(ename, factory) for each level of the Hierarchy.
Factory for generating nullspace.
Factory for building Petrov-Galerkin Smoothed Aggregation prolongators.
Factory for building coarse matrices.
Factory for building Smoothed Aggregation prolongators.
Generic Smoother Factory for generating the smoothers of the MG hierarchy.
Factory for building tentative prolongator.
Factory for building restriction operators.
Class that encapsulates external library smoothers.
Teuchos::RCP< MueLu::SmootherFactory< SC, LO, GO, NO > > getSmoother(Teuchos::ParameterList &list)
Namespace for MueLu classes and methods.
void CreateSublists(const Teuchos::ParameterList &List, Teuchos::ParameterList &newList)
Teuchos::RCP< Teuchos::ParameterList > ExtractSetOfParameters(const Teuchos::ParameterList &paramList, const std::string &str)
@ Warnings0
Important warning messages (one line)
void MergeParameterList(const Teuchos::ParameterList &source, Teuchos::ParameterList &dest, bool overWrite)
: merge two parameter lists
const Teuchos::ParameterList & GetMLSubList(const Teuchos::ParameterList &paramList, const std::string &type, int levelID)
VerbLevel toMueLuVerbLevel(const Teuchos::EVerbosityLevel verbLevel)
Translate Teuchos verbosity level to MueLu verbosity level.