Teko  Version of the Day
 All Classes Files Functions Variables Pages
Teko_StridedMappingStrategy.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_StridedMappingStrategy_hpp__
11 #define __Teko_StridedMappingStrategy_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 
35 namespace Teko {
36 namespace Epetra {
37 
38 class StridedMappingStrategy : public MappingStrategy {
39  public:
41 
42 
52  StridedMappingStrategy(const std::vector<int>& vars, const Teuchos::RCP<const Epetra_Map>& map,
53  const Epetra_Comm& comm);
55 
57 
58 
66  virtual void copyEpetraIntoThyra(
67  const Epetra_MultiVector& epetra_X,
68  const Teuchos::Ptr<Thyra::MultiVectorBase<double> >& thyra_X) const;
69 
77  virtual void copyThyraIntoEpetra(
78  const Teuchos::RCP<const Thyra::MultiVectorBase<double> >& thyra_Y,
79  Epetra_MultiVector& epetra_Y) const;
80 
88  virtual const Teuchos::RCP<const Epetra_Map> domainMap() const { return domainMap_; }
89 
97  virtual const Teuchos::RCP<const Epetra_Map> rangeMap() const { return rangeMap_; }
98 
103  virtual std::string toString() const { return std::string("StridedMappingStrategy"); }
104 
106 
108 
109 
124  void buildBlockTransferData(const std::vector<int>& vars,
125  const Teuchos::RCP<const Epetra_Map>& baseMap,
126  const Epetra_Comm& comm);
127 
139  const std::vector<std::pair<int, Teuchos::RCP<Epetra_Map> > >& getMaps() const {
140  return blockMaps_;
141  }
142 
154  const Teuchos::RCP<Thyra::BlockedLinearOpBase<double> > buildBlockedThyraOp(
155  const Teuchos::RCP<const Epetra_CrsMatrix>& mat, const std::string& label = "<ANYM>") const;
156 
166  void rebuildBlockedThyraOp(const RCP<const Epetra_CrsMatrix>& mat,
167  const RCP<Thyra::BlockedLinearOpBase<double> >& A) const;
168 
170 
171  protected:
172  // member variables
173 
175 
176  Teuchos::RCP<const Epetra_Map> domainMap_;
177  Teuchos::RCP<const Epetra_Map> rangeMap_;
179 
181 
182  std::vector<std::pair<int, Teuchos::RCP<Epetra_Map> > > blockMaps_;
183  std::vector<Teuchos::RCP<Epetra_Export> > blockExport_;
184  std::vector<Teuchos::RCP<Epetra_Import> > blockImport_;
186 };
187 
188 } // end namespace Epetra
189 } // end namespace Teko
190 
191 #endif
virtual void copyThyraIntoEpetra(const RCP< const Thyra::MultiVectorBase< double > > &thyraX, Epetra_MultiVector &epetraX) const =0
Copy an Thyra::MultiVectorBase into a Epetra_MultiVector.