MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_MLParameterListInterpreter_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_MLPARAMETERLISTINTERPRETER_DECL_HPP
11 #define MUELU_MLPARAMETERLISTINTERPRETER_DECL_HPP
12 
14 
15 #include <Xpetra_Matrix_fwd.hpp>
17 #include <Xpetra_Operator_fwd.hpp>
18 
19 #include "MueLu_ConfigDefs.hpp"
22 
23 #include "MueLu_Hierarchy_fwd.hpp"
25 
27 #include "MueLu_SaPFactory_fwd.hpp"
28 #include "MueLu_PgPFactory_fwd.hpp"
36 #include "MueLu_RAPFactory_fwd.hpp"
41 
42 #if defined(HAVE_MUELU_ISORROPIA) && defined(HAVE_MPI)
49 #endif
50 
51 #ifdef HAVE_MUELU_DEPRECATED_CODE
52 #ifdef MueLu_SHOW_DEPRECATED_WARNINGS
53 #warning "The header file MueLu_MLParameterListInterpreter.hpp is deprecated"
54 #endif
55 #else
56 #error "The header file MueLu_MLParameterListInterpreter.hpp is deprecated"
57 #endif
58 
59 namespace MueLu {
60 
61 /*
62  Utility that from an existing Teuchos::ParameterList creates a new list, in
63  which level-specific parameters are replaced with sublists.
64 
65  Currently, level-specific parameters that begin with "smoother:"
66  or "aggregation:" are placed in sublists. Coarse options are also placed
67  in a coarse list.
68 
69  Example:
70  Input:
71  smoother: type (level 0) = symmetric Gauss-Seidel
72  smoother: sweeps (level 0) = 1
73  Output:
74  smoother: list (level 0) ->
75  smoother: type = symmetric Gauss-Seidel
76  smoother: sweeps = 1
77 */
78 // This function is a copy of ML_CreateSublists to avoid dependency on ML
79 // Throw exception on error instead of exit()
80 void CreateSublists(const ParameterList& List, ParameterList& newList);
81 
91 template <class Scalar = DefaultScalar,
94  class Node = DefaultNode>
95 class MLParameterListInterpreter : public HierarchyManager<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
96 #undef MUELU_MLPARAMETERLISTINTERPRETER_SHORT
97 #include "MueLu_UseShortNames.hpp"
98 
99  public:
101 
102 
105  : nullspace_(NULL)
106  , blksize_(1) {}
107 
116  MLParameterListInterpreter(Teuchos::ParameterList& paramList, Teuchos::RCP<const Teuchos::Comm<int> > comm = Teuchos::null, std::vector<RCP<FactoryBase> > factoryList = std::vector<RCP<FactoryBase> >(0));
117 
125  MLParameterListInterpreter(const std::string& xmlFileName, std::vector<RCP<FactoryBase> > factoryList = std::vector<RCP<FactoryBase> >(0));
126 
128  virtual ~MLParameterListInterpreter() = default;
129 
131 
133 
134  void SetParameterList(const Teuchos::ParameterList& paramList);
135 
137 
139 
141  virtual void SetupHierarchy(Hierarchy& H) const;
142 
144 
146 
149 
150 
152  // @param AFact: Factory used by smoother to find 'A'
153  static RCP<SmootherFactory> GetSmootherFactory(const Teuchos::ParameterList& paramList, const RCP<FactoryBase>& AFact = Teuchos::null);
154 
156 
158 
159 
165  void AddTransferFactory(const RCP<FactoryBase>& factory);
166 
168  size_t NumTransferFactories() const;
170 
171  private:
174  double* nullspace_; // TODO: replace by Teuchos::ArrayRCP<>
175 
177  double* xcoord_;
178  double* ycoord_;
179  double* zcoord_;
180 
185  std::vector<RCP<FactoryBase> > TransferFacts_;
186 
188 
190  virtual void SetupOperator(Operator& Op) const;
191 
193  int blksize_;
194 
196 
197 }; // class MLParameterListInterpreter
198 
199 } // namespace MueLu
200 
201 #define MUELU_MLPARAMETERLISTINTERPRETER_SHORT
202 #endif /* MUELU_MLPARAMETERLISTINTERPRETER_DECL_HPP */
MueLu::DefaultLocalOrdinal LocalOrdinal
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
double * xcoord_
coordinates can be embedded in the ML parameter list
virtual ~MLParameterListInterpreter()=default
Destructor.
MueLu::DefaultNode Node
void AddTransferFactory(const RCP< FactoryBase > &factory)
Add transfer factory in the end of list of transfer factories for RAPFactory.
virtual void SetupHierarchy(Hierarchy &H) const
Setup Hierarchy object.
void CreateSublists(const ParameterList &List, ParameterList &newList)
MueLu::DefaultScalar Scalar
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
static RCP< SmootherFactory > GetSmootherFactory(const Teuchos::ParameterList &paramList, const RCP< FactoryBase > &AFact=Teuchos::null)
Read smoother options and build the corresponding smoother factory.
virtual void SetupOperator(Operator &Op) const
Setup Operator object.
size_t NumTransferFactories() const
Returns number of transfer factories.
int nullspaceDim_
nullspace can be embedded in the ML parameter list
Class that accepts ML-style parameters and builds a MueLu preconditioner. This interpreter uses the s...
void SetParameterList(const Teuchos::ParameterList &paramList)
Provides methods to build a multigrid hierarchy and apply multigrid cycles.