10#ifndef IFPACK2_DETAILS_TRIDISOLVER_DECL_HPP
11#define IFPACK2_DETAILS_TRIDISOLVER_DECL_HPP
16#include "Ifpack2_ConfigDefs.hpp"
19#include "Ifpack2_Details_LapackSupportsScalar.hpp"
20#include "Tpetra_RowMatrix.hpp"
21#include "Tpetra_Import_fwd.hpp"
22#include "Tpetra_Export_fwd.hpp"
23#include "Teuchos_SerialTriDiMatrix.hpp"
41template <
class MatrixType,
42 const bool stub = !LapackSupportsScalar<typename MatrixType::scalar_type>::value>
44 typename MatrixType::local_ordinal_type,
45 typename MatrixType::global_ordinal_type,
46 typename MatrixType::node_type>,
48 typename MatrixType::local_ordinal_type,
49 typename MatrixType::global_ordinal_type,
50 typename MatrixType::node_type> > {};
53template <
class MatrixType>
55 typename MatrixType::local_ordinal_type,
56 typename MatrixType::global_ordinal_type,
57 typename MatrixType::node_type>,
59 typename MatrixType::local_ordinal_type,
60 typename MatrixType::global_ordinal_type,
61 typename MatrixType::node_type> > {
84 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType
magnitude_type;
87 typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>
row_matrix_type;
89 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
"Ifpack2::Details::TriDiSolver: The template parameter MatrixType must be a Tpetra::RowMatrix specialization. Please don't use Tpetra::CrsMatrix (a subclass of Tpetra::RowMatrix) here anymore. The constructor can take either a RowMatrix or a CrsMatrix just fine.");
91 typedef typename row_matrix_type::nonconst_global_inds_host_view_type nonconst_global_inds_host_view_type;
92 typedef typename row_matrix_type::nonconst_local_inds_host_view_type nonconst_local_inds_host_view_type;
93 typedef typename row_matrix_type::nonconst_values_host_view_type nonconst_values_host_view_type;
96 typedef Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type>
map_type;
105 TriDiSolver(
const Teuchos::RCP<const row_matrix_type>& matrix);
132 apply(
const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& X,
133 Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& Y,
134 Teuchos::ETransp mode = Teuchos::NO_TRANS,
135 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
136 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const;
172 Teuchos::RCP<const row_matrix_type>
getMatrix()
const;
175 void setMatrix(
const Teuchos::RCP<const row_matrix_type>& A);
204 describe(Teuchos::FancyOStream& out,
205 const Teuchos::EVerbosityLevel verbLevel =
206 Teuchos::Describable::verbLevel_default)
const;
211 describeLocal(Teuchos::FancyOStream& out,
212 const Teuchos::EVerbosityLevel verbLevel)
const;
225 extract(Teuchos::SerialTriDiMatrix<int, scalar_type>& A_local_tridi,
238 factor(Teuchos::SerialTriDiMatrix<int, scalar_type>& A,
239 const Teuchos::ArrayView<int>& ipiv);
257 typedef Teuchos::ScalarTraits<scalar_type> STS;
268 applyImpl(
const MV& X,
270 const Teuchos::ETransp mode,
275 Teuchos::RCP<const row_matrix_type> A_;
278 Teuchos::RCP<const row_matrix_type> A_local_;
281 Teuchos::SerialTriDiMatrix<int, scalar_type> A_local_tridi_;
284 Teuchos::Array<int> ipiv_;
287 double initializeTime_;
293 mutable double applyTime_;
302 mutable int numApply_;
312template <
class MatrixType>
314 typename MatrixType::local_ordinal_type,
315 typename MatrixType::global_ordinal_type,
316 typename MatrixType::node_type>,
318 typename MatrixType::local_ordinal_type,
319 typename MatrixType::global_ordinal_type,
320 typename MatrixType::node_type> > {
343 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType
magnitude_type;
346 typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type>
row_matrix_type;
348 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
"Ifpack2::Details::TriDiSolver: The template parameter MatrixType must be a Tpetra::RowMatrix specialization. Please don't use Tpetra::CrsMatrix (a subclass of Tpetra::RowMatrix) here anymore. The constructor can take either a RowMatrix or a CrsMatrix just fine.");
351 typedef Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type>
map_type;
360 TriDiSolver(
const Teuchos::RCP<const row_matrix_type>& matrix);
387 apply(
const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& X,
388 Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& Y,
389 Teuchos::ETransp mode = Teuchos::NO_TRANS,
390 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
391 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const;
427 Teuchos::RCP<const row_matrix_type>
getMatrix()
const;
430 void setMatrix(
const Teuchos::RCP<const row_matrix_type>& A);
459 describe(Teuchos::FancyOStream& out,
460 const Teuchos::EVerbosityLevel verbLevel =
461 Teuchos::Describable::verbLevel_default)
const;
464 describeLocal(Teuchos::FancyOStream& out,
465 const Teuchos::EVerbosityLevel verbLevel)
const;
Declaration of interface for preconditioners that can change their matrix after construction.
Mix-in interface for preconditioners that can change their matrix after construction.
Definition Ifpack2_Details_CanChangeMatrix.hpp:60
virtual void setMatrix(const Teuchos::RCP< const Tpetra::RowMatrix< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > > &A)=0
Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > row_matrix_type
Specialization of Tpetra::RowMatrix used by this class.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:87
TriDiSolver(const Teuchos::RCP< const row_matrix_type > &matrix)
Constructor.
Definition Ifpack2_Details_TriDiSolver_def.hpp:36
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input (global) matrix.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:78
Teuchos::ScalarTraits< scalar_type >::magnitudeType magnitude_type
The type of the absolute value (magnitude) of a scalar_type.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:84
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to the given FancyOStream.
Definition Ifpack2_Details_TriDiSolver_def.hpp:504
MatrixType::node_type node_type
The Node type of the input (global) matrix.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:81
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input (global) matrix.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:75
std::string description() const
A one-line description of this object.
Definition Ifpack2_Details_TriDiSolver_def.hpp:444
MatrixType matrix_type
The first template parameter of this class.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:69
MatrixType::scalar_type scalar_type
The type of entries in the input (global) matrix.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:72
Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > map_type
Specialization of Tpetra::Map used by this class.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:96
TriDiSolver(const Teuchos::RCP< const row_matrix_type > &matrix)
Constructor.
Definition Ifpack2_Details_TriDiSolver_def.hpp:607
MatrixType::scalar_type scalar_type
The type of entries in the input (global) matrix.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:331
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to the given FancyOStream.
Definition Ifpack2_Details_TriDiSolver_def.hpp:714
Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > row_matrix_type
Specialization of Tpetra::RowMatrix used by this class.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:346
MatrixType matrix_type
The first template parameter of this class.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:328
MatrixType::node_type node_type
The Node type of the input (global) matrix.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:340
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input (global) matrix.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:337
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input (global) matrix.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:334
Teuchos::ScalarTraits< scalar_type >::magnitudeType magnitude_type
The type of the absolute value (magnitude) of a scalar_type.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:343
std::string description() const
A one-line description of this object.
Definition Ifpack2_Details_TriDiSolver_def.hpp:709
Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > map_type
Specialization of Tpetra::Map used by this class.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:351
"Preconditioner" that uses LAPACK's tridi LU.
Definition Ifpack2_Details_TriDiSolver_decl.hpp:50
Interface for all Ifpack2 preconditioners.
Definition Ifpack2_Preconditioner.hpp:74
virtual double getComputeTime() const=0
virtual bool isInitialized() const=0
virtual int getNumCompute() const=0
virtual Teuchos::RCP< const Tpetra::RowMatrix< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > > getMatrix() const=0
virtual int getNumApply() const=0
virtual double getApplyTime() const=0
virtual void setParameters(const Teuchos::ParameterList &List)=0
virtual void apply(const Tpetra::MultiVector< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > &X, Tpetra::MultiVector< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, MatrixType::scalar_type alpha=Teuchos::ScalarTraits< MatrixType::scalar_type >::one(), MatrixType::scalar_type beta=Teuchos::ScalarTraits< MatrixType::scalar_type >::zero()) const=0
virtual Teuchos::RCP< const Tpetra::Map< MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > > getRangeMap() const=0
virtual Teuchos::RCP< const Tpetra::Map< MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > > getDomainMap() const=0
virtual bool isComputed() const=0
virtual void initialize()=0
virtual double getInitializeTime() const=0
virtual int getNumInitialize() const=0
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:40