Teko  Version of the Day
 All Classes Files Functions Variables Pages
Teko_BlockedEpetraOperator.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_BlockedEpetraOperator_hpp__
11 #define __Teko_BlockedEpetraOperator_hpp__
12 
13 // Epetra includes
14 #include "Epetra_Operator.h"
15 
16 // Teuchos includes
17 #include "Teuchos_RCP.hpp"
18 
19 #include "Thyra_LinearOpBase.hpp"
20 
21 // Teko includes
22 #include "Teko_BlockedReordering.hpp"
23 #include "Teko_EpetraOperatorWrapper.hpp"
24 #include "Teko_BlockedMappingStrategy.hpp"
25 
26 namespace Teko {
27 namespace Epetra {
28 
33  public:
42  BlockedEpetraOperator(const std::vector<std::vector<int> > &vars,
43  const Teuchos::RCP<const Epetra_Operator> &content,
44  const std::string &label = "<ANYM>");
45 
54  virtual void SetContent(const std::vector<std::vector<int> > &vars,
55  const Teuchos::RCP<const Epetra_Operator> &content);
56 
60  virtual void RebuildOps() { BuildBlockedOperator(); }
61 
62  virtual const Teuchos::RCP<const Epetra_Operator> GetContent() const { return fullContent_; }
63 
64  virtual const Teuchos::RCP<const Epetra_Operator> GetContent() { return fullContent_; }
65 
66  const Teuchos::RCP<const Epetra_Operator> GetBlock(int i, int j) const;
67 
71  void Reorder(const BlockReorderManager &brm);
72 
74  void RemoveReording();
75 
78  virtual void WriteBlocks(const std::string &prefix) const;
79 
80  // functions overloading Epetra_Operator
82 
83  // destructor
84  virtual ~BlockedEpetraOperator() {}
85 
86  // attribute set methods
87 
88  // don't use transpose...ever!
89  virtual int SetUseTranspose(bool /* useTranspose */) { return -1; }
90 
91  virtual int ApplyInverse(const Epetra_MultiVector & /* X */, Epetra_MultiVector & /* Y */) const {
92  TEUCHOS_ASSERT(false);
93  return -1;
94  }
95 
96  virtual double NormInf() const {
97  TEUCHOS_ASSERT(false);
98  return 0.0;
99  }
100 
101  // attribute access functions
102  virtual bool UseTranspose() const { return false; }
103  virtual bool HasNormInf() const { return false; }
104  virtual const Epetra_Comm &Comm() const { return fullContent_->Comm(); }
105 
107  bool testAgainstFullOperator(int count, double tol) const;
108 
109  protected:
110  // gooey center of this shell
111  Teuchos::RCP<const Epetra_Operator> fullContent_;
112  Teuchos::RCP<BlockedMappingStrategy> blockedMapping_;
113  Teuchos::RCP<Thyra::LinearOpBase<double> > blockedOperator_;
114  Teuchos::RCP<const BlockReorderManager> reorderManager_;
115 
116  std::string label_;
117 
118  void BuildBlockedOperator();
119 };
120 
121 } // end namespace Epetra
122 } // end namespace Teko
123 
124 #endif
bool testAgainstFullOperator(int count, double tol) const
Helps perform sanity checks.
void Reorder(const BlockReorderManager &brm)
Implements the Epetra_Operator interface with a Thyra LinearOperator. This enables the use of absrtac...
virtual void SetContent(const std::vector< std::vector< int > > &vars, const Teuchos::RCP< const Epetra_Operator > &content)
void RemoveReording()
Remove any reordering on this object.
Tear about a user specified Epetra_Operator (CrsMatrix) using a vector of vectors of GIDs for each bl...
BlockedEpetraOperator(const std::vector< std::vector< int > > &vars, const Teuchos::RCP< const Epetra_Operator > &content, const std::string &label="<ANYM>")
virtual void WriteBlocks(const std::string &prefix) const