Teko  Version of the Day
 All Classes Files Functions Variables Pages
Teko_Preconditioner.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_Preconditioner_hpp__
11 #define __Teko_Preconditioner_hpp__
12 
13 // Thyra includes
14 #include "Thyra_DefaultPreconditioner.hpp"
15 
16 // Teko includes
17 #include "Teko_Utilities.hpp"
18 #include "Teko_PreconditionerState.hpp"
19 
20 namespace Teko {
21 
22 using Teuchos::RCP;
23 using Thyra::DefaultPreconditioner;
24 using Thyra::LinearOpBase;
25 
33 class Preconditioner : public DefaultPreconditioner<double> {
34  public:
36 
37  Preconditioner() : DefaultPreconditioner<double>() {}
38  Preconditioner(const RCP<LinearOpBase<double> >& leftPrecOp,
39  const RCP<LinearOpBase<double> >& rightPrecOp)
40  : DefaultPreconditioner<double>(leftPrecOp, rightPrecOp) {}
41  Preconditioner(const RCP<const LinearOpBase<double> >& leftPrecOp,
42  const RCP<const LinearOpBase<double> >& rightPrecOp)
43  : DefaultPreconditioner<double>(leftPrecOp, rightPrecOp) {}
44  Preconditioner(const RCP<LinearOpBase<double> >& unspecifiedPrecOp)
45  : DefaultPreconditioner<double>(unspecifiedPrecOp) {}
46  Preconditioner(const RCP<const LinearOpBase<double> >& unspecifiedPrecOp)
47  : DefaultPreconditioner<double>(unspecifiedPrecOp) {}
49 
54  virtual void setSourceVector(const RCP<Thyra::MultiVectorBase<double> >& srcVec) {
55  if (srcVec != Teuchos::null)
56  state_->setSourceVector(srcVec);
57  else
58  state_->setSourceVector(Teuchos::null);
59  }
60 
65  virtual void setStateObject(const RCP<PreconditionerState>& state) { state_ = state; }
66 
71  virtual const RCP<PreconditionerState> getStateObject() { return state_; }
72 
77  virtual const RCP<const PreconditionerState> getStateObject() const { return state_; }
78 
84  virtual void mergeStateObject(const PreconditionerState& state) { state_->merge(state); }
85 
86  protected:
88  RCP<PreconditionerState> state_;
89 };
90 
91 } // end namespace Teko
92 
93 #endif
virtual const RCP< PreconditionerState > getStateObject()
virtual void mergeStateObject(const PreconditionerState &state)
virtual const RCP< const PreconditionerState > getStateObject() const
virtual void setSourceVector(const RCP< Thyra::MultiVectorBase< double > > &srcVec)
virtual void setStateObject(const RCP< PreconditionerState > &state)
An extension of the Thyra::DefaultPreconditioner class with some specializations useful for use withi...
RCP< PreconditionerState > state_
User defined state for this preconditioner.
An implementation of a state object preconditioners.