Teko  Version of the Day
 All Classes Files Functions Variables Pages
Teko_BlockedMappingStrategy.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_BlockedMappingStrategy_hpp__
11 #define __Teko_BlockedMappingStrategy_hpp__
12 
13 // stl includes
14 #include <vector>
15 
16 // Teuchos includes
17 #include "Teuchos_RCP.hpp"
18 
19 // Thyra includes
20 #include "Thyra_MultiVectorBase.hpp"
21 #include "Thyra_LinearOpBase.hpp"
22 #include "Thyra_BlockedLinearOpBase.hpp"
23 
24 // Epetra includes
25 #include "Epetra_Comm.h"
26 #include "Epetra_Map.h"
27 #include "Epetra_MultiVector.h"
28 #include "Epetra_Import.h"
29 #include "Epetra_Export.h"
30 #include "Epetra_CrsMatrix.h"
31 
32 // Teko includes
33 #include "Teko_EpetraOperatorWrapper.hpp"
34 #include "Teko_BlockingEpetra.hpp"
35 
36 namespace Teko {
37 namespace Epetra {
38 
39 class BlockedMappingStrategy : public MappingStrategy {
40  public:
42 
43 
53  BlockedMappingStrategy(const std::vector<std::vector<int> >& vars,
54  const Teuchos::RCP<const Epetra_Map>& baseMap, const Epetra_Comm& comm);
56 
58 
59 
67  virtual void copyEpetraIntoThyra(
68  const Epetra_MultiVector& epetra_X,
69  const Teuchos::Ptr<Thyra::MultiVectorBase<double> >& thyra_X) const;
70 
78  virtual void copyThyraIntoEpetra(
79  const Teuchos::RCP<const Thyra::MultiVectorBase<double> >& thyra_Y,
80  Epetra_MultiVector& epetra_Y) const;
81 
89  virtual const Teuchos::RCP<const Epetra_Map> domainMap() const { return domainMap_; }
90 
98  virtual const Teuchos::RCP<const Epetra_Map> rangeMap() const { return rangeMap_; }
99 
104  virtual std::string toString() const { return std::string("BlockedMappingStrategy"); }
105 
107 
109 
110 
125  void buildBlockTransferData(const std::vector<std::vector<int> >& vars,
126  const Teuchos::RCP<const Epetra_Map>& baseMap,
127  const Epetra_Comm& comm);
128 
140  const std::vector<Blocking::MapPair>& getMaps() const { return blockMaps_; }
141 
153  const Teuchos::RCP<Thyra::BlockedLinearOpBase<double> > buildBlockedThyraOp(
154  const Teuchos::RCP<const Epetra_CrsMatrix>& mat, const std::string& label = "<ANYM>") const;
155 
165  void rebuildBlockedThyraOp(const RCP<const Epetra_CrsMatrix>& mat,
166  const RCP<Thyra::BlockedLinearOpBase<double> >& A) const;
167 
169 
170  protected:
171  // member variables
172 
174 
175  Teuchos::RCP<const Epetra_Map> domainMap_;
176  Teuchos::RCP<const Epetra_Map> rangeMap_;
178 
180 
181  std::vector<Blocking::MapPair> blockMaps_;
182  std::vector<Teuchos::RCP<Epetra_Import> > blockImport_;
183  std::vector<Teuchos::RCP<Epetra_Export> > blockExport_;
185 };
186 
187 } // end namespace Epetra
188 } // end namespace Teko
189 
190 #endif
virtual void copyThyraIntoEpetra(const RCP< const Thyra::MultiVectorBase< double > > &thyraX, Epetra_MultiVector &epetraX) const =0
Copy an Thyra::MultiVectorBase into a Epetra_MultiVector.