Teko Version of the Day
Loading...
Searching...
No Matches
Teko_PreconditionerLinearOpDecl.hpp
1// @HEADER
2// *****************************************************************************
3// Teko: A package for block and physics based preconditioning
4//
5// Copyright 2010 NTESS and the Teko contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef __Teko_PreconditionerLinearOpDecl_hpp__
11#define __Teko_PreconditionerLinearOpDecl_hpp__
12
13#include "Thyra_LinearOpBase.hpp"
14#include "Thyra_PreconditionerBase.hpp"
15#include "Thyra_VectorSpaceBase.hpp"
16
17#include "Teuchos_ConstNonconstObjectContainer.hpp"
18
19namespace Teko {
20
28template <typename ScalarT>
29class PreconditionerLinearOp : public Thyra::LinearOpBase<ScalarT> {
30 public:
31 PreconditionerLinearOp();
32 PreconditionerLinearOp(const Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> >& prec);
33 PreconditionerLinearOp(const Teuchos::RCP<const Thyra::PreconditionerBase<ScalarT> >& prec);
34
36 void initialize(const Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> >& prec);
37
39 void initialize(const Teuchos::RCP<const Thyra::PreconditionerBase<ScalarT> >& prec);
40
42 void uninitialize();
43
45 virtual Teuchos::RCP<const Thyra::VectorSpaceBase<ScalarT> > range() const;
46
48 virtual Teuchos::RCP<const Thyra::VectorSpaceBase<ScalarT> > domain() const;
49
50 virtual bool opSupportedImpl(const Thyra::EOpTransp M_trans) const;
51
53 virtual void applyImpl(const Thyra::EOpTransp M_trans, const Thyra::MultiVectorBase<ScalarT>& x,
54 const Teuchos::Ptr<Thyra::MultiVectorBase<ScalarT> >& y,
55 const ScalarT alpha, const ScalarT beta) const;
56
58 virtual Teuchos::RCP<Thyra::PreconditionerBase<ScalarT> > getNonconstPreconditioner();
59
61 virtual Teuchos::RCP<const Thyra::PreconditionerBase<ScalarT> > getPreconditioner() const;
62
64 Teko::LinearOp getOperator() const { return getOperator_cnoc().getConstObj(); }
65
66 // Inherited from Teuchos::Describable
67 void describe(Teuchos::FancyOStream& out_arg, const Teuchos::EVerbosityLevel verbLevel) const;
68
69 protected:
71 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> > getOperator_cnoc() const;
72
74 Teuchos::ConstNonconstObjectContainer<Thyra::LinearOpBase<ScalarT> > getOperator_cnoc();
75
76 Teuchos::ConstNonconstObjectContainer<Thyra::PreconditionerBase<ScalarT> > preconditioner_;
77};
78
91inline Teko::LinearOp extractOperatorFromPrecOp(const Teko::LinearOp& lo);
92
93} // end namespace Teko
94
95#endif
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.
Teko::LinearOp getOperator() const
Get teko linear operator.
void uninitialize()
Disassociate this object with the currently owned preconditioner.
Teuchos::ConstNonconstObjectContainer< Thyra::LinearOpBase< ScalarT > > getOperator_cnoc() const
get operator associated with the preconditioner