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>
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 = double, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = KokkosClassic::DefaultNode::DefaultNodeType>
75  public HierarchyManager<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
76 #undef MUELU_ADAPTIVESAMLPARAMETERLISTINTERPRETER_SHORT
77 #include "MueLu_UseShortNames.hpp"
78 
79  public:
81 
82 
85 
94  AdaptiveSaMLParameterListInterpreter(Teuchos::ParameterList & paramList,std::vector<RCP<FactoryBase> > factoryList = std::vector<RCP<FactoryBase> >(0));
95 
103  AdaptiveSaMLParameterListInterpreter(const std::string & xmlFileName,std::vector<RCP<FactoryBase> > factoryList = std::vector<RCP<FactoryBase> >(0));
104 
107 
109 
111 
112  void SetParameterList(const Teuchos::ParameterList & paramList);
113 
115 
117 
119  virtual void SetupHierarchy(Hierarchy & H) const;
120 
122 
124 
126 
127 
133  void AddTransferFactory(const RCP<FactoryBase> & factory);
134 
136  size_t NumTransferFactories() const;
138 
139  private:
140 
146  void SetupInitHierarchy(Hierarchy & H) const;
147 
149  void AddInitFactoryManager(int startLevel, int numDesiredLevel, RCP<FactoryManagerBase> manager) {
150  const int lastLevel = startLevel + numDesiredLevel - 1;
151  if (init_levelManagers_.size() < lastLevel + 1) init_levelManagers_.resize(lastLevel + 1);
152 
153  for(int iLevel = startLevel; iLevel <= lastLevel; iLevel++) {
154  init_levelManagers_[iLevel] = manager;
155  }
156  }
157 
160  Teuchos::RCP<FactoryManagerBase> InitLvlMngr(int levelID, int lastLevelID) const {
161 
162  // Please not that the order of the 'if' statements is important.
163 
164  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)
165  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...)
166 
167  if (0 == init_levelManagers_.size()) { // default factory manager.
168  // the default manager is shared across levels, initialized only if needed and deleted with the HierarchyManager.
169  static RCP<FactoryManagerBase> defaultMngr = rcp(new FactoryManager());
170  return defaultMngr;
171  }
172  if (levelID >= init_levelManagers_.size()) return init_levelManagers_[init_levelManagers_.size()-1]; // last levelManager is used for all the remaining levels.
173 
174  return init_levelManagers_[levelID]; // throw exception if out of bound.
175  }
176 
179  double* nullspace_;
180 
183 
188  std::vector<RCP<FactoryBase> > TransferFacts_;
189 
193 
195 
198  virtual void SetupOperator(Operator & Op) const;
199 
201  int blksize_;
203 
204  }; // class AdaptiveSaMLParameterListInterpreter
205 
206 } // namespace MueLu
207 
208 #define MUELU_ADAPTIVESAMLPARAMETERLISTINTERPRETER_SHORT
209 #endif /* MUELU_ADAPTIVESAMLPARAMTERLISTINTERPRETER_DECL_HPP_ */
This class specifies the default factory that should generate some data on a Level if the data does n...
int nullspaceDim_
nullspace can be embedded in the ML parameter list
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
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)
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.