Teko  Version of the Day
 All Classes Files Functions Variables Pages
Teko_TpetraInverseFactoryOperator.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_TpetraInverseFactoryOperator_hpp__
11 #define __Teko_TpetraInverseFactoryOperator_hpp__
12 
13 #include "Teuchos_ConstNonconstObjectContainer.hpp"
14 
15 #include "Teko_ConfigDefs.hpp"
16 #include "Teko_InverseFactory.hpp"
17 #include "Teko_TpetraInverseOpWrapper.hpp"
18 
19 namespace Teko {
20 namespace TpetraHelpers {
21 
32 class InverseFactoryOperator : public TpetraInverseOpWrapper {
33  public:
40  InverseFactoryOperator(const Teuchos::RCP<const InverseFactory> &bfp);
41 
54  virtual void initInverse(bool clearOld = false);
55 
68  virtual void buildInverseOperator(const Teuchos::RCP<const Tpetra::Operator<ST, LO, GO, NT> > &A,
69  bool clear = true);
70 
83  virtual void buildInverseOperator(const Teuchos::RCP<Tpetra::Operator<ST, LO, GO, NT> > &A,
84  bool clear = true);
85 
98  virtual void rebuildInverseOperator(
99  const Teuchos::RCP<const Tpetra::Operator<ST, LO, GO, NT> > &A);
100 
113  virtual void rebuildInverseOperator(const Teuchos::RCP<Tpetra::Operator<ST, LO, GO, NT> > &A);
114 
118  Teuchos::RCP<const Tpetra::Operator<ST, LO, GO, NT> > getForwardOp() const {
119  return fwdOp_.getConstObj();
120  }
121 
125  Teuchos::RCP<Tpetra::Operator<ST, LO, GO, NT> > getNonconstForwardOp() const {
126  return fwdOp_.getNonconstObj();
127  }
128 
129  protected:
130  Teuchos::RCP<const Thyra::LinearOpBase<ST> > extractLinearOp(
131  const Teuchos::RCP<const Tpetra::Operator<ST, LO, GO, NT> > &A) const;
132  Teuchos::RCP<const MappingStrategy> extractMappingStrategy(
133  const Teuchos::RCP<const Tpetra::Operator<ST, LO, GO, NT> > &A) const;
134 
137 
138  Teuchos::RCP<const Teko::InverseFactory> inverseFactory_;
139  Teko::ModifiableLinearOp invOperator_;
140  bool firstBuildComplete_;
141 
142  Teuchos::ConstNonconstObjectContainer<Tpetra::Operator<ST, LO, GO, NT> > fwdOp_;
143  bool setConstFwdOp_;
144 };
145 
146 } // end namespace TpetraHelpers
147 } // end namespace Teko
148 
149 #endif
Teuchos::RCP< Tpetra::Operator< ST, LO, GO, NT > > getNonconstForwardOp() const
virtual void initInverse(bool clearOld=false)
Build the underlying data structure for the inverse operator.
virtual void buildInverseOperator(const Teuchos::RCP< const Tpetra::Operator< ST, LO, GO, NT > > &A, bool clear=true)
Build this inverse operator from an Epetra_Operator passed in to this object.
Teuchos::RCP< const Tpetra::Operator< ST, LO, GO, NT > > getForwardOp() const
A single Epetra wrapper for all operators constructed from an inverse operator.
virtual void rebuildInverseOperator(const Teuchos::RCP< const Tpetra::Operator< ST, LO, GO, NT > > &A)
Rebuild this inverse from an Epetra_Operator passed in this to object.