MueLu
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
MueLu_TrilinosSmoother_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_TRILINOSSMOOTHER_DECL_HPP
47
#define MUELU_TRILINOSSMOOTHER_DECL_HPP
48
49
#include <Teuchos_ParameterList.hpp>
50
51
52
#include "
MueLu_ConfigDefs.hpp
"
53
#include "
MueLu_TrilinosSmoother_fwd.hpp
"
54
#include "MueLu_SmootherPrototype.hpp"
55
56
#include "
MueLu_FactoryBase_fwd.hpp
"
57
#include "
MueLu_IfpackSmoother_fwd.hpp
"
58
59
#if defined(HAVE_MUELU_IFPACK2)
60
#include "
MueLu_Ifpack2Smoother_fwd.hpp
"
61
#include "MueLu_Ifpack2Smoother.hpp"
62
#endif
63
64
#if defined(HAVE_MUELU_BELOS)
65
#include "
MueLu_BelosSmoother_fwd.hpp
"
66
#endif
67
68
#if defined(HAVE_MUELU_STRATIMIKOS)
69
#include "
MueLu_StratimikosSmoother_fwd.hpp
"
70
#endif
71
72
// Note: TrilinosSmoother is a SmootherPrototype that cannot be turned into a smoother using Setup().
73
// When this prototype is cloned using Copy(), the clone is an Ifpack or an Ifpack2 smoother.
74
// The clone can be used as a smoother after calling Setup().
75
76
namespace
MueLu
{
77
85
86
template <class Scalar = SmootherPrototype<>::scalar_type,
87
class
LocalOrdinal
=
typename
SmootherPrototype<Scalar>::local_ordinal_type
,
88
class
GlobalOrdinal
=
typename
SmootherPrototype<Scalar, LocalOrdinal>::global_ordinal_type
,
89
class
Node
=
typename
SmootherPrototype<Scalar, LocalOrdinal, GlobalOrdinal>::node_type
>
90
class
TrilinosSmoother
:
public
SmootherPrototype
<Scalar,LocalOrdinal,GlobalOrdinal,Node> {
91
#undef MUELU_TRILINOSSMOOTHER_SHORT
92
#include "
MueLu_UseShortNames.hpp
"
93
94
public
:
95
97
98
110
111
TrilinosSmoother
(
const
std::string& type =
""
,
const
Teuchos::ParameterList& paramList = Teuchos::ParameterList(),
const
LO& overlap = 0);
112
114
virtual
~TrilinosSmoother
() { }
115
117
119
120
121
void
DeclareInput
(
Level
& currentLevel)
const
;
122
124
126
127
129
void
Setup
(
Level
& currentLevel);
130
132
void
Apply
(MultiVector& X,
const
MultiVector& B,
bool
InitialGuessIsZero =
false
)
const
;
133
135
137
void
SetFactory
(
const
std::string& varName,
const
RCP<const FactoryBase>& factory);
138
140
RCP<SmootherPrototype>
Copy
()
const
;
141
142
#ifndef _MSC_VER
144
template
<
class
Scalar2,
class
LocalOrdinal2,
class
GlobalOrdinal2,
class
Node2>
145
friend
class
TrilinosSmoother
;
146
#endif
147
149
// As a temporary solution.
150
// See https://software.sandia.gov/bugzilla/show_bug.cgi?id=5283#c5 for what I proposed to do
151
static
std::string
Ifpack2ToIfpack1Type
(
const
std::string& type);
152
154
// As a temporary solution.
155
// See https://software.sandia.gov/bugzilla/show_bug.cgi?id=5283#c5 for what I proposed to do
156
/* TODO:
157
ifpackList.set("type", "Chebyshev");
158
ifpackList.set("chebyshev: degree", (int) 1);
159
ifpackList.set("chebyshev: max eigenvalue", (double) 2.0);
160
ifpackList.set("chebyshev: min eigenvalue", (double) 1.0);
161
ifpackList.set("chebyshev: zero starting solution", false);
162
*/
163
static
Teuchos::ParameterList
Ifpack2ToIfpack1Param
(
const
Teuchos::ParameterList& ifpack2List);
164
166
167
169
std::string
description
()
const
;
170
172
//using MueLu::Describable::describe; // overloading, not hiding
173
//void describe(Teuchos::FancyOStream &out, const VerbLevel verbLevel = Default) const {
174
void
print
(Teuchos::FancyOStream& out,
const
VerbLevel
verbLevel =
Default
)
const
;
175
177
RCP<SmootherPrototype>
getSmoother
() {
return
s_
;}
178
180
size_t
getNodeSmootherComplexity
()
const
{
return
s_
->getNodeSmootherComplexity();}
181
183
184
private
:
185
187
std::string
type_
;
188
190
LO
overlap_
;
191
193
RCP<FactoryBase>
AFact_
;
194
195
//
196
// Underlying Smoother
197
//
198
200
RCP<SmootherPrototype>
sEpetra_
,
sTpetra_
,
sBelos_
,
sStratimikos_
;
201
mutable
202
RCP<SmootherPrototype>
s_
;
203
204
// Records for the case if something goes wrong
205
bool
triedEpetra_
,
triedTpetra_
,
triedBelos_
,
triedStratimikos_
;
206
std::string
errorEpetra_
,
errorTpetra_
,
errorBelos_
,
errorStratimikos_
;
207
208
};
// class TrilinosSmoother
209
210
}
// namespace MueLu
211
212
#define MUELU_TRILINOSSMOOTHER_SHORT
213
#endif
// MUELU_TRILINOSSMOOTHER_DECL_HPP
MueLu_BelosSmoother_fwd.hpp
MueLu_ConfigDefs.hpp
MueLu_FactoryBase_fwd.hpp
MueLu_Ifpack2Smoother_fwd.hpp
MueLu_IfpackSmoother_fwd.hpp
MueLu_StratimikosSmoother_fwd.hpp
MueLu_TrilinosSmoother_fwd.hpp
LocalOrdinal
MueLu::DefaultLocalOrdinal LocalOrdinal
Definition
MueLu_UseDefaultTypes.hpp:50
GlobalOrdinal
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Definition
MueLu_UseDefaultTypes.hpp:51
Node
MueLu::DefaultNode Node
Definition
MueLu_UseDefaultTypes.hpp:52
MueLu_UseShortNames.hpp
MueLu::Level
Class that holds all level-specific information.
Definition
MueLu_Level.hpp:99
MueLu::SmootherPrototype::node_type
Node node_type
Definition
MueLu_SmootherPrototype_decl.hpp:82
MueLu::SmootherPrototype::SmootherPrototype
SmootherPrototype()
@nameConstructors/Destructors.
Definition
MueLu_SmootherPrototype_def.hpp:54
MueLu::SmootherPrototype::global_ordinal_type
GlobalOrdinal global_ordinal_type
Definition
MueLu_SmootherPrototype_decl.hpp:81
MueLu::SmootherPrototype::local_ordinal_type
LocalOrdinal local_ordinal_type
Definition
MueLu_SmootherPrototype_decl.hpp:80
MueLu::TrilinosSmoother::Copy
RCP< SmootherPrototype > Copy() const
When this prototype is cloned using Copy(), the clone is an Ifpack or an Ifpack2 smoother.
Definition
MueLu_TrilinosSmoother_def.hpp:254
MueLu::TrilinosSmoother::Setup
void Setup(Level ¤tLevel)
TrilinosSmoother cannot be turned into a smoother using Setup(). Setup() always returns a RuntimeErro...
Definition
MueLu_TrilinosSmoother_def.hpp:230
MueLu::TrilinosSmoother::getSmoother
RCP< SmootherPrototype > getSmoother()
For diagnostic purposes.
Definition
MueLu_TrilinosSmoother_decl.hpp:177
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::overlap_
LO overlap_
Definition
MueLu_TrilinosSmoother_decl.hpp:190
MueLu::TrilinosSmoother::Ifpack2ToIfpack1Param
static Teuchos::ParameterList Ifpack2ToIfpack1Param(const Teuchos::ParameterList &ifpack2List)
Convert an Ifpack2 parameter list to Ifpack.
Definition
MueLu_TrilinosSmoother_def.hpp:329
MueLu::TrilinosSmoother::Ifpack2ToIfpack1Type
static std::string Ifpack2ToIfpack1Type(const std::string &type)
Convert an Ifpack2 preconditioner name to Ifpack.
Definition
MueLu_TrilinosSmoother_def.hpp:283
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::type_
std::string type_
Definition
MueLu_TrilinosSmoother_decl.hpp:187
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::errorBelos_
std::string errorBelos_
Definition
MueLu_TrilinosSmoother_decl.hpp:206
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::sBelos_
RCP< SmootherPrototype > sBelos_
Definition
MueLu_TrilinosSmoother_decl.hpp:200
MueLu::TrilinosSmoother::TrilinosSmoother
friend class TrilinosSmoother
Friend declaration required for clone() functionality.
Definition
MueLu_TrilinosSmoother_decl.hpp:145
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::errorStratimikos_
std::string errorStratimikos_
Definition
MueLu_TrilinosSmoother_decl.hpp:206
MueLu::TrilinosSmoother::DeclareInput
void DeclareInput(Level ¤tLevel) const
Input.
Definition
MueLu_TrilinosSmoother_def.hpp:182
MueLu::TrilinosSmoother::getNodeSmootherComplexity
size_t getNodeSmootherComplexity() const
Get a rough estimate of cost per iteration.
Definition
MueLu_TrilinosSmoother_decl.hpp:180
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::errorEpetra_
std::string errorEpetra_
Definition
MueLu_TrilinosSmoother_decl.hpp:206
MueLu::TrilinosSmoother::~TrilinosSmoother
virtual ~TrilinosSmoother()
Destructor.
Definition
MueLu_TrilinosSmoother_decl.hpp:114
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::sEpetra_
RCP< SmootherPrototype > sEpetra_
Definition
MueLu_TrilinosSmoother_decl.hpp:200
MueLu::TrilinosSmoother::TrilinosSmoother
TrilinosSmoother(const std::string &type="", const Teuchos::ParameterList ¶mList=Teuchos::ParameterList(), const LO &overlap=0)
Constructor.
Definition
MueLu_TrilinosSmoother_def.hpp:64
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::triedStratimikos_
bool triedStratimikos_
Definition
MueLu_TrilinosSmoother_decl.hpp:205
MueLu::TrilinosSmoother::SetFactory
void SetFactory(const std::string &varName, const RCP< const FactoryBase > &factory)
Custom SetFactory.
Definition
MueLu_TrilinosSmoother_def.hpp:173
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::sStratimikos_
RCP< SmootherPrototype > sStratimikos_
Definition
MueLu_TrilinosSmoother_decl.hpp:200
MueLu::TrilinosSmoother::Apply
void Apply(MultiVector &X, const MultiVector &B, bool InitialGuessIsZero=false) const
TrilinosSmoother cannot be applied. Apply() always returns a RuntimeError exception.
Definition
MueLu_TrilinosSmoother_def.hpp:246
MueLu::TrilinosSmoother::print
void print(Teuchos::FancyOStream &out, const VerbLevel verbLevel=Default) const
Print the object with some verbosity level to an FancyOStream object.
Definition
MueLu_TrilinosSmoother_def.hpp:356
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::triedTpetra_
bool triedTpetra_
Definition
MueLu_TrilinosSmoother_decl.hpp:205
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::triedEpetra_
bool triedEpetra_
Definition
MueLu_TrilinosSmoother_decl.hpp:205
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::s_
RCP< SmootherPrototype > s_
Definition
MueLu_TrilinosSmoother_decl.hpp:202
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::AFact_
RCP< FactoryBase > AFact_
Definition
MueLu_TrilinosSmoother_decl.hpp:193
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::triedBelos_
bool triedBelos_
Definition
MueLu_TrilinosSmoother_decl.hpp:205
MueLu::TrilinosSmoother::description
std::string description() const
Return a simple one-line description of this object.
Definition
MueLu_TrilinosSmoother_def.hpp:344
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::errorTpetra_
std::string errorTpetra_
Definition
MueLu_TrilinosSmoother_decl.hpp:206
MueLu::TrilinosSmoother< Scalar, LocalOrdinal, GlobalOrdinal, Node >::sTpetra_
RCP< SmootherPrototype > sTpetra_
Definition
MueLu_TrilinosSmoother_decl.hpp:200
MueLu
Namespace for MueLu classes and methods.
Definition
MueLu_BrickAggregationFactory_decl.hpp:78
MueLu::VerbLevel
int VerbLevel
Definition
MueLu_VerbosityLevel.hpp:113
MueLu::Default
@ Default
Definition
MueLu_VerbosityLevel.hpp:107
src
Smoothers
MueLu_TrilinosSmoother_decl.hpp
Generated by
1.17.0