50 #ifndef IFPACK2_KRYLOV_DECL_HPP 51 #define IFPACK2_KRYLOV_DECL_HPP 57 #include "BelosTpetraAdapter.hpp" 58 #include "Teuchos_ScalarTraits.hpp" 59 #include <type_traits> 77 template <
typename ScalarType>
79 typedef ScalarType type;
94 template<
class MatrixType>
97 typename MatrixType::local_ordinal_type,
98 typename MatrixType::global_ordinal_type,
99 typename MatrixType::node_type>,
101 typename MatrixType::local_ordinal_type,
102 typename MatrixType::global_ordinal_type,
103 typename MatrixType::node_type> >
125 typedef typename Teuchos::ScalarTraits<scalar_type>::magnitudeType
magnitude_type;
128 typedef Tpetra::RowMatrix<scalar_type,
133 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
"Ifpack2::Krylov: 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.");
146 explicit Krylov (
const Teuchos::RCP<const row_matrix_type>& A);
169 void setParameters (
const Teuchos::ParameterList& params);
176 return IsInitialized_;
213 virtual void setMatrix (
const Teuchos::RCP<const row_matrix_type>& A);
221 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
222 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
223 Teuchos::ETransp mode = Teuchos::NO_TRANS,
224 scalar_type alpha = Teuchos::ScalarTraits<scalar_type>::one(),
225 scalar_type beta = Teuchos::ScalarTraits<scalar_type>::zero())
const;
228 Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> > getDomainMap()
const;
231 Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> > getRangeMap()
const;
234 bool hasTransposeApply()
const;
241 Teuchos::RCP<const Teuchos::Comm<int> > getComm()
const;
244 Teuchos::RCP<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > getMatrix()
const;
247 int getNumInitialize()
const;
250 int getNumCompute()
const;
253 int getNumApply()
const;
256 double getInitializeTime()
const;
259 double getComputeTime()
const;
262 double getApplyTime()
const;
268 std::string description()
const;
271 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const;
276 typedef Teuchos::ScalarTraits<scalar_type> STS;
277 typedef Teuchos::ScalarTraits<magnitude_type> STM;
289 Teuchos::RCP<const row_matrix_type> A_;
296 std::string iterationType_;
302 magnitude_type resTol_;
308 bool ZeroStartingSolution_;
315 int PreconditionerType_;
321 Teuchos::ParameterList precParams_;
332 mutable int NumApply_;
334 double InitializeTime_;
338 mutable double ApplyTime_;
342 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>,
343 Tpetra::Operator<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > > belosProblem_;
347 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>,
348 Tpetra::Operator<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > > belosSolver_;
351 Teuchos::RCP<prec_type> ifpack2_prec_;
356 #endif // IFPACK2_KRYLOV_DECL_HPP Mix-in interface for preconditioners that can change their matrix after construction.
Definition: Ifpack2_Details_CanChangeMatrix.hpp:93
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_Krylov_decl.hpp:110
Traits class for determining the scalar type to use for Belos.
Definition: Ifpack2_Krylov_decl.hpp:78
Teuchos::ScalarTraits< scalar_type >::magnitudeType magnitude_type
The type of the magnitude (absolute value) of a matrix entry.
Definition: Ifpack2_Krylov_decl.hpp:125
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_Krylov_decl.hpp:119
MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition: Ifpack2_Krylov_decl.hpp:122
Ifpack2::Preconditioner< scalar_type, local_ordinal_type, global_ordinal_type, node_type > prec_type
Type of the Ifpack2::Preconditioner specialization from which this class inherits.
Definition: Ifpack2_Krylov_decl.hpp:133
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_Krylov_decl.hpp:116
Interface for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:107
Declaration of interface for preconditioners that can change their matrix after construction.
Wrapper for iterative linear solvers (e.g., CG or GMRES).
Definition: Ifpack2_Krylov_decl.hpp:95
bool isComputed() const
Return true if compute() completed successfully, else false.
Definition: Ifpack2_Krylov_decl.hpp:183
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:63
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_Krylov_decl.hpp:131
BelosScalarType< scalar_type >::type belos_scalar_type
The scalar type used by Belos (which may not be scalar_type)
Definition: Ifpack2_Krylov_decl.hpp:113
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
bool isInitialized() const
Return true if initialize() completed successfully, else false.
Definition: Ifpack2_Krylov_decl.hpp:175