10 #ifndef VERTEXFCFD_LINEARSOLVERS_HYPRE_HPP
11 #define VERTEXFCFD_LINEARSOLVERS_HYPRE_HPP
13 #include <Ifpack2_Details_CanChangeMatrix.hpp>
14 #include <Ifpack2_Preconditioner.hpp>
16 #include <Tpetra_CrsGraph.hpp>
17 #include <Tpetra_CrsMatrix.hpp>
18 #include <Tpetra_Map.hpp>
19 #include <Tpetra_MultiVector.hpp>
20 #include <Tpetra_Vector.hpp>
25 #include <HYPRE_IJ_mv.h>
26 #include <HYPRE_parcsr_ls.h>
27 #include <HYPRE_parcsr_mv.h>
28 #include <_hypre_IJ_mv.h>
29 #include <_hypre_parcsr_mv.h>
33 namespace LinearSolvers
37 class Hypre :
public Ifpack2::Preconditioner<>,
38 public Ifpack2::Details::CanChangeMatrix<Tpetra::RowMatrix<>>
68 bool isComputed()
const override {
return (is_computed_); }
72 void setParameters(
const Teuchos::ParameterList& parameterlist)
override;
76 void setMatrix(
const Teuchos::RCP<
const Tpetra::RowMatrix<>>& A);
114 apply(
const Tpetra::MultiVector<>& x,
115 Tpetra::MultiVector<>& y,
116 Teuchos::ETransp mode = Teuchos::NO_TRANS,
117 double alpha = Teuchos::ScalarTraits<double>::one(),
118 double beta = Teuchos::ScalarTraits<double>::zero())
const override;
121 Teuchos::RCP<const Tpetra::Map<>>
getDomainMap()
const override;
124 Teuchos::RCP<const Tpetra::Map<>>
getRangeMap()
const override;
134 Teuchos::RCP<const Teuchos::Comm<int>>
getComm()
const;
137 Teuchos::RCP<const Tpetra::RowMatrix<>>
getMatrix()
const override;
165 void describe(Teuchos::FancyOStream& out,
166 const Teuchos::EVerbosityLevel verbLevel
167 = Teuchos::Describable::verbLevel_default)
const override;
181 int copyTpetraToHypre();
184 Teuchos::RCP<const Tpetra::Map<>> makeContiguousColumnMap(
185 Teuchos::RCP<
const Tpetra::CrsMatrix<>>& Matrix)
const;
192 hypreApply(
const Tpetra::MultiVector<>& x, Tpetra::MultiVector<>& y)
const;
197 Teuchos::RCP<const Tpetra::RowMatrix<>> A_;
200 Teuchos::ParameterList List_;
203 bool is_initialized_;
218 mutable int num_apply_;
221 double initialize_time_;
224 double compute_time_;
230 mutable double apply_time_;
233 mutable HYPRE_IJMatrix hypre_A_;
236 mutable HYPRE_IJVector hypre_x_;
237 mutable HYPRE_ParVector par_x_;
240 mutable HYPRE_IJVector hypre_y_;
241 mutable HYPRE_ParVector par_y_;
244 Teuchos::RCP<const Tpetra::Map<>> globally_contiguous_row_map_;
245 Teuchos::RCP<const Tpetra::Map<>> globally_contiguous_col_map_;
248 std::string hypredrive_yaml_;
251 HYPREDRV_t hypredrv_;
Definition: VertexCFD_LinearSolvers_Hypre.hpp:39
Definition: tstMethodManufacturedSolutionBC.cpp:23
bool isInitialized() const
Definition: VertexCFD_LinearSolvers_Hypre.hpp:58
bool hasTransposeApply() const override
Whether it's possible to apply the transpose of this operator.
Definition: VertexCFD_LinearSolvers_Hypre.cpp:575
std::string description() const override
A simple one-line description of this object.
Definition: VertexCFD_LinearSolvers_Hypre.cpp:333
int getNumApply() const override
The number of calls to apply().
Definition: VertexCFD_LinearSolvers_Hypre.cpp:508
Teuchos::RCP< const Tpetra::Map<> > getRangeMap() const override
The Tpetra::Map representing the range of this operator.
Definition: VertexCFD_LinearSolvers_Hypre.cpp:545
double getInitializeTime() const override
The time (in seconds) spent in initialize().
Definition: VertexCFD_LinearSolvers_Hypre.cpp:514
Hypre()
Constructor.
Definition: VertexCFD_LinearSolvers_Hypre.cpp:49
void setMatrix(const Teuchos::RCP< const Tpetra::RowMatrix<>> &A)
Set the matrix to be preconditioned.
Definition: VertexCFD_LinearSolvers_Hypre.cpp:558
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const override
Print the object with some verbosity level to a Teuchos::FancyOStream.
Definition: VertexCFD_LinearSolvers_Hypre.cpp:360
int getNumInitialize() const override
The number of calls to initialize().
Definition: VertexCFD_LinearSolvers_Hypre.cpp:496
void apply(const Tpetra::MultiVector<> &x, Tpetra::MultiVector<> &y, Teuchos::ETransp mode=Teuchos::NO_TRANS, double alpha=Teuchos::ScalarTraits< double >::one(), double beta=Teuchos::ScalarTraits< double >::zero()) const override
Apply the preconditioner to X, returning the result in Y.
Definition: VertexCFD_LinearSolvers_Hypre.cpp:276
Teuchos::RCP< const Tpetra::Map<> > getDomainMap() const override
The Tpetra::Map representing the domain of this operator.
Definition: VertexCFD_LinearSolvers_Hypre.cpp:532
Teuchos::RCP< const Tpetra::RowMatrix<> > getMatrix() const override
The matrix for which this is a preconditioner.
Definition: VertexCFD_LinearSolvers_Hypre.cpp:569
void compute() override
Definition: VertexCFD_LinearSolvers_Hypre.cpp:195
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The communicator over which the matrix is distributed.
~Hypre()
Destructor.
Definition: VertexCFD_LinearSolvers_Hypre.cpp:62
double getApplyTime() const override
The time (in seconds) spent in apply().
Definition: VertexCFD_LinearSolvers_Hypre.cpp:526
int getNumCompute() const override
The number of calls to compute().
Definition: VertexCFD_LinearSolvers_Hypre.cpp:502
void initialize() override
Initialize the preconditioner, does not touch matrix values.
Definition: VertexCFD_LinearSolvers_Hypre.cpp:82
bool isComputed() const override
Definition: VertexCFD_LinearSolvers_Hypre.hpp:68
double getComputeTime() const override
The time (in seconds) spent in compute().
Definition: VertexCFD_LinearSolvers_Hypre.cpp:520
void setParameters(const Teuchos::ParameterList ¶meterlist) override
Definition: VertexCFD_LinearSolvers_Hypre.cpp:189