| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// MueLu: A package for multigrid based preconditioning |
| 4 |
// |
| 5 |
// Copyright 2012 NTESS and the MueLu contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
#ifndef TPETRA_OPERATORWITHDIAGONAL_HPP |
| 11 |
#define TPETRA_OPERATORWITHDIAGONAL_HPP |
| 12 |
|
| 13 |
#include <Teuchos_RCP.hpp> |
| 14 |
#include <Tpetra_Map.hpp> |
| 15 |
#include <Tpetra_MultiVector.hpp> |
| 16 |
#include <Tpetra_RowMatrix.hpp> |
| 17 |
#include "Teuchos_VerbosityLevel.hpp" |
| 18 |
|
| 19 |
namespace Tpetra { |
| 20 |
|
| 21 |
template <class Scalar = Tpetra::RowMatrix<>::scalar_type, |
| 22 |
class LocalOrdinal = typename Tpetra::RowMatrix<Scalar>::local_ordinal_type, |
| 23 |
class GlobalOrdinal = typename Tpetra::RowMatrix<Scalar, LocalOrdinal>::global_ordinal_type, |
| 24 |
class Node = typename Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal>::node_type> |
| 25 |
class OperatorWithDiagonal : public Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> { |
| 26 |
public: |
| 27 |
using mv_type = Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>; |
| 28 |
using map_type = Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node>; |
| 29 |
|
| 30 |
using row_matrix_type = RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>; |
| 31 |
|
| 32 |
using impl_scalar_type = typename row_matrix_type::impl_scalar_type; |
| 33 |
using mag_type = typename Kokkos::ArithTraits<impl_scalar_type>::mag_type; |
| 34 |
|
| 35 |
using local_inds_device_view_type = |
| 36 |
typename row_matrix_type::local_inds_device_view_type; |
| 37 |
using local_inds_host_view_type = |
| 38 |
typename row_matrix_type::local_inds_host_view_type; |
| 39 |
using nonconst_local_inds_host_view_type = |
| 40 |
typename row_matrix_type::nonconst_local_inds_host_view_type; |
| 41 |
|
| 42 |
using global_inds_device_view_type = |
| 43 |
typename row_matrix_type::global_inds_device_view_type; |
| 44 |
using global_inds_host_view_type = |
| 45 |
typename row_matrix_type::global_inds_host_view_type; |
| 46 |
using nonconst_global_inds_host_view_type = |
| 47 |
typename row_matrix_type::nonconst_global_inds_host_view_type; |
| 48 |
|
| 49 |
using values_device_view_type = |
| 50 |
typename row_matrix_type::values_device_view_type; |
| 51 |
using values_host_view_type = |
| 52 |
typename row_matrix_type::values_host_view_type; |
| 53 |
using nonconst_values_host_view_type = |
| 54 |
typename row_matrix_type::nonconst_values_host_view_type; |
| 55 |
|
| 56 |
//! @name Constructor/Destructor |
| 57 |
//@{ |
| 58 |
|
| 59 |
virtual ~OperatorWithDiagonal() = default; |
| 60 |
|
| 61 |
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { |
| 62 |
throw std::runtime_error("Not implemented."); |
| 63 |
} |
| 64 |
|
| 65 |
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { |
| 66 |
throw std::runtime_error("Not implemented."); |
| 67 |
} |
| 68 |
|
| 69 |
size_t getGlobalMaxNumRowEntries() const { |
| 70 |
throw std::runtime_error("Not implemented."); |
| 71 |
} |
| 72 |
|
| 73 |
LocalOrdinal getBlockSize() const { |
| 74 |
throw std::runtime_error("Not implemented."); |
| 75 |
} |
| 76 |
|
| 77 |
size_t getLocalMaxNumRowEntries() const { |
| 78 |
throw std::runtime_error("Not implemented."); |
| 79 |
} |
| 80 |
|
| 81 |
bool hasColMap() const { |
| 82 |
return false; |
| 83 |
} |
| 84 |
|
| 85 |
bool isLocallyIndexed() const { |
| 86 |
return true; |
| 87 |
} |
| 88 |
|
| 89 |
bool isGloballyIndexed() const { |
| 90 |
return true; |
| 91 |
} |
| 92 |
|
| 93 |
bool isFillComplete() const { |
| 94 |
return true; |
| 95 |
} |
| 96 |
|
| 97 |
bool supportsRowViews() const { |
| 98 |
return false; |
| 99 |
} |
| 100 |
|
| 101 |
void |
| 102 |
getGlobalRowCopy(GlobalOrdinal GlobalRow, |
| 103 |
nonconst_global_inds_host_view_type& Indices, |
| 104 |
nonconst_values_host_view_type& Values, |
| 105 |
size_t& NumEntries) const { |
| 106 |
throw std::runtime_error("Not implemented."); |
| 107 |
} |
| 108 |
|
| 109 |
void |
| 110 |
getLocalRowCopy(LocalOrdinal LocalRow, |
| 111 |
nonconst_local_inds_host_view_type& Indices, |
| 112 |
nonconst_values_host_view_type& Values, |
| 113 |
size_t& NumEntries) const { |
| 114 |
throw std::runtime_error("Not implemented."); |
| 115 |
} |
| 116 |
|
| 117 |
void |
| 118 |
getGlobalRowView(GlobalOrdinal GlobalRow, |
| 119 |
global_inds_host_view_type& indices, |
| 120 |
values_host_view_type& values) const { |
| 121 |
throw std::runtime_error("Not implemented."); |
| 122 |
} |
| 123 |
|
| 124 |
void |
| 125 |
getLocalRowView(LocalOrdinal LocalRow, |
| 126 |
local_inds_host_view_type& indices, |
| 127 |
values_host_view_type& values) const { |
| 128 |
throw std::runtime_error("Not implemented."); |
| 129 |
} |
| 130 |
|
| 131 |
void leftScale(const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) { |
| 132 |
throw std::runtime_error("Not implemented."); |
| 133 |
} |
| 134 |
|
| 135 |
void rightScale(const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) { |
| 136 |
throw std::runtime_error("Not implemented."); |
| 137 |
} |
| 138 |
|
| 139 |
mag_type getFrobeniusNorm() const { |
| 140 |
return 0.; |
| 141 |
} |
| 142 |
}; |
| 143 |
} // namespace Tpetra |
| 144 |
|
| 145 |
#endif // TPETRA_OPERATORWITHDIAGONAL_HPP |