MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
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_ParameterListInterpreter.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; \
58  if (paramList.isParameter(paramStr)) varName = paramList.get<varType>(paramStr);
59 
60 // Read a parameter value from a paraeter list and copy it into a new parameter list (with another parameter name)
61 #define MUELU_COPY_PARAM(paramList, paramStr, varType, defaultValue, outParamList, outParamStr) \
62  if (paramList.isParameter(paramStr)) \
63  outParamList.set<varType>(outParamStr, paramList.get<varType>(paramStr)); \
64  else \
65  outParamList.set<varType>(outParamStr, defaultValue);
66 
67 namespace MueLu {
68 
69 namespace AdaptiveDetails {
70 template <class SC, class LO, class GO, class NO>
73  ParameterListInterpreter interpreter(list);
74  return Teuchos::rcp_const_cast<SF>(Teuchos::rcp_dynamic_cast<const SF>(interpreter.GetFactoryManager(0)->GetFactory("Smoother")));
75 }
76 } // namespace AdaptiveDetails
77 
78 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
80  : TransferFacts_(factoryList)
81  , blksize_(1) {
82  SetParameterList(paramList);
83 }
84 
85 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
87  : nullspace_(NULL)
88  , TransferFacts_(factoryList)
89  , blksize_(1) {
90  Teuchos::RCP<Teuchos::ParameterList> paramList = Teuchos::getParametersFromXmlFile(xmlFileName);
91  SetParameterList(*paramList);
92 }
93 
94 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
96  Teuchos::ParameterList paramList = paramList_in;
97 
98  RCP<Teuchos::FancyOStream> out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout)); // TODO: use internal out (GetOStream())
99 
100  //
101  // Read top-level of the parameter list
102  //
103 
104  // hard-coded default values == ML defaults according to the manual
105  MUELU_READ_PARAM(paramList, "ML output", int, 0, verbosityLevel);
106  MUELU_READ_PARAM(paramList, "max levels", int, 10, maxLevels);
107  MUELU_READ_PARAM(paramList, "PDE equations", int, 1, nDofsPerNode);
108 
109  MUELU_READ_PARAM(paramList, "coarse: max size", int, 128, maxCoarseSize);
110 
111  MUELU_READ_PARAM(paramList, "aggregation: type", std::string, "Uncoupled", agg_type);
112  // MUELU_READ_PARAM(paramList, "aggregation: threshold", double, 0.0, agg_threshold);
113  MUELU_READ_PARAM(paramList, "aggregation: damping factor", double, (double)4 / (double)3, agg_damping);
114  // MUELU_READ_PARAM(paramList, "aggregation: smoothing sweeps", int, 1, agg_smoothingsweeps);
115  MUELU_READ_PARAM(paramList, "aggregation: nodes per aggregate", int, 1, minPerAgg);
116 
117  MUELU_READ_PARAM(paramList, "null space: type", std::string, "default vectors", nullspaceType);
118  MUELU_READ_PARAM(paramList, "null space: dimension", int, -1, nullspaceDim); // TODO: ML default not in documentation
119  MUELU_READ_PARAM(paramList, "null space: vectors", double*, NULL, nullspaceVec); // TODO: ML default not in documentation
120 
121  MUELU_READ_PARAM(paramList, "energy minimization: enable", bool, false, bEnergyMinimization);
122 
123  //
124  // Move smoothers/aggregation/coarse parameters to sublists
125  //
126 
127  // ML allows to have level-specific smoothers/aggregation/coarse parameters at the top level of the list or/and defined in sublists:
128  // See also: ML Guide section 6.4.1, MueLu::CreateSublists, ML_CreateSublists
129  ParameterList paramListWithSubList;
130  MueLu::CreateSublists(paramList, paramListWithSubList);
131  paramList = paramListWithSubList; // swap
132 
133  // std::cout << std::endl << "Parameter list after CreateSublists" << std::endl;
134  // std::cout << paramListWithSubList << std::endl;
135 
136  int maxNbrAlreadySelected = 0;
137 
138  // Matrix option
139  this->blksize_ = nDofsPerNode;
140 
141  // Translate verbosity parameter
143  if (verbosityLevel == 0) eVerbLevel = Teuchos::VERB_NONE;
144  if (verbosityLevel > 0) eVerbLevel = Teuchos::VERB_LOW;
145  if (verbosityLevel > 4) eVerbLevel = Teuchos::VERB_MEDIUM;
146  if (verbosityLevel > 7) eVerbLevel = Teuchos::VERB_HIGH;
147  if (verbosityLevel > 9) eVerbLevel = Teuchos::VERB_EXTREME;
148 
149  TEUCHOS_TEST_FOR_EXCEPTION(agg_type != "Uncoupled", Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter::Setup(): parameter \"aggregation: type\": only 'Uncoupled' aggregation is supported.");
150 
151  // Create MueLu factories
152  // RCP<NullspaceFactory> nspFact = rcp(new NullspaceFactory());
154  // dropFact->SetVerbLevel(toMueLuVerbLevel(eVerbLevel));
155 
156  // Uncoupled aggregation
158  AggFact->SetMinNodesPerAggregate(minPerAgg); // TODO should increase if run anything other than 1D
159  AggFact->SetMaxNeighAlreadySelected(maxNbrAlreadySelected);
160  AggFact->SetOrdering("natural");
161 
162  if (verbosityLevel > 3) { // TODO fix me: Setup is a static function: we cannot use GetOStream without an object...
163  *out << "========================= Aggregate option summary =========================" << std::endl;
164  *out << "min Nodes per aggregate : " << minPerAgg << std::endl;
165  *out << "min # of root nbrs already aggregated : " << maxNbrAlreadySelected << std::endl;
166  *out << "aggregate ordering : natural" << std::endl;
167  *out << "=============================================================================" << std::endl;
168  }
169 
170  RCP<Factory> PFact;
171  RCP<Factory> RFact;
172  RCP<Factory> PtentFact = rcp(new TentativePFactory());
173  if (agg_damping == 0.0 && bEnergyMinimization == false) {
174  // tentative prolongation operator (PA-AMG)
175  PFact = PtentFact;
176  RFact = rcp(new TransPFactory());
177  } else if (agg_damping != 0.0 && bEnergyMinimization == false) {
178  // smoothed aggregation (SA-AMG)
179  RCP<SaPFactory> SaPFact = rcp(new SaPFactory());
180  SaPFact->SetParameter("sa: damping factor", ParameterEntry(agg_damping));
181  PFact = SaPFact;
182  RFact = rcp(new TransPFactory());
183  } else if (bEnergyMinimization == true) {
184  // Petrov Galerkin PG-AMG smoothed aggregation (energy minimization in ML)
185  PFact = rcp(new PgPFactory());
186  RFact = rcp(new GenericRFactory());
187  }
188 
189  RCP<RAPFactory> AcFact = rcp(new RAPFactory());
190  for (size_t i = 0; i < TransferFacts_.size(); i++) {
191  AcFact->AddTransferFactory(TransferFacts_[i]); // THIS WILL BE REPLACED with a call to the MLParamterListInterpreter
192  }
193 
194  //
195  // Nullspace factory
196  //
197 
198  // Set fine level nullspace
199  // extract pre-computed nullspace from ML parameter list
200  // store it in nullspace_ and nullspaceDim_
201  if (nullspaceType != "default vectors") {
202  TEUCHOS_TEST_FOR_EXCEPTION(nullspaceType != "pre-computed", Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: no valid nullspace (no pre-computed null space). error.");
203  TEUCHOS_TEST_FOR_EXCEPTION(nullspaceDim == -1, Exceptions::RuntimeError, "MueLu::MLParameterListInterpreter: no valid nullspace (nullspace dim == -1). error.");
204  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\'");
205 
206  nullspaceDim_ = nullspaceDim;
207  nullspace_ = nullspaceVec;
208  }
209 
211  nspFact->SetFactory("Nullspace", PtentFact);
212 
213  //
214  // Hierarchy + FactoryManager
215  //
216 
217  // Hierarchy options
218  this->SetVerbLevel(toMueLuVerbLevel(eVerbLevel));
219  this->numDesiredLevel_ = maxLevels;
220  this->maxCoarseSize_ = maxCoarseSize;
221 
222  // init smoother
223  RCP<SmootherFactory> initSmootherFact = Teuchos::null;
224  if (paramList.isSublist("init smoother")) {
225  ParameterList& initList = paramList.sublist("init smoother"); // TODO move this before for loop
226  initSmootherFact = AdaptiveDetails::getSmoother<SC, LO, GO, NO>(initList);
227  } else {
228  std::string ifpackType = "RELAXATION";
229  Teuchos::ParameterList smootherParamList;
230  smootherParamList.set("relaxation: type", "symmetric Gauss-Seidel");
231  smootherParamList.set("smoother: sweeps", 1);
232  smootherParamList.set("smoother: damping factor", 1.0);
233  RCP<SmootherPrototype> smooProto = rcp(new TrilinosSmoother(ifpackType, smootherParamList, 0));
234 
235  initSmootherFact = rcp(new SmootherFactory());
236  initSmootherFact->SetSmootherPrototypes(smooProto, smooProto);
237  }
238 
239  //
240  // Coarse Smoother
241  //
242  ParameterList& coarseList = paramList.sublist("coarse: list");
243  // coarseList.get("smoother: type", "Amesos-KLU"); // set default
244  RCP<SmootherFactory> coarseFact = AdaptiveDetails::getSmoother<SC, LO, GO, NO>(coarseList);
245 
246  // Smoothers Top Level Parameters
247 
248  RCP<ParameterList> topLevelSmootherParam = ExtractSetOfParameters(paramList, "smoother");
249  // std::cout << std::endl << "Top level smoother parameters:" << std::endl;
250  // std::cout << *topLevelSmootherParam << std::endl;
251 
252  //
253 
254  // Prepare factory managers
255  // TODO: smootherFact can be reuse accross level if same parameters/no specific parameterList
256 
257  for (int levelID = 0; levelID < maxLevels; levelID++) {
258  //
259  // Level FactoryManager
260  //
261 
262  RCP<FactoryManager> manager = rcp(new FactoryManager());
263  RCP<FactoryManager> initmanager = rcp(new FactoryManager());
264 
265  //
266  // Smoothers
267  //
268 
269  {
270  // Merge level-specific parameters with global parameters. level-specific parameters takes precedence.
271  // TODO: unit-test this part alone
272 
273  ParameterList levelSmootherParam = GetMLSubList(paramList, "smoother", levelID); // copy
274  MergeParameterList(*topLevelSmootherParam, levelSmootherParam, false); /* false = do no overwrite levelSmootherParam parameters by topLevelSmootherParam parameters */
275  // std::cout << std::endl << "Merged List for level " << levelID << std::endl;
276  // std::cout << levelSmootherParam << std::endl;
277 
278  // RCP<SmootherFactory> smootherFact = this->GetSmootherFactory(levelSmootherParam); // TODO: missing AFact input arg.
279  RCP<SmootherFactory> smootherFact = AdaptiveDetails::getSmoother<SC, LO, GO, NO>(levelSmootherParam);
280  manager->SetFactory("Smoother", smootherFact);
281  smootherFact->DisableMultipleCallCheck();
282 
283  initmanager->SetFactory("Smoother", initSmootherFact);
284  initmanager->SetFactory("CoarseSolver", initSmootherFact);
285  initSmootherFact->DisableMultipleCallCheck();
286  }
287 
288  //
289  // Misc
290  //
291 
292  Teuchos::rcp_dynamic_cast<PFactory>(PFact)->DisableMultipleCallCheck();
293  Teuchos::rcp_dynamic_cast<PFactory>(PtentFact)->DisableMultipleCallCheck();
294  Teuchos::rcp_dynamic_cast<TwoLevelFactoryBase>(RFact)->DisableMultipleCallCheck();
295  Teuchos::rcp_dynamic_cast<SingleLevelFactoryBase>(coarseFact)->DisableMultipleCallCheck();
296  Teuchos::rcp_dynamic_cast<SingleLevelFactoryBase>(dropFact)->DisableMultipleCallCheck();
297  Teuchos::rcp_dynamic_cast<SingleLevelFactoryBase>(AggFact)->DisableMultipleCallCheck();
298  Teuchos::rcp_dynamic_cast<TwoLevelFactoryBase>(AcFact)->DisableMultipleCallCheck();
299  Teuchos::rcp_dynamic_cast<SingleLevelFactoryBase>(nspFact)->DisableMultipleCallCheck();
300 
301  manager->SetFactory("CoarseSolver", coarseFact); // TODO: should not be done in the loop
302  manager->SetFactory("Graph", dropFact);
303  manager->SetFactory("Aggregates", AggFact);
304  manager->SetFactory("DofsPerNode", dropFact);
305  manager->SetFactory("A", AcFact);
306  manager->SetFactory("P", PFact);
307  manager->SetFactory("Ptent", PtentFact);
308  manager->SetFactory("R", RFact);
309  manager->SetFactory("Nullspace", nspFact);
310 
311  // initmanager->SetFactory("CoarseSolver", coarseFact);
312  initmanager->SetFactory("Graph", dropFact);
313  initmanager->SetFactory("Aggregates", AggFact);
314  initmanager->SetFactory("DofsPerNode", dropFact);
315  initmanager->SetFactory("A", AcFact);
316  initmanager->SetFactory("P", PtentFact); // use nonsmoothed transfers
317  initmanager->SetFactory("Ptent", PtentFact);
318  initmanager->SetFactory("R", RFact);
319  initmanager->SetFactory("Nullspace", nspFact);
320 
321  this->AddFactoryManager(levelID, 1, manager);
322  this->AddInitFactoryManager(levelID, 1, initmanager);
323  } // for (level loop)
324 }
325 
326 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
328  TEUCHOS_TEST_FOR_EXCEPTION(!H.GetLevel(0)->IsAvailable("A"), Exceptions::RuntimeError, "No fine level operator");
329 
330  RCP<Level> l = H.GetLevel(0);
331  RCP<Operator> Op = l->Get<RCP<Operator> >("A");
332  SetupOperator(*Op); // use overloaded SetupMatrix routine
333  this->SetupExtra(H);
334 
335  // Setup Hierarchy
336  H.SetMaxCoarseSize(this->maxCoarseSize_); // TODO
337 
338  int levelID = 0;
339  int lastLevelID = this->numDesiredLevel_ - 1;
340  bool isLastLevel = false;
341 
342  while (!isLastLevel) {
343  bool r = H.Setup(levelID,
344  InitLvlMngr(levelID - 1, lastLevelID),
345  InitLvlMngr(levelID, lastLevelID),
346  InitLvlMngr(levelID + 1, lastLevelID));
347 
348  isLastLevel = r || (levelID == lastLevelID);
349  levelID++;
350  }
351 }
352 
353 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
355  // set fine level null space
356  // usually this null space is provided from outside (by the user) using
357  // the ML parameter lists.
358  if (this->nullspace_ != NULL) {
359  RCP<Level> fineLevel = H.GetLevel(0);
360  const RCP<const Map> rowMap = fineLevel->Get<RCP<Matrix> >("A")->getRowMap();
361  RCP<MultiVector> nullspace = MultiVectorFactory::Build(rowMap, nullspaceDim_, true);
362 
363  for (size_t i = 0; i < Teuchos::as<size_t>(nullspaceDim_); i++) {
364  Teuchos::ArrayRCP<Scalar> nullspacei = nullspace->getDataNonConst(i);
365  const size_t myLength = nullspace->getLocalLength();
366 
367  for (size_t j = 0; j < myLength; j++) {
368  nullspacei[j] = nullspace_[i * myLength + j];
369  }
370  }
371 
372  fineLevel->Set("Nullspace", nullspace);
373  }
374 
375  // keep aggregates
376  H.Keep("Aggregates", HierarchyManager::GetFactoryManager(0)->GetFactory("Aggregates").get());
377 
379 
380  // build hierarchy for initialization
381  SetupInitHierarchy(H);
382 
383  {
384  // do some iterations with the built hierarchy to improve the null space
385  Teuchos::RCP<MueLu::Level> Finest = H.GetLevel(0); // get finest level,MueLu::NoFactory::get()
386  Teuchos::RCP<MultiVector> nspVector2 = Finest->Get<Teuchos::RCP<MultiVector> >("Nullspace");
387 
389 
390  RCP<Matrix> Op = Finest->Get<RCP<Matrix> >("A");
392 
393  Teuchos::RCP<MultiVector> homogRhsVec = MultiVectorFactory::Build(nspVector2->getMap(), nspVector2->getNumVectors(), true);
394  homogRhsVec->putScalar(0.0);
395 
396  // do 1 multigrid cycle for improving the null space by "solving"
397  // A B_f = 0
398  // where A is the system matrix and B_f the fine level null space vectors
399  H.Iterate(*homogRhsVec, *nspVector2, 1, false);
400 
401  // store improved fine level null space
402  Finest->Set("Nullspace", nspVector2);
403 
405 
406  // H.Delete("CoarseSolver", init_levelManagers_[0]->GetFactory("CoarseSolver").get());
407  }
408 
409  {
410  // do some clean up.
411  // remove all old default factories. Build new ones for the second build.
412  // this is a little bit tricky to understand
413  for (size_t k = 0; k < HierarchyManager::getNumFactoryManagers(); k++) {
415  // Teuchos::rcp_dynamic_cast<const SingleLevelFactoryBase>(HierarchyManager::GetFactoryManager(k)->GetFactory("Smoother"))->DisableMultipleCallCheck(); // after changing to MLParamterListInterpreter functions
416  }
417  // not sure about this. i only need it if Smoother is defined explicitely (not using default smoother)
418  // need this: otherwise RAPFactory::Build is complaining on level 0
419  // and TentativePFactory::Build is complaining on level 1
420  Teuchos::rcp_dynamic_cast<const TwoLevelFactoryBase>(HierarchyManager::GetFactoryManager(0)->GetFactory("A"))->DisableMultipleCallCheck();
421  Teuchos::rcp_dynamic_cast<const TwoLevelFactoryBase>(HierarchyManager::GetFactoryManager(1)->GetFactory("P"))->DisableMultipleCallCheck();
422  Teuchos::rcp_dynamic_cast<const TwoLevelFactoryBase>(HierarchyManager::GetFactoryManager(1)->GetFactory("Ptent"))->DisableMultipleCallCheck();
423 
425  }
426 }
427 
428 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
430  // check if it's a TwoLevelFactoryBase based transfer factory
431  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!");
432  TransferFacts_.push_back(factory);
433 }
434 
435 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
437  return TransferFacts_.size();
438 }
439 
440 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
442  try {
443  Matrix& A = dynamic_cast<Matrix&>(Op);
444  if (A.IsFixedBlockSizeSet() && (A.GetFixedBlockSize() != blksize_))
445  this->GetOStream(Warnings0) << "Setting matrix block size to " << blksize_ << " (value of the parameter in the list) "
446  << "instead of " << A.GetFixedBlockSize() << " (provided matrix)." << std::endl;
447 
448  A.SetFixedBlockSize(blksize_);
449 
450  } catch (std::bad_cast& e) {
451  this->GetOStream(Warnings0) << "Skipping setting block size as the operator is not a matrix" << std::endl;
452  }
453 }
454 
455 } // namespace MueLu
456 
457 #endif /* MUELU_ADAPTIVESAMLPARAMETERLISTINTERPRETER_DEF_HPP_ */
Important warning messages (one line)
Generic Smoother Factory for generating the smoothers of the MG hierarchy.
void DisableMultipleCallCheck() const
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
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access). Usage: Level-&gt;Get&lt; RCP&lt;Matrix&gt; &gt;(&quot;A&quot;, factory) if factory == NULL =&gt; use default factory.
RCP< Level > & GetLevel(const int levelID=0)
Retrieve a certain level from hierarchy.
Class that encapsulates external library smoothers.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
static void Write(const std::string &fileName, const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &M)
void SetMaxCoarseSize(Xpetra::global_size_t maxCoarseSize)
VerbLevel toMueLuVerbLevel(const Teuchos::EVerbosityLevel verbLevel)
Translate Teuchos verbosity level to MueLu verbosity level.
Base class for factories that use two levels (fineLevel and coarseLevel).
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
void AddTransferFactory(const RCP< const FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories in RepartitionAcFactory.
const Teuchos::ParameterList & GetMLSubList(const Teuchos::ParameterList &paramList, const std::string &type, int levelID)
Factory for building tentative prolongator.
ConvergenceStatus Iterate(const MultiVector &B, MultiVector &X, ConvData conv=ConvData(), bool InitialGuessIsZero=false, LO startLevel=0)
Apply the multigrid preconditioner.
Factory for building restriction operators using a prolongator factory.
void CreateSublists(const ParameterList &List, ParameterList &newList)
size_t getNumFactoryManagers() const
returns number of factory managers stored in levelManagers_ vector.
void AddTransferFactory(const RCP< FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories for RAPFactory.
void SetSmootherPrototypes(RCP< SmootherPrototype > preAndPostSmootherPrototype)
Set smoother prototypes.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
size_t NumTransferFactories() const
Returns number of transfer factories.
bool isSublist(const std::string &name) const
Teuchos::RCP< Teuchos::ParameterList > ExtractSetOfParameters(const Teuchos::ParameterList &paramList, const std::string &str)
void SetMaxNeighAlreadySelected(int maxNeighAlreadySelected)
RCP< FactoryManagerBase > GetFactoryManager(int levelID) const
void Set(const std::string &ename, const T &entry, const FactoryBase *factory=NoFactory::get())
void SetParameter(const std::string &name, const ParameterEntry &entry)
Set a parameter directly as a ParameterEntry.
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Set Factory.
Factory for creating a graph based on a given matrix.
virtual void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)=0
Configuration.
An exception safe way to call the method TwoLevelFactoryBase::DisableMultipleCallCheck.
Factory for building restriction operators.
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
Exception throws to report errors in the internal logical of the program.
Factory that provides an interface for a concrete implementation of a prolongation operator...
void Keep(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Call Level::Keep(ename, factory) for each level of the Hierarchy.
Factory for building coarse matrices.
Factory for building Petrov-Galerkin Smoothed Aggregation prolongators.
Factory for building Smoothed Aggregation prolongators.Input/output of SaPFactory
#define MUELU_READ_PARAM(paramList, paramStr, varType, defaultValue, varName)
Factory for building uncoupled aggregates.
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.
Base class for factories that use one level (currentLevel).
Teuchos::RCP< MueLu::SmootherFactory< SC, LO, GO, NO > > getSmoother(Teuchos::ParameterList &list)
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
Factory for generating nullspace.
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.