Teko Version of the Day
Loading...
Searching...
No Matches
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
28namespace Teko {
29namespace TpetraHelpers {
30namespace Strided {
31
51void 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
73void 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
97void 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
121void 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
126void 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
133void 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
140void 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
145Teuchos::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
150void 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
156void 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
161void 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