9 #ifndef Thyra_AdjointPreconditionerFactory_hpp
10 #define Thyra_AdjointPreconditionerFactory_hpp
12 #include "Thyra_PreconditionerFactoryBase.hpp"
13 #include "Teuchos_ConstNonconstObjectContainer.hpp"
14 #include "Thyra_DefaultScaledAdjointLinearOp.hpp"
22 template<
class Scalar>
24 :
virtual public PreconditionerFactoryBase<Scalar>
35 const RCP<PreconditionerFactoryBase<Scalar> > &prec_fac) {
41 const RCP<
const PreconditionerFactoryBase<Scalar> > &prec_fac) {
46 RCP<PreconditionerFactoryBase<Scalar> >
49 RCP<const PreconditionerFactoryBase<Scalar> >
61 std::ostringstream oss;
62 oss << this->Teuchos::Describable::description()
66 oss <<
prec_fac_.getConstObj()->description();
80 prec_fac_.getNonconstObj()->setParameterList(paramList);
85 return prec_fac_.getNonconstObj()->getNonconstParameterList();
90 return prec_fac_.getNonconstObj()->unsetParameterList();
95 return prec_fac_.getConstObj()->getParameterList();
100 return prec_fac_.getConstObj()->getValidParameters();
111 {
return prec_fac_.getConstObj()->isCompatible(fwdOpSrc); }
114 {
return nonconstAdjointPreconditioner(
115 prec_fac_.getConstObj()->createPrec()); }
118 const RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
119 PreconditionerBase<Scalar> *precOp,
120 const ESupportSolveUse supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED
123 using Teuchos::dyn_cast;
124 using Teuchos::rcp_dynamic_cast;
126 typedef DefaultScaledAdjointLinearOp<Scalar> ALO;
128 const RCP<const ALO> alo =
129 rcp_dynamic_cast<
const ALO>(fwdOpSrc->getOp().assert_not_null());
130 AP &ap = dyn_cast<AP>(*precOp);
132 defaultLinearOpSource<Scalar>(alo->getOp()),
133 ap.getNonconstPreconditioner().get(),
138 PreconditionerBase<Scalar> *precOp,
139 RCP<
const LinearOpSourceBase<Scalar> > *fwdOpSrc = NULL,
140 ESupportSolveUse *supportSolveUse = NULL
143 using Teuchos::dyn_cast;
146 TEUCHOS_TEST_FOR_EXCEPT(0==precOp);
149 AP &ap = dyn_cast<AP>(*precOp);
150 RCP<const LinearOpSourceBase<Scalar> > inner_fwdOpSrc;
151 prec_fac_.getConstObj()->uninitializePrec(
152 ap.getNonconstPreconditioner().get(),
153 fwdOpSrc ? &inner_fwdOpSrc : NULL,
157 defaultLinearOpSource<Scalar>(adjoint(inner_fwdOpSrc->getOp()));
167 typedef Teuchos::ConstNonconstObjectContainer<PreconditionerFactoryBase<Scalar> >
CNPFB;
178 const RCP<
const PreconditionerFactoryBase<Scalar> > &prec_fac) {
180 TEUCHOS_TEST_FOR_EXCEPT(is_null(prec_fac));
192 template<
class Scalar>
193 RCP<AdjointPreconditionerFactory<Scalar> >
203 template<
class Scalar>
204 RCP<AdjointPreconditionerFactory<Scalar> >
206 const RCP<PreconditionerFactoryBase<Scalar> > &prec_fac)
208 RCP<AdjointPreconditionerFactory<Scalar> >
210 afac->nonconstInitialize(prec_fac);
218 template<
class Scalar>
219 RCP<AdjointPreconditionerFactory<Scalar> >
221 const RCP<
const PreconditionerFactoryBase<Scalar> > &prec_fac)
223 RCP<AdjointPreconditionerFactory<Scalar> >
225 afac->initialize(prec_fac);
void initializePrec(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, PreconditionerBase< Scalar > *precOp, const ESupportSolveUse supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED) const
std::string description() const
void uninitializePrec(PreconditionerBase< Scalar > *precOp, RCP< const LinearOpSourceBase< Scalar > > *fwdOpSrc=NULL, ESupportSolveUse *supportSolveUse=NULL) const
bool isCompatible(const LinearOpSourceBase< Scalar > &fwdOpSrc) const
Concrete PreconditionerBase subclass that wraps a preconditioner operator in MultiVectorLinearOp.
RCP< PreconditionerFactoryBase< Scalar > > getNonconstPreconditionerFactory()
RCP< const ParameterList > getParameterList() const
RCP< ParameterList > unsetParameterList()
void nonconstInitialize(const RCP< PreconditionerFactoryBase< Scalar > > &prec_fac)
RCP< const PreconditionerFactoryBase< Scalar > > getPreconditionerFactory() const
RCP< const ParameterList > getValidParameters() const
RCP< AdjointPreconditionerFactory< Scalar > > nonconstAdjointPreconditionerFactory(const RCP< PreconditionerFactoryBase< Scalar > > &prec_fac)
Nonmember constructor function.
AdjointPreconditionerFactory()
Construct to uninitialized.
void initialize(const RCP< const PreconditionerFactoryBase< Scalar > > &prec_fac)
RCP< AdjointPreconditionerFactory< Scalar > > adjointPreconditionerFactory(const RCP< const PreconditionerFactoryBase< Scalar > > &prec_fac)
Nonmember constructor function.
void setParameterList(RCP< ParameterList > const ¶mList)
RCP< ParameterList > getNonconstParameterList()
RCP< PreconditionerBase< Scalar > > createPrec() const
static void validateInitialize(const RCP< const PreconditionerFactoryBase< Scalar > > &prec_fac)
RCP< AdjointPreconditionerFactory< Scalar > > adjointPreconditionerFactory()
Nonmember constructor function.
Teuchos::ConstNonconstObjectContainer< PreconditionerFactoryBase< Scalar > > CNPFB
Concrete PreconditionerFactoryBase subclass that wraps a preconditioner in AdjointPreconditioner.