MueLu Version of the Day
Loading...
Searching...
No Matches
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
23
37
38namespace MueLu {
39
40 /*
41 Utility that from an existing Teuchos::ParameterList creates a new list, in
42 which level-specific parameters are replaced with sublists.
43
44 Currently, level-specific parameters that begin with "smoother:"
45 or "aggregation:" are placed in sublists. Coarse options are also placed
46 in a coarse list.
47
48 Example:
49 Input:
50 smoother: type (level 0) = symmetric Gauss-Seidel
51 smoother: sweeps (level 0) = 1
52 Output:
53 smoother: list (level 0) ->
54 smoother: type = symmetric Gauss-Seidel
55 smoother: sweeps = 1
56 */
57 // This function is a copy of ML_CreateSublists to avoid dependency on ML
58 // Throw exception on error instead of exit()
59 //void CreateSublists(const ParameterList &List, ParameterList &newList);
60
61
67
68 template <class Scalar = DefaultScalar,
71 class Node = DefaultNode>
73 public HierarchyManager<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
74#undef MUELU_ADAPTIVESAMLPARAMETERLISTINTERPRETER_SHORT
76
77 public:
79
80
83
92 AdaptiveSaMLParameterListInterpreter(Teuchos::ParameterList & paramList,std::vector<RCP<FactoryBase> > factoryList = std::vector<RCP<FactoryBase> >(0));
93
101 AdaptiveSaMLParameterListInterpreter(const std::string & xmlFileName,std::vector<RCP<FactoryBase> > factoryList = std::vector<RCP<FactoryBase> >(0));
102
105
107
109
110 void SetParameterList(const Teuchos::ParameterList & paramList);
111
113
115
117 virtual void SetupHierarchy(Hierarchy & H) const;
118
120
122
125
131 void AddTransferFactory(const RCP<FactoryBase> & factory);
132
134 size_t NumTransferFactories() const;
137 private:
138
144 void SetupInitHierarchy(Hierarchy & H) const;
145
147 void AddInitFactoryManager(int startLevel, int numDesiredLevel, RCP<FactoryManagerBase> manager) {
148 const int lastLevel = startLevel + numDesiredLevel - 1;
149 if (init_levelManagers_.size() < lastLevel + 1) init_levelManagers_.resize(lastLevel + 1);
150
151 for(int iLevel = startLevel; iLevel <= lastLevel; iLevel++) {
152 init_levelManagers_[iLevel] = manager;
153 }
154 }
155
158 Teuchos::RCP<FactoryManagerBase> InitLvlMngr(int levelID, int lastLevelID) const {
159
160 // Please not that the order of the 'if' statements is important.
161
162 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)
163 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...)
164
165 if (0 == init_levelManagers_.size()) { // default factory manager.
166 // the default manager is shared across levels, initialized only if needed and deleted with the HierarchyManager.
167 static RCP<FactoryManagerBase> defaultMngr = rcp(new FactoryManager());
168 return defaultMngr;
169 }
170 if (levelID >= init_levelManagers_.size()) return init_levelManagers_[init_levelManagers_.size()-1]; // last levelManager is used for all the remaining levels.
171
172 return init_levelManagers_[levelID]; // throw exception if out of bound.
173 }
174
177 double* nullspace_;
178
181
186 std::vector<RCP<FactoryBase> > TransferFacts_;
187
190 Array<RCP<FactoryManagerBase> > init_levelManagers_;
191
196 virtual void SetupOperator(Operator & Op) const;
197
201
202 }; // class AdaptiveSaMLParameterListInterpreter
203
204} // namespace MueLu
205
206#define MUELU_ADAPTIVESAMLPARAMETERLISTINTERPRETER_SHORT
207#endif /* MUELU_ADAPTIVESAMLPARAMTERLISTINTERPRETER_DECL_HPP_ */
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
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
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
Teuchos::RCP< FactoryManagerBase > InitLvlMngr(int levelID, int lastLevelID) const
int nullspaceDim_
nullspace can be embedded in the ML parameter list
MueLu::Hierarchy< Scalar, LocalOrdinal, GlobalOrdinal, Node > Hierarchy
void AddTransferFactory(const RCP< FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories for RAPFactory.
MueLu::HierarchyManager< Scalar, LocalOrdinal, GlobalOrdinal, Node > HierarchyManager
This class specifies the default factory that should generate some data on a Level if the data does n...
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
Namespace for MueLu classes and methods.
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar