1 #ifndef VERTEXCFD_LINEARSOLVERS_PRECONDITIONER_HPP
2 #define VERTEXCFD_LINEARSOLVERS_PRECONDITIONER_HPP
4 #include "VertexCFD_LinearSolvers_LocalDirectSolver.hpp"
6 #include <Ifpack2_Details_CanChangeMatrix.hpp>
7 #include <Ifpack2_Preconditioner.hpp>
8 #include <Teuchos_FancyOStream.hpp>
9 #include <Tpetra_Map.hpp>
10 #include <Tpetra_MultiVector.hpp>
11 #include <Tpetra_RowMatrix.hpp>
17 namespace LinearSolvers
34 :
public Ifpack2::Preconditioner<>,
35 public Ifpack2::Details::CanChangeMatrix<Tpetra::RowMatrix<>>
38 using MV = Tpetra::MultiVector<>;
41 Teuchos::RCP<const Tpetra::RowMatrix<>> _A;
44 std::shared_ptr<LocalDirectSolver> _local_solver;
51 mutable int _num_apply;
54 mutable double _apply_time;
57 const std::string _set_label =
"VertexCFD::Preconditioner::setMatrix";
58 const std::string _init_label =
"VertexCFD::Preconditioner::initialize";
59 const std::string _compute_label =
"VertexCFD::Preconditioner::compute";
60 const std::string _apply_label =
"VertexCFD::Preconditioner::apply";
67 void setMatrix(
const Teuchos::RCP<
const Tpetra::RowMatrix<>>& A)
override;
70 Teuchos::RCP<const Tpetra::RowMatrix<>> getMatrix()
const override
74 bool isInitialized()
const override {
return _initialized; }
75 bool isComputed()
const override {
return _computed; }
76 int getNumInitialize()
const override {
return _num_initialize; }
77 int getNumCompute()
const override {
return _num_compute; }
78 int getNumApply()
const override {
return _num_apply; }
79 double getInitializeTime()
const override {
return _init_time; }
80 double getComputeTime()
const override {
return _compute_time; }
81 double getApplyTime()
const override {
return _apply_time; }
82 Teuchos::RCP<const Tpetra::Map<>> getDomainMap()
const override
84 return _A->getDomainMap();
86 Teuchos::RCP<const Tpetra::Map<>> getRangeMap()
const override
88 return _A->getRangeMap();
90 void setParameters(
const Teuchos::ParameterList& pl)
override;
91 void initialize()
override;
92 void compute()
override;
93 void apply(
const Tpetra::MultiVector<>& x,
94 Tpetra::MultiVector<>& y,
95 Teuchos::ETransp mode,
97 double beta)
const override;
105 #endif // VERTEXCFD_LINEARSOLVERS_PRECONDITIONER_HPP