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"
20template <
typename ScalarT>
21PreconditionerLinearOp<ScalarT>::PreconditionerLinearOp() {}
23template <
typename ScalarT>
24PreconditionerLinearOp<ScalarT>::PreconditionerLinearOp(
25 const Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> >& prec) {
26 preconditioner_.initialize(prec);
29template <
typename ScalarT>
30PreconditionerLinearOp<ScalarT>::PreconditionerLinearOp(
31 const Teuchos::RCP<
const Thyra::PreconditionerBase<ScalarT> >& prec) {
32 preconditioner_.initialize(prec);
36template <
typename ScalarT>
38 const Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> >& prec) {
40 preconditioner_.initialize(prec);
44template <
typename ScalarT>
46 const Teuchos::RCP<
const Thyra::PreconditionerBase<ScalarT> >& prec) {
48 preconditioner_.initialize(prec);
52template <
typename ScalarT>
54 preconditioner_.uninitialize();
58template <
typename ScalarT>
65template <
typename ScalarT>
71template <
typename ScalarT>
72bool PreconditionerLinearOp<ScalarT>::opSupportedImpl(
const Thyra::EOpTransp M_trans)
const {
73 return getOperator_cnoc()->opSupported(M_trans);
76template <
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 {
85template <
typename ScalarT>
86Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> >
88 return preconditioner_.getNonconstObj();
92template <
typename ScalarT>
93Teuchos::RCP<const Thyra::PreconditionerBase<ScalarT> >
95 return preconditioner_.getConstObj();
99template <
typename ScalarT>
100Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> >
102 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> > oper;
103 oper.initialize(preconditioner_.getConstObj()->getUnspecifiedPrecOp());
109template <
typename ScalarT>
110Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> >
112 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> > oper;
113 oper.initialize(preconditioner_.getNonconstObj()->getNonconstUnspecifiedPrecOp());
118template <
typename ScalarT>
119void PreconditionerLinearOp<ScalarT>::describe(Teuchos::FancyOStream& out_arg,
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);
148inline Teko::LinearOp extractOperatorFromPrecOp(
const Teko::LinearOp& lo) {
149 Teuchos::RCP<const Teko::PreconditionerLinearOp<double> > plo =
150 Teuchos::rcp_dynamic_cast<const Teko::PreconditionerLinearOp<double> >(lo);
151 if (plo != Teuchos::null)
152 return plo->getOperator();
virtual Teuchos::RCP< const Thyra::PreconditionerBase< ScalarT > > getPreconditioner() const
Get a constant PreconditionerBase object.
virtual Teuchos::RCP< Thyra::PreconditionerBase< ScalarT > > getNonconstPreconditioner()
Get a nonconstant PreconditionerBase object.
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< ScalarT > > range() const
Range space of this operator.
void initialize(const Teuchos::RCP< Thyra::PreconditionerBase< ScalarT > > &prec)
build a linear operator using this preconditioner, this initialization permits changes
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< ScalarT > > domain() const
Domain space of this 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.
void uninitialize()
Disassociate this object with the currently owned preconditioner.
Teuchos::ConstNonconstObjectContainer< Thyra::LinearOpBase< ScalarT > > getOperator_cnoc() const
get operator associated with the preconditioner