43 #ifndef IFPACK2_DIAGONAL_DECL_HPP
44 #define IFPACK2_DIAGONAL_DECL_HPP
48 #include "Tpetra_CrsMatrix_decl.hpp"
49 #include <type_traits>
70 template<
class MatrixType>
73 typename MatrixType::local_ordinal_type,
74 typename MatrixType::global_ordinal_type,
75 typename MatrixType::node_type>,
77 typename MatrixType::local_ordinal_type,
78 typename MatrixType::global_ordinal_type,
79 typename MatrixType::node_type> >
82 typedef typename MatrixType::scalar_type scalar_type;
83 typedef typename MatrixType::local_ordinal_type local_ordinal_type;
84 typedef typename MatrixType::global_ordinal_type global_ordinal_type;
85 typedef typename MatrixType::node_type node_type;
89 typedef Tpetra::RowMatrix<scalar_type,
92 node_type> row_matrix_type;
94 static_assert(std::is_same<MatrixType, row_matrix_type>::value,
"Ifpack2::Diagonal: 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.");
97 typedef Tpetra::CrsMatrix<scalar_type,
100 node_type> crs_matrix_type;
102 typedef Tpetra::Vector<scalar_type,
105 node_type> vector_type;
107 typedef Tpetra::Map<local_ordinal_type,
139 virtual ~Diagonal ();
151 bool isInitialized ()
const {
152 return isInitialized_;
159 bool isComputed ()
const {
202 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
203 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
231 double getComputeFlops()
const;
234 double getApplyFlops()
const;
237 int getNumInitialize()
const;
240 int getNumCompute()
const;
243 int getNumApply()
const;
246 double getInitializeTime()
const;
249 double getComputeTime()
const;
252 double getApplyTime()
const;
259 std::string description()
const;
284 typedef Kokkos::View<size_t*, typename node_type::device_type> offsets_type;
285 offsets_type offsets_;
287 double initializeTime_;
289 mutable double applyTime_;
293 mutable int numApply_;
315 template<
class MatrixType,
class VectorType>
316 Teuchos::RCP<Ifpack2::Diagonal<Tpetra::RowMatrix<
typename MatrixType::scalar_type,
317 typename MatrixType::local_ordinal_type,
318 typename MatrixType::global_ordinal_type,
319 typename MatrixType::node_type> > >
322 typedef Tpetra::RowMatrix<
typename MatrixType::scalar_type,
323 typename MatrixType::local_ordinal_type,
324 typename MatrixType::global_ordinal_type,
325 typename MatrixType::node_type> row_matrix_type;
327 return Teuchos::rcp (
new Ifpack2::Diagonal<row_matrix_type> (invdiag));
Mix-in interface for preconditioners that can change their matrix after construction.
Definition: Ifpack2_Details_CanChangeMatrix.hpp:93
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Interface for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:107
Declaration of interface for preconditioners that can change their matrix after construction.
static const EVerbosityLevel verbLevel_default