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 // ***********************************************************************
4 //
5 // MueLu: A package for multigrid based preconditioning
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef MUELU_STRATIMIKOSSMOOTHER_DECL_HPP
47 #define MUELU_STRATIMIKOSSMOOTHER_DECL_HPP
48 
50 
51 #include <Xpetra_CrsMatrixWrap.hpp>
52 #include <Xpetra_Matrix_fwd.hpp>
53 #include <Xpetra_Matrix.hpp>
54 
55 #include "MueLu_ConfigDefs.hpp"
57 
58 #if defined(HAVE_MUELU_STRATIMIKOS) && defined(HAVE_MUELU_TPETRA) && defined(HAVE_MUELU_THYRA)
59 
60 #include <Tpetra_CrsMatrix.hpp>
61 
64 #include "MueLu_Level_fwd.hpp"
65 #include "MueLu_SmootherPrototype.hpp"
66 #include "MueLu_Utilities_fwd.hpp"
67 
68 #include <Thyra_LinearOpWithSolveBase.hpp>
69 
70 
71 namespace MueLu {
72 
83  template <class Scalar = SmootherPrototype<>::scalar_type,
84  class LocalOrdinal = typename SmootherPrototype<Scalar>::local_ordinal_type,
85  class GlobalOrdinal = typename SmootherPrototype<Scalar, LocalOrdinal>::global_ordinal_type,
86  class Node = typename SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal>::node_type>
87  class StratimikosSmoother : public SmootherPrototype<Scalar,LocalOrdinal,GlobalOrdinal,Node> {
88 #undef MUELU_STRATIMIKOSSMOOTHER_SHORT
89 #include "MueLu_UseShortNames.hpp"
90 
91  public:
92 
94 
95  //TODO: update doc for Stratimikos.
105 #ifndef _MSC_VER
106  // Avoid error C3772: invalid friend template declaration
107  template<class Scalar2, class LocalOrdinal2, class GlobalOrdinal2, class Node2>
108  friend class StratimikosSmoother;
109 #endif
110 
111  StratimikosSmoother(const std::string type, const Teuchos::ParameterList& paramList = Teuchos::ParameterList()) {
112  TEUCHOS_TEST_FOR_EXCEPTION(true, Exceptions::RuntimeError, "Stratimikos only works for Scalar=double.")
113  };
114 
116  virtual ~StratimikosSmoother() = default;
117 
119 
120  void SetParameterList(const Teuchos::ParameterList& paramList) {};
121 
123 
124 
125  void DeclareInput(Level &currentLevel) const {};
126 
128 
130 
131 
137  void Setup(Level &currentLevel) {};
138 
147  void Apply(MultiVector& X, const MultiVector& B, bool InitialGuessIsZero = false) const {};
148 
150 
152 
153 
154  RCP<SmootherPrototype> Copy() const { return Teuchos::null; };
155 
157 
159 
160 
162  std::string description() const { return std::string(""); };
163 
165  //using MueLu::Describable::describe; // overloading, not hiding
166  //void describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const
167  void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const {};
168 
170 
172  // RCP<Ifpack2::Preconditioner<Scalar,LocalOrdinal,GlobalOrdinal,Node> > getPreconditioner(){return prec_;}
173 
175  size_t getNodeSmootherComplexity() const { return Teuchos::OrdinalTraits<size_t>::invalid(); };
176 
177  }; // class StratimikosSmoother
178 
179 
180  template<class LocalOrdinal, class GlobalOrdinal, class Node>
181  struct StratimikosSmoother<double,LocalOrdinal,GlobalOrdinal,Node> : public SmootherPrototype<double,LocalOrdinal,GlobalOrdinal,Node> {
182  typedef double Scalar;
183 #undef MUELU_STRATIMIKOSSMOOTHER_SHORT
184 #include "MueLu_UseShortNames.hpp"
185 
186  StratimikosSmoother(const std::string type, const Teuchos::ParameterList& paramList = Teuchos::ParameterList());
187 
189  virtual ~StratimikosSmoother() = default;
190 
192 
193  void SetParameterList(const Teuchos::ParameterList& paramList);
194 
196 
197 
198  void DeclareInput(Level &currentLevel) const;
199 
201 
203 
204 
210  void Setup(Level &currentLevel);
211 
220  void Apply(MultiVector& X, const MultiVector& B, bool InitialGuessIsZero = false) const;
221 
223 
225 
226 
227  RCP<SmootherPrototype> Copy() const;
228 
230 
232 
233 
235  std::string description() const;
236 
238  //using MueLu::Describable::describe; // overloading, not hiding
239  //void describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const
240  void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const;
241 
243 
245  // RCP<Ifpack2::Preconditioner<Scalar,LocalOrdinal,GlobalOrdinal,Node> > getPreconditioner(){return prec_;}
246 
248  size_t getNodeSmootherComplexity() const;
249 
250  private:
251  void SetupStratimikos (Level& currentLevel);
252 
253  std::string type_;
254 
256 
258  RCP<Matrix> A_;
259 
260  }; // class StratimikosSmoother
261 
262 } // namespace MueLu
263 
264 #define MUELU_STRATIMIKOSSMOOTHER_SHORT
265 #endif // HAVE_MUELU_STRATIMIKOS
266 #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