MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_HierarchyManager.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 #ifndef MUELU_HIERARCHYMANAGER_DECL_HPP
11 #define MUELU_HIERARCHYMANAGER_DECL_HPP
12 
13 #include <string>
14 #include <map>
15 
16 #include <Teuchos_Array.hpp>
17 
18 #include <Xpetra_Operator.hpp>
19 #include <Xpetra_IO.hpp>
20 
21 #include "MueLu_ConfigDefs.hpp"
22 
23 #include "MueLu_Exceptions.hpp"
24 #include "MueLu_Aggregates.hpp"
25 #include "MueLu_Hierarchy.hpp"
27 #include "MueLu_Level.hpp"
28 #include "MueLu_MasterList.hpp"
29 #include "MueLu_PerfUtils.hpp"
30 
31 #ifdef HAVE_MUELU_INTREPID2
32 #include "Kokkos_DynRankView.hpp"
33 #endif
34 
35 namespace MueLu {
36 
37 // This class stores the configuration of a Hierarchy.
38 // The class also provides an algorithm to build a Hierarchy from the configuration.
39 //
40 // See also: FactoryManager
41 //
42 template <class Scalar = DefaultScalar,
45  class Node = DefaultNode>
46 class HierarchyManager : public HierarchyFactory<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
47 #undef MUELU_HIERARCHYMANAGER_SHORT
48 #include "MueLu_UseShortNames.hpp"
49  typedef std::pair<std::string, const FactoryBase*> keep_pair;
50 
51  public:
53  HierarchyManager(int numDesiredLevel = MasterList::getDefault<int>("max levels"))
54  : numDesiredLevel_(numDesiredLevel)
55  , maxCoarseSize_(MasterList::getDefault<int>("coarse: max size"))
57  , doPRrebalance_(MasterList::getDefault<bool>("repartition: rebalance P and R"))
58  , doPRViaCopyrebalance_(MasterList::getDefault<bool>("repartition: explicit via new copy rebalance P and R"))
59  , implicitTranspose_(MasterList::getDefault<bool>("transpose: use implicit"))
60  , fuseProlongationAndUpdate_(MasterList::getDefault<bool>("fuse prolongation and update"))
61  , suppressNullspaceDimensionCheck_(MasterList::getDefault<bool>("nullspace: suppress dimension check"))
62  , sizeOfMultiVectors_(MasterList::getDefault<int>("number of vectors"))
64 
66  virtual ~HierarchyManager() = default;
67 
69  void AddFactoryManager(int startLevel, int numDesiredLevel, RCP<FactoryManagerBase> manager) {
70  const int lastLevel = startLevel + numDesiredLevel - 1;
71  if (levelManagers_.size() < lastLevel + 1)
72  levelManagers_.resize(lastLevel + 1);
73 
74  for (int iLevel = startLevel; iLevel <= lastLevel; iLevel++)
75  levelManagers_[iLevel] = manager;
76  }
77 
80  // NOTE: last levelManager is used for all the remaining levels
81  return (levelID >= levelManagers_.size() ? levelManagers_[levelManagers_.size() - 1] : levelManagers_[levelID]);
82  }
83 
85  size_t getNumFactoryManagers() const {
86  return levelManagers_.size();
87  }
88 
90  void CheckConfig() {
91  for (int i = 0; i < levelManagers_.size(); i++)
92  TEUCHOS_TEST_FOR_EXCEPTION(levelManagers_[i] == Teuchos::null, Exceptions::RuntimeError, "MueLu:HierarchyConfig::CheckConfig(): Undefined configuration for level:");
93  }
94 
96 
97  virtual RCP<Hierarchy> CreateHierarchy() const {
98  return rcp(new Hierarchy());
99  }
100 
101  virtual RCP<Hierarchy> CreateHierarchy(const std::string& label) const {
102  return rcp(new Hierarchy(label));
103  }
104 
106  virtual void SetupHierarchy(Hierarchy& H) const {
107  TEUCHOS_TEST_FOR_EXCEPTION(!H.GetLevel(0)->IsAvailable("A"), Exceptions::RuntimeError, "No fine level operator");
108 
109  RCP<Level> l0 = H.GetLevel(0);
110  RCP<Operator> Op = l0->Get<RCP<Operator>>("A");
111 
112  // Compare nullspace dimension to NumPDEs and throw/warn based on user input
113  if (l0->IsAvailable("Nullspace")) {
114  RCP<Matrix> A = Teuchos::rcp_dynamic_cast<Matrix>(Op);
115  if (A != Teuchos::null) {
116  RCP<MultiVector> nullspace = l0->Get<RCP<MultiVector>>("Nullspace");
117 
118  if (static_cast<size_t>(A->GetFixedBlockSize()) > nullspace->getNumVectors()) {
119  std::stringstream msg;
120  msg << "User-provided nullspace has fewer vectors ("
121  << nullspace->getNumVectors() << ") than number of PDE equations ("
122  << A->GetFixedBlockSize() << "). ";
123 
125  msg << "It depends on the PDE, if this is a problem or not.";
126  this->GetOStream(Warnings0) << msg.str() << std::endl;
127  } else {
128  msg << "Add the missing nullspace vectors! (You can suppress this check. See the MueLu user guide for details.)";
129  TEUCHOS_TEST_FOR_EXCEPTION(static_cast<size_t>(A->GetFixedBlockSize()) > nullspace->getNumVectors(), Exceptions::RuntimeError, msg.str());
130  }
131  }
132  } else {
133  this->GetOStream(Warnings0) << "Skipping dimension check of user-supplied nullspace because user-supplied operator is not a matrix" << std::endl;
134  }
135  }
136 
137 #ifdef HAVE_MUELU_DEBUG
138  // Reset factories' data used for debugging
139  for (int i = 0; i < levelManagers_.size(); i++)
140  levelManagers_[i]->ResetDebugData();
141 
142 #endif
143 
144  // Setup Matrix
145  // TODO: I should certainly undo this somewhere...
146 
147  Xpetra::UnderlyingLib lib = Op->getDomainMap()->lib();
148  H.setlib(lib);
149 
150  SetupOperator(*Op);
151  SetupExtra(H);
152 
153  // Setup Hierarchy
156  if (graphOutputLevel_ >= 0 || graphOutputLevel_ == -1)
157  H.EnableGraphDumping("dep_graph", graphOutputLevel_);
158 
160  RCP<Matrix> Amat = rcp_dynamic_cast<Matrix>(Op);
161 
162  if (!Amat.is_null()) {
163  RCP<ParameterList> params = rcp(new ParameterList());
164  params->set("printLoadBalancingInfo", true);
165  params->set("printCommInfo", true);
166 
168  } else {
169  VerboseObject::GetOStream(Warnings1) << "Fine level operator is not a matrix, statistics are not available" << std::endl;
170  }
171  }
172 
174 
178 
179  H.Clear();
180 
181  // There are few issues with using Keep in the interpreter:
182  // 1. Hierarchy::Keep interface takes a name and a factory. If
183  // factories are different on different levels, the AddNewLevel() call
184  // in Hierarchy does not work properly, as it assume that factories are
185  // the same.
186  // 2. FactoryManager does not have a Keep option, only Hierarchy and
187  // Level have it
188  // 3. Interpreter constructs factory managers, but not levels. So we
189  // cannot set up Keep flags there.
190  //
191  // The solution implemented here does the following:
192  // 1. Construct hierarchy with dummy levels. This avoids
193  // Hierarchy::AddNewLevel() calls which will propagate wrong
194  // inheritance.
195  // 2. Interpreter constructs keep_ array with names and factories for
196  // that level
197  // 3. For each level, we call Keep(name, factory) for each keep_
198 
199  for (int i = 0; i < numDesiredLevel_; i++) {
200  std::map<int, std::vector<keep_pair>>::const_iterator it = keep_.find(i);
201  if (it != keep_.end()) {
202  RCP<Level> l = H.GetLevel(i);
203  const std::vector<keep_pair>& keeps = it->second;
204  for (size_t j = 0; j < keeps.size(); j++)
205  l->Keep(keeps[j].first, keeps[j].second);
206  }
207  if (i < numDesiredLevel_ - 1) {
208  RCP<Level> newLevel = rcp(new Level());
209  H.AddLevel(newLevel);
210  }
211  }
212 
213  // Matrices to print
214  for (auto iter = matricesToPrint_.begin(); iter != matricesToPrint_.end(); iter++)
215  ExportDataSetKeepFlags(H, iter->second, iter->first);
216 
217  // Vectors, aggregates and other things that need special case handling
218  ExportDataSetKeepFlags(H, nullspaceToPrint_, "Nullspace");
219  ExportDataSetKeepFlags(H, coordinatesToPrint_, "Coordinates");
221  // NOTE: Aggregates use the next level's Factory
223 #ifdef HAVE_MUELU_INTREPID2
224  ExportDataSetKeepFlags(H, elementToNodeMapsToPrint_, "pcoarsen: element to node map");
225 #endif
226 
227  // Data to keep only (these do not have a level, so we do all levels)
228  for (int i = 0; i < dataToKeep_.size(); i++)
230 
231  int levelID = 0;
232  int lastLevelID = numDesiredLevel_ - 1;
233  bool isLastLevel = false;
234 
235  while (!isLastLevel) {
236  bool r = H.Setup(levelID,
237  LvlMngr(levelID - 1, lastLevelID),
238  LvlMngr(levelID, lastLevelID),
239  LvlMngr(levelID + 1, lastLevelID));
240  if (levelID < H.GetNumLevels())
241  H.GetLevel(levelID)->print(H.GetOStream(Developer), verbosity_);
242 
243  isLastLevel = r || (levelID == lastLevelID);
244  levelID++;
245  }
246 
247  if (!matvecParams_.is_null())
250  // Set hierarchy description.
251  // This is cached, but involves and MPI_Allreduce.
252  H.description();
255 
256  // When we reuse hierarchy, it is necessary that we don't
257  // change the number of levels. We also cannot make requests
258  // for coarser levels, because we don't construct all the
259  // data on previous levels. For instance, let's say our first
260  // run constructed three levels. If we try to do requests during
261  // next setup for the fourth level, it would need Aggregates
262  // which we didn't construct for level 3 because we reused P.
263  // To fix this situation, we change the number of desired levels
264  // here.
265  numDesiredLevel_ = levelID;
266 
267  // Matrix prints
268  for (auto iter = matricesToPrint_.begin(); iter != matricesToPrint_.end(); iter++) {
269  WriteData<Matrix>(H, iter->second, iter->first);
270  }
271 
272  // Vectors, aggregates and all things we need to print manually
273  WriteData<MultiVector>(H, nullspaceToPrint_, "Nullspace");
274  WriteData<MultiVector>(H, coordinatesToPrint_, "Coordinates");
275  WriteData<MultiVector>(H, materialToPrint_, "Material");
276  WriteDataAggregates(H, aggregatesToPrint_, "Aggregates");
277 
278 #ifdef HAVE_MUELU_INTREPID2
279  typedef Kokkos::DynRankView<LocalOrdinal, typename Node::device_type> FCi;
280  WriteDataFC<FCi>(H, elementToNodeMapsToPrint_, "pcoarsen: element to node map", "el2node");
281 #endif
282 
283  } // SetupHierarchy
284 
286  void SetNumDesiredLevel(int numDesiredLevel) { numDesiredLevel_ = numDesiredLevel; }
287 
290 
292 
293  typedef std::map<std::string, RCP<const FactoryBase>> FactoryMap;
294 
295  protected: // TODO: access function
297  virtual void SetupOperator(Operator& /* Op */) const {}
298 
300  // TODO: merge with SetupMatrix ?
301  virtual void SetupExtra(Hierarchy& /* H */) const {}
302 
303  // TODO this was private
304  // Used in SetupHierarchy() to access levelManagers_
305  // Inputs i=-1 and i=size() are allowed to simplify calls to hierarchy->Setup()
306  Teuchos::RCP<FactoryManagerBase> LvlMngr(int levelID, int lastLevelID) const {
307  // NOTE: the order of 'if' statements is important
308  if (levelID == -1) // levelID = -1 corresponds to the finest level
309  return Teuchos::null;
310 
311  if (levelID == lastLevelID + 1) // levelID = 'lastLevelID+1' corresponds to the last level (i.e., no nextLevel)
312  return Teuchos::null;
313 
314  if (levelManagers_.size() == 0) { // default factory manager.
315  // The default manager is shared across levels, initialized only if needed and deleted with the HierarchyManager
316  static RCP<FactoryManagerBase> defaultMngr = rcp(new FactoryManager());
317  return defaultMngr;
318  }
319 
320  return GetFactoryManager(levelID);
321  }
322 
325  mutable int numDesiredLevel_;
328 
333 
341 
343 
346 
348  // Items here get handled manually
354 
355  // Data we'll need to keep, either to dump to disk or to use post-setup
357 
358  // Matrices we'll need to print
359  std::map<std::string, Teuchos::Array<int>> matricesToPrint_;
360 
362 
363  std::map<int, std::vector<keep_pair>> keep_;
365 
366  private:
367  // Set the keep flags for Export Data
368  void ExportDataSetKeepFlags(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name) const {
369  for (int i = 0; i < data.size(); ++i) {
370  if (data[i] < H.GetNumLevels()) {
371  RCP<Level> L = H.GetLevel(data[i]);
372  if (!L.is_null() && data[i] < levelManagers_.size())
373  L->AddKeepFlag(name, &*levelManagers_[data[i]]->GetFactory(name));
374  }
375  }
376  }
377 
378  void ExportDataSetKeepFlagsNextLevel(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name) const {
379  for (int i = 0; i < data.size(); ++i) {
380  if (data[i] < H.GetNumLevels()) {
381  RCP<Level> L = H.GetLevel(data[i]);
382  if (!L.is_null() && data[i] + 1 < levelManagers_.size())
383  L->AddKeepFlag(name, &*levelManagers_[data[i] + 1]->GetFactory(name));
384  }
385  }
386  }
387 
388  // Set the keep flags for Export Data
389  void ExportDataSetKeepFlagsAll(Hierarchy& H, const std::string& name) const {
390  for (int i = 0; i < H.GetNumLevels(); i++) {
391  RCP<Level> L = H.GetLevel(i);
392  if (!L.is_null() && i < levelManagers_.size())
393  L->AddKeepFlag(name, &*levelManagers_[i]->GetFactory(name));
394  }
395  }
396 
397  template <class T>
398  void WriteData(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name) const {
399  for (int i = 0; i < data.size(); ++i) {
400  std::string fileName;
401  if (H.getObjectLabel() != "")
402  fileName = H.getObjectLabel() + "_" + name + "_" + Teuchos::toString(data[i]) + ".m";
403  else
404  fileName = name + "_" + Teuchos::toString(data[i]) + ".m";
405 
406  if (data[i] < H.GetNumLevels()) {
407  RCP<Level> L = H.GetLevel(data[i]);
408  if (data[i] < levelManagers_.size() && L->IsAvailable(name, &*levelManagers_[data[i]]->GetFactory(name))) {
409  // Try generating factory
410  RCP<T> M = L->template Get<RCP<T>>(name, &*levelManagers_[data[i]]->GetFactory(name));
411  if (!M.is_null()) {
413  }
414  } else if (L->IsAvailable(name)) {
415  // Try nofactory
416  RCP<T> M = L->template Get<RCP<T>>(name);
417  if (!M.is_null()) {
419  }
420  }
421  }
422  }
423  }
424 
425  void WriteDataAggregates(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name) const {
426  for (int i = 0; i < data.size(); ++i) {
427  const std::string fileName = name + "_" + Teuchos::toString(data[i]) + ".m";
428 
429  if (data[i] < H.GetNumLevels()) {
430  RCP<Level> L = H.GetLevel(data[i]);
431 
432  // NOTE: Aggregates use the next level's factory
433  RCP<Aggregates> agg;
434  if (data[i] + 1 < H.GetNumLevels() && L->IsAvailable(name, &*levelManagers_[data[i] + 1]->GetFactory(name))) {
435  // Try generating factory
436  agg = L->template Get<RCP<Aggregates>>(name, &*levelManagers_[data[i] + 1]->GetFactory(name));
437  } else if (L->IsAvailable(name)) {
438  agg = L->template Get<RCP<Aggregates>>("Aggregates");
439  }
440  if (!agg.is_null()) {
441  std::ofstream ofs(fileName);
442  Teuchos::FancyOStream fofs(rcp(&ofs, false));
443  agg->print(fofs, Teuchos::VERB_EXTREME);
444  }
445  }
446  }
447  }
448 
449  template <class T>
450  void WriteDataFC(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name, const std::string& ofname) const {
451  for (int i = 0; i < data.size(); ++i) {
452  const std::string fileName = ofname + "_" + Teuchos::toString(data[i]) + ".m";
453 
454  if (data[i] < H.GetNumLevels()) {
455  RCP<Level> L = H.GetLevel(data[i]);
456 
457  if (L->IsAvailable(name)) {
458  RCP<T> M = L->template Get<RCP<T>>(name);
459  if (!M.is_null()) {
460  RCP<Matrix> A = L->template Get<RCP<Matrix>>("A");
461  RCP<const CrsGraph> AG = A->getCrsGraph();
462  WriteFieldContainer<T>(fileName, *M, *AG->getColMap());
463  }
464  }
465  }
466  }
467  }
468 
469  // For dumping an IntrepidPCoarsening element-to-node map to disk
470  template <class T>
471  void WriteFieldContainer(const std::string& fileName, T& fcont, const Map& colMap) const {
472  size_t num_els = (size_t)fcont.extent(0);
473  size_t num_vecs = (size_t)fcont.extent(1);
474 
475  // Generate rowMap
476  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());
477 
478  // Fill multivector to use *petra dump routines
480 
481  for (size_t j = 0; j < num_vecs; j++) {
482  Teuchos::ArrayRCP<GO> v = vec->getDataNonConst(j);
483  for (size_t i = 0; i < num_els; i++)
484  v[i] = colMap.getGlobalElement(fcont(i, j));
485  }
486 
488  }
489 
490  // Levels
491  Array<RCP<FactoryManagerBase>> levelManagers_; // one FactoryManager per level (the last levelManager is used for all the remaining levels)
492 
493 }; // class HierarchyManager
494 
495 } // namespace MueLu
496 
497 #define MUELU_HIERARCHYMANAGER_SHORT
498 #endif // MUELU_HIERARCHYMANAGER_HPP
499 
500 // TODO: split into _decl/_def
501 // TODO: default value for first param (FactoryManager()) should not be duplicated (code maintainability)
virtual void SetupExtra(Hierarchy &) const
Setup extra data.
Important warning messages (one line)
virtual ~HierarchyManager()=default
Destructor.
This class specifies the default factory that should generate some data on a Level if the data does n...
MueLu::DefaultLocalOrdinal LocalOrdinal
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
virtual std::string getObjectLabel() const
void SetNumDesiredLevel(int numDesiredLevel)
Set the number of desired levels.
RCP< Level > & GetLevel(const int levelID=0)
Retrieve a certain level from hierarchy.
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
static Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &map, size_t NumVectors, bool zeroOut=true)
void WriteDataAggregates(Hierarchy &H, const Teuchos::Array< int > &data, const std::string &name) const
void ExportDataSetKeepFlags(Hierarchy &H, const Teuchos::Array< int > &data, const std::string &name) const
Teuchos::Array< int > materialToPrint_
RCP< FactoryManagerBase > GetFactoryManager(int levelID) const
void AddLevel(const RCP< Level > &level)
Add a level at the end of the hierarchy.
void CheckForEmptySmoothersAndCoarseSolve()
virtual RCP< Hierarchy > CreateHierarchy(const std::string &label) const
Create a labeled empty Hierarchy object.
#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)
Print information primarily of interest to developers.
void AddFactoryManager(int startLevel, int numDesiredLevel, RCP< FactoryManagerBase > manager)
One-liner description of what is happening.
Teuchos::Array< int > elementToNodeMapsToPrint_
void Clear(int startLevel=0)
Clear impermanent data from previous setup.
void SetFuseProlongationAndUpdate(const bool &fuse)
Teuchos::RCP< FactoryManagerBase > LvlMngr(int levelID, int lastLevelID) const
std::map< std::string, RCP< const FactoryBase > > FactoryMap
MueLu::DefaultNode Node
Static class that holds the complete list of valid MueLu parameters.
Teuchos::Array< int > coordinatesToPrint_
Print even more statistics.
virtual RCP< Hierarchy > CreateHierarchy() const
Create an empty Hierarchy object.
Teuchos::Array< int > nullspaceToPrint_
Lists of entities to be exported (or saved)
Additional warnings.
void WriteData(Hierarchy &H, const Teuchos::Array< int > &data, const std::string &name) const
static void SetDefaultVerbLevel(const VerbLevel defaultVerbLevel)
Set the default (global) verbosity level.
size_t getNumFactoryManagers() const
returns number of factory managers stored in levelManagers_ vector.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultScalar Scalar
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Class that holds all level-specific information.
Definition: MueLu_Level.hpp:63
static Teuchos::RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > Build(UnderlyingLib lib, global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int >> &comm, LocalGlobal lg=Xpetra::GloballyDistributed)
std::string description() const
Return a simple one-line description of this object.
bool IsPrint(MsgType type, int thisProcRankOnly=-1) const
Find out whether we need to print out information for a specific message type.
Teuchos::Array< int > aggregatesToPrint_
bool suppressNullspaceDimensionCheck_
Flag to indicate whether the check of the nullspace dimension is suppressed.
void ExportDataSetKeepFlagsAll(Hierarchy &H, const std::string &name) const
void AllocateLevelMultiVectors(int numvecs, bool forceMapCheck=false)
Teuchos::Array< std::string > dataToKeep_
static std::string PrintMatrixInfo(const Matrix &A, const std::string &msgTag, RCP< const Teuchos::ParameterList > params=Teuchos::null)
void SetPRrebalance(bool doPRrebalance)
int graphOutputLevel_
-2 = no output, -1 = all levels
size_t global_size_t
std::map< std::string, Teuchos::Array< int > > matricesToPrint_
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
void SetMatvecParams(RCP< ParameterList > matvecParams)
void SetPRViaCopyrebalance(bool doPRViaCopyrebalance)
TransListIter iter
virtual void SetupOperator(Operator &) const
Setup Matrix object.
void SetImplicitTranspose(const bool &implicit)
size_type size() const
HierarchyManager(int numDesiredLevel=MasterList::getDefault< int >("max levels"))
Constructor.
Exception throws to report errors in the internal logical of the program.
std::pair< std::string, const FactoryBase * > keep_pair
void describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the Hierarchy with some verbosity level to a FancyOStream object.
int GetNumDesiredLevel()
Get the number of desired levels.
void WriteDataFC(Hierarchy &H, const Teuchos::Array< int > &data, const std::string &name, const std::string &ofname) const
void setlib(Xpetra::UnderlyingLib inlib)
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.
void WriteFieldContainer(const std::string &fileName, T &fcont, const Map &colMap) const
Teuchos::RCP< Teuchos::ParameterList > matvecParams_
void EnableGraphDumping(const std::string &filename, int levelID=1)
std::map< int, std::vector< keep_pair > > keep_
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
std::string toString(const T &t)
Array< RCP< FactoryManagerBase > > levelManagers_
void ExportDataSetKeepFlagsNextLevel(Hierarchy &H, const Teuchos::Array< int > &data, const std::string &name) const
bool is_null() const