Teko  Version of the Day
 All Classes Files Functions Variables Pages
Teko_InterlacedEpetra.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_InterlacedEpetra_hpp__
11 #define __Teko_InterlacedEpetra_hpp__
12 
13 // Teuchos includes
14 #include "Teuchos_RCP.hpp"
15 
16 // include basic Epetra information
17 #ifdef HAVE_MPI
18 #include "Epetra_MpiComm.h"
19 #else
20 #include "Epetra_SerialComm.h"
21 #endif
22 #include "Epetra_Map.h"
23 #include "Epetra_CrsMatrix.h"
24 #include "Epetra_MultiVector.h"
25 #include "Epetra_Vector.h"
26 #include "Epetra_Export.h"
27 #include "Epetra_Import.h"
28 
29 #include <vector>
30 
31 namespace Teko {
32 namespace Epetra {
33 namespace Strided {
34 
54 void buildSubMaps(int numGlobals, int numVars, const Epetra_Comm& comm,
55  std::vector<std::pair<int, Teuchos::RCP<Epetra_Map> > >& subMaps);
56 
76 void buildSubMaps(int numGlobals, const std::vector<int>& vars, const Epetra_Comm& comm,
77  std::vector<std::pair<int, Teuchos::RCP<Epetra_Map> > >& subMaps);
78 
100 void buildSubMaps(int numGlobals, int numMyElements, int minMyGID, const std::vector<int>& vars,
101  const Epetra_Comm& comm,
102  std::vector<std::pair<int, Teuchos::RCP<Epetra_Map> > >& subMaps);
103 
124 void buildSubMaps(const Epetra_Map& globalMap, const std::vector<int>& vars,
125  const Epetra_Comm& comm,
126  std::vector<std::pair<int, Teuchos::RCP<Epetra_Map> > >& subMaps);
127 
128 // build conversion import and export operators
129 void buildExportImport(const Epetra_Map& baseMap,
130  const std::vector<std::pair<int, Teuchos::RCP<Epetra_Map> > >& subMaps,
131  std::vector<Teuchos::RCP<Epetra_Export> >& subExport,
132  std::vector<Teuchos::RCP<Epetra_Import> >& subImport);
133 
134 // build a vector of subVectors
135 void buildSubVectors(const std::vector<std::pair<int, Teuchos::RCP<Epetra_Map> > >& subMaps,
136  std::vector<Teuchos::RCP<Epetra_MultiVector> >& subVectors, int count);
137 
141 void associateSubVectors(const std::vector<std::pair<int, Teuchos::RCP<Epetra_Map> > >& subMaps,
142  std::vector<Teuchos::RCP<const Epetra_MultiVector> >& subVectors);
143 
144 // build a single subblock Epetra_CrsMatrix
145 Teuchos::RCP<Epetra_CrsMatrix> buildSubBlock(
146  int i, int j, const Epetra_CrsMatrix& A,
147  const std::vector<std::pair<int, Teuchos::RCP<Epetra_Map> > >& subMaps);
148 
149 // Rebuild a single subblock of a matrix
150 void rebuildSubBlock(int i, int j, const Epetra_CrsMatrix& A,
151  const std::vector<std::pair<int, Teuchos::RCP<Epetra_Map> > >& subMaps,
152  Epetra_CrsMatrix& mat);
153 
154 // copy contents of many subvectors to a single vector
155 void many2one(Epetra_MultiVector& one,
156  const std::vector<Teuchos::RCP<const Epetra_MultiVector> >& many,
157  const std::vector<Teuchos::RCP<Epetra_Export> >& subExport);
158 
159 // copy contents of a single vector to many subvectors
160 void one2many(std::vector<Teuchos::RCP<Epetra_MultiVector> >& many,
161  const Epetra_MultiVector& single,
162  const std::vector<Teuchos::RCP<Epetra_Import> >& subImport);
163 
164 } // namespace Strided
165 } // end namespace Epetra
166 } // end namespace Teko
167 
168 #endif