Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_SolverMap_LinearProblem_def.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef TPETRA_SOLVERMAP_LINEARPROBLEM_DEF_HPP
11#define TPETRA_SOLVERMAP_LINEARPROBLEM_DEF_HPP
12
22
24
25namespace Tpetra {
26
27template <class Scalar,
28 class LocalOrdinal,
29 class GlobalOrdinal,
30 class Node>
32 : StructuralSameTypeTransform<LinearProblem<Scalar, LocalOrdinal, GlobalOrdinal, Node> >()
33 , solverMapCrsMatrixTrans_() {
34 // Nothing to do
35}
36
37template <class Scalar,
38 class LocalOrdinal,
39 class GlobalOrdinal,
40 class Node>
44
45template <class Scalar,
46 class LocalOrdinal,
47 class GlobalOrdinal,
48 class Node>
49typename SolverMap_LinearProblem<Scalar, LocalOrdinal, GlobalOrdinal, Node>::NewType
51operator()(OriginalType const &origProblem) {
55
56 this->origObj_ = origProblem;
57
58 cm_t *oldMatrix = dynamic_cast<cm_t *>(origProblem->getMatrix().get());
59 Teuchos::RCP<mv_t> oldRHS = origProblem->getRHS();
60 Teuchos::RCP<mv_t> oldLHS = origProblem->getLHS();
61 Teuchos::RCP<cm_t> newMatrix = solverMapCrsMatrixTrans_(Teuchos::rcp<cm_t>(oldMatrix, false));
62
63 if (newMatrix.get() == oldMatrix) {
64 // Same matrix, so use same problem
65 this->newObj_ = this->origObj_;
66 } else {
67 this->newObj_ = Teuchos::rcp<lp_t>(new lp_t(newMatrix, oldLHS, oldRHS));
68 }
69
70 return this->newObj_;
71}
72
73//
74// Explicit instantiation macro
75//
76// Must be expanded from within the Tpetra namespace!
77//
78
79#define TPETRA_SOLVERMAPLINEARPROBLEM_INSTANT(SCALAR, LO, GO, NODE) \
80 template class SolverMap_LinearProblem<SCALAR, LO, GO, NODE>;
81
82} // namespace Tpetra
83
84#endif // TPETRA_SOLVERMAP_LINEARPROBLEM_DEF_HPP
Declaration of the Tpetra::SolverMap_LinearProblem class.
Struct that holds views of the contents of a CrsMatrix.
Class that encapulates linear problem (Ax = b).
NewType operator()(OriginalType const &origProblem)
Namespace Tpetra contains the class and methods constituting the Tpetra library.