MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_AdaptiveSaMLParameterListInterpreter_decl.hpp
Go to the documentation of this file.
1 /*
2  * MueLu_AdaptiveSaMLParamterListInterpreter_decl.hpp
3  *
4  * Created on: Jan 28, 2013
5  * Author: tobias
6  */
7 
8 #ifndef MUELU_ADAPTIVESAMLPARAMTERLISTINTERPRETER_DECL_HPP_
9 #define MUELU_ADAPTIVESAMLPARAMTERLISTINTERPRETER_DECL_HPP_
10 
12 
13 #include <Xpetra_Matrix_fwd.hpp>
14 #include <Xpetra_MultiVector_fwd.hpp>
15 #include <Xpetra_Operator_fwd.hpp>
16 
17 #include "MueLu_ConfigDefs.hpp"
20 
21 #include "MueLu_Hierarchy_fwd.hpp"
23 
25 #include "MueLu_SaPFactory_fwd.hpp"
26 #include "MueLu_PgPFactory_fwd.hpp"
35 #include "MueLu_RAPFactory_fwd.hpp"
42 
43 namespace MueLu {
44 
45  /*
46  Utility that from an existing Teuchos::ParameterList creates a new list, in
47  which level-specific parameters are replaced with sublists.
48 
49  Currently, level-specific parameters that begin with "smoother:"
50  or "aggregation:" are placed in sublists. Coarse options are also placed
51  in a coarse list.
52 
53  Example:
54  Input:
55  smoother: type (level 0) = symmetric Gauss-Seidel
56  smoother: sweeps (level 0) = 1
57  Output:
58  smoother: list (level 0) ->
59  smoother: type = symmetric Gauss-Seidel
60  smoother: sweeps = 1
61  */
62  // This function is a copy of ML_CreateSublists to avoid dependency on ML
63  // Throw exception on error instead of exit()
64  //void CreateSublists(const ParameterList &List, ParameterList &newList);
65 
66 
73  template <class Scalar = DefaultScalar,
76  class Node = DefaultNode>
78  public HierarchyManager<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
79 #undef MUELU_ADAPTIVESAMLPARAMETERLISTINTERPRETER_SHORT
80 #include "MueLu_UseShortNames.hpp"
81 
82  public:
84 
85 
88 
97  AdaptiveSaMLParameterListInterpreter(Teuchos::ParameterList & paramList,std::vector<RCP<FactoryBase> > factoryList = std::vector<RCP<FactoryBase> >(0));
98 
106  AdaptiveSaMLParameterListInterpreter(const std::string & xmlFileName,std::vector<RCP<FactoryBase> > factoryList = std::vector<RCP<FactoryBase> >(0));
107 
110 
112 
114 
115  void SetParameterList(const Teuchos::ParameterList & paramList);
116 
118 
120 
122  virtual void SetupHierarchy(Hierarchy & H) const;
123 
125 
127 
129 
130 
136  void AddTransferFactory(const RCP<FactoryBase> & factory);
137 
139  size_t NumTransferFactories() const;
141 
142  private:
143 
149  void SetupInitHierarchy(Hierarchy & H) const;
150 
152  void AddInitFactoryManager(int startLevel, int numDesiredLevel, RCP<FactoryManagerBase> manager) {
153  const int lastLevel = startLevel + numDesiredLevel - 1;
154  if (init_levelManagers_.size() < lastLevel + 1) init_levelManagers_.resize(lastLevel + 1);
155 
156  for(int iLevel = startLevel; iLevel <= lastLevel; iLevel++) {
157  init_levelManagers_[iLevel] = manager;
158  }
159  }
160 
163  Teuchos::RCP<FactoryManagerBase> InitLvlMngr(int levelID, int lastLevelID) const {
164 
165  // Please not that the order of the 'if' statements is important.
166 
167  if (levelID == -1) return Teuchos::null; // when this routine is called with levelID == '-1', it means that we are processing the finest Level (there is no finer level)
168  if (levelID == lastLevelID+1) return Teuchos::null; // when this routine is called with levelID == 'lastLevelID+1', it means that we are processing the last level (ie: there is no nextLevel...)
169 
170  if (0 == init_levelManagers_.size()) { // default factory manager.
171  // the default manager is shared across levels, initialized only if needed and deleted with the HierarchyManager.
172  static RCP<FactoryManagerBase> defaultMngr = rcp(new FactoryManager());
173  return defaultMngr;
174  }
175  if (levelID >= init_levelManagers_.size()) return init_levelManagers_[init_levelManagers_.size()-1]; // last levelManager is used for all the remaining levels.
176 
177  return init_levelManagers_[levelID]; // throw exception if out of bound.
178  }
179 
182  double* nullspace_;
183 
186 
191  std::vector<RCP<FactoryBase> > TransferFacts_;
192 
196 
198 
201  virtual void SetupOperator(Operator & Op) const;
202 
204  int blksize_;
206 
207  }; // class AdaptiveSaMLParameterListInterpreter
208 
209 } // namespace MueLu
210 
211 #define MUELU_ADAPTIVESAMLPARAMETERLISTINTERPRETER_SHORT
212 #endif /* MUELU_ADAPTIVESAMLPARAMTERLISTINTERPRETER_DECL_HPP_ */
This class specifies the default factory that should generate some data on a Level if the data does n...
MueLu::DefaultLocalOrdinal LocalOrdinal
KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
int nullspaceDim_
nullspace can be embedded in the ML parameter list
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
MueLu::DefaultNode Node
Teuchos::RCP< FactoryManagerBase > InitLvlMngr(int levelID, int lastLevelID) const
void AddTransferFactory(const RCP< FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories for RAPFactory.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
size_t NumTransferFactories() const
Returns number of transfer factories.
void AddInitFactoryManager(int startLevel, int numDesiredLevel, RCP< FactoryManagerBase > manager)
internal routine to add a new factory manager used for the initialization phase
Provides methods to build a multigrid hierarchy and apply multigrid cycles.