Tempus Version of the Day
Time Integration
Loading...
Searching...
No Matches
Thyra_ReusePreconditionerFactory.hpp
Go to the documentation of this file.
1// @HEADER
2// ****************************************************************************
3// Tempus: Copyright (2017) Sandia Corporation
4//
5// Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6// ****************************************************************************
7// @HEADER
8
9#ifndef Thyra_ReusePreconditionerFactory_hpp
10#define Thyra_ReusePreconditionerFactory_hpp
11
12#include "Thyra_PreconditionerFactoryBase.hpp"
13
14namespace Thyra {
15
19template<class Scalar>
21 : virtual public PreconditionerFactoryBase<Scalar>
22{
23public:
24
27
30
32 const RCP<PreconditionerBase<Scalar> > &prec
33 ) {
34#ifdef TEUCHOS_DEBUG
35 TEUCHOS_TEST_FOR_EXCEPT(is_null(prec));
36#endif
37 prec_ = prec;
38 }
39
40 RCP<PreconditionerBase<Scalar> >
42
43 RCP<const PreconditionerBase<Scalar> >
44 getPreconditioner() const { return prec_; }
45
46 void uninitialize() {
47 prec_ = Teuchos::null;
48 }
49
52
53 std::string description() const
54 {
55 std::ostringstream oss;
56 oss << this->Teuchos::Describable::description()
57 << "{"
58 << "prec=";
59 if (!is_null(prec_))
60 oss << prec_->description();
61 else
62 oss << "NULL";
63 oss << "}";
64 return oss.str();
65 }
66
68
71
72 void setParameterList(RCP<ParameterList> const& /* paramList */)
73 {
74 }
75
76 RCP<ParameterList> getNonconstParameterList()
77 {
78 return Teuchos::null;
79 }
80
81 RCP<ParameterList> unsetParameterList()
82 {
83 return Teuchos::null;
84 }
85
86 RCP<const ParameterList> getParameterList() const
87 {
88 return Teuchos::null;
89 }
90
91 RCP<const ParameterList> getValidParameters() const
92 {
93 return rcp(new ParameterList);
94 }
95
97
99
102
103 bool isCompatible(const LinearOpSourceBase<Scalar> &/* fwdOpSrc */) const
104 { return false; }
105
106 RCP<PreconditionerBase<Scalar> > createPrec() const
107 { return prec_; }
108
110 const RCP<const LinearOpSourceBase<Scalar> > &/* fwdOpSrc */,
111 PreconditionerBase<Scalar> * /* precOp */,
112 const ESupportSolveUse /* supportSolveUse */ = SUPPORT_SOLVE_UNSPECIFIED
113 ) const
114 {
115 }
116
118 PreconditionerBase<Scalar> * /* precOp */,
119 RCP<const LinearOpSourceBase<Scalar> > *fwdOpSrc = NULL,
120 ESupportSolveUse *supportSolveUse = NULL
121 ) const
122 {
123 }
124
126
127private:
128
129 // //////////////////////////////
130 // Private data members
131
132 RCP< PreconditionerBase<Scalar> > prec_;
133
134};
135
140template<class Scalar>
141RCP<ReusePreconditionerFactory<Scalar> >
143{
144 return Teuchos::rcp(new ReusePreconditionerFactory<Scalar>());
145}
146
151template<class Scalar>
152RCP<ReusePreconditionerFactory<Scalar> >
154 const RCP<PreconditionerBase<Scalar> > &prec
155 )
156{
157 RCP<ReusePreconditionerFactory<Scalar> >
158 fac = Teuchos::rcp(new ReusePreconditionerFactory<Scalar>());
159 fac->initialize(prec);
160 return fac;
161}
162
163} // end namespace Thyra
164
165#endif
Concrete PreconditionerFactoryBase subclass that just returns an already created/initialized precondi...
RCP< PreconditionerBase< Scalar > > getNonconstPreconditioner()
RCP< ReusePreconditionerFactory< Scalar > > reusePreconditionerFactory(const RCP< PreconditionerBase< Scalar > > &prec)
Nonmember constructor function.
RCP< const ParameterList > getParameterList() const
RCP< const ParameterList > getValidParameters() const
RCP< ReusePreconditionerFactory< Scalar > > reusePreconditionerFactory()
Nonmember constructor function.
RCP< PreconditionerBase< Scalar > > createPrec() const
void initializePrec(const RCP< const LinearOpSourceBase< Scalar > > &, PreconditionerBase< Scalar > *, const ESupportSolveUse=SUPPORT_SOLVE_UNSPECIFIED) const
void initialize(const RCP< PreconditionerBase< Scalar > > &prec)
void setParameterList(RCP< ParameterList > const &)
bool isCompatible(const LinearOpSourceBase< Scalar > &) const
void uninitializePrec(PreconditionerBase< Scalar > *, RCP< const LinearOpSourceBase< Scalar > > *fwdOpSrc=NULL, ESupportSolveUse *supportSolveUse=NULL) const
RCP< const PreconditionerBase< Scalar > > getPreconditioner() const