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() {}
60 template <
typename ScalarT>
61 PreconditionerLinearOp<ScalarT>::PreconditionerLinearOp(
62 const Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> >& prec) {
63 preconditioner_.initialize(prec);
66 template <
typename ScalarT>
67 PreconditionerLinearOp<ScalarT>::PreconditionerLinearOp(
68 const Teuchos::RCP<
const Thyra::PreconditionerBase<ScalarT> >& prec) {
69 preconditioner_.initialize(prec);
73 template <
typename ScalarT>
75 const Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> >& prec) {
77 preconditioner_.initialize(prec);
81 template <
typename ScalarT>
83 const Teuchos::RCP<
const Thyra::PreconditionerBase<ScalarT> >& prec) {
85 preconditioner_.initialize(prec);
89 template <
typename ScalarT>
91 preconditioner_.uninitialize();
95 template <
typename ScalarT>
98 return getOperator_cnoc()->range();
102 template <
typename ScalarT>
105 return getOperator_cnoc()->domain();
108 template <
typename ScalarT>
110 return getOperator_cnoc()->opSupported(M_trans);
113 template <
typename ScalarT>
115 const Thyra::EOpTransp M_trans,
const Thyra::MultiVectorBase<ScalarT>& x,
116 const Teuchos::Ptr<Thyra::MultiVectorBase<ScalarT> >& y,
const ScalarT alpha,
117 const ScalarT beta)
const {
118 getOperator_cnoc()->apply(M_trans, x, y, alpha, beta);
122 template <
typename ScalarT>
123 Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> >
125 return preconditioner_.getNonconstObj();
129 template <
typename ScalarT>
130 Teuchos::RCP<const Thyra::PreconditionerBase<ScalarT> >
132 return preconditioner_.getConstObj();
136 template <
typename ScalarT>
137 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> >
139 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> > oper;
140 oper.initialize(preconditioner_.getConstObj()->getUnspecifiedPrecOp());
146 template <
typename ScalarT>
147 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> >
149 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> > oper;
150 oper.initialize(preconditioner_.getNonconstObj()->getNonconstUnspecifiedPrecOp());
155 template <
typename ScalarT>
157 const Teuchos::EVerbosityLevel verbLevel)
const {
158 using Teuchos::OSTab;
160 Teuchos::RCP<Teuchos::FancyOStream> out = rcp(&out_arg,
false);
163 case Teuchos::VERB_DEFAULT:
164 case Teuchos::VERB_LOW:
165 *out << this->description() <<
" ( [Operator] = " << getOperator_cnoc()->description() <<
" )"
168 case Teuchos::VERB_MEDIUM:
169 case Teuchos::VERB_HIGH:
170 case Teuchos::VERB_EXTREME: {
171 *out << Teuchos::Describable::description() <<
"{"
172 <<
"rangeDim=" << this->range()->dim() <<
",domainDim=" << this->domain()->dim()
176 *out <<
"[Operator] = ";
177 *out << Teuchos::describe(*getOperator_cnoc(), verbLevel);
181 default: TEUCHOS_TEST_FOR_EXCEPT(
true);
185 inline Teko::LinearOp extractOperatorFromPrecOp(
const Teko::LinearOp& lo) {
186 Teuchos::RCP<const Teko::PreconditionerLinearOp<double> > plo =
188 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.