Ifpack2 Templated Preconditioning Package  Version 1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Ifpack2_Details_Amesos2Wrapper_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Ifpack2: Templated Object-Oriented Algebraic Preconditioner Package
4 //
5 // Copyright 2009 NTESS and the Ifpack2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
17 
18 #ifndef IFPACK2_DETAILS_AMESOS2WRAPPER_DECL_HPP
19 #define IFPACK2_DETAILS_AMESOS2WRAPPER_DECL_HPP
20 
21 #include "Ifpack2_ConfigDefs.hpp"
22 
23 #ifdef HAVE_IFPACK2_AMESOS2
24 
27 #include "Tpetra_CrsMatrix.hpp"
28 #include <type_traits>
29 
30 namespace Teuchos {
31 // forward declaration
32 class ParameterList;
33 } // namespace Teuchos
34 
35 namespace Trilinos {
36 namespace Details {
37 template <class MV, class OP, class NormType>
38 class LinearSolver; // forward declaration
39 } // namespace Details
40 } // namespace Trilinos
41 
42 namespace Ifpack2 {
43 namespace Details {
67 template <class MatrixType>
68 class Amesos2Wrapper : virtual public Ifpack2::Preconditioner<typename MatrixType::scalar_type,
69  typename MatrixType::local_ordinal_type,
70  typename MatrixType::global_ordinal_type,
71  typename MatrixType::node_type>,
72  virtual public Ifpack2::Details::CanChangeMatrix<Tpetra::RowMatrix<typename MatrixType::scalar_type,
73  typename MatrixType::local_ordinal_type,
74  typename MatrixType::global_ordinal_type,
75  typename MatrixType::node_type> > {
76  public:
78 
79 
81  typedef typename MatrixType::scalar_type scalar_type;
82 
84  typedef typename MatrixType::local_ordinal_type local_ordinal_type;
85 
87  typedef typename MatrixType::global_ordinal_type global_ordinal_type;
88 
90  typedef typename MatrixType::node_type node_type;
91 
94 
96  typedef Tpetra::RowMatrix<scalar_type,
99  node_type>
101 
102  static_assert(std::is_same<MatrixType, row_matrix_type>::value,
103  "Ifpack2::Details::Amesos2Wrapper: Please use MatrixType = Tpetra::RowMatrix.");
104 
106  typedef Tpetra::Map<local_ordinal_type,
108  node_type>
109  map_type;
110 
112  typedef Tpetra::CrsMatrix<scalar_type,
115  node_type>
118 
120 
127 
129  virtual ~Amesos2Wrapper();
130 
132 
134 
136  void setParameters(const Teuchos::ParameterList& params);
137 
150  void initialize();
151 
153  inline bool isInitialized() const {
154  return IsInitialized_;
155  }
156 
168  void compute();
169 
171  inline bool isComputed() const {
172  return IsComputed_;
173  }
174 
176 
178 
201  virtual void
203 
205 
207 
223  void
224  apply(const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& X,
225  Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& Y,
229 
232 
235 
237  bool hasTransposeApply() const;
238 
240 
242 
245 
248 
250  int getNumInitialize() const;
251 
253  int getNumCompute() const;
254 
256  int getNumApply() const;
257 
259  double getInitializeTime() const;
260 
262  double getComputeTime() const;
263 
265  double getApplyTime() const;
266 
268 
270 
272  std::string description() const;
273 
275  void
277  const Teuchos::EVerbosityLevel verbLevel =
280 
281  private:
284  typedef typename Teuchos::Array<local_ordinal_type>::size_type size_type;
285 
287  typedef Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type> MV;
289  typedef Tpetra::Operator<scalar_type, local_ordinal_type, global_ordinal_type, node_type> OP;
290 
293 
296 
299 
306  makeLocalFilter(const Teuchos::RCP<const row_matrix_type>& A);
307 
309  // Teuchos::RCP<const MatrixType> A_;
311 
321 
323  // \name Parameters (set by setParameters())
325 
329 
331  // \name Other internal data
333 
335  double InitializeTime_;
337  double ComputeTime_;
339  mutable double ApplyTime_;
341  int NumInitialize_;
343  int NumCompute_;
345  mutable int NumApply_;
347  bool IsInitialized_;
349  bool IsComputed_;
352  std::string SolverName_;
354 }; // class Amesos2Wrapper
355 
356 } // namespace Details
357 } // namespace Ifpack2
358 
359 #endif // HAVE_IFPACK2_AMESOS2
360 
361 #endif // IFPACK2_DETAILS_AMESOS2WRAPPER_DECL_HPP
double getInitializeTime() const
The total time in seconds spent in successful calls to initialize().
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:153
Mix-in interface for preconditioners that can change their matrix after construction.
Definition: Ifpack2_Details_CanChangeMatrix.hpp:60
double getApplyTime() const
The total time in seconds spent in successful calls to apply().
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:163
void setParameters(const Teuchos::ParameterList &params)
Set parameters.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:51
Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > row_matrix_type
Type of the Tpetra::RowMatrix specialization that this class uses.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:100
bool hasTransposeApply() const
Whether this object&#39;s apply() method can apply the transpose (or conjugate transpose, if applicable).
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:133
int getNumApply() const
The total number of successful calls to apply().
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:148
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:87
void initialize()
Compute the preordering and symbolic factorization of the matrix.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:225
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The input matrix&#39;s communicator.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:95
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to the given output stream.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:492
int getNumInitialize() const
The total number of successful calls to initialize().
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:138
bool isInitialized() const
Returns true if the preconditioner has been successfully initialized.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:153
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:81
Teuchos::RCP< const map_type > getDomainMap() const
Tpetra::Map representing the domain of this operator.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:112
Tpetra::CrsMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > crs_matrix_type
Type of the Tpetra::CrsMatrix specialization that this class uses.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:116
Ordinal size_type
Wrapper class for direct solvers in Amesos2.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:68
Teuchos::RCP< const map_type > getRangeMap() const
Tpetra::Map representing the range of this operator.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:123
Interface for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:74
virtual ~Amesos2Wrapper()
Destructor.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:48
MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:90
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:84
Declaration of interface for preconditioners that can change their matrix after construction.
static const EVerbosityLevel verbLevel_default
Amesos2Wrapper(const Teuchos::RCP< const row_matrix_type > &A)
Constructor.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:35
Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > map_type
Type of the Tpetra::Map specialization that this class uses.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:103
Teuchos::RCP< const row_matrix_type > getMatrix() const
The input matrix; the matrix to be preconditioned.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:106
Teuchos::ScalarTraits< scalar_type >::magnitudeType magnitude_type
The type of the magnitude (absolute value) of a matrix entry.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:93
double getComputeTime() const
The total time in seconds spent in successful calls to compute().
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:158
int getNumCompute() const
The total number of successful calls to compute().
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:143
void apply(const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &X, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, scalar_type alpha=Teuchos::ScalarTraits< scalar_type >::one(), scalar_type beta=Teuchos::ScalarTraits< scalar_type >::zero()) const
Apply the preconditioner to X, resulting in Y.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:360
void compute()
Compute the numeric factorization of the matrix.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:329
std::string description() const
A one-line description of this object.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:455
virtual void setMatrix(const Teuchos::RCP< const row_matrix_type > &A)
Change the matrix to be preconditioned.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:168
bool isComputed() const
True if compute() completed successfully, else false.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:171