Thyra
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
support
operator_solve
client_support
Thyra_PreconditionerFactoryHelpers.hpp
1
// @HEADER
2
// *****************************************************************************
3
// Thyra: Interfaces and Support for Abstract Numerical Algorithms
4
//
5
// Copyright 2004 NTESS and the Thyra contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef THYRA_PRECONDITIONER_FACTORY_HELPERS_DECL_HPP
11
#define THYRA_PRECONDITIONER_FACTORY_HELPERS_DECL_HPP
12
13
14
#include "Thyra_PreconditionerFactoryBase.hpp"
15
#include "Thyra_DefaultLinearOpSource.hpp"
16
#include "Thyra_DefaultPreconditioner.hpp"
17
18
19
namespace
Thyra {
20
21
26
template
<
class
Scalar>
27
void
initializePrec
(
28
const
PreconditionerFactoryBase<Scalar>
&precFactory,
29
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &fwdOp,
30
const
Teuchos::Ptr
<
PreconditionerBase<Scalar>
> &
prec
,
31
const
ESupportSolveUse
supportSolveUse =
SUPPORT_SOLVE_UNSPECIFIED
32
)
33
{
34
precFactory.
initializePrec
(
defaultLinearOpSource
(fwdOp),
prec
.get(),
35
supportSolveUse);
36
}
37
38
44
template
<
class
Scalar>
45
void
uninitializePrec
(
46
const
PreconditionerFactoryBase<Scalar>
&precFactory,
47
const
Teuchos::Ptr
<
PreconditionerBase<Scalar>
> &
prec
,
48
const
Teuchos::Ptr
<
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> > &fwdOp = Teuchos::null,
49
const
Teuchos::Ptr<ESupportSolveUse>
&supportSolveUse = Teuchos::null
50
)
51
{
52
Teuchos::RCP<const LinearOpSourceBase<Scalar>
> fwdOpSrc;
53
precFactory.
uninitializePrec
(
prec
, Teuchos::outArg(fwdOpSrc), supportSolveUse);
54
if
(nonnull(fwdOp)) {*fwdOp = fwdOpSrc->getOp();}
55
}
56
57
62
template
<
class
Scalar>
63
Teuchos::RCP<PreconditionerBase<Scalar>
>
64
prec
(
65
const
PreconditionerFactoryBase<Scalar>
&precFactory,
66
const
Teuchos::RCP
<
const
LinearOpBase<Scalar>
> &fwdOp,
67
const
ESupportSolveUse
supportSolveUse =
SUPPORT_SOLVE_UNSPECIFIED
68
)
69
{
70
Teuchos::RCP<PreconditionerBase<Scalar>
>
prec
=
71
precFactory.
createPrec
();
72
precFactory.
initializePrec
(
defaultLinearOpSource
(fwdOp), &*
prec
, supportSolveUse);
73
return
prec
;
74
}
75
76
77
}
// namespace Thyra
78
79
80
#endif
// THYRA_PRECONDITIONER_FACTORY_HELPERS_DECL_HPP
Teuchos::Ptr
Teuchos::RCP
Thyra::DefaultLinearOpSource::defaultLinearOpSource
Teuchos::RCP< const DefaultLinearOpSource< Scalar > > defaultLinearOpSource(const Teuchos::RCP< const LinearOpBase< Scalar > > &op)
Create a DefaultLinearOpSource object out of a LinearOpBase object.
Definition
Thyra_DefaultLinearOpSource_decl.hpp:95
Thyra::LinearOpBase
Base class for all linear operators.
Definition
Thyra_LinearOpBase_decl.hpp:159
Thyra::PreconditionerBase
Simple interface class to access a precreated preconditioner as one or more linear operators objects ...
Definition
Thyra_PreconditionerBase.hpp:58
Thyra::PreconditionerFactoryBase
Factory interface for creating preconditioner objects from LinearOpBase objects.
Definition
Thyra_PreconditionerFactoryBase_decl.hpp:35
Thyra::PreconditionerFactoryBase::uninitializePrec
virtual void uninitializePrec(PreconditionerBase< Scalar > *prec, RCP< const LinearOpSourceBase< Scalar > > *fwdOpSrc=NULL, ESupportSolveUse *supportSolveUse=NULL) const =0
Uninitialize a LinearOpBase preconditioner object and return its remembered forward linear operator.
Thyra::PreconditionerFactoryBase::uninitializePrec
void uninitializePrec(const PreconditionerFactoryBase< Scalar > &precFactory, const Teuchos::Ptr< PreconditionerBase< Scalar > > &prec, const Teuchos::Ptr< Teuchos::RCP< const LinearOpBase< Scalar > > > &fwdOp=Teuchos::null, const Teuchos::Ptr< ESupportSolveUse > &supportSolveUse=Teuchos::null)
Uninitialize a preconditioner and optionally extra what was used to create it.
Definition
Thyra_PreconditionerFactoryHelpers.hpp:45
Thyra::PreconditionerFactoryBase::prec
Teuchos::RCP< PreconditionerBase< Scalar > > prec(const PreconditionerFactoryBase< Scalar > &precFactory, const Teuchos::RCP< const LinearOpBase< Scalar > > &fwdOp, const ESupportSolveUse supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED)
Create and initialize a preconditioner from a forward linear operator.
Definition
Thyra_PreconditionerFactoryHelpers.hpp:64
Thyra::PreconditionerFactoryBase::initializePrec
void initializePrec(const PreconditionerFactoryBase< Scalar > &precFactory, const Teuchos::RCP< const LinearOpBase< Scalar > > &fwdOp, const Teuchos::Ptr< PreconditionerBase< Scalar > > &prec, const ESupportSolveUse supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED)
Initialize a preconditioner from a forward linear operator.
Definition
Thyra_PreconditionerFactoryHelpers.hpp:27
Thyra::PreconditionerFactoryBase::initializePrec
virtual void initializePrec(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, PreconditionerBase< Scalar > *precOp, const ESupportSolveUse supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED) const =0
Initialize a pre-created LinearOpBase preconditioner object given a "compatible" LinearOpBase object.
Thyra::PreconditionerFactoryBase::createPrec
virtual RCP< PreconditionerBase< Scalar > > createPrec() const =0
Create an (uninitialized) LinearOpBase object to be initialized as the preconditioner later in this->...
Thyra::ESupportSolveUse
ESupportSolveUse
Enum that specifies how a LinearOpWithSolveBase object will be used for solves after it is constructe...
Definition
Thyra_SolveSupportTypes.hpp:457
Thyra::SUPPORT_SOLVE_UNSPECIFIED
@ SUPPORT_SOLVE_UNSPECIFIED
How the output LOWSB object will be useded for solves in unspecified.
Definition
Thyra_SolveSupportTypes.hpp:458
Generated by
1.17.0