9 #ifndef Thyra_ReuseLinearOpWithSolveFactory_hpp
10 #define Thyra_ReuseLinearOpWithSolveFactory_hpp
12 #include "Thyra_LinearOpWithSolveFactoryBase.hpp"
20 template<
class Scalar>
22 :
virtual public LinearOpWithSolveFactoryBase<Scalar>
44 const RCP<LinearOpWithSolveFactoryBase<Scalar> > &lowsf,
45 const RCP<PreconditionerBase<Scalar> > &prec
61 const RCP<
const LinearOpWithSolveFactoryBase<Scalar> > &lowsf,
62 const RCP<PreconditionerBase<Scalar> > &prec
101 const RCP<PreconditionerFactoryBase<Scalar> > &precFactory,
102 const std::string &precFactoryName
106 virtual RCP<PreconditionerFactoryBase<Scalar> >
111 RCP<PreconditionerFactoryBase<Scalar> > *precFactory,
112 std::string *precFactoryName
116 const LinearOpSourceBase<Scalar> &fwdOpSrc
119 virtual RCP<LinearOpWithSolveBase<Scalar> >
createOp()
const;
122 const RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
123 LinearOpWithSolveBase<Scalar> *Op,
124 const ESupportSolveUse supportSolveUse
128 const RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
129 LinearOpWithSolveBase<Scalar> *Op
133 LinearOpWithSolveBase<Scalar> *Op,
134 RCP<
const LinearOpSourceBase<Scalar> > *fwdOpSrc,
135 RCP<
const PreconditionerBase<Scalar> > *prec,
136 RCP<
const LinearOpSourceBase<Scalar> > *approxFwdOpSrc,
137 ESupportSolveUse *supportSolveUse
141 const EPreconditionerInputType precOpType
145 const RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
146 const RCP<
const PreconditionerBase<Scalar> > &prec,
147 LinearOpWithSolveBase<Scalar> *Op,
148 const ESupportSolveUse supportSolveUse
152 const RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
153 const RCP<
const LinearOpSourceBase<Scalar> > &approxFwdOpSrc,
154 LinearOpWithSolveBase<Scalar> *Op,
155 const ESupportSolveUse supportSolveUse
171 typedef Teuchos::ConstNonconstObjectContainer<LinearOpWithSolveFactoryBase<Scalar> >
LOWSF_t;
174 RCP< PreconditionerBase<Scalar> >
prec_;
182 template<
class Scalar>
183 RCP<ReuseLinearOpWithSolveFactory<Scalar> >
185 const RCP<LinearOpWithSolveFactoryBase<Scalar> > &lowsf,
186 const RCP<PreconditionerBase<Scalar> > &prec
189 RCP<ReuseLinearOpWithSolveFactory<Scalar> > rlowsf =
191 rlowsf->nonconstInitialize(lowsf, prec);
199 template<
class Scalar>
200 RCP<ReuseLinearOpWithSolveFactory<Scalar> >
202 const RCP<
const LinearOpWithSolveFactoryBase<Scalar> > &lowsf,
203 const RCP<PreconditionerBase<Scalar> > &prec
206 RCP<ReuseLinearOpWithSolveFactory<Scalar> > rlowsf =
208 rlowsf->initialize(lowsf, prec);
214 template<
class Scalar>
218 const RCP<LinearOpWithSolveFactoryBase<Scalar> > &lowsf,
219 const RCP<PreconditionerBase<Scalar> > &prec
223 TEUCHOS_TEST_FOR_EXCEPT(is_null(lowsf));
224 TEUCHOS_TEST_FOR_EXCEPT(is_null(prec));
226 lowsf_.initialize(lowsf);
230 template<
class Scalar>
234 const RCP<
const LinearOpWithSolveFactoryBase<Scalar> > &lowsf,
235 const RCP<PreconditionerBase<Scalar> > &prec
239 TEUCHOS_TEST_FOR_EXCEPT(is_null(lowsf));
240 TEUCHOS_TEST_FOR_EXCEPT(is_null(prec));
242 lowsf_.initialize(lowsf);
246 template<
class Scalar>
247 RCP<LinearOpWithSolveFactoryBase<Scalar> >
251 return lowsf_.getNonconstObj();
254 template<
class Scalar>
255 RCP<const LinearOpWithSolveFactoryBase<Scalar> >
259 return lowsf_.getConstObj();
262 template<
class Scalar>
263 RCP<PreconditionerBase<Scalar> >
270 template<
class Scalar>
271 RCP<const PreconditionerBase<Scalar> >
280 template<
class Scalar>
285 std::ostringstream oss;
286 oss << this->Teuchos::Describable::description()
289 if (!is_null(lowsf_.getConstObj()))
290 oss << lowsf_.getConstObj()->description();
296 oss << prec_->description();
305 template<
class Scalar>
309 RCP<ParameterList>
const& paramList
312 lowsf_.getNonconstObj()->setParameterList(paramList);
315 template<
class Scalar>
320 return lowsf_.getNonconstObj()->getNonconstParameterList();
323 template<
class Scalar>
328 return lowsf_.getNonconstObj()->unsetParameterList();
331 template<
class Scalar>
332 RCP<const ParameterList>
336 return lowsf_.getConstObj()->getParameterList();
339 template<
class Scalar>
340 RCP<const ParameterList>
344 return lowsf_.getConstObj()->getValidParameters();
349 template<
class Scalar>
357 template<
class Scalar>
361 const RCP<PreconditionerFactoryBase<Scalar> > &,
367 template<
class Scalar>
368 RCP<PreconditionerFactoryBase<Scalar> >
372 return Thyra::reusePreconditionerFactory<Scalar>(prec_);
375 template<
class Scalar>
378 RCP<PreconditionerFactoryBase<Scalar> > * ,
384 template<
class Scalar>
388 const LinearOpSourceBase<Scalar> &fwdOpSrc
391 return lowsf_.getConstObj()->isCompatible(fwdOpSrc);
394 template<
class Scalar>
395 RCP<LinearOpWithSolveBase<Scalar> >
399 return lowsf_.getConstObj()->createOp();
402 template<
class Scalar>
406 const RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
407 LinearOpWithSolveBase<Scalar> *Op,
408 const ESupportSolveUse supportSolveUse
411 lowsf_.getConstObj()->initializeOp(fwdOpSrc, Op, supportSolveUse);
414 template<
class Scalar>
418 const RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
419 LinearOpWithSolveBase<Scalar> *Op
422 lowsf_.getConstObj()->initializeAndReuseOp(fwdOpSrc, Op);
425 template<
class Scalar>
429 LinearOpWithSolveBase<Scalar> *Op,
430 RCP<
const LinearOpSourceBase<Scalar> > *fwdOpSrc,
431 RCP<
const PreconditionerBase<Scalar> > *prec,
432 RCP<
const LinearOpSourceBase<Scalar> > *approxFwdOpSrc,
433 ESupportSolveUse *supportSolveUse
436 lowsf_.getConstObj()->uninitializeOp(Op, fwdOpSrc, prec, approxFwdOpSrc,
440 template<
class Scalar>
444 const EPreconditionerInputType precOpType
447 return lowsf_.getConstObj()->supportsPreconditionerInputType(precOpType);
450 template<
class Scalar>
454 const RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
455 const RCP<
const PreconditionerBase<Scalar> > &prec,
456 LinearOpWithSolveBase<Scalar> *Op,
457 const ESupportSolveUse supportSolveUse
460 lowsf_.getConstObj()->initializePreconditionedOp(fwdOpSrc, prec, Op,
464 template<
class Scalar>
468 const RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
469 const RCP<
const LinearOpSourceBase<Scalar> > &approxFwdOpSrc,
470 LinearOpWithSolveBase<Scalar> *Op,
471 const ESupportSolveUse supportSolveUse
474 lowsf_.getConstObj()->initializeApproxPreconditionedOp(fwdOpSrc,
482 template<
class Scalar>
487 lowsf_.getConstObj()->setVerbLevel(this->getVerbLevel());
488 lowsf_.getConstObj()->setOStream(this->getOStream());
virtual void unsetPreconditionerFactory(RCP< PreconditionerFactoryBase< Scalar > > *precFactory, std::string *precFactoryName)
Throws exception.
RCP< LinearOpWithSolveFactoryBase< Scalar > > getUnderlyingLOWSF()
virtual void setPreconditionerFactory(const RCP< PreconditionerFactoryBase< Scalar > > &precFactory, const std::string &precFactoryName)
Throws exception.
virtual void uninitializeOp(LinearOpWithSolveBase< Scalar > *Op, RCP< const LinearOpSourceBase< Scalar > > *fwdOpSrc, RCP< const PreconditionerBase< Scalar > > *prec, RCP< const LinearOpSourceBase< Scalar > > *approxFwdOpSrc, ESupportSolveUse *supportSolveUse) const
std::string description() const
A LinearOpWithSolveFactory that is designed to reuse an already created/initialized preconditioner...
RCP< PreconditionerBase< Scalar > > prec_
RCP< ParameterList > getNonconstParameterList()
virtual bool acceptsPreconditionerFactory() const
returns false.
RCP< const ParameterList > getValidParameters() const
RCP< ReuseLinearOpWithSolveFactory< Scalar > > reuseLinearOpWithSolveFactory(const RCP< const LinearOpWithSolveFactoryBase< Scalar > > &lowsf, const RCP< PreconditionerBase< Scalar > > &prec)
Nonmember constructor.
virtual bool isCompatible(const LinearOpSourceBase< Scalar > &fwdOpSrc) const
RCP< const ParameterList > getParameterList() const
virtual void initializeAndReuseOp(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, LinearOpWithSolveBase< Scalar > *Op) const
void informUpdatedVerbosityState() const
Overridden from Teuchos::VerboseObjectBase.
virtual void initializeOp(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
virtual void initializePreconditionedOp(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const RCP< const PreconditionerBase< Scalar > > &prec, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
RCP< PreconditionerBase< Scalar > > getUnderlyingPreconditioner()
virtual bool supportsPreconditionerInputType(const EPreconditionerInputType precOpType) const
RCP< ReuseLinearOpWithSolveFactory< Scalar > > nonconstReuseLinearOpWithSolveFactory(const RCP< LinearOpWithSolveFactoryBase< Scalar > > &lowsf, const RCP< PreconditionerBase< Scalar > > &prec)
Nonmember constructor.
Teuchos::ConstNonconstObjectContainer< LinearOpWithSolveFactoryBase< Scalar > > LOWSF_t
RCP< ParameterList > unsetParameterList()
virtual void initializeApproxPreconditionedOp(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, const RCP< const LinearOpSourceBase< Scalar > > &approxFwdOpSrc, LinearOpWithSolveBase< Scalar > *Op, const ESupportSolveUse supportSolveUse) const
void nonconstInitialize(const RCP< LinearOpWithSolveFactoryBase< Scalar > > &lowsf, const RCP< PreconditionerBase< Scalar > > &prec)
Initialize given a single non-const LOWSFB object.
void setParameterList(RCP< ParameterList > const ¶mList)
ReuseLinearOpWithSolveFactory()
Construct to uninitialized.
void initialize(const RCP< const LinearOpWithSolveFactoryBase< Scalar > > &lowsf, const RCP< PreconditionerBase< Scalar > > &prec)
Initialize given a single const LOWSFB object.
virtual RCP< LinearOpWithSolveBase< Scalar > > createOp() const
virtual RCP< PreconditionerFactoryBase< Scalar > > getPreconditionerFactory() const
Returns null .