9#ifndef MUELU_TPETRAOPERATORASROWMATRIX_HPP
10#define MUELU_TPETRAOPERATORASROWMATRIX_HPP
12#include <Teuchos_RCP.hpp>
13#include <Tpetra_RowMatrix.hpp>
18template <class Scalar = Tpetra::Operator<>::scalar_type,
19 class LocalOrdinal =
typename Tpetra::Operator<Scalar>::local_ordinal_type,
20 class GlobalOrdinal =
typename Tpetra::Operator<Scalar, LocalOrdinal>::global_ordinal_type,
21 class Node =
typename Tpetra::Operator<Scalar, LocalOrdinal, GlobalOrdinal>::node_type>
24 using op_type = Tpetra::Operator<Scalar, LocalOrdinal, GlobalOrdinal, Node>;
25 using vec_type = Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>;
28 using row_matrix_type = Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>;
31 using mag_type =
typename KokkosKernels::ArithTraits<impl_scalar_type>::mag_type;
34 typename row_matrix_type::local_inds_device_view_type;
36 typename row_matrix_type::local_inds_host_view_type;
38 typename row_matrix_type::nonconst_local_inds_host_view_type;
41 typename row_matrix_type::global_inds_device_view_type;
43 typename row_matrix_type::global_inds_host_view_type;
45 typename row_matrix_type::nonconst_global_inds_host_view_type;
48 typename row_matrix_type::values_device_view_type;
50 typename row_matrix_type::values_host_view_type;
52 typename row_matrix_type::nonconst_values_host_view_type;
63 const RCP<vec_type>& diag)
68 Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> >
getDomainMap()
const {
69 return op_->getDomainMap();
73 Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> >
getRangeMap()
const {
74 return op_->getRangeMap();
82 void apply(
const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& X,
83 Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Y,
84 Teuchos::ETransp mode = Teuchos::NO_TRANS,
85 Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
86 Scalar beta = Teuchos::ScalarTraits<Scalar>::zero())
const {
87 op_->apply(X, Y, mode, alpha, beta);
91 Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> >
getRowMap()
const {
92 return op_->getRangeMap();
95 Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> >
getColMap()
const {
99 typename row_matrix_type::local_ordinal_type
getBlockSize()
const {
103 Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const {
104 return op_->getDomainMap()->getComm();
107 Teuchos::RCP<const Tpetra::RowGraph<LocalOrdinal, GlobalOrdinal, Node> >
getGraph()
const {
112 return getRowMap()->getGlobalNumElements();
120 return getRowMap()->getLocalNumElements();
179 size_t& NumEntries)
const {
187 size_t& NumEntries)
const {
205 void getLocalDiagCopy(Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& diag)
const {
212 void leftScale(
const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) {
216 void rightScale(
const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) {
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Exception throws to report errors in the internal logical of the program.
Teuchos::RCP< const Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node > > getGraph() const
void getGlobalRowCopy(GlobalOrdinal GlobalRow, nonconst_global_inds_host_view_type &Indices, nonconst_values_host_view_type &Values, size_t &NumEntries) const
typename row_matrix_type::nonconst_values_host_view_type nonconst_values_host_view_type
void getLocalRowView(LocalOrdinal LocalRow, local_inds_host_view_type &indices, values_host_view_type &values) const
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
typename row_matrix_type::local_inds_host_view_type local_inds_host_view_type
Tpetra::global_size_t getGlobalNumEntries() const
typename row_matrix_type::values_host_view_type values_host_view_type
typename row_matrix_type::global_inds_host_view_type global_inds_host_view_type
void apply(const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Returns in Y the result of a Tpetra::Operator applied to a Tpetra::MultiVector X.
typename row_matrix_type::local_inds_device_view_type local_inds_device_view_type
size_t getGlobalMaxNumRowEntries() const
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
typename row_matrix_type::global_inds_device_view_type global_inds_device_view_type
Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > vec_type
bool isFillComplete() const
void rightScale(const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
size_t getLocalMaxNumRowEntries() const
typename row_matrix_type::nonconst_global_inds_host_view_type nonconst_global_inds_host_view_type
Tpetra::global_size_t getGlobalNumRows() const
size_t getLocalNumCols() const
typename row_matrix_type::impl_scalar_type impl_scalar_type
GlobalOrdinal getIndexBase() const
Tpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > op_type
bool isLocallyIndexed() const
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Tpetra::Map object associated with the range of this operator.
Tpetra::global_size_t getGlobalNumCols() const
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Tpetra::Map object associated with the domain of this operator.
typename row_matrix_type::values_device_view_type values_device_view_type
typename row_matrix_type::nonconst_local_inds_host_view_type nonconst_local_inds_host_view_type
size_t getLocalNumEntries() const
void getLocalRowCopy(LocalOrdinal LocalRow, nonconst_local_inds_host_view_type &Indices, nonconst_values_host_view_type &Values, size_t &NumEntries) const
mag_type getFrobeniusNorm() const
Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > row_matrix_type
The RowMatrix representing the base class of CrsMatrix.
bool supportsRowViews() const
bool isGloballyIndexed() const
Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
TpetraOperatorAsRowMatrix(const RCP< op_type > &op, const RCP< vec_type > &diag)
void getGlobalRowView(GlobalOrdinal GlobalRow, global_inds_host_view_type &indices, values_host_view_type &values) const
TpetraOperatorAsRowMatrix(const RCP< op_type > &op)
Constructor.
typename KokkosKernels::ArithTraits< impl_scalar_type >::mag_type mag_type
void leftScale(const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
size_t getLocalNumRows() const
row_matrix_type::local_ordinal_type getBlockSize() const
void getLocalDiagCopy(Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Namespace for MueLu classes and methods.