Thyra
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
support
operator_solve
client_support
Thyra_DefaultPreconditioner_decl.hpp
1
// @HEADER
2
// ***********************************************************************
3
//
4
// Thyra: Interfaces and Support for Abstract Numerical Algorithms
5
// Copyright (2004) Sandia Corporation
6
//
7
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8
// license for use of this work by or on behalf of the U.S. Government.
9
//
10
// Redistribution and use in source and binary forms, with or without
11
// modification, are permitted provided that the following conditions are
12
// met:
13
//
14
// 1. Redistributions of source code must retain the above copyright
15
// notice, this list of conditions and the following disclaimer.
16
//
17
// 2. Redistributions in binary form must reproduce the above copyright
18
// notice, this list of conditions and the following disclaimer in the
19
// documentation and/or other materials provided with the distribution.
20
//
21
// 3. Neither the name of the Corporation nor the names of the
22
// contributors may be used to endorse or promote products derived from
23
// this software without specific prior written permission.
24
//
25
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
//
37
// Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38
//
39
// ***********************************************************************
40
// @HEADER
41
42
#ifndef THYRA_DEFUALT_PRECONDITIONER_DECL_HPP
43
#define THYRA_DEFUALT_PRECONDITIONER_DECL_HPP
44
45
#include "Thyra_PreconditionerBase.hpp"
46
#include "Teuchos_ConstNonconstObjectContainer.hpp"
47
48
49
namespace
Thyra {
50
51
79
template
<
class
Scalar>
80
class
DefaultPreconditioner
:
virtual
public
PreconditionerBase
<Scalar>
81
{
82
public
:
83
86
89
DefaultPreconditioner
();
90
94
DefaultPreconditioner
(
95
const
Teuchos::RCP
<
LinearOpBase<Scalar>
> &leftPrecOp,
96
const
Teuchos::RCP
<
LinearOpBase<Scalar>
> &rightPrecOp
97
);
98
102
DefaultPreconditioner
(
103
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &leftPrecOp,
104
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &rightPrecOp
105
);
106
109
DefaultPreconditioner
(
110
const
Teuchos::RCP
<
LinearOpBase<Scalar>
> &unspecifiedPrecOp
111
);
112
115
DefaultPreconditioner
(
116
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &unspecifiedPrecOp
117
);
118
121
void
initializeLeft
(
122
const
Teuchos::RCP
<
LinearOpBase<Scalar>
> &leftPrecOp
123
);
124
127
void
initializeLeft
(
128
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &leftPrecOp
129
);
130
133
void
initializeRight
(
134
const
Teuchos::RCP
<
LinearOpBase<Scalar>
> &rightPrecOp
135
);
136
139
void
initializeRight
(
140
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &rightPrecOp
141
);
142
145
void
initializeLeftRight
(
146
const
Teuchos::RCP
<
LinearOpBase<Scalar>
> &leftPrecOp
147
,
const
Teuchos::RCP
<
LinearOpBase<Scalar>
> &rightPrecOp
148
);
149
152
void
initializeLeftRight
(
153
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &leftPrecOp
154
,
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &rightPrecOp
155
);
156
160
void
initializeUnspecified
(
161
const
Teuchos::RCP
<
LinearOpBase<Scalar>
> &unspecifiedPrecOp
162
);
163
167
void
initializeUnspecified
(
168
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &unspecifiedPrecOp
169
);
170
177
void
uninitialize
();
178
180
183
184
std::string
description
()
const
;
186
void
describe
(
187
Teuchos::FancyOStream
&out,
188
const
Teuchos::EVerbosityLevel
verbLevel
189
)
const
;
191
194
195
bool
isLeftPrecOpConst
()
const
;
197
Teuchos::RCP<LinearOpBase<Scalar>
>
getNonconstLeftPrecOp
();
199
Teuchos::RCP<const LinearOpBase<Scalar>
>
getLeftPrecOp
()
const
;
201
bool
isRightPrecOpConst
()
const
;
203
Teuchos::RCP<LinearOpBase<Scalar>
>
getNonconstRightPrecOp
();
205
Teuchos::RCP<const LinearOpBase<Scalar>
>
getRightPrecOp
()
const
;
207
bool
isUnspecifiedPrecOpConst
()
const
;
209
Teuchos::RCP<LinearOpBase<Scalar>
>
getNonconstUnspecifiedPrecOp
();
211
Teuchos::RCP<const LinearOpBase<Scalar>
>
getUnspecifiedPrecOp
()
const
;
213
214
private
:
215
216
Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar>
> leftPrecOp_;
217
Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar>
> rightPrecOp_;
218
Teuchos::ConstNonconstObjectContainer<LinearOpBase<Scalar>
> unspecifiedPrecOp_;
219
220
};
221
222
// ///////////////////////
223
// Related functions
224
225
231
template
<
class
Scalar>
232
Teuchos::RCP<const DefaultPreconditioner<Scalar>
>
233
unspecifiedPrec
(
234
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &unspecifiedPrecOp
235
)
236
{
237
return
Teuchos::rcp
(
new
DefaultPreconditioner<Scalar>
(unspecifiedPrecOp));
238
}
239
240
246
template
<
class
Scalar>
247
Teuchos::RCP<DefaultPreconditioner<Scalar>
>
248
nonconstUnspecifiedPrec
(
249
const
Teuchos::RCP
<
LinearOpBase<Scalar>
> &unspecifiedPrecOp
250
)
251
{
252
return
Teuchos::rcp
(
new
DefaultPreconditioner<Scalar>
(unspecifiedPrecOp));
253
}
254
255
261
template
<
class
Scalar>
262
Teuchos::RCP<const DefaultPreconditioner<Scalar>
>
263
leftPrec
(
264
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &leftPrecOp
265
)
266
{
267
return
Teuchos::rcp
(
new
DefaultPreconditioner<Scalar>
(leftPrecOp,Teuchos::null));
268
}
269
275
template
<
class
Scalar>
276
Teuchos::RCP<const DefaultPreconditioner<Scalar>
>
277
rightPrec
(
278
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &rightPrecOp
279
)
280
{
281
return
Teuchos::rcp
(
new
DefaultPreconditioner<Scalar>
(Teuchos::null,rightPrecOp));
282
}
283
289
template
<
class
Scalar>
290
Teuchos::RCP<const DefaultPreconditioner<Scalar>
>
291
splitPrec
(
292
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &leftPrecOp
293
,
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &rightPrecOp
294
)
295
{
296
return
Teuchos::rcp
(
new
DefaultPreconditioner<Scalar>
(leftPrecOp,rightPrecOp));
297
}
298
299
300
}
// namespace Thyra
301
302
303
#endif
// THYRA_DEFUALT_PRECONDITIONER_DECL_HPP
Teuchos::ConstNonconstObjectContainer
Teuchos::RCP
Thyra::DefaultPreconditioner::rightPrec
Teuchos::RCP< const DefaultPreconditioner< Scalar > > rightPrec(const Teuchos::RCP< const LinearOpBase< Scalar > > &rightPrecOp)
Create a precondioner from a single linear operator targeted to be used on the right.
Definition
Thyra_DefaultPreconditioner_decl.hpp:277
Thyra::DefaultPreconditioner::initializeUnspecified
void initializeUnspecified(const Teuchos::RCP< LinearOpBase< Scalar > > &unspecifiedPrecOp)
Initialize a single unspecified preconditioner operator.
Definition
Thyra_DefaultPreconditioner_def.hpp:175
Thyra::DefaultPreconditioner::getNonconstRightPrecOp
Teuchos::RCP< LinearOpBase< Scalar > > getNonconstRightPrecOp()
Definition
Thyra_DefaultPreconditioner_def.hpp:238
Thyra::DefaultPreconditioner::nonconstUnspecifiedPrec
Teuchos::RCP< DefaultPreconditioner< Scalar > > nonconstUnspecifiedPrec(const Teuchos::RCP< LinearOpBase< Scalar > > &unspecifiedPrecOp)
Create a precondioner from a single linear operator not targeted to be used on the left or the right.
Definition
Thyra_DefaultPreconditioner_decl.hpp:248
Thyra::DefaultPreconditioner::leftPrec
Teuchos::RCP< const DefaultPreconditioner< Scalar > > leftPrec(const Teuchos::RCP< const LinearOpBase< Scalar > > &leftPrecOp)
Create a precondioner from a single linear operator targeted to be used on the left.
Definition
Thyra_DefaultPreconditioner_decl.hpp:263
Thyra::DefaultPreconditioner::getNonconstLeftPrecOp
Teuchos::RCP< LinearOpBase< Scalar > > getNonconstLeftPrecOp()
Definition
Thyra_DefaultPreconditioner_def.hpp:215
Thyra::DefaultPreconditioner::getRightPrecOp
Teuchos::RCP< const LinearOpBase< Scalar > > getRightPrecOp() const
Definition
Thyra_DefaultPreconditioner_def.hpp:246
Thyra::DefaultPreconditioner::describe
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Definition
Thyra_DefaultPreconditioner_def.hpp:305
Thyra::DefaultPreconditioner::isUnspecifiedPrecOpConst
bool isUnspecifiedPrecOpConst() const
Definition
Thyra_DefaultPreconditioner_def.hpp:253
Thyra::DefaultPreconditioner::getUnspecifiedPrecOp
Teuchos::RCP< const LinearOpBase< Scalar > > getUnspecifiedPrecOp() const
Definition
Thyra_DefaultPreconditioner_def.hpp:269
Thyra::DefaultPreconditioner::isLeftPrecOpConst
bool isLeftPrecOpConst() const
Definition
Thyra_DefaultPreconditioner_def.hpp:207
Thyra::DefaultPreconditioner::unspecifiedPrec
Teuchos::RCP< const DefaultPreconditioner< Scalar > > unspecifiedPrec(const Teuchos::RCP< const LinearOpBase< Scalar > > &unspecifiedPrecOp)
Create a precondioner from a single linear operator not targeted to be used on the left or the right.
Definition
Thyra_DefaultPreconditioner_decl.hpp:233
Thyra::DefaultPreconditioner::initializeLeft
void initializeLeft(const Teuchos::RCP< LinearOpBase< Scalar > > &leftPrecOp)
Initialize a left preconditioner.
Definition
Thyra_DefaultPreconditioner_def.hpp:111
Thyra::DefaultPreconditioner::splitPrec
Teuchos::RCP< const DefaultPreconditioner< Scalar > > splitPrec(const Teuchos::RCP< const LinearOpBase< Scalar > > &leftPrecOp, const Teuchos::RCP< const LinearOpBase< Scalar > > &rightPrecOp)
Create a split precondioner from two linear operators, one to be applied on the left and one to be ap...
Definition
Thyra_DefaultPreconditioner_decl.hpp:291
Thyra::DefaultPreconditioner::description
std::string description() const
Definition
Thyra_DefaultPreconditioner_def.hpp:279
Thyra::DefaultPreconditioner::DefaultPreconditioner
DefaultPreconditioner()
Construct to uninitialized.
Definition
Thyra_DefaultPreconditioner_def.hpp:56
Thyra::DefaultPreconditioner::initializeRight
void initializeRight(const Teuchos::RCP< LinearOpBase< Scalar > > &rightPrecOp)
Initialize a right preconditioner.
Definition
Thyra_DefaultPreconditioner_def.hpp:131
Thyra::DefaultPreconditioner::getNonconstUnspecifiedPrecOp
Teuchos::RCP< LinearOpBase< Scalar > > getNonconstUnspecifiedPrecOp()
Definition
Thyra_DefaultPreconditioner_def.hpp:261
Thyra::DefaultPreconditioner::uninitialize
void uninitialize()
Uninitialize.
Definition
Thyra_DefaultPreconditioner_def.hpp:195
Thyra::DefaultPreconditioner::getLeftPrecOp
Teuchos::RCP< const LinearOpBase< Scalar > > getLeftPrecOp() const
Definition
Thyra_DefaultPreconditioner_def.hpp:223
Thyra::DefaultPreconditioner::isRightPrecOpConst
bool isRightPrecOpConst() const
Definition
Thyra_DefaultPreconditioner_def.hpp:230
Thyra::DefaultPreconditioner::initializeLeftRight
void initializeLeftRight(const Teuchos::RCP< LinearOpBase< Scalar > > &leftPrecOp, const Teuchos::RCP< LinearOpBase< Scalar > > &rightPrecOp)
Initialize a split left/right preconditioner.
Definition
Thyra_DefaultPreconditioner_def.hpp:151
Thyra::LinearOpBase
Base class for all linear operators.
Definition
Thyra_LinearOpBase_decl.hpp:191
Thyra::PreconditionerBase
Simple interface class to access a precreated preconditioner as one or more linear operators objects ...
Definition
Thyra_PreconditionerBase.hpp:90
Teuchos::FancyOStream
basic_FancyOStream< char > FancyOStream
Teuchos::EVerbosityLevel
EVerbosityLevel
Teuchos::rcp
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Generated by
1.17.0