MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_Ifpack2Smoother_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_IFPACK2SMOOTHER_DECL_HPP
11#define MUELU_IFPACK2SMOOTHER_DECL_HPP
12
13#include <Teuchos_ParameterList.hpp>
14
15#include <Xpetra_BlockedCrsMatrix_fwd.hpp>
16#include <Xpetra_CrsMatrixWrap_fwd.hpp>
17#include <Xpetra_Matrix_fwd.hpp>
18#include <Xpetra_MultiVectorFactory_fwd.hpp>
19#include <Xpetra_TpetraCrsMatrix_fwd.hpp>
20
21#include "MueLu_ConfigDefs.hpp"
23
24#include <Tpetra_CrsMatrix.hpp>
25
26#include <Ifpack2_Factory_decl.hpp>
27#include <Ifpack2_Factory_def.hpp>
29
30#include "MueLu_Level_fwd.hpp"
31#include "MueLu_SmootherPrototype.hpp"
34
35namespace MueLu {
36
47template <class Scalar = SmootherPrototype<>::scalar_type,
51class Ifpack2Smoother : public SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
52#undef MUELU_IFPACK2SMOOTHER_SHORT
54
55 public:
57
58 // TODO: update doc for Ifpack2. Right now, it's a copy of the doc of IfpackSmoother
94#ifndef _MSC_VER
95 // Avoid error C3772: invalid friend template declaration
96 template <class Scalar2, class LocalOrdinal2, class GlobalOrdinal2, class Node2>
97 friend class Ifpack2Smoother;
98#endif
99
100 Ifpack2Smoother(const std::string& type, const Teuchos::ParameterList& paramList = Teuchos::ParameterList(), const LO& overlap = 0); // TODO: empty paramList valid for Ifpack??
101
103 virtual ~Ifpack2Smoother() {}
104
106
107 void SetParameterList(const Teuchos::ParameterList& paramList);
108
110
111
112 void DeclareInput(Level& currentLevel) const;
113
115
117
118
126 void Setup(Level& currentLevel);
127
136 void Apply(MultiVector& X, const MultiVector& B, bool InitialGuessIsZero = false) const;
137
139
141
142
143 RCP<SmootherPrototype> Copy() const;
144
146
148
149
151 std::string description() const;
152
154 // using MueLu::Describable::describe; // overloading, not hiding
155 // void describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const
156 void print(Teuchos::FancyOStream& out, const VerbLevel verbLevel = Default) const;
157
159
161 RCP<Ifpack2::Preconditioner<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getPreconditioner() { return prec_; }
162
164 size_t getNodeSmootherComplexity() const;
165
166 private:
167 void SetPrecParameters(const Teuchos::ParameterList& list = Teuchos::ParameterList()) const;
168
169 void SetupSchwarz(Level& currentLevel);
170 void SetupChebyshev(Level& currentLevel);
171 void SetupLineSmoothing(Level& currentLevel);
172 void SetupBlockRelaxation(Level& currentLevel);
173 void SetupTopological(Level& currentLevel);
174 void SetupAggregate(Level& currentLevel);
175 void SetupHiptmair(Level& currentLevel);
176 void SetupGeneric(Level& currentLevel);
177 Scalar SetupChebyshevEigenvalues(Level& currentLevel, const std::string& matrixName, const std::string& label, Teuchos::ParameterList& paramList) const;
178
179 private:
182
184 std::string type_;
185
188
190 RCP<Ifpack2::Preconditioner<Scalar, LocalOrdinal, GlobalOrdinal, Node> > prec_;
191
193 RCP<Operator> A_;
194
195}; // class Ifpack2Smoother
196
197} // namespace MueLu
198
199#define MUELU_IFPACK2SMOOTHER_SHORT
200#endif // MUELU_IFPACK2SMOOTHER_DECL_HPP
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
Class that encapsulates Ifpack2 smoothers.
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the object with some verbosity level to an FancyOStream object.
RCP< Ifpack2::Preconditioner< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getPreconditioner()
For diagnostic purposes.
void SetupSchwarz(Level &currentLevel)
void Setup(Level &currentLevel)
Set up the smoother.
Scalar SetupChebyshevEigenvalues(Level &currentLevel, const std::string &matrixName, const std::string &label, Teuchos::ParameterList &paramList) const
void SetupAggregate(Level &currentLevel)
void SetupBlockRelaxation(Level &currentLevel)
void SetupChebyshev(Level &currentLevel)
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
void SetParameterList(const Teuchos::ParameterList &paramList)
Set parameters from a parameter list and return with default values.
RCP< SmootherPrototype > Copy() const
std::string description() const
Return a simple one-line description of this object.
void SetupHiptmair(Level &currentLevel)
LO overlap_
overlap when using the smoother in additive Schwarz mode
RCP< Ifpack2::Preconditioner< Scalar, LocalOrdinal, GlobalOrdinal, Node > > prec_
pointer to Ifpack2 preconditioner object
void SetPrecParameters(const Teuchos::ParameterList &list=Teuchos::ParameterList()) const
void SetupTopological(Level &currentLevel)
std::string type_
ifpack2-specific key phrase that denote smoother type
friend class Ifpack2Smoother
Constructor.
void DeclareInput(Level &currentLevel) const
Input.
RCP< Operator > A_
matrix, used in apply if solving residual equation
void SetupLineSmoothing(Level &currentLevel)
void SetupGeneric(Level &currentLevel)
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
Apply the preconditioner.
Class that holds all level-specific information.
Base class for smoother prototypes.
Namespace for MueLu classes and methods.