9 #ifndef Thyra_MultiVectorPreconditionerFactory_hpp
10 #define Thyra_MultiVectorPreconditionerFactory_hpp
12 #include "Thyra_PreconditionerFactoryBase.hpp"
13 #include "Teuchos_ConstNonconstObjectContainer.hpp"
16 #include "Thyra_DefaultMultiVectorProductVectorSpace.hpp"
23 template<
class Scalar>
25 :
virtual public PreconditionerFactoryBase<Scalar>
36 const RCP<PreconditionerFactoryBase<Scalar> > &prec_fac,
37 const RCP<
const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
38 const RCP<
const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
47 const RCP<
const PreconditionerFactoryBase<Scalar> > &prec_fac,
48 const RCP<
const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
49 const RCP<
const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain) {
56 RCP<PreconditionerFactoryBase<Scalar> >
59 RCP<const PreconditionerFactoryBase<Scalar> >
73 std::ostringstream oss;
74 oss << this->Teuchos::Describable::description()
78 oss <<
prec_fac_.getConstObj()->description();
92 prec_fac_.getNonconstObj()->setParameterList(paramList);
97 return prec_fac_.getNonconstObj()->getNonconstParameterList();
102 return prec_fac_.getNonconstObj()->unsetParameterList();
107 return prec_fac_.getConstObj()->getParameterList();
112 return prec_fac_.getConstObj()->getValidParameters();
123 {
return prec_fac_.getConstObj()->isCompatible(fwdOpSrc); }
126 {
return nonconstMultiVectorPreconditioner(
132 const RCP<
const LinearOpSourceBase<Scalar> > &fwdOpSrc,
133 PreconditionerBase<Scalar> *precOp,
134 const ESupportSolveUse supportSolveUse = SUPPORT_SOLVE_UNSPECIFIED
137 using Teuchos::dyn_cast;
138 using Teuchos::rcp_dynamic_cast;
142 const RCP<const MVLO> mvlo =
143 rcp_dynamic_cast<
const MVLO>(fwdOpSrc->getOp().assert_not_null());
144 MVP &mvp = dyn_cast<MVP>(*precOp);
146 defaultLinearOpSource<Scalar>(mvlo->getLinearOp()),
147 mvp.getNonconstPreconditioner().get(),
152 PreconditionerBase<Scalar> *precOp,
153 RCP<
const LinearOpSourceBase<Scalar> > *fwdOpSrc = NULL,
154 ESupportSolveUse *supportSolveUse = NULL
157 using Teuchos::dyn_cast;
160 TEUCHOS_TEST_FOR_EXCEPT(0==precOp);
163 MVP &mvp = dyn_cast<MVP>(*precOp);
164 RCP<const LinearOpSourceBase<Scalar> > inner_fwdOpSrc;
165 prec_fac_.getConstObj()->uninitializePrec(
166 mvp.getNonconstPreconditioner().get(),
167 fwdOpSrc ? &inner_fwdOpSrc : NULL,
171 defaultLinearOpSource<Scalar>(multiVectorLinearOp(inner_fwdOpSrc->getOp(),
183 typedef Teuchos::ConstNonconstObjectContainer<PreconditionerFactoryBase<Scalar> >
CNPFB;
196 const RCP<
const PreconditionerFactoryBase<Scalar> > &prec_fac,
197 const RCP<
const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
198 const RCP<
const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
201 TEUCHOS_TEST_FOR_EXCEPT(is_null(prec_fac));
202 TEUCHOS_TEST_FOR_EXCEPT(is_null(multiVecRange));
203 TEUCHOS_TEST_FOR_EXCEPT(is_null(multiVecDomain));
204 TEUCHOS_TEST_FOR_EXCEPT( multiVecRange->numBlocks() != multiVecDomain->numBlocks() );
208 (void)multiVecDomain;
218 template<
class Scalar>
219 RCP<MultiVectorPreconditionerFactory<Scalar> >
229 template<
class Scalar>
230 RCP<MultiVectorPreconditionerFactory<Scalar> >
232 const RCP<PreconditionerFactoryBase<Scalar> > &prec_fac,
233 const RCP<
const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
234 const RCP<
const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
237 RCP<MultiVectorPreconditionerFactory<Scalar> >
239 mvfac->nonconstInitialize(prec_fac,multiVecRange,multiVecDomain);
247 template<
class Scalar>
248 RCP<MultiVectorPreconditionerFactory<Scalar> >
250 const RCP<
const PreconditionerFactoryBase<Scalar> > &prec_fac,
251 const RCP<
const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
252 const RCP<
const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
255 RCP<MultiVectorPreconditionerFactory<Scalar> >
257 mvfac->initialize(prec_fac,multiVecRange,multiVecDomain);
Teuchos::ConstNonconstObjectContainer< PreconditionerFactoryBase< Scalar > > CNPFB
Concrete PreconditionerFactoryBase subclass that wraps a preconditioner in MultiVectorPreconditioner...
RCP< PreconditionerFactoryBase< Scalar > > getNonconstPreconditionerFactory()
std::string description() const
RCP< const PreconditionerFactoryBase< Scalar > > getPreconditionerFactory() const
void initializePrec(const RCP< const LinearOpSourceBase< Scalar > > &fwdOpSrc, PreconditionerBase< Scalar > *precOp, const ESupportSolveUse supportSolveUse=SUPPORT_SOLVE_UNSPECIFIED) const
RCP< MultiVectorPreconditionerFactory< Scalar > > multiVectorPreconditionerFactory(const RCP< const PreconditionerFactoryBase< Scalar > > &prec_fac, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
Nonmember constructor function.
RCP< const ParameterList > getParameterList() const
RCP< MultiVectorPreconditionerFactory< Scalar > > nonconstMultiVectorPreconditionerFactory(const RCP< PreconditionerFactoryBase< Scalar > > &prec_fac, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
Nonmember constructor function.
RCP< PreconditionerBase< Scalar > > createPrec() const
MultiVectorPreconditionerFactory()
Construct to uninitialized.
RCP< ParameterList > unsetParameterList()
void nonconstInitialize(const RCP< PreconditionerFactoryBase< Scalar > > &prec_fac, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
void setParameterList(RCP< ParameterList > const ¶mList)
RCP< const ParameterList > getValidParameters() const
RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > multiVecRange_
RCP< MultiVectorPreconditionerFactory< Scalar > > multiVectorPreconditionerFactory()
Nonmember constructor function.
Implicit concrete LinearOpBase subclass that takes a flattended out multi-vector and performs a multi...
RCP< ParameterList > getNonconstParameterList()
Concrete PreconditionerBase subclass that wraps a preconditioner operator in MultiVectorLinearOp.
void initialize(const RCP< const PreconditionerFactoryBase< Scalar > > &prec_fac, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > multiVecDomain_
void uninitializePrec(PreconditionerBase< Scalar > *precOp, RCP< const LinearOpSourceBase< Scalar > > *fwdOpSrc=NULL, ESupportSolveUse *supportSolveUse=NULL) const
static void validateInitialize(const RCP< const PreconditionerFactoryBase< Scalar > > &prec_fac, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
bool isCompatible(const LinearOpSourceBase< Scalar > &fwdOpSrc) const