MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_StratimikosSmoother_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_STRATIMIKOSSMOOTHER_DECL_HPP
11 #define MUELU_STRATIMIKOSSMOOTHER_DECL_HPP
12 
14 
16 #include <Xpetra_Matrix_fwd.hpp>
17 
18 #include "MueLu_ConfigDefs.hpp"
20 
21 #if defined(HAVE_MUELU_STRATIMIKOS) && defined(HAVE_MUELU_THYRA)
22 
23 #include <Tpetra_CrsMatrix.hpp>
24 
26 #include "MueLu_Level_fwd.hpp"
27 #include "MueLu_SmootherPrototype.hpp"
28 #include "MueLu_Utilities_fwd.hpp"
29 
30 #include <Thyra_LinearOpWithSolveBase.hpp>
31 
32 namespace MueLu {
33 
44 template <class Scalar = SmootherPrototype<>::scalar_type,
45  class LocalOrdinal = typename SmootherPrototype<Scalar>::local_ordinal_type,
46  class GlobalOrdinal = typename SmootherPrototype<Scalar, LocalOrdinal>::global_ordinal_type,
47  class Node = typename SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal>::node_type>
48 class StratimikosSmoother : public SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
49 #undef MUELU_STRATIMIKOSSMOOTHER_SHORT
50 #include "MueLu_UseShortNames.hpp"
51 
52  public:
54 
55  // TODO: update doc for Stratimikos.
65 #ifndef _MSC_VER
66  // Avoid error C3772: invalid friend template declaration
67  template <class Scalar2, class LocalOrdinal2, class GlobalOrdinal2, class Node2>
68  friend class StratimikosSmoother;
69 #endif
70 
71  StratimikosSmoother(const std::string type, const Teuchos::ParameterList& paramList = Teuchos::ParameterList()){
72  TEUCHOS_TEST_FOR_EXCEPTION(true, Exceptions::RuntimeError, "Stratimikos only works for Scalar=double.")};
73 
75  virtual ~StratimikosSmoother() = default;
76 
78 
79  void SetParameterList(const Teuchos::ParameterList& paramList){};
80 
82 
83 
84  void DeclareInput(Level& currentLevel) const {};
85 
87 
89 
90 
96  void Setup(Level& currentLevel){};
97 
106  void Apply(MultiVector& X, const MultiVector& B, bool InitialGuessIsZero = false) const {};
107 
109 
111 
112 
113  RCP<SmootherPrototype> Copy() const { return Teuchos::null; };
114 
116 
118 
119 
121  std::string description() const { return std::string(""); };
122 
124  // using MueLu::Describable::describe; // overloading, not hiding
125  // void describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const
126  void print(Teuchos::FancyOStream& out, const VerbLevel verbLevel = Default) const {};
127 
129 
131  // RCP<Ifpack2::Preconditioner<Scalar,LocalOrdinal,GlobalOrdinal,Node> > getPreconditioner(){return prec_;}
132 
134  size_t getNodeSmootherComplexity() const { return Teuchos::OrdinalTraits<size_t>::invalid(); };
135 
136 }; // class StratimikosSmoother
137 
138 template <class LocalOrdinal, class GlobalOrdinal, class Node>
139 struct StratimikosSmoother<double, LocalOrdinal, GlobalOrdinal, Node> : public SmootherPrototype<double, LocalOrdinal, GlobalOrdinal, Node> {
140  typedef double Scalar;
141 #undef MUELU_STRATIMIKOSSMOOTHER_SHORT
142 #include "MueLu_UseShortNames.hpp"
143 
144  StratimikosSmoother(const std::string type, const Teuchos::ParameterList& paramList = Teuchos::ParameterList());
145 
147  virtual ~StratimikosSmoother() = default;
148 
150 
151  void SetParameterList(const Teuchos::ParameterList& paramList);
152 
154 
155 
156  void DeclareInput(Level& currentLevel) const;
157 
159 
161 
162 
168  void Setup(Level& currentLevel);
169 
178  void Apply(MultiVector& X, const MultiVector& B, bool InitialGuessIsZero = false) const;
179 
181 
183 
184 
185  RCP<SmootherPrototype> Copy() const;
186 
188 
190 
191 
193  std::string description() const;
194 
196  // using MueLu::Describable::describe; // overloading, not hiding
197  // void describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const
198  void print(Teuchos::FancyOStream& out, const VerbLevel verbLevel = Default) const;
199 
201 
203  // RCP<Ifpack2::Preconditioner<Scalar,LocalOrdinal,GlobalOrdinal,Node> > getPreconditioner(){return prec_;}
204 
206  size_t getNodeSmootherComplexity() const;
207 
208  private:
209  void SetupStratimikos(Level& currentLevel);
216  void ExperimentalDropVertConnections(RCP<Matrix>& filteredA, Level& currentLevel);
217 
219 
220  std::string type_;
221 
223 
225  RCP<Matrix> A_;
226 
227  bool recurMgOnFilteredA_ = false;
228 }; // class StratimikosSmoother
229 
230 } // namespace MueLu
231 
232 #define MUELU_STRATIMIKOSSMOOTHER_SHORT
233 #endif // HAVE_MUELU_STRATIMIKOS
234 #endif // MUELU_STRATIMIKOSSMOOTHER_DECL_HPP
MueLu::DefaultLocalOrdinal LocalOrdinal
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
MueLu::DefaultNode Node
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal