MueLu  Version of the Day
MueLu_HierarchyManager.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // MueLu: A package for multigrid based preconditioning
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef MUELU_HIERARCHYMANAGER_DECL_HPP
47 #define MUELU_HIERARCHYMANAGER_DECL_HPP
48 
49 #include <string>
50 #include <map>
51 
52 #include <Teuchos_Array.hpp>
53 
54 #include <Xpetra_Operator.hpp>
55 #include <Xpetra_IO.hpp>
56 
57 #include "MueLu_ConfigDefs.hpp"
58 
59 #include "MueLu_Exceptions.hpp"
60 #include "MueLu_Aggregates.hpp"
61 #include "MueLu_Hierarchy.hpp"
63 #include "MueLu_Level.hpp"
64 #include "MueLu_MasterList.hpp"
65 #include "MueLu_PerfUtils.hpp"
66 
67 #ifdef HAVE_MUELU_INTREPID2
68 #include "Kokkos_DynRankView.hpp"
69 #endif
70 
71 namespace MueLu {
72 
73  // This class stores the configuration of a Hierarchy.
74  // The class also provides an algorithm to build a Hierarchy from the configuration.
75  //
76  // See also: FactoryManager
77  //
78  template <class Scalar = DefaultScalar,
81  class Node = DefaultNode>
82  class HierarchyManager : public HierarchyFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
83 #undef MUELU_HIERARCHYMANAGER_SHORT
84 #include "MueLu_UseShortNames.hpp"
85  typedef std::pair<std::string, const FactoryBase*> keep_pair;
86 
87  public:
88 
90  HierarchyManager(int numDesiredLevel = MasterList::getDefault<int>("max levels")) :
91  numDesiredLevel_ (numDesiredLevel),
92  maxCoarseSize_ (MasterList::getDefault<int>("coarse: max size")),
94  doPRrebalance_ (MasterList::getDefault<bool>("repartition: rebalance P and R")),
95  implicitTranspose_ (MasterList::getDefault<bool>("transpose: use implicit")),
96  fuseProlongationAndUpdate_ (MasterList::getDefault<bool>("fuse prolongation and update")),
97  sizeOfMultiVectors_ (MasterList::getDefault<int>("number of vectors")),
98  // -2 = no output, -1 = all levels
99  graphOutputLevel_(-2) { }
100 
102  virtual ~HierarchyManager() { }
103 
105  void AddFactoryManager(int startLevel, int numDesiredLevel, RCP<FactoryManagerBase> manager) {
106  const int lastLevel = startLevel + numDesiredLevel - 1;
107  if (levelManagers_.size() < lastLevel + 1)
108  levelManagers_.resize(lastLevel + 1);
109 
110  for (int iLevel = startLevel; iLevel <= lastLevel; iLevel++)
111  levelManagers_[iLevel] = manager;
112  }
113 
115  RCP<FactoryManagerBase> GetFactoryManager(int levelID) const {
116  // NOTE: last levelManager is used for all the remaining levels
117  return (levelID >= levelManagers_.size() ? levelManagers_[levelManagers_.size()-1] : levelManagers_[levelID]);
118  }
119 
121  size_t getNumFactoryManagers() const {
122  return levelManagers_.size();
123  }
124 
126  void CheckConfig() {
127  for (int i = 0; i < levelManagers_.size(); i++)
128  TEUCHOS_TEST_FOR_EXCEPTION(levelManagers_[i] == Teuchos::null, Exceptions::RuntimeError, "MueLu:HierarchyConfig::CheckConfig(): Undefined configuration for level:");
129  }
130 
132 
133  virtual RCP<Hierarchy> CreateHierarchy() const {
134  return rcp(new Hierarchy());
135  }
136 
137  virtual RCP<Hierarchy> CreateHierarchy(const std::string& label) const {
138  return rcp(new Hierarchy(label));
139  }
140 
142  virtual void SetupHierarchy(Hierarchy& H) const {
143  TEUCHOS_TEST_FOR_EXCEPTION(!H.GetLevel(0)->IsAvailable("A"), Exceptions::RuntimeError, "No fine level operator");
144 
145  RCP<Level> l0 = H.GetLevel(0);
146  RCP<Operator> Op = l0->Get<RCP<Operator> >("A");
147  // Check that user-supplied nullspace dimension is at least as large as NumPDEs
148  if (l0->IsAvailable("Nullspace")) {
149  RCP<Matrix> A = Teuchos::rcp_dynamic_cast<Matrix>(Op);
150  if (A != Teuchos::null) {
151  Teuchos::RCP<MultiVector> nullspace = l0->Get<RCP<MultiVector> >("Nullspace");
152  TEUCHOS_TEST_FOR_EXCEPTION(static_cast<size_t>(A->GetFixedBlockSize()) > nullspace->getNumVectors(), Exceptions::RuntimeError, "user-provided nullspace has fewer vectors (" << nullspace->getNumVectors() << ") than number of PDE equations (" << A->GetFixedBlockSize() << ")");
153  } else {
154  this->GetOStream(Warnings0) << "Skipping dimension check of user-supplied nullspace because user-supplied operator is not a matrix" << std::endl;
155  }
156  }
157 
158 #ifdef HAVE_MUELU_DEBUG
159  // Reset factories' data used for debugging
160  for (int i = 0; i < levelManagers_.size(); i++)
161  levelManagers_[i]->ResetDebugData();
162 
163 #endif
164 
165  // Setup Matrix
166  // TODO: I should certainly undo this somewhere...
167 
168  Xpetra::UnderlyingLib lib = Op->getDomainMap()->lib();
169  H.setlib(lib);
170 
171  SetupOperator(*Op);
172  SetupExtra(H);
173 
174  // Setup Hierarchy
177  if (graphOutputLevel_ >= 0 || graphOutputLevel_ == -1)
178  H.EnableGraphDumping("dep_graph", graphOutputLevel_);
179 
181  RCP<Matrix> Amat = rcp_dynamic_cast<Matrix>(Op);
182 
183  if (!Amat.is_null()) {
184  RCP<ParameterList> params = rcp(new ParameterList());
185  params->set("printLoadBalancingInfo", true);
186  params->set("printCommInfo", true);
187 
189  } else {
190  VerboseObject::GetOStream(Warnings1) << "Fine level operator is not a matrix, statistics are not available" << std::endl;
191  }
192  }
193 
197 
198  H.Clear();
199 
200  // There are few issues with using Keep in the interpreter:
201  // 1. Hierarchy::Keep interface takes a name and a factory. If
202  // factories are different on different levels, the AddNewLevel() call
203  // in Hierarchy does not work properly, as it assume that factories are
204  // the same.
205  // 2. FactoryManager does not have a Keep option, only Hierarchy and
206  // Level have it
207  // 3. Interpreter constructs factory managers, but not levels. So we
208  // cannot set up Keep flags there.
209  //
210  // The solution implemented here does the following:
211  // 1. Construct hierarchy with dummy levels. This avoids
212  // Hierarchy::AddNewLevel() calls which will propagate wrong
213  // inheritance.
214  // 2. Interpreter constructs keep_ array with names and factories for
215  // that level
216  // 3. For each level, we call Keep(name, factory) for each keep_
217  for (int i = 0; i < numDesiredLevel_; i++) {
218  std::map<int, std::vector<keep_pair> >::const_iterator it = keep_.find(i);
219  if (it != keep_.end()) {
220  RCP<Level> l = H.GetLevel(i);
221  const std::vector<keep_pair>& keeps = it->second;
222  for (size_t j = 0; j < keeps.size(); j++)
223  l->Keep(keeps[j].first, keeps[j].second);
224  }
225  if (i < numDesiredLevel_-1) {
226  RCP<Level> newLevel = rcp(new Level());
227  H.AddLevel(newLevel);
228  }
229  }
233  ExportDataSetKeepFlags(H, nullspaceToPrint_, "Nullspace");
234  ExportDataSetKeepFlags(H, coordinatesToPrint_, "Coordinates");
235  // NOTE: Aggregates use the next level's Factory
237 #ifdef HAVE_MUELU_INTREPID2
238  ExportDataSetKeepFlags(H,elementToNodeMapsToPrint_, "pcoarsen: element to node map");
239 #endif
240 
241  int levelID = 0;
242  int lastLevelID = numDesiredLevel_ - 1;
243  bool isLastLevel = false;
244 
245  while (!isLastLevel) {
246  bool r = H.Setup(levelID,
247  LvlMngr(levelID-1, lastLevelID),
248  LvlMngr(levelID, lastLevelID),
249  LvlMngr(levelID+1, lastLevelID));
250  H.GetLevel(levelID)->print(H.GetOStream(Developer), verbosity_);
251 
252  isLastLevel = r || (levelID == lastLevelID);
253  levelID++;
254  }
255  if (!matvecParams_.is_null())
258  // Set hierarchy description.
259  // This is cached, but involves and MPI_Allreduce.
260  H.description();
262 
263  // When we reuse hierarchy, it is necessary that we don't
264  // change the number of levels. We also cannot make requests
265  // for coarser levels, because we don't construct all the
266  // data on previous levels. For instance, let's say our first
267  // run constructed three levels. If we try to do requests during
268  // next setup for the fourth level, it would need Aggregates
269  // which we didn't construct for level 3 because we reused P.
270  // To fix this situation, we change the number of desired levels
271  // here.
272  numDesiredLevel_ = levelID;
273 
274  WriteData<Matrix>(H, matricesToPrint_, "A");
275  WriteData<Matrix>(H, prolongatorsToPrint_, "P");
276  WriteData<Matrix>(H, restrictorsToPrint_, "R");
277  WriteData<MultiVector>(H, nullspaceToPrint_, "Nullspace");
278  WriteData<MultiVector>(H, coordinatesToPrint_, "Coordinates");
279  WriteDataAggregates(H, aggregatesToPrint_, "Aggregates");
280 #ifdef HAVE_MUELU_INTREPID2
281  typedef Kokkos::DynRankView<LocalOrdinal,typename Node::device_type> FCi;
282  WriteDataFC<FCi>(H,elementToNodeMapsToPrint_, "pcoarsen: element to node map","el2node");
283 #endif
284 
285 
286  } //SetupHierarchy
287 
289 
290  typedef std::map<std::string, RCP<const FactoryBase> > FactoryMap;
291 
292  protected: //TODO: access function
293 
295  virtual void SetupOperator(Operator& /* Op */) const { }
296 
298  // TODO: merge with SetupMatrix ?
299  virtual void SetupExtra(Hierarchy& /* H */) const { }
300 
301  // TODO this was private
302  // Used in SetupHierarchy() to access levelManagers_
303  // Inputs i=-1 and i=size() are allowed to simplify calls to hierarchy->Setup()
304  Teuchos::RCP<FactoryManagerBase> LvlMngr(int levelID, int lastLevelID) const {
305  // NOTE: the order of 'if' statements is important
306  if (levelID == -1) // levelID = -1 corresponds to the finest level
307  return Teuchos::null;
308 
309  if (levelID == lastLevelID+1) // levelID = 'lastLevelID+1' corresponds to the last level (i.e., no nextLevel)
310  return Teuchos::null;
311 
312  if (levelManagers_.size() == 0) { // default factory manager.
313  // The default manager is shared across levels, initialized only if needed and deleted with the HierarchyManager
314  static RCP<FactoryManagerBase> defaultMngr = rcp(new FactoryManager());
315  return defaultMngr;
316  }
317 
318  return GetFactoryManager(levelID);
319  }
320 
321  // Hierarchy parameters
322  mutable int numDesiredLevel_;
323  Xpetra::global_size_t maxCoarseSize_;
330  Teuchos::Array<int> matricesToPrint_;
331  Teuchos::Array<int> prolongatorsToPrint_;
332  Teuchos::Array<int> restrictorsToPrint_;
333  Teuchos::Array<int> nullspaceToPrint_;
334  Teuchos::Array<int> coordinatesToPrint_;
335  Teuchos::Array<int> aggregatesToPrint_;
336  Teuchos::Array<int> elementToNodeMapsToPrint_;
337  Teuchos::RCP<Teuchos::ParameterList> matvecParams_;
338 
339  std::map<int, std::vector<keep_pair> > keep_;
340 
341  private:
342  // Set the keep flags for Export Data
343  void ExportDataSetKeepFlags(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name) const {
344  for (int i = 0; i < data.size(); ++i) {
345  if (data[i] < H.GetNumLevels()) {
346  RCP<Level> L = H.GetLevel(data[i]);
347  if(!L.is_null() && data[i] < levelManagers_.size())
348  L->AddKeepFlag(name, &*levelManagers_[data[i]]->GetFactory(name));
349  }
350  }
351  }
352 
353  void ExportDataSetKeepFlagsNextLevel(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name) const {
354  for (int i = 0; i < data.size(); ++i) {
355  if (data[i] < H.GetNumLevels()) {
356  RCP<Level> L = H.GetLevel(data[i]);
357  if(!L.is_null() && data[i]+1 < levelManagers_.size())
358  L->AddKeepFlag(name, &*levelManagers_[data[i]+1]->GetFactory(name));
359  }
360  }
361  }
362 
363 
364  template<class T>
365  void WriteData(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name) const {
366  for (int i = 0; i < data.size(); ++i) {
367  std::string fileName;
368  if (H.getObjectLabel() != "")
369  fileName = H.getObjectLabel() + "_" + name + "_" + Teuchos::toString(data[i]) + ".m";
370  else
371  fileName = name + "_" + Teuchos::toString(data[i]) + ".m";
372 
373  if (data[i] < H.GetNumLevels()) {
374  RCP<Level> L = H.GetLevel(data[i]);
375  if (data[i] < levelManagers_.size() && L->IsAvailable(name,&*levelManagers_[data[i]]->GetFactory(name))) {
376  // Try generating factory
377  RCP<T> M = L->template Get< RCP<T> >(name,&*levelManagers_[data[i]]->GetFactory(name));
378  if (!M.is_null()) {
379  Xpetra::IO<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Write(fileName,* M);
380  }
381  }
382  else if (L->IsAvailable(name)) {
383  // Try nofactory
384  RCP<T> M = L->template Get< RCP<T> >(name);
385  if (!M.is_null()) {
386  Xpetra::IO<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Write(fileName,* M);
387  }
388  }
389 
390  }
391  }
392  }
393 
394 
395  void WriteDataAggregates(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name) const {
396  for (int i = 0; i < data.size(); ++i) {
397  const std::string fileName = name + "_" + Teuchos::toString(data[i]) + ".m";
398 
399  if (data[i] < H.GetNumLevels()) {
400  RCP<Level> L = H.GetLevel(data[i]);
401 
402  // NOTE: Aggregates use the next level's factory
403  RCP<Aggregates> agg;
404  if(data[i]+1 < H.GetNumLevels() && L->IsAvailable(name,&*levelManagers_[data[i]+1]->GetFactory(name))) {
405  // Try generating factory
406  agg = L->template Get< RCP<Aggregates> >(name,&*levelManagers_[data[i]+1]->GetFactory(name));
407  }
408  else if (L->IsAvailable(name)) {
409  agg = L->template Get<RCP<Aggregates> >("Aggregates");
410  }
411  if(!agg.is_null()) {
412  std::ofstream ofs(fileName);
413  Teuchos::FancyOStream fofs(rcp(&ofs,false));
414  agg->print(fofs,Teuchos::VERB_EXTREME);
415  }
416  }
417  }
418  }
419 
420  template<class T>
421  void WriteDataFC(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name, const std::string & ofname) const {
422  for (int i = 0; i < data.size(); ++i) {
423  const std::string fileName = ofname + "_" + Teuchos::toString(data[i]) + ".m";
424 
425  if (data[i] < H.GetNumLevels()) {
426  RCP<Level> L = H.GetLevel(data[i]);
427 
428  if (L->IsAvailable(name)) {
429  RCP<T> M = L->template Get< RCP<T> >(name);
430  if (!M.is_null()) {
431  RCP<Matrix> A = L->template Get<RCP<Matrix> >("A");
432  RCP<const CrsGraph> AG = A->getCrsGraph();
433  WriteFieldContainer<T>(fileName,*M,*AG->getColMap());
434  }
435  }
436  }
437  }
438  }
439 
440  // For dumping an IntrepidPCoarsening element-to-node map to disk
441  template<class T>
442  void WriteFieldContainer(const std::string& fileName, T & fcont,const Map &colMap) const {
443 
444  size_t num_els = (size_t) fcont.extent(0);
445  size_t num_vecs =(size_t) fcont.extent(1);
446 
447  // Generate rowMap
448  Teuchos::RCP<const Map> rowMap = Xpetra::MapFactory<LO,GO,NO>::Build(colMap.lib(),Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid(),fcont.extent(0),colMap.getIndexBase(),colMap.getComm());
449 
450  // Fill multivector to use *petra dump routines
451  RCP<GOMultiVector> vec = Xpetra::MultiVectorFactory<GO, LO, GO, NO>::Build(rowMap,num_vecs);
452 
453  for(size_t j=0; j<num_vecs; j++) {
454  Teuchos::ArrayRCP<GO> v = vec->getDataNonConst(j);
455  for(size_t i=0; i<num_els; i++)
456  v[i] = colMap.getGlobalElement(fcont(i,j));
457  }
458 
459  Xpetra::IO<GO,LO,GO,NO>::Write(fileName,*vec);
460  }
461 
462 
463 
464  // Levels
465  Array<RCP<FactoryManagerBase> > levelManagers_; // one FactoryManager per level (the last levelManager is used for all the remaining levels)
466 
467  }; // class HierarchyManager
468 
469 } // namespace MueLu
470 
471 #define MUELU_HIERARCHYMANAGER_SHORT
472 #endif // MUELU_HIERARCHYMANAGER_HPP
473 
474 //TODO: split into _decl/_def
475 // TODO: default value for first param (FactoryManager()) should not be duplicated (code maintainability)
Important warning messages (one line)
void ExportDataSetKeepFlagsNextLevel(Hierarchy &H, const Teuchos::Array< int > &data, const std::string &name) const
This class specifies the default factory that should generate some data on a Level if the data does n...
Teuchos::Array< int > matricesToPrint_
MueLu::DefaultLocalOrdinal LocalOrdinal
KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
virtual void SetupOperator(Operator &) const
Setup Matrix object.
RCP< Level > & GetLevel(const int levelID=0)
Retrieve a certain level from hierarchy.
std::string toString(const T &what)
Little helper function to convert non-string types to strings.
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
static void SetDefaultVerbLevel(const VerbLevel defaultVerbLevel)
Set the default (global) verbosity level.
void AddLevel(const RCP< Level > &level)
Add a level at the end of the hierarchy.
Teuchos::Array< int > elementToNodeMapsToPrint_
void SetMaxCoarseSize(Xpetra::global_size_t maxCoarseSize)
Print information primarily of interest to developers.
void AddFactoryManager(int startLevel, int numDesiredLevel, RCP< FactoryManagerBase > manager)
One-liner description of what is happening.
void WriteData(Hierarchy &H, const Teuchos::Array< int > &data, const std::string &name) const
void Clear(int startLevel=0)
Clear impermanent data from previous setup.
void WriteDataAggregates(Hierarchy &H, const Teuchos::Array< int > &data, const std::string &name) const
void SetFuseProlongationAndUpdate(const bool &fuse)
Namespace for MueLu classes and methods.
RCP< FactoryManagerBase > GetFactoryManager(int levelID) const
bool IsPrint(MsgType type, int thisProcRankOnly=-1) const
Find out whether we need to print out information for a specific message type.
std::map< std::string, RCP< const FactoryBase > > FactoryMap
MueLu::DefaultNode Node
Static class that holds the complete list of valid MueLu parameters.
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
Print even more statistics.
Additional warnings.
Teuchos::RCP< FactoryManagerBase > LvlMngr(int levelID, int lastLevelID) const
Teuchos::RCP< Teuchos::ParameterList > matvecParams_
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Class that holds all level-specific information.
Definition: MueLu_Level.hpp:99
Teuchos::Array< int > nullspaceToPrint_
Array< RCP< FactoryManagerBase > > levelManagers_
void ExportDataSetKeepFlags(Hierarchy &H, const Teuchos::Array< int > &data, const std::string &name) const
void describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the Hierarchy with some verbosity level to a FancyOStream object.
void AllocateLevelMultiVectors(int numvecs, bool forceMapCheck=false)
static std::string PrintMatrixInfo(const Matrix &A, const std::string &msgTag, RCP< const Teuchos::ParameterList > params=Teuchos::null)
virtual void SetupExtra(Hierarchy &) const
Setup extra data.
void SetPRrebalance(bool doPRrebalance)
void SetMatvecParams(RCP< ParameterList > matvecParams)
Teuchos::Array< int > aggregatesToPrint_
void SetImplicitTranspose(const bool &implicit)
void WriteDataFC(Hierarchy &H, const Teuchos::Array< int > &data, const std::string &name, const std::string &ofname) const
virtual RCP< Hierarchy > CreateHierarchy() const
Create an empty Hierarchy object.
Teuchos::Array< int > prolongatorsToPrint_
virtual RCP< Hierarchy > CreateHierarchy(const std::string &label) const
Create a labeled empty Hierarchy object.
void WriteFieldContainer(const std::string &fileName, T &fcont, const Map &colMap) const
Teuchos::Array< int > coordinatesToPrint_
std::map< int, std::vector< keep_pair > > keep_
HierarchyManager(int numDesiredLevel=MasterList::getDefault< int >("max levels"))
Exception throws to report errors in the internal logical of the program.
std::pair< std::string, const FactoryBase * > keep_pair
size_t getNumFactoryManagers() const
returns number of factory managers stored in levelManagers_ vector.
void setlib(Xpetra::UnderlyingLib inlib)
std::string description() const
Return a simple one-line description of this object.
Xpetra::global_size_t maxCoarseSize_
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.
Teuchos::Array< int > restrictorsToPrint_
void EnableGraphDumping(const std::string &filename, int levelID=1)
Provides methods to build a multigrid hierarchy and apply multigrid cycles.