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#if KOKKOS_VERSION >= 40799
32 using mag_type =
typename KokkosKernels::ArithTraits<impl_scalar_type>::mag_type;
34 using mag_type =
typename Kokkos::ArithTraits<impl_scalar_type>::mag_type;
38 typename row_matrix_type::local_inds_device_view_type;
40 typename row_matrix_type::local_inds_host_view_type;
42 typename row_matrix_type::nonconst_local_inds_host_view_type;
45 typename row_matrix_type::global_inds_device_view_type;
47 typename row_matrix_type::global_inds_host_view_type;
49 typename row_matrix_type::nonconst_global_inds_host_view_type;
52 typename row_matrix_type::values_device_view_type;
54 typename row_matrix_type::values_host_view_type;
56 typename row_matrix_type::nonconst_values_host_view_type;
67 const RCP<vec_type>& diag)
72 Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> >
getDomainMap()
const {
73 return op_->getDomainMap();
77 Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> >
getRangeMap()
const {
78 return op_->getRangeMap();
86 void apply(
const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& X,
87 Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Y,
88 Teuchos::ETransp mode = Teuchos::NO_TRANS,
89 Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
90 Scalar beta = Teuchos::ScalarTraits<Scalar>::zero())
const {
91 op_->apply(X, Y, mode, alpha, beta);
95 Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> >
getRowMap()
const {
96 return op_->getRangeMap();
99 Teuchos::RCP<const Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> >
getColMap()
const {
107 Teuchos::RCP<const Teuchos::Comm<int> >
getComm()
const {
108 return op_->getDomainMap()->getComm();
111 Teuchos::RCP<const Tpetra::RowGraph<LocalOrdinal, GlobalOrdinal, Node> >
getGraph()
const {
116 return getRowMap()->getGlobalNumElements();
124 return getRowMap()->getLocalNumElements();
183 size_t& NumEntries)
const {
191 size_t& NumEntries)
const {
209 void getLocalDiagCopy(Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& diag)
const {
216 void leftScale(
const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) {
220 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
typename Kokkos::ArithTraits< impl_scalar_type >::mag_type mag_type
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.
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.