Teko  Version of the Day
 All Classes Files Functions Variables Pages
Teko_BlockingTpetra.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_BlockingTpetra_hpp__
11 #define __Teko_BlockingTpetra_hpp__
12 
13 #include "Teuchos_RCP.hpp"
14 
15 // include basic Tpetra information
16 #include "Tpetra_Map.hpp"
17 #include "Tpetra_CrsMatrix.hpp"
18 #include "Tpetra_Vector.hpp"
19 #include "Tpetra_MultiVector.hpp"
20 #include "Tpetra_Export.hpp"
21 #include "Tpetra_Import.hpp"
22 
23 #include "Teko_ConfigDefs.hpp"
24 
25 #include <vector>
26 
27 namespace Teko {
28 namespace TpetraHelpers {
29 namespace Blocking {
30 
31 typedef std::pair<Teuchos::RCP<Tpetra::Map<LO, GO, NT> >, Teuchos::RCP<Tpetra::Map<LO, GO, NT> > >
32  MapPair;
33 typedef std::pair<Teuchos::RCP<Tpetra::Import<LO, GO, NT> >,
34  Teuchos::RCP<Tpetra::Export<LO, GO, NT> > >
35  ImExPair;
36 
50 const MapPair buildSubMap(const std::vector<GO>& gid, const Teuchos::Comm<int>& comm);
51 
61 const ImExPair buildExportImport(const Tpetra::Map<LO, GO, NT>& baseMap, const MapPair& maps);
62 
73 void many2one(Tpetra::MultiVector<ST, LO, GO, NT>& one,
74  const std::vector<Teuchos::RCP<const Tpetra::MultiVector<ST, LO, GO, NT> > >& many,
75  const std::vector<Teuchos::RCP<Tpetra::Export<LO, GO, NT> > >& subExport);
76 
84 void one2many(std::vector<Teuchos::RCP<Tpetra::MultiVector<ST, LO, GO, NT> > >& many,
85  const Tpetra::MultiVector<ST, LO, GO, NT>& single,
86  const std::vector<Teuchos::RCP<Tpetra::Import<LO, GO, NT> > >& subImport);
87 
95 void buildSubVectors(const std::vector<MapPair>& maps,
96  std::vector<Teuchos::RCP<Tpetra::MultiVector<ST, LO, GO, NT> > >& vectors,
97  int count);
98 
104 Teuchos::RCP<Tpetra::Vector<GO, LO, GO, NT> > getSubBlockColumnGIDs(
105  const Tpetra::CrsMatrix<ST, LO, GO, NT>& A, const MapPair& mapPair);
106 
120 Teuchos::RCP<Tpetra::CrsMatrix<ST, LO, GO, NT> > buildSubBlock(
121  int i, int j, const Teuchos::RCP<const Tpetra::CrsMatrix<ST, LO, GO, NT> >& A,
122  const std::vector<MapPair>& subMaps);
123 
137 void rebuildSubBlock(int i, int j, const Teuchos::RCP<const Tpetra::CrsMatrix<ST, LO, GO, NT> >& A,
138  const std::vector<MapPair>& subMaps, Tpetra::CrsMatrix<ST, LO, GO, NT>& mat);
139 
140 } // namespace Blocking
141 } // namespace TpetraHelpers
142 } // namespace Teko
143 
144 #endif