47 #ifndef __Teko_PreconditionerLinearOp_hpp__
48 #define __Teko_PreconditionerLinearOp_hpp__
50 #include "Teko_PreconditionerLinearOpDecl.hpp"
52 #include "Thyra_LinearOpBase.hpp"
53 #include "Thyra_PreconditionerBase.hpp"
57 template <
typename ScalarT>
58 PreconditionerLinearOp<ScalarT>::PreconditionerLinearOp()
61 template <
typename ScalarT>
62 PreconditionerLinearOp<ScalarT>::PreconditionerLinearOp(
const Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> > & prec)
64 preconditioner_.initialize(prec);
67 template <
typename ScalarT>
68 PreconditionerLinearOp<ScalarT>::PreconditionerLinearOp(
const Teuchos::RCP<
const Thyra::PreconditionerBase<ScalarT> > & prec)
70 preconditioner_.initialize(prec);
74 template <
typename ScalarT>
78 preconditioner_.initialize(prec);
82 template <
typename ScalarT>
86 preconditioner_.initialize(prec);
90 template <
typename ScalarT>
93 preconditioner_.uninitialize();
97 template <
typename ScalarT>
100 return getOperator_cnoc()->range();
104 template <
typename ScalarT>
107 return getOperator_cnoc()->domain();
110 template <
typename ScalarT>
112 const Thyra::EOpTransp M_trans)
const
114 return getOperator_cnoc()->opSupported(M_trans);
117 template <
typename ScalarT>
119 const Thyra::EOpTransp M_trans,
120 const Thyra::MultiVectorBase<ScalarT> & x,
121 const Teuchos::Ptr<Thyra::MultiVectorBase<ScalarT> > & y,
126 getOperator_cnoc()->apply(M_trans, x, y, alpha, beta);
131 template <
typename ScalarT>
134 return preconditioner_.getNonconstObj();
138 template <
typename ScalarT>
141 return preconditioner_.getConstObj();
145 template <
typename ScalarT>
148 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> > oper;
149 oper.initialize(preconditioner_.getConstObj()->getUnspecifiedPrecOp());
155 template <
typename ScalarT>
158 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> > oper;
159 oper.initialize(preconditioner_.getNonconstObj()->getNonconstUnspecifiedPrecOp());
164 template <
typename ScalarT>
166 const Teuchos::EVerbosityLevel verbLevel)
const
168 using Teuchos::OSTab;
170 Teuchos::RCP<Teuchos::FancyOStream> out = rcp(&out_arg,
false);
173 case Teuchos::VERB_DEFAULT:
174 case Teuchos::VERB_LOW:
175 *out << this->description() <<
" ( [Operator] = " << getOperator_cnoc()->description() <<
" )" << std::endl;
177 case Teuchos::VERB_MEDIUM:
178 case Teuchos::VERB_HIGH:
179 case Teuchos::VERB_EXTREME:
181 *out << Teuchos::Describable::description() <<
"{"
182 <<
"rangeDim=" << this->range()->dim()
183 <<
",domainDim=" << this->domain()->dim()
187 *out <<
"[Operator] = ";
188 *out << Teuchos::describe(*getOperator_cnoc(),verbLevel);
193 TEUCHOS_TEST_FOR_EXCEPT(
true);
197 inline Teko::LinearOp extractOperatorFromPrecOp(
const Teko::LinearOp & lo)
199 Teuchos::RCP<const Teko::PreconditionerLinearOp<double> > plo =
201 if(plo!=Teuchos::null)
void initialize(const Teuchos::RCP< Thyra::PreconditionerBase< ScalarT > > &prec)
build a linear operator using this preconditioner, this initialization permits changes ...
virtual Teuchos::RCP< Thyra::PreconditionerBase< ScalarT > > getNonconstPreconditioner()
Get a nonconstant PreconditionerBase object.
void uninitialize()
Disassociate this object with the currently owned preconditioner.
Teko::LinearOp getOperator() const
Get teko linear operator.
virtual void applyImpl(const Thyra::EOpTransp M_trans, const Thyra::MultiVectorBase< ScalarT > &x, const Teuchos::Ptr< Thyra::MultiVectorBase< ScalarT > > &y, const ScalarT alpha, const ScalarT beta) const
Apply operation.
virtual Teuchos::RCP< const Thyra::PreconditionerBase< ScalarT > > getPreconditioner() const
Get a constant PreconditionerBase object.
Teuchos::ConstNonconstObjectContainer< Thyra::LinearOpBase< ScalarT > > getOperator_cnoc() const
get operator associated with the preconditioner
Class that wraps a PreconditionerBase object it makes it behave like a linear operator.
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< ScalarT > > range() const
Range space of this operator.
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< ScalarT > > domain() const
Domain space of this operator.