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