Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tpetra_LinearProblem_decl.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_LINEARPROBLEM_DECL_HPP
11 #define TPETRA_LINEARPROBLEM_DECL_HPP
12 
15 
16 #include "Teuchos_DataAccess.hpp"
17 
18 #include "Tpetra_Vector_decl.hpp"
20 #include "Tpetra_RowMatrix_decl.hpp"
21 #include "Tpetra_DistObject.hpp"
22 #include "Tpetra_Details_ExecutionSpacesUser.hpp"
23 
24 namespace Tpetra {
25 
42 
43  template <class Scalar,
44  class LocalOrdinal,
45  class GlobalOrdinal,
46  class Node>
47  class LinearProblem :
48  public DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
50  {
51 
52  private:
55 
56  public:
58 
59 
65 
67 
69 
70 
77  LinearProblem();
78 
82  LinearProblem(const Teuchos::RCP<row_matrix_type> & A,
83  const Teuchos::RCP<multivector_type>& X,
84  const Teuchos::RCP<multivector_type>& B);
85 
87  LinearProblem(const LinearProblem<Scalar, LocalOrdinal,
88  GlobalOrdinal, Node>& Problem);
89 
91  virtual ~LinearProblem() = default;
92 
94 
96 
97 
104  void checkInput() const;
105 
107 
109 
110 
111  virtual bool
112  checkSizes (const SrcDistObject& source) override;
113 
115 
116 
118 
119 
123  void setMatrix(Teuchos::RCP<row_matrix_type> A)
124  { A_ = A; }
125 
129  void setLHS(Teuchos::RCP<multivector_type> X) {X_ = X;}
130 
134  void setRHS(Teuchos::RCP<multivector_type> B) {B_ = B;}
135 
137 
139 
140 
152  void leftScale(const Teuchos::RCP<const vector_type> & D,
153  Teuchos::ETransp mode = Teuchos::NO_TRANS);
154 
168  void rightScale(const Teuchos::RCP<const vector_type> & D,
169  Teuchos::ETransp mode = Teuchos::NO_TRANS);
170 
172 
174 
175 
177  Teuchos::RCP<row_matrix_type> getMatrix() const {return(A_);}
179  Teuchos::RCP<multivector_type> getLHS() const {return(X_);}
181  Teuchos::RCP<multivector_type> getRHS() const {return(B_);}
182 
184 
185  private:
186 
187  Teuchos::RCP<row_matrix_type> A_;
188  Teuchos::RCP<multivector_type> X_;
189  Teuchos::RCP<multivector_type> B_;
190 
191  LinearProblem & operator=(const LinearProblem<Scalar, LocalOrdinal,
192  GlobalOrdinal, Node>& Problem) = default;
193 };
194 
195 } // namespace Tpetra
196 
197 #endif // TPETRA_LINEARPROBLEM_DECL_HPP
Class that encapulates linear problem (Ax = b).
Teuchos::RCP< row_matrix_type > getMatrix() const
Get an RCP to the matrix A.
void checkInput() const
Check input parameters for existence and size consistency.
Declaration of the Tpetra::Vector class.
void setMatrix(Teuchos::RCP< row_matrix_type > A)
Set Matrix A of linear problem AX = B using a RowMatrix.
void rightScale(const Teuchos::RCP< const vector_type > &D, Teuchos::ETransp mode=Teuchos::NO_TRANS)
Perform right scaling of a linear problem.
void setRHS(Teuchos::RCP< multivector_type > B)
Set right-hand-side B of linear problem AX = B.
Declaration of the Tpetra::MultiVector class.
void setLHS(Teuchos::RCP< multivector_type > X)
Set left-hand-side X of linear problem AX = B.
LinearProblem()
Default Constructor.
A class can inherit from this if it wants to use Tpetra managed spaces.
virtual bool checkSizes(const SrcDistObject &source) override
Compare the source and target (this) objects for compatibility.
Abstract base class for objects that can be the source of an Import or Export operation.
Teuchos::RCP< multivector_type > getLHS() const
Get an RCP to the left-hand-side X.
A parallel distribution of indices over processes.
A read-only, row-oriented interface to a sparse matrix.
A distributed dense vector.
Teuchos::RCP< multivector_type > getRHS() const
Get an RCP to the right-hand-side B.
void leftScale(const Teuchos::RCP< const vector_type > &D, Teuchos::ETransp mode=Teuchos::NO_TRANS)
Perform left scaling of a linear problem.
Base class for distributed Tpetra objects that support data redistribution.
virtual ~LinearProblem()=default
LinearProblem Destructor.