MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_ParameterListInterpreter_decl.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_PARAMETERLISTINTERPRETER_DECL_HPP
11 #define MUELU_PARAMETERLISTINTERPRETER_DECL_HPP
12 
14 
15 #include <Xpetra_Matrix_fwd.hpp>
16 #include <Xpetra_Operator_fwd.hpp>
17 
18 #include "MueLu_ConfigDefs.hpp"
20 
31 #include "MueLu_FacadeClassBase.hpp"
32 #include "MueLu_FacadeClassFactory.hpp"
43 #include "MueLu_PgPFactory_fwd.hpp"
44 #include "MueLu_RAPFactory_fwd.hpp"
50 #include "MueLu_SaPFactory_fwd.hpp"
60 #ifdef HAVE_MUELU_MATLAB
64 #endif
65 
69 
70 #ifdef HAVE_MUELU_INTREPID2
72 #endif
73 
74 namespace MueLu {
75 
76 template <class Scalar = DefaultScalar,
79  class Node = DefaultNode>
80 class ParameterListInterpreter : public HierarchyManager<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
81 #undef MUELU_PARAMETERLISTINTERPRETER_SHORT
82 #include "MueLu_UseShortNames.hpp"
83  typedef std::pair<std::string, const FactoryBase*> keep_pair;
84 
85  public:
87 
88 
89  protected:
95  factFact_ = Teuchos::null;
97  }
98 
99  public:
112  ParameterListInterpreter(Teuchos::ParameterList& paramList, Teuchos::RCP<const Teuchos::Comm<int> > comm = Teuchos::null, Teuchos::RCP<FactoryFactory> factFact = Teuchos::null, Teuchos::RCP<FacadeClassFactory> facadeFact = Teuchos::null);
113 
124  ParameterListInterpreter(const std::string& xmlFileName, const Teuchos::Comm<int>& comm, Teuchos::RCP<FactoryFactory> factFact = Teuchos::null, Teuchos::RCP<FacadeClassFactory> facadeFact = Teuchos::null);
125 
127  virtual ~ParameterListInterpreter();
128 
130 
147  void SetParameterList(const Teuchos::ParameterList& paramList);
148 
150  void SetupHierarchy(Hierarchy& H) const;
151 
152  private:
154  virtual void SetupOperator(Operator& A) const;
155 
159  double scalingFactor_;
161 
163 
164  // These three variables are only needed to print out proper [default]
168 
169  void SetEasyParameterList(const Teuchos::ParameterList& paramList);
170  void Validate(const Teuchos::ParameterList& paramList) const;
171 
172  void UpdateFactoryManager(Teuchos::ParameterList& paramList, const Teuchos::ParameterList& defaultList, FactoryManager& manager,
173  int levelID, std::vector<keep_pair>& keeps) const;
174 
175  // "Generic components" for UpdateFactoryManager
177  int levelID, std::vector<keep_pair>& keeps) const;
179  int levelID, std::vector<keep_pair>& keeps) const;
181  int levelID, std::vector<keep_pair>& keeps) const;
183  int levelID, std::vector<keep_pair>& keeps) const;
184  void UpdateFactoryManager_RAP(Teuchos::ParameterList& paramList, const Teuchos::ParameterList& defaultList, FactoryManager& manager,
185  int levelID, std::vector<keep_pair>& keeps) const;
187  int levelID, std::vector<keep_pair>& keeps) const;
189  int levelID, std::vector<keep_pair>& keeps, RCP<Factory>& nullSpaceFactory) const;
190  void UpdateFactoryManager_LowPrecision(ParameterList& paramList, const ParameterList& defaultList, FactoryManager& manager,
191  int levelID, std::vector<keep_pair>& keeps) const;
193  int levelID, std::vector<keep_pair>& keeps, RCP<Factory>& nullSpaceFactory) const;
195  FactoryManager& manager, int levelID, std::vector<keep_pair>& keeps) const;
196  void UpdateFactoryManager_LocalOrdinalTransfer(const std::string& VarName, const std::string& multigridAlgo, Teuchos::ParameterList& paramList, const Teuchos::ParameterList& defaultList,
197  FactoryManager& manager, int levelID, std::vector<keep_pair>& keeps) const;
198 
199  // Algorithm-specific components for UpdateFactoryManager
201  int levelID, std::vector<keep_pair>& keeps) const;
203  int levelID, std::vector<keep_pair>& keeps) const;
204  void UpdateFactoryManager_SA(Teuchos::ParameterList& paramList, const Teuchos::ParameterList& defaultList, FactoryManager& manager,
205  int levelID, std::vector<keep_pair>& keeps) const;
207  int levelID, std::vector<keep_pair>& keeps) const;
208  void UpdateFactoryManager_Emin(Teuchos::ParameterList& paramList, const Teuchos::ParameterList& defaultList, FactoryManager& manager,
209  int levelID, std::vector<keep_pair>& keeps) const;
210  void UpdateFactoryManager_PG(Teuchos::ParameterList& paramList, const Teuchos::ParameterList& defaultList, FactoryManager& manager,
211  int levelID, std::vector<keep_pair>& keeps) const;
213  int levelID, std::vector<keep_pair>& keeps) const;
215  int levelID, std::vector<keep_pair>& keeps) const;
216  void UpdateFactoryManager_Matlab(Teuchos::ParameterList& paramList, const Teuchos::ParameterList& defaultList, FactoryManager& manager,
217  int levelID, std::vector<keep_pair>& keeps) const;
218 
223 
225  // TODO:
226  // - parameter list validator
227  // - SetParameterList
228  // - Set/Get directly Level manager
229  // - build per level
230  // - comments/docs
231  // - use FactoryManager instead of FactoryMap
233  void SetFactoryParameterList(const Teuchos::ParameterList& paramList);
234 
235  typedef std::map<std::string, RCP<const FactoryBase> > FactoryMap; // TODO: remove this line
236  typedef std::map<std::string, RCP<FactoryManagerBase> > FactoryManagerMap;
237 
238  void BuildFactoryMap(const Teuchos::ParameterList& paramList, const FactoryMap& factoryMapIn, FactoryMap& factoryMapOut, FactoryManagerMap& factoryManagers) const;
239 
242 
245 
247 };
248 
249 } // namespace MueLu
250 
251 #define MUELU_PARAMETERLISTINTERPRETER_SHORT
252 #endif /* MUELU_PARAMETERLISTINTERPRETER_DECL_HPP */
virtual ~ParameterListInterpreter()
Destructor.
This class specifies the default factory that should generate some data on a Level if the data does n...
void SetupHierarchy(Hierarchy &H) const
Call the SetupHierarchy routine from the HiearchyManager object.
MueLu::DefaultLocalOrdinal LocalOrdinal
void UpdateFactoryManager_Replicate(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Reitzinger(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
int WCycleStartLevel_
in case of W-cycle, level on which cycle should start
double scalingFactor_
prolongator scaling factor
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
void UpdateFactoryManager(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Matlab(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_LowPrecision(ParameterList &paramList, const ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_SemiCoarsen(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
std::map< std::string, RCP< FactoryManagerBase > > FactoryManagerMap
std::map< std::string, RCP< const FactoryBase > > FactoryMap
MueLu::DefaultNode Node
void UpdateFactoryManager_Nullspace(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps, RCP< Factory > &nullSpaceFactory) const
virtual void SetupOperator(Operator &A) const
Setup Operator object.
void UpdateFactoryManager_PG(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
Teuchos::RCP< MueLu::FacadeClassFactory< Scalar, LocalOrdinal, GlobalOrdinal, Node > > facadeFact_
FacadeClass factory.
int blockSize_
block size of matrix (fixed block size)
Teuchos::RCP< FactoryFactory > factFact_
Internal factory for factories.
void UpdateFactoryManager_Emin(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
MueLu::DefaultScalar Scalar
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar
void UpdateFactoryManager_Coordinates(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
MueLu::DefaultGlobalOrdinal GlobalOrdinal
std::map< std::string, RCP< const FactoryBase > > FactoryMap
void SetFactoryParameterList(const Teuchos::ParameterList &paramList)
Factory interpreter stuff.
std::pair< std::string, const FactoryBase * > keep_pair
void UpdateFactoryManager_RAP(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Restriction(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_BlockNumber(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Aggregation_TentativeP(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
GlobalOrdinal dofOffset_
global offset variable describing offset of DOFs in operator
void BuildFactoryMap(const Teuchos::ParameterList &paramList, const FactoryMap &factoryMapIn, FactoryMap &factoryMapOut, FactoryManagerMap &factoryManagers) const
Interpret &quot;Factories&quot; sublist.
void SetParameterList(const Teuchos::ParameterList &paramList)
Set parameter list for Parameter list interpreter.
void UpdateFactoryManager_Combine(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_SA(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void Validate(const Teuchos::ParameterList &paramList) const
void UpdateFactoryManager_PCoarsen(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_Repartition(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps, RCP< Factory > &nullSpaceFactory) const
void UpdateFactoryManager_Smoothers(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void UpdateFactoryManager_CoarseSolvers(Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const
void SetEasyParameterList(const Teuchos::ParameterList &paramList)
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
CycleType Cycle_
multigrid cycle type (V-cycle or W-cycle)
void UpdateFactoryManager_LocalOrdinalTransfer(const std::string &VarName, const std::string &multigridAlgo, Teuchos::ParameterList &paramList, const Teuchos::ParameterList &defaultList, FactoryManager &manager, int levelID, std::vector< keep_pair > &keeps) const