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");
220  // NOTE: Aggregates use the next level's Factory
222 #ifdef HAVE_MUELU_INTREPID2
223  ExportDataSetKeepFlags(H, elementToNodeMapsToPrint_, "pcoarsen: element to node map");
224 #endif
225 
226  // Data to keep only (these do not have a level, so we do all levels)
227  for (int i = 0; i < dataToKeep_.size(); i++)
229 
230  int levelID = 0;
231  int lastLevelID = numDesiredLevel_ - 1;
232  bool isLastLevel = false;
233 
234  while (!isLastLevel) {
235  bool r = H.Setup(levelID,
236  LvlMngr(levelID - 1, lastLevelID),
237  LvlMngr(levelID, lastLevelID),
238  LvlMngr(levelID + 1, lastLevelID));
239  if (levelID < H.GetNumLevels())
240  H.GetLevel(levelID)->print(H.GetOStream(Developer), verbosity_);
241 
242  isLastLevel = r || (levelID == lastLevelID);
243  levelID++;
244  }
245 
246  if (!matvecParams_.is_null())
249  // Set hierarchy description.
250  // This is cached, but involves and MPI_Allreduce.
251  H.description();
254 
255  // When we reuse hierarchy, it is necessary that we don't
256  // change the number of levels. We also cannot make requests
257  // for coarser levels, because we don't construct all the
258  // data on previous levels. For instance, let's say our first
259  // run constructed three levels. If we try to do requests during
260  // next setup for the fourth level, it would need Aggregates
261  // which we didn't construct for level 3 because we reused P.
262  // To fix this situation, we change the number of desired levels
263  // here.
264  numDesiredLevel_ = levelID;
265 
266  // Matrix prints
267  for (auto iter = matricesToPrint_.begin(); iter != matricesToPrint_.end(); iter++) {
268  WriteData<Matrix>(H, iter->second, iter->first);
269  }
270 
271  // Vectors, aggregates and all things we need to print manually
272  WriteData<MultiVector>(H, nullspaceToPrint_, "Nullspace");
273  WriteData<MultiVector>(H, coordinatesToPrint_, "Coordinates");
274  WriteDataAggregates(H, aggregatesToPrint_, "Aggregates");
275 
276 #ifdef HAVE_MUELU_INTREPID2
277  typedef Kokkos::DynRankView<LocalOrdinal, typename Node::device_type> FCi;
278  WriteDataFC<FCi>(H, elementToNodeMapsToPrint_, "pcoarsen: element to node map", "el2node");
279 #endif
280 
281  } // SetupHierarchy
282 
284  void SetNumDesiredLevel(int numDesiredLevel) { numDesiredLevel_ = numDesiredLevel; }
285 
288 
290 
291  typedef std::map<std::string, RCP<const FactoryBase>> FactoryMap;
292 
293  protected: // TODO: access function
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 
323  mutable int numDesiredLevel_;
326 
331 
339 
341 
344 
346  // Items here get handled manually
351 
352  // Data we'll need to keep, either to dump to disk or to use post-setup
354 
355  // Matrices we'll need to print
356  std::map<std::string, Teuchos::Array<int>> matricesToPrint_;
357 
359 
360  std::map<int, std::vector<keep_pair>> keep_;
362 
363  private:
364  // Set the keep flags for Export Data
365  void ExportDataSetKeepFlags(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name) const {
366  for (int i = 0; i < data.size(); ++i) {
367  if (data[i] < H.GetNumLevels()) {
368  RCP<Level> L = H.GetLevel(data[i]);
369  if (!L.is_null() && data[i] < levelManagers_.size())
370  L->AddKeepFlag(name, &*levelManagers_[data[i]]->GetFactory(name));
371  }
372  }
373  }
374 
375  void ExportDataSetKeepFlagsNextLevel(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name) const {
376  for (int i = 0; i < data.size(); ++i) {
377  if (data[i] < H.GetNumLevels()) {
378  RCP<Level> L = H.GetLevel(data[i]);
379  if (!L.is_null() && data[i] + 1 < levelManagers_.size())
380  L->AddKeepFlag(name, &*levelManagers_[data[i] + 1]->GetFactory(name));
381  }
382  }
383  }
384 
385  // Set the keep flags for Export Data
386  void ExportDataSetKeepFlagsAll(Hierarchy& H, const std::string& name) const {
387  for (int i = 0; i < H.GetNumLevels(); i++) {
388  RCP<Level> L = H.GetLevel(i);
389  if (!L.is_null() && i < levelManagers_.size())
390  L->AddKeepFlag(name, &*levelManagers_[i]->GetFactory(name));
391  }
392  }
393 
394  template <class T>
395  void WriteData(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name) const {
396  for (int i = 0; i < data.size(); ++i) {
397  std::string fileName;
398  if (H.getObjectLabel() != "")
399  fileName = H.getObjectLabel() + "_" + name + "_" + Teuchos::toString(data[i]) + ".m";
400  else
401  fileName = name + "_" + Teuchos::toString(data[i]) + ".m";
402 
403  if (data[i] < H.GetNumLevels()) {
404  RCP<Level> L = H.GetLevel(data[i]);
405  if (data[i] < levelManagers_.size() && L->IsAvailable(name, &*levelManagers_[data[i]]->GetFactory(name))) {
406  // Try generating factory
407  RCP<T> M = L->template Get<RCP<T>>(name, &*levelManagers_[data[i]]->GetFactory(name));
408  if (!M.is_null()) {
410  }
411  } else if (L->IsAvailable(name)) {
412  // Try nofactory
413  RCP<T> M = L->template Get<RCP<T>>(name);
414  if (!M.is_null()) {
416  }
417  }
418  }
419  }
420  }
421 
422  void WriteDataAggregates(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name) const {
423  for (int i = 0; i < data.size(); ++i) {
424  const std::string fileName = name + "_" + Teuchos::toString(data[i]) + ".m";
425 
426  if (data[i] < H.GetNumLevels()) {
427  RCP<Level> L = H.GetLevel(data[i]);
428 
429  // NOTE: Aggregates use the next level's factory
430  RCP<Aggregates> agg;
431  if (data[i] + 1 < H.GetNumLevels() && L->IsAvailable(name, &*levelManagers_[data[i] + 1]->GetFactory(name))) {
432  // Try generating factory
433  agg = L->template Get<RCP<Aggregates>>(name, &*levelManagers_[data[i] + 1]->GetFactory(name));
434  } else if (L->IsAvailable(name)) {
435  agg = L->template Get<RCP<Aggregates>>("Aggregates");
436  }
437  if (!agg.is_null()) {
438  std::ofstream ofs(fileName);
439  Teuchos::FancyOStream fofs(rcp(&ofs, false));
440  agg->print(fofs, Teuchos::VERB_EXTREME);
441  }
442  }
443  }
444  }
445 
446  template <class T>
447  void WriteDataFC(Hierarchy& H, const Teuchos::Array<int>& data, const std::string& name, const std::string& ofname) const {
448  for (int i = 0; i < data.size(); ++i) {
449  const std::string fileName = ofname + "_" + Teuchos::toString(data[i]) + ".m";
450 
451  if (data[i] < H.GetNumLevels()) {
452  RCP<Level> L = H.GetLevel(data[i]);
453 
454  if (L->IsAvailable(name)) {
455  RCP<T> M = L->template Get<RCP<T>>(name);
456  if (!M.is_null()) {
457  RCP<Matrix> A = L->template Get<RCP<Matrix>>("A");
458  RCP<const CrsGraph> AG = A->getCrsGraph();
459  WriteFieldContainer<T>(fileName, *M, *AG->getColMap());
460  }
461  }
462  }
463  }
464  }
465 
466  // For dumping an IntrepidPCoarsening element-to-node map to disk
467  template <class T>
468  void WriteFieldContainer(const std::string& fileName, T& fcont, const Map& colMap) const {
469  size_t num_els = (size_t)fcont.extent(0);
470  size_t num_vecs = (size_t)fcont.extent(1);
471 
472  // Generate rowMap
473  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());
474 
475  // Fill multivector to use *petra dump routines
477 
478  for (size_t j = 0; j < num_vecs; j++) {
479  Teuchos::ArrayRCP<GO> v = vec->getDataNonConst(j);
480  for (size_t i = 0; i < num_els; i++)
481  v[i] = colMap.getGlobalElement(fcont(i, j));
482  }
483 
485  }
486 
487  // Levels
488  Array<RCP<FactoryManagerBase>> levelManagers_; // one FactoryManager per level (the last levelManager is used for all the remaining levels)
489 
490 }; // class HierarchyManager
491 
492 } // namespace MueLu
493 
494 #define MUELU_HIERARCHYMANAGER_SHORT
495 #endif // MUELU_HIERARCHYMANAGER_HPP
496 
497 // TODO: split into _decl/_def
498 // 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
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