10 #ifndef __Teko_PreconditionerLinearOp_hpp__
11 #define __Teko_PreconditionerLinearOp_hpp__
13 #include "Teko_PreconditionerLinearOpDecl.hpp"
15 #include "Thyra_LinearOpBase.hpp"
16 #include "Thyra_PreconditionerBase.hpp"
20 template <
typename ScalarT>
21 PreconditionerLinearOp<ScalarT>::PreconditionerLinearOp() {}
23 template <
typename ScalarT>
24 PreconditionerLinearOp<ScalarT>::PreconditionerLinearOp(
25 const Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> >& prec) {
26 preconditioner_.initialize(prec);
29 template <
typename ScalarT>
30 PreconditionerLinearOp<ScalarT>::PreconditionerLinearOp(
31 const Teuchos::RCP<
const Thyra::PreconditionerBase<ScalarT> >& prec) {
32 preconditioner_.initialize(prec);
36 template <
typename ScalarT>
38 const Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> >& prec) {
40 preconditioner_.initialize(prec);
44 template <
typename ScalarT>
46 const Teuchos::RCP<
const Thyra::PreconditionerBase<ScalarT> >& prec) {
48 preconditioner_.initialize(prec);
52 template <
typename ScalarT>
54 preconditioner_.uninitialize();
58 template <
typename ScalarT>
61 return getOperator_cnoc()->range();
65 template <
typename ScalarT>
68 return getOperator_cnoc()->domain();
71 template <
typename ScalarT>
73 return getOperator_cnoc()->opSupported(M_trans);
76 template <
typename ScalarT>
78 const Thyra::EOpTransp M_trans,
const Thyra::MultiVectorBase<ScalarT>& x,
79 const Teuchos::Ptr<Thyra::MultiVectorBase<ScalarT> >& y,
const ScalarT alpha,
80 const ScalarT beta)
const {
81 getOperator_cnoc()->apply(M_trans, x, y, alpha, beta);
85 template <
typename ScalarT>
86 Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> >
88 return preconditioner_.getNonconstObj();
92 template <
typename ScalarT>
93 Teuchos::RCP<const Thyra::PreconditionerBase<ScalarT> >
95 return preconditioner_.getConstObj();
99 template <
typename ScalarT>
100 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> >
102 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> > oper;
103 oper.initialize(preconditioner_.getConstObj()->getUnspecifiedPrecOp());
109 template <
typename ScalarT>
110 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> >
112 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> > oper;
113 oper.initialize(preconditioner_.getNonconstObj()->getNonconstUnspecifiedPrecOp());
118 template <
typename ScalarT>
120 const Teuchos::EVerbosityLevel verbLevel)
const {
121 using Teuchos::OSTab;
123 Teuchos::RCP<Teuchos::FancyOStream> out = rcp(&out_arg,
false);
126 case Teuchos::VERB_DEFAULT:
127 case Teuchos::VERB_LOW:
128 *out << this->description() <<
" ( [Operator] = " << getOperator_cnoc()->description() <<
" )"
131 case Teuchos::VERB_MEDIUM:
132 case Teuchos::VERB_HIGH:
133 case Teuchos::VERB_EXTREME: {
134 *out << Teuchos::Describable::description() <<
"{"
135 <<
"rangeDim=" << this->range()->dim() <<
",domainDim=" << this->domain()->dim()
139 *out <<
"[Operator] = ";
140 *out << Teuchos::describe(*getOperator_cnoc(), verbLevel);
144 default: TEUCHOS_TEST_FOR_EXCEPT(
true);
148 inline Teko::LinearOp extractOperatorFromPrecOp(
const Teko::LinearOp& lo) {
149 Teuchos::RCP<const Teko::PreconditionerLinearOp<double> > plo =
151 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.