Teko  Version of the Day
 All Classes Files Functions Variables Pages
Teko_TpetraStridedMappingStrategy.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_TpetraStridedMappingStrategy_hpp__
11 #define __Teko_TpetraStridedMappingStrategy_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 // Tpetra includes
25 #include "Tpetra_Map.hpp"
26 #include "Tpetra_MultiVector.hpp"
27 #include "Tpetra_Import.hpp"
28 #include "Tpetra_Export.hpp"
29 #include "Tpetra_CrsMatrix.hpp"
30 
31 // Teko includes
32 #include "Teko_TpetraOperatorWrapper.hpp"
33 #include "Teko_ConfigDefs.hpp"
34 
35 namespace Teko {
36 namespace TpetraHelpers {
37 
38 class TpetraStridedMappingStrategy : public MappingStrategy {
39  public:
41 
42 
52  TpetraStridedMappingStrategy(const std::vector<int>& vars,
53  const Teuchos::RCP<const Tpetra::Map<LO, GO, NT> >& map,
54  const Teuchos::Comm<int>& comm);
56 
58 
59 
67  virtual void copyTpetraIntoThyra(const Tpetra::MultiVector<ST, LO, GO, NT>& tpetra_X,
68  const Teuchos::Ptr<Thyra::MultiVectorBase<ST> >& thyra_X) const;
69 
77  virtual void copyThyraIntoTpetra(const Teuchos::RCP<const Thyra::MultiVectorBase<ST> >& thyra_Y,
78  Tpetra::MultiVector<ST, LO, GO, NT>& tpetra_Y) const;
79 
87  virtual const Teuchos::RCP<const Tpetra::Map<LO, GO, NT> > domainMap() const {
88  return domainMap_;
89  }
90 
98  virtual const Teuchos::RCP<const Tpetra::Map<LO, GO, NT> > rangeMap() const { return rangeMap_; }
99 
104  virtual std::string toString() const { return std::string("TpetraStridedMappingStrategy"); }
105 
107 
109 
110 
125  void buildBlockTransferData(const std::vector<int>& vars,
126  const Teuchos::RCP<const Tpetra::Map<LO, GO, NT> >& baseMap,
127  const Teuchos::Comm<int>& comm);
128 
140  const std::vector<std::pair<int, Teuchos::RCP<Tpetra::Map<LO, GO, NT> > > >& getMaps() const {
141  return blockMaps_;
142  }
143 
155  const Teuchos::RCP<Thyra::BlockedLinearOpBase<ST> > buildBlockedThyraOp(
156  const Teuchos::RCP<const Tpetra::CrsMatrix<ST, LO, GO, NT> >& mat,
157  const std::string& label = "<ANYM>") const;
158 
168  void rebuildBlockedThyraOp(const RCP<const Tpetra::CrsMatrix<ST, LO, GO, NT> >& mat,
169  const RCP<Thyra::BlockedLinearOpBase<ST> >& A) const;
170 
172 
173  protected:
174  // member variables
175 
177 
178  Teuchos::RCP<const Tpetra::Map<LO, GO, NT> > domainMap_;
179  Teuchos::RCP<const Tpetra::Map<LO, GO, NT> > rangeMap_;
181 
183 
184  std::vector<std::pair<int, Teuchos::RCP<Tpetra::Map<LO, GO, NT> > > > blockMaps_;
185  std::vector<Teuchos::RCP<Tpetra::Export<LO, GO, NT> > > blockExport_;
186  std::vector<Teuchos::RCP<Tpetra::Import<LO, GO, NT> > > blockImport_;
188 };
189 
190 } // end namespace TpetraHelpers
191 } // end namespace Teko
192 
193 #endif
virtual void copyThyraIntoTpetra(const RCP< const Thyra::MultiVectorBase< ST > > &thyraX, Tpetra::MultiVector< ST, LO, GO, NT > &tpetraX) const =0
Copy an Thyra::MultiVectorBase into a Epetra_MultiVector.