Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DefaultPreconditioner_decl.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
4 //
5 // Copyright 2004 NTESS and the Thyra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef THYRA_DEFUALT_PRECONDITIONER_DECL_HPP
11 #define THYRA_DEFUALT_PRECONDITIONER_DECL_HPP
12 
13 #include "Thyra_PreconditionerBase.hpp"
14 #include "Teuchos_ConstNonconstObjectContainer.hpp"
15 
16 
17 namespace Thyra {
18 
19 
47 template <class Scalar>
48 class DefaultPreconditioner : virtual public PreconditionerBase<Scalar>
49 {
50 public:
51 
54 
58 
63  const Teuchos::RCP<LinearOpBase<Scalar> > &leftPrecOp,
64  const Teuchos::RCP<LinearOpBase<Scalar> > &rightPrecOp
65  );
66 
71  const Teuchos::RCP<const LinearOpBase<Scalar> > &leftPrecOp,
72  const Teuchos::RCP<const LinearOpBase<Scalar> > &rightPrecOp
73  );
74 
78  const Teuchos::RCP<LinearOpBase<Scalar> > &unspecifiedPrecOp
79  );
80 
84  const Teuchos::RCP<const LinearOpBase<Scalar> > &unspecifiedPrecOp
85  );
86 
89  void initializeLeft(
90  const Teuchos::RCP<LinearOpBase<Scalar> > &leftPrecOp
91  );
92 
95  void initializeLeft(
96  const Teuchos::RCP<const LinearOpBase<Scalar> > &leftPrecOp
97  );
98 
101  void initializeRight(
102  const Teuchos::RCP<LinearOpBase<Scalar> > &rightPrecOp
103  );
104 
107  void initializeRight(
108  const Teuchos::RCP<const LinearOpBase<Scalar> > &rightPrecOp
109  );
110 
113  void initializeLeftRight(
114  const Teuchos::RCP<LinearOpBase<Scalar> > &leftPrecOp
115  ,const Teuchos::RCP<LinearOpBase<Scalar> > &rightPrecOp
116  );
117 
120  void initializeLeftRight(
121  const Teuchos::RCP<const LinearOpBase<Scalar> > &leftPrecOp
122  ,const Teuchos::RCP<const LinearOpBase<Scalar> > &rightPrecOp
123  );
124 
129  const Teuchos::RCP<LinearOpBase<Scalar> > &unspecifiedPrecOp
130  );
131 
136  const Teuchos::RCP<const LinearOpBase<Scalar> > &unspecifiedPrecOp
137  );
138 
145  void uninitialize();
146 
148 
152  std::string description() const;
154  void describe(
156  const Teuchos::EVerbosityLevel verbLevel
157  ) const;
159 
163  bool isLeftPrecOpConst() const;
169  bool isRightPrecOpConst() const;
175  bool isUnspecifiedPrecOpConst() const;
181 
182 private:
183 
187 
188 };
189 
190 // ///////////////////////
191 // Related functions
192 
193 
199 template <class Scalar>
202  const Teuchos::RCP<const LinearOpBase<Scalar> > &unspecifiedPrecOp
203  )
204 {
205  return Teuchos::rcp(new DefaultPreconditioner<Scalar>(unspecifiedPrecOp));
206 }
207 
208 
214 template <class Scalar>
217  const Teuchos::RCP<LinearOpBase<Scalar> > &unspecifiedPrecOp
218  )
219 {
220  return Teuchos::rcp(new DefaultPreconditioner<Scalar>(unspecifiedPrecOp));
221 }
222 
223 
229 template <class Scalar>
232  const Teuchos::RCP<const LinearOpBase<Scalar> > &leftPrecOp
233  )
234 {
235  return Teuchos::rcp(new DefaultPreconditioner<Scalar>(leftPrecOp,Teuchos::null));
236 }
237 
243 template <class Scalar>
246  const Teuchos::RCP<const LinearOpBase<Scalar> > &rightPrecOp
247  )
248 {
249  return Teuchos::rcp(new DefaultPreconditioner<Scalar>(Teuchos::null,rightPrecOp));
250 }
251 
257 template <class Scalar>
260  const Teuchos::RCP<const LinearOpBase<Scalar> > &leftPrecOp
261  ,const Teuchos::RCP<const LinearOpBase<Scalar> > &rightPrecOp
262  )
263 {
264  return Teuchos::rcp(new DefaultPreconditioner<Scalar>(leftPrecOp,rightPrecOp));
265 }
266 
267 
268 } // namespace Thyra
269 
270 
271 #endif // THYRA_DEFUALT_PRECONDITIONER_DECL_HPP
void initializeUnspecified(const Teuchos::RCP< LinearOpBase< Scalar > > &unspecifiedPrecOp)
Initialize a single unspecified preconditioner operator.
Teuchos::RCP< const DefaultPreconditioner< Scalar > > leftPrec(const Teuchos::RCP< const LinearOpBase< Scalar > > &leftPrecOp)
Create a precondioner from a single linear operator targeted to be used on the left.
void initializeRight(const Teuchos::RCP< LinearOpBase< Scalar > > &rightPrecOp)
Initialize a right preconditioner.
Simple interface class to access a precreated preconditioner as one or more linear operators objects ...
Teuchos::RCP< LinearOpBase< Scalar > > getNonconstUnspecifiedPrecOp()
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Teuchos::RCP< const DefaultPreconditioner< Scalar > > rightPrec(const Teuchos::RCP< const LinearOpBase< Scalar > > &rightPrecOp)
Create a precondioner from a single linear operator targeted to be used on the right.
Teuchos::RCP< const LinearOpBase< Scalar > > getRightPrecOp() const
Default implementation of a PreconditionerBase that just accepts precreated preconditioner linear ope...
Teuchos::RCP< const DefaultPreconditioner< Scalar > > unspecifiedPrec(const Teuchos::RCP< const LinearOpBase< Scalar > > &unspecifiedPrecOp)
Create a precondioner from a single linear operator not targeted to be used on the left or the right...
Base class for all linear operators.
Teuchos::RCP< const LinearOpBase< Scalar > > getLeftPrecOp() const
Teuchos::RCP< LinearOpBase< Scalar > > getNonconstLeftPrecOp()
Teuchos::RCP< LinearOpBase< Scalar > > getNonconstRightPrecOp()
Teuchos::RCP< const LinearOpBase< Scalar > > getUnspecifiedPrecOp() const
void initializeLeftRight(const Teuchos::RCP< LinearOpBase< Scalar > > &leftPrecOp, const Teuchos::RCP< LinearOpBase< Scalar > > &rightPrecOp)
Initialize a split left/right preconditioner.
Teuchos::RCP< const DefaultPreconditioner< Scalar > > splitPrec(const Teuchos::RCP< const LinearOpBase< Scalar > > &leftPrecOp, const Teuchos::RCP< const LinearOpBase< Scalar > > &rightPrecOp)
Create a split precondioner from two linear operators, one to be applied on the left and one to be ap...
DefaultPreconditioner()
Construct to uninitialized.
void initializeLeft(const Teuchos::RCP< LinearOpBase< Scalar > > &leftPrecOp)
Initialize a left preconditioner.
Teuchos::RCP< DefaultPreconditioner< Scalar > > nonconstUnspecifiedPrec(const Teuchos::RCP< LinearOpBase< Scalar > > &unspecifiedPrecOp)
Create a precondioner from a single linear operator not targeted to be used on the left or the right...