MueLu Version of the Day
Loading...
Searching...
No Matches
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
49#include <Teuchos_ParameterList.hpp>
50
51#include <Xpetra_CrsMatrixWrap_fwd.hpp>
52#include <Xpetra_Matrix_fwd.hpp>
53
54#include "MueLu_ConfigDefs.hpp"
56
57#if defined(HAVE_MUELU_STRATIMIKOS) && defined(HAVE_MUELU_THYRA)
58
59#include <Tpetra_CrsMatrix.hpp>
60
62#include "MueLu_Level_fwd.hpp"
63#include "MueLu_SmootherPrototype.hpp"
65
66#include <Thyra_LinearOpWithSolveBase.hpp>
67
68
69namespace MueLu {
70
80
81 template <class Scalar = SmootherPrototype<>::scalar_type,
85 class StratimikosSmoother : public SmootherPrototype<Scalar,LocalOrdinal,GlobalOrdinal,Node> {
86#undef MUELU_STRATIMIKOSSMOOTHER_SHORT
88
89 public:
90
92
93 //TODO: update doc for Stratimikos.
102
103#ifndef _MSC_VER
104 // Avoid error C3772: invalid friend template declaration
105 template<class Scalar2, class LocalOrdinal2, class GlobalOrdinal2, class Node2>
106 friend class StratimikosSmoother;
107#endif
108
109 StratimikosSmoother(const std::string type, const Teuchos::ParameterList& paramList = Teuchos::ParameterList()) {
110 TEUCHOS_TEST_FOR_EXCEPTION(true, Exceptions::RuntimeError, "Stratimikos only works for Scalar=double.")
111 };
112
114 virtual ~StratimikosSmoother() = default;
115
117
118 void SetParameterList(const Teuchos::ParameterList& paramList) {};
119
121
122
123 void DeclareInput(Level &currentLevel) const {};
124
126
128
129
135 void Setup(Level &currentLevel) {};
136
145 void Apply(MultiVector& X, const MultiVector& B, bool InitialGuessIsZero = false) const {};
146
148
150
151
152 RCP<SmootherPrototype> Copy() const { return Teuchos::null; };
153
155
157
158
160 std::string description() const { return std::string(""); };
161
163 //using MueLu::Describable::describe; // overloading, not hiding
164 //void describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const
165 void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const {};
166
168
170 // RCP<Ifpack2::Preconditioner<Scalar,LocalOrdinal,GlobalOrdinal,Node> > getPreconditioner(){return prec_;}
171
173 size_t getNodeSmootherComplexity() const { return Teuchos::OrdinalTraits<size_t>::invalid(); };
174
175 }; // class StratimikosSmoother
176
177
178 template<class LocalOrdinal, class GlobalOrdinal, class Node>
179 struct StratimikosSmoother<double,LocalOrdinal,GlobalOrdinal,Node> : public SmootherPrototype<double,LocalOrdinal,GlobalOrdinal,Node> {
180 typedef double Scalar;
181#undef MUELU_STRATIMIKOSSMOOTHER_SHORT
183
184 StratimikosSmoother(const std::string type, const Teuchos::ParameterList& paramList = Teuchos::ParameterList());
185
187 virtual ~StratimikosSmoother() = default;
188
190
191 void SetParameterList(const Teuchos::ParameterList& paramList);
192
194
195
196 void DeclareInput(Level &currentLevel) const;
197
199
201
202
208 void Setup(Level &currentLevel);
209
218 void Apply(MultiVector& X, const MultiVector& B, bool InitialGuessIsZero = false) const;
219
221
223
224
225 RCP<SmootherPrototype> Copy() const;
226
228
230
231
233 std::string description() const;
234
236 //using MueLu::Describable::describe; // overloading, not hiding
237 //void describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const
238 void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const;
239
241
243 // RCP<Ifpack2::Preconditioner<Scalar,LocalOrdinal,GlobalOrdinal,Node> > getPreconditioner(){return prec_;}
244
246 size_t getNodeSmootherComplexity() const;
247
248 private:
249 void SetupStratimikos (Level& currentLevel);
256 void ExperimentalDropVertConnections(RCP<Matrix> & filteredA, Level& currentLevel);
257
259
260 std::string type_;
261
262 Teuchos::RCP<Thyra::LinearOpWithSolveBase<Scalar> > solver_;
263
265 RCP<Matrix> A_;
266
267 bool recurMgOnFilteredA_ = false;
268 }; // class StratimikosSmoother
269
270} // namespace MueLu
271
272#define MUELU_STRATIMIKOSSMOOTHER_SHORT
273#endif // HAVE_MUELU_STRATIMIKOS
274#endif // MUELU_STRATIMIKOSSMOOTHER_DECL_HPP
Copy
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
Base class for smoother prototypes.
Namespace for MueLu classes and methods.