Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DelayedLinearOpWithSolveFactory_def.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_DELAYED_LINEAR_OP_WITH_SOLVE_FACTORY_HPP
11 #define THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_FACTORY_HPP
12 
13 
14 #include "Thyra_DelayedLinearOpWithSolveFactory_decl.hpp"
15 #include "Thyra_LinearOpWithSolveBase.hpp"
16 #include "Thyra_DelayedLinearOpWithSolve.hpp"
17 
18 
19 namespace Thyra {
20 
21 
22 // Overridden from Constructors/Initializers/Accessors
23 
24 
25 template<class Scalar>
28  )
29 {
30 #ifdef TEUCHOS_DEBUG
32 #endif
33  lowsf_ = lowsf;
34 }
35 
36 template<class Scalar>
39 {
40  return lowsf_;
41 }
42 
43 
44 template<class Scalar>
47 {
48  return lowsf_;
49 }
50 
51 
52 // Overridden from Teuchos::Describable
53 
54 
55 template<class Scalar>
57 {
58  std::ostringstream oss;
60  << "{"
61  << "lowsf=";
62  if (!is_null(lowsf_))
63  oss << lowsf_->description();
64  else
65  oss << "NULL";
66  oss << "}";
67  return oss.str();
68 }
69 
70 
71 // Overridden from ParameterListAcceptor
72 
73 
74 template<class Scalar>
76  RCP<ParameterList> const& paramList
77  )
78 {
79  lowsf_->setParameterList(paramList);
80 }
81 
82 
83 template<class Scalar>
86 {
87  return lowsf_->getNonconstParameterList();
88 }
89 
90 
91 template<class Scalar>
94 {
95  return lowsf_->unsetParameterList();
96 }
97 
98 
99 template<class Scalar>
102 {
103  return lowsf_->getParameterList();
104 }
105 
106 
107 template<class Scalar>
110 {
111  return lowsf_->getValidParameters();
112 }
113 
114 
115 // Overridden from LinearOpWithSolveFactoyBase
116 
117 
118 template<class Scalar>
120 {
121  return lowsf_->acceptsPreconditionerFactory();
122 }
123 
124 
125 template<class Scalar>
127  const RCP<PreconditionerFactoryBase<Scalar> > &precFactory,
128  const std::string &precFactoryName
129  )
130 {
131  lowsf_->setPreconditionerFactory(precFactory,precFactoryName);
132 }
133 
134 
135 template<class Scalar>
138 {
139  return lowsf_->getPreconditionerFactory();
140 }
141 
142 
143 template<class Scalar>
145  RCP<PreconditionerFactoryBase<Scalar> > *precFactory,
146  std::string * /* precFactoryName */
147  )
148 {
149  lowsf_->unsetPreconditionerFactory(precFactory);
150 }
151 
152 
153 template<class Scalar>
155  const LinearOpSourceBase<Scalar> &fwdOpSrc
156  ) const
157 {
158  return lowsf_->isCompatible(fwdOpSrc);
159 }
160 
161 
162 template<class Scalar>
165 {
168  dlows->setVerbLevel(this->getVerbLevel());
169  dlows->setOStream(this->getOStream());
170  return dlows;
171 }
172 
173 
174 template<class Scalar>
176  const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
178  const ESupportSolveUse supportSolveUse
179  ) const
180 {
181  using Teuchos::null;
182 #ifdef TEUCHOS_DEBUG
183  TEUCHOS_TEST_FOR_EXCEPT(is_null(fwdOpSrc));
185 #endif
188  dlows.initialize( fwdOpSrc, null, null, supportSolveUse, lowsf_ );
189 }
190 
191 
192 template<class Scalar>
194  const RCP<const LinearOpSourceBase<Scalar> > &/* fwdOpSrc */,
196  ) const
197 {
199 }
200 
201 
202 template<class Scalar>
205  RCP<const LinearOpSourceBase<Scalar> > *fwdOpSrc,
206  RCP<const PreconditionerBase<Scalar> > *prec,
207  RCP<const LinearOpSourceBase<Scalar> > *approxFwdOpSrc,
208  ESupportSolveUse *supportSolveUse
209  ) const
210 {
211 
212  using Teuchos::dyn_cast;
213 
214 #ifdef TEUCHOS_DEBUG
216 #endif
217 
220 
221  if (fwdOpSrc)
222  *fwdOpSrc = dlows.getFwdOpSrc();
223  if (prec)
224  *prec = dlows.getPrec();
225  if (approxFwdOpSrc)
226  *approxFwdOpSrc = dlows.getApproxFwdOpSrc();
227  if (supportSolveUse)
228  *supportSolveUse = dlows.getSupportSolveUse();
229 
230  // ToDo: 2007/08/16: rabartl: Consider uninitalizing dlows?
231 
232 }
233 
234 
235 template<class Scalar>
237  const EPreconditionerInputType precOpType
238  ) const
239 {
240  return lowsf_->supportsPreconditionerInputType(precOpType);
241 }
242 
243 
244 template<class Scalar>
246  const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
247  const RCP<const PreconditionerBase<Scalar> > &prec,
249  const ESupportSolveUse supportSolveUse
250  ) const
251 {
252  using Teuchos::null;
253 #ifdef TEUCHOS_DEBUG
254  TEUCHOS_TEST_FOR_EXCEPT(is_null(fwdOpSrc));
256 #endif
259  dlows.initialize( fwdOpSrc, prec, null, supportSolveUse, lowsf_ );
260 }
261 
262 
263 template<class Scalar>
265  const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
266  const RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc,
268  const ESupportSolveUse supportSolveUse
269  ) const
270 {
271  using Teuchos::null;
272 #ifdef TEUCHOS_DEBUG
273  TEUCHOS_TEST_FOR_EXCEPT(is_null(fwdOpSrc));
275 #endif
278  dlows.initialize( fwdOpSrc, null, approxFwdOpSrc, supportSolveUse, lowsf_ );
279 }
280 
281 
282 // protected
283 
284 
285 template<class Scalar>
287 {
288  lowsf_->setVerbLevel(this->getVerbLevel());
289  lowsf_->setOStream(this->getOStream());
290 }
291 
292 
293 } // namespace Thyra
294 
295 
296 #endif // THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_FACTORY_HPP
RCP< const PreconditionerBase< Scalar > > getPrec() const
Base class for all linear operators that can support a high-level solve operation.
bool is_null(const boost::shared_ptr< T > &p)
virtual bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const
virtual bool isCompatible(const LinearOpSourceBase< Scalar > &fwdOpSrc) const
virtual RCP< LinearOpWithSolveBase< Scalar > > createOp() const
virtual RCP< PreconditionerFactoryBase< Scalar > > getPreconditionerFactory() const
virtual void setPreconditionerFactory(const RCP< PreconditionerFactoryBase< Scalar > > &precFactory, const std::string &precFactoryName)
virtual void initializeApproxPreconditionedOp(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const RCP< const LinearOpSourceBase< Scalar > > &approxFwdOpSrc, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
T_To & dyn_cast(T_From &from)
virtual void unsetPreconditionerFactory(RCP< PreconditionerFactoryBase< Scalar > > *precFactory, std::string *precFactoryName)
Simple interface class to access a precreated preconditioner as one or more linear operators objects ...
virtual void initializePreconditionedOp(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const RCP< const PreconditionerBase< Scalar > > &prec, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
RCP< const LinearOpSourceBase< Scalar > > getFwdOpSrc() const
Factory interface for creating LinearOpWithSolveBase objects from compatible LinearOpBase objects...
virtual void initializeOp(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
virtual std::string description() const
void initialize(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const RCP< const PreconditionerBase< Scalar > > &prec, const RCP< const LinearOpSourceBase< Scalar > > &approxFwdOpSrc, const ESupportSolveUse supportSolveUse, const RCP< LinearOpWithSolveFactoryBase< Scalar > > &lowsf)
Factory interface for creating preconditioner objects from LinearOpBase objects.
Base interface for objects that can return a linear operator.
RCP< const LinearOpSourceBase< Scalar > > getApproxFwdOpSrc() const
General delayed construction LinearOpWithSolveFactoryBase subclass.
ESupportSolveUse
Enum that specifies how a LinearOpWithSolveBase object will be used for solves after it is constructe...
void informUpdatedVerbosityState() const
Overridden from Teuchos::VerboseObjectBase.
RCP< LinearOpWithSolveFactoryBase< Scalar > > getUnderlyingLOWSF()
virtual void initializeAndReuseOp(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, LinearOpWithSolveBase< Scalar > *Op) const
EPreconditionerInputType
Enum defining the status of a preconditioner object.
void setParameterList(RCP< ParameterList > const &paramList)
virtual void uninitializeOp(LinearOpWithSolveBase< Scalar > *Op, RCP< const LinearOpSourceBase< Scalar > > *fwdOpSrc, RCP< const PreconditionerBase< Scalar > > *prec, RCP< const LinearOpSourceBase< Scalar > > *approxFwdOpSrc, ESupportSolveUse *supportSolveUse) const
Delayed linear solver construction LinearOpWithSolveBase decorator class.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)