Teko  Version of the Day
 All Classes Files Functions Variables Pages
Teko_InterlacedTpetra.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_InterlacedTpetra_hpp__
11 #define __Teko_InterlacedTpetra_hpp__
12 
13 // Teuchos includes
14 #include "Teuchos_RCP.hpp"
15 
16 // include basic Tpetra information
17 #include "Tpetra_Map.hpp"
18 #include "Tpetra_CrsMatrix.hpp"
19 #include "Tpetra_MultiVector.hpp"
20 #include "Tpetra_Vector.hpp"
21 #include "Tpetra_Export.hpp"
22 #include "Tpetra_Import.hpp"
23 
24 #include "Teko_ConfigDefs.hpp"
25 
26 #include <vector>
27 
28 namespace Teko {
29 namespace TpetraHelpers {
30 namespace Strided {
31 
51 void buildSubMaps(GO numGlobals, int numVars, const Teuchos::Comm<int>& comm,
52  std::vector<std::pair<int, Teuchos::RCP<Tpetra::Map<LO, GO, NT> > > >& subMaps);
53 
73 void buildSubMaps(GO numGlobals, const std::vector<int>& vars, const Teuchos::Comm<int>& comm,
74  std::vector<std::pair<int, Teuchos::RCP<Tpetra::Map<LO, GO, NT> > > >& subMaps);
75 
97 void buildSubMaps(GO numGlobals, LO numMyElements, GO minMyGID, const std::vector<int>& vars,
98  const Teuchos::Comm<int>& comm,
99  std::vector<std::pair<int, Teuchos::RCP<Tpetra::Map<LO, GO, NT> > > >& subMaps);
100 
121 void buildSubMaps(const Tpetra::Map<LO, GO, NT>& globalMap, const std::vector<int>& vars,
122  const Teuchos::Comm<int>& comm,
123  std::vector<std::pair<int, Teuchos::RCP<Tpetra::Map<LO, GO, NT> > > >& subMaps);
124 
125 // build conversion import and export operators
126 void buildExportImport(
127  const Tpetra::Map<LO, GO, NT>& baseMap,
128  const std::vector<std::pair<int, Teuchos::RCP<Tpetra::Map<LO, GO, NT> > > >& subMaps,
129  std::vector<Teuchos::RCP<Tpetra::Export<LO, GO, NT> > >& subExport,
130  std::vector<Teuchos::RCP<Tpetra::Import<LO, GO, NT> > >& subImport);
131 
132 // build a vector of subVectors
133 void buildSubVectors(
134  const std::vector<std::pair<int, Teuchos::RCP<Tpetra::Map<LO, GO, NT> > > >& subMaps,
135  std::vector<Teuchos::RCP<Tpetra::MultiVector<ST, LO, GO, NT> > >& subVectors, LO count);
136 
140 void associateSubVectors(
141  const std::vector<std::pair<int, Teuchos::RCP<Tpetra::Map<LO, GO, NT> > > >& subMaps,
142  std::vector<Teuchos::RCP<const Tpetra::MultiVector<ST, LO, GO, NT> > >& subVectors);
143 
144 // build a single subblock Epetra_CrsMatrix
145 Teuchos::RCP<Tpetra::CrsMatrix<ST, LO, GO, NT> > buildSubBlock(
146  int i, int j, const Teuchos::RCP<const Tpetra::CrsMatrix<ST, LO, GO, NT> >& A,
147  const std::vector<std::pair<int, Teuchos::RCP<Tpetra::Map<LO, GO, NT> > > >& subMaps);
148 
149 // Rebuild a single subblock of a matrix
150 void rebuildSubBlock(
151  int i, int j, const Teuchos::RCP<const Tpetra::CrsMatrix<ST, LO, GO, NT> >& A,
152  const std::vector<std::pair<int, Teuchos::RCP<Tpetra::Map<LO, GO, NT> > > >& subMaps,
153  Tpetra::CrsMatrix<ST, LO, GO, NT>& mat);
154 
155 // copy contents of many subvectors to a single vector
156 void many2one(Tpetra::MultiVector<ST, LO, GO, NT>& one,
157  const std::vector<Teuchos::RCP<const Tpetra::MultiVector<ST, LO, GO, NT> > >& many,
158  const std::vector<Teuchos::RCP<Tpetra::Export<LO, GO, NT> > >& subExport);
159 
160 // copy contents of a single vector to many subvectors
161 void one2many(std::vector<Teuchos::RCP<Tpetra::MultiVector<ST, LO, GO, NT> > >& many,
162  const Tpetra::MultiVector<ST, LO, GO, NT>& single,
163  const std::vector<Teuchos::RCP<Tpetra::Import<LO, GO, NT> > >& subImport);
164 
165 } // namespace Strided
166 } // end namespace TpetraHelpers
167 } // end namespace Teko
168 
169 #endif