Teko  Version of the Day
 All Classes Files Functions Variables Pages
Teko_BlockUpperTriInverseOp.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_BlockUpperTriInverseOp_hpp__
11 #define __Teko_BlockUpperTriInverseOp_hpp__
12 
13 #include "Teko_Utilities.hpp"
14 #include "Teko_BlockImplicitLinearOp.hpp"
15 
16 namespace Teko {
17 
27  public:
37  BlockUpperTriInverseOp(BlockedLinearOp &U, const std::vector<LinearOp> &invDiag);
38 
40 
41 
43  virtual VectorSpace range() const { return productRange_; }
44 
46  virtual VectorSpace domain() const { return productDomain_; }
47 
60  virtual void implicitApply(const BlockedMultiVector &x, BlockedMultiVector &y,
61  const double alpha = 1.0, const double beta = 0.0) const;
62 
76  virtual void implicitApply(const Thyra::EOpTransp M_trans, const BlockedMultiVector &x,
77  BlockedMultiVector &y, const double alpha = 1.0,
78  const double beta = 0.0) const;
80 
81  virtual void describe(Teuchos::FancyOStream &out_arg,
82  const Teuchos::EVerbosityLevel verbLevel) const;
83 
84  protected:
85  // fundamental operators to use
86  const BlockedLinearOp U_;
87  std::vector<LinearOp> invDiag_;
88 
89  Teuchos::RCP<const Thyra::ProductVectorSpaceBase<double> >
91  Teuchos::RCP<const Thyra::ProductVectorSpaceBase<double> >
93 
94  // scratch space...so we don't have to reallocate
95  mutable BlockedMultiVector srcScrap_;
96  mutable BlockedMultiVector dstScrap_;
97  mutable bool allocated = false;
98 
99  private:
100  // hide me!
103 };
104 
105 inline LinearOp createBlockUpperTriInverseOp(BlockedLinearOp &U,
106  const std::vector<LinearOp> &invDiag) {
107  return Teuchos::rcp(new BlockUpperTriInverseOp(U, invDiag));
108 }
109 
110 inline LinearOp createBlockUpperTriInverseOp(BlockedLinearOp &U,
111  const std::vector<LinearOp> &invDiag,
112  const std::string &str) {
113  Teuchos::RCP<Thyra::LinearOpBase<double> > result =
114  Teuchos::rcp(new BlockUpperTriInverseOp(U, invDiag));
115  result->setObjectLabel(str);
116 
117  return result;
118 }
119 
120 } // end namespace Teko
121 
122 #endif
virtual VectorSpace domain() const
Domain space of this operator.
std::vector< LinearOp > invDiag_
(Approximate) Inverses of the diagonal operators
virtual VectorSpace range() const
Range space of this operator.
Teuchos::RCP< const Thyra::ProductVectorSpaceBase< double > > productRange_
Range vector space.
virtual void implicitApply(const BlockedMultiVector &x, BlockedMultiVector &y, const double alpha=1.0, const double beta=0.0) const
Perform a matrix vector multiply with this operator.
const BlockedLinearOp U_
operator
A virtual class that simplifies the construction of custom operators.
Teuchos::RCP< const Thyra::ProductVectorSpaceBase< double > > productDomain_
Domain vector space.
This linear operator computes the inverse of a upper triangular matrix.