MueLu  Version of the Day
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 
11 #include <Teuchos_ParameterList.hpp>
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 = 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 
192  Array<RCP<FactoryManagerBase> > init_levelManagers_;
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_ */
MueLu_ConfigDefs.hpp
MueLu_RAPFactory_fwd.hpp
MueLu_SmootherFactory_fwd.hpp
MueLu::AdaptiveSaMLParameterListInterpreter::bExportAggregates_
bool bExportAggregates_
export aggregates
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_decl.hpp:182
MueLu_DirectSolver_fwd.hpp
MueLu::AdaptiveSaMLParameterListInterpreter::SetParameterList
void SetParameterList(const Teuchos::ParameterList &paramList)
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_def.hpp:83
MueLu::AdaptiveSaMLParameterListInterpreter::nullspace_
double * nullspace_
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_decl.hpp:179
MueLu
Namespace for MueLu classes and methods.
Definition: MueLu_BrickAggregationFactory_decl.hpp:76
MueLu_TentativePFactory_fwd.hpp
MueLu_IfpackSmoother_fwd.hpp
MueLu::AdaptiveSaMLParameterListInterpreter::nullspaceDim_
int nullspaceDim_
nullspace can be embedded in the ML parameter list
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_decl.hpp:178
MueLu_MLParameterListInterpreter_fwd.hpp
MueLu_TrilinosSmoother_fwd.hpp
MueLu_GenericRFactory_fwd.hpp
MueLu_CoupledAggregationFactory_fwd.hpp
MueLu::AdaptiveSaMLParameterListInterpreter::NumTransferFactories
size_t NumTransferFactories() const
Returns number of transfer factories.
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_def.hpp:442
MueLu_UncoupledAggregationFactory_fwd.hpp
MueLu_AdaptiveSaMLParameterListInterpreter_fwd.hpp
MueLu_Hierarchy_fwd.hpp
MueLu::AdaptiveSaMLParameterListInterpreter::~AdaptiveSaMLParameterListInterpreter
virtual ~AdaptiveSaMLParameterListInterpreter()
Destructor.
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_decl.hpp:106
MueLu_TransPFactory_fwd.hpp
MueLu_SaPFactory_fwd.hpp
MueLu::AdaptiveSaMLParameterListInterpreter::SetupHierarchy
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_def.hpp:357
MueLu::AdaptiveSaMLParameterListInterpreter::AddTransferFactory
void AddTransferFactory(const RCP< FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories for RAPFactory.
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_def.hpp:435
MueLu_CoalesceDropFactory_fwd.hpp
MueLu::AdaptiveSaMLParameterListInterpreter::init_levelManagers_
Array< RCP< FactoryManagerBase > > init_levelManagers_
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_decl.hpp:192
MueLu::AdaptiveSaMLParameterListInterpreter::InitLvlMngr
Teuchos::RCP< FactoryManagerBase > InitLvlMngr(int levelID, int lastLevelID) const
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_decl.hpp:160
MueLu::AdaptiveSaMLParameterListInterpreter::blksize_
int blksize_
Matrix configuration storage.
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_decl.hpp:201
MueLu::AdaptiveSaMLParameterListInterpreter
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_decl.hpp:74
MueLu_PgPFactory_fwd.hpp
MueLu_FactoryBase_fwd.hpp
MueLu_NullspaceFactory_fwd.hpp
MueLu::AdaptiveSaMLParameterListInterpreter::AdaptiveSaMLParameterListInterpreter
AdaptiveSaMLParameterListInterpreter()
Constructor.
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_decl.hpp:84
MueLu_HierarchyUtils_fwd.hpp
MueLu_UseShortNames.hpp
MueLu_SmootherPrototype_fwd.hpp
MueLu::AdaptiveSaMLParameterListInterpreter::SetupInitHierarchy
void SetupInitHierarchy(Hierarchy &H) const
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_def.hpp:330
MueLu::HierarchyManager
Definition: MueLu_HierarchyManager.hpp:78
MueLu_HierarchyManager.hpp
MueLu::AdaptiveSaMLParameterListInterpreter::TransferFacts_
std::vector< RCP< FactoryBase > > TransferFacts_
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_decl.hpp:188
MueLu::Hierarchy
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
Definition: MueLu_Hierarchy_decl.hpp:104
MueLu::AdaptiveSaMLParameterListInterpreter::AddInitFactoryManager
void AddInitFactoryManager(int startLevel, int numDesiredLevel, RCP< FactoryManagerBase > manager)
internal routine to add a new factory manager used for the initialization phase
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_decl.hpp:149
MueLu::FactoryManager
This class specifies the default factory that should generate some data on a Level if the data does n...
Definition: MueLu_FactoryManager_decl.hpp:103
MueLu::AdaptiveSaMLParameterListInterpreter::SetupOperator
virtual void SetupOperator(Operator &Op) const
Definition: MueLu_AdaptiveSaMLParameterListInterpreter_def.hpp:447