| 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 XPETRA_OPERATORWITHDIAGONAL_HPP |
| 11 |
#define XPETRA_OPERATORWITHDIAGONAL_HPP |
| 12 |
|
| 13 |
#include <Xpetra_Map.hpp> |
| 14 |
#include <Xpetra_MultiVector.hpp> |
| 15 |
#include <Xpetra_TpetraRowMatrix.hpp> |
| 16 |
|
| 17 |
namespace Xpetra { |
| 18 |
|
| 19 |
template <class Scalar, |
| 20 |
class LocalOrdinal, |
| 21 |
class GlobalOrdinal, |
| 22 |
class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType> |
| 23 |
class OperatorWithDiagonal : virtual public Xpetra::TpetraRowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> { |
| 24 |
public: |
| 25 |
typedef Scalar scalar_type; |
| 26 |
typedef LocalOrdinal local_ordinal_type; |
| 27 |
typedef GlobalOrdinal global_ordinal_type; |
| 28 |
typedef Node node_type; |
| 29 |
|
| 30 |
//! @name Constructor/Destructor Methods |
| 31 |
//@{ |
| 32 |
|
| 33 |
//! Destructor. |
| 34 |
virtual ~OperatorWithDiagonal() = default; |
| 35 |
|
| 36 |
//@} |
| 37 |
|
| 38 |
//! @name Matrix Query Methods |
| 39 |
//@{ |
| 40 |
|
| 41 |
//! Returns the Map that describes the row distribution in this matrix. |
| 42 |
const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getRowMap() const { |
| 43 |
throw std::runtime_error("Not implemented."); |
| 44 |
}; |
| 45 |
|
| 46 |
//! Returns the Map that describes the column distribution in this matrix. |
| 47 |
const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getColMap() const { |
| 48 |
throw std::runtime_error("Not implemented."); |
| 49 |
}; |
| 50 |
|
| 51 |
//! Returns the number of global rows in this matrix. |
| 52 |
global_size_t getGlobalNumRows() const { |
| 53 |
return this->getRangeMap()->getGlobalNumElements(); |
| 54 |
}; |
| 55 |
|
| 56 |
//! Returns the number of global columns in this matrix. |
| 57 |
global_size_t getGlobalNumCols() const { |
| 58 |
return this->getDomainMap()->getGlobalNumElements(); |
| 59 |
}; |
| 60 |
|
| 61 |
//! Returns the number of rows owned on the calling node. |
| 62 |
size_t getLocalNumRows() const { |
| 63 |
return this->getRangeMap()->getLocalNumElements(); |
| 64 |
}; |
| 65 |
|
| 66 |
//! Returns the number of columns needed to apply the forward operator on this node, i.e., the number of elements listed in the column map. |
| 67 |
size_t getLocalNumCols() const { |
| 68 |
return this->getDomainMap()->getLocalNumElements(); |
| 69 |
}; |
| 70 |
|
| 71 |
//! Returns the global number of entries in this matrix. |
| 72 |
global_size_t getGlobalNumEntries() const { |
| 73 |
throw std::runtime_error("Not implemented."); |
| 74 |
}; |
| 75 |
|
| 76 |
//! Returns the local number of entries in this matrix. |
| 77 |
size_t getLocalNumEntries() const { |
| 78 |
throw std::runtime_error("Not implemented."); |
| 79 |
}; |
| 80 |
|
| 81 |
//! Returns the current number of entries on this node in the specified local row. |
| 82 |
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { |
| 83 |
throw std::runtime_error("Not implemented."); |
| 84 |
}; |
| 85 |
|
| 86 |
//! Returns the maximum number of entries across all rows/columns on all nodes. |
| 87 |
size_t getGlobalMaxNumRowEntries() const { |
| 88 |
throw std::runtime_error("Not implemented."); |
| 89 |
}; |
| 90 |
|
| 91 |
//! Returns the maximum number of entries across all rows/columns on this node. |
| 92 |
size_t getLocalMaxNumRowEntries() const { |
| 93 |
throw std::runtime_error("Not implemented."); |
| 94 |
}; |
| 95 |
|
| 96 |
//! If matrix indices are in the local range, this function returns true. Otherwise, this function returns false. */. |
| 97 |
bool isLocallyIndexed() const { |
| 98 |
return true; |
| 99 |
}; |
| 100 |
|
| 101 |
//! If matrix indices are in the global range, this function returns true. Otherwise, this function returns false. */. |
| 102 |
bool isGloballyIndexed() const { |
| 103 |
return true; |
| 104 |
}; |
| 105 |
|
| 106 |
//! Returns true if fillComplete() has been called. |
| 107 |
bool isFillComplete() const { |
| 108 |
return true; |
| 109 |
}; |
| 110 |
|
| 111 |
//! Returns true if getLocalRowView() and getGlobalRowView() are valid for this class. |
| 112 |
bool supportsRowViews() const { |
| 113 |
return false; |
| 114 |
}; |
| 115 |
|
| 116 |
//@} |
| 117 |
|
| 118 |
//! @name Extraction Methods |
| 119 |
//@{ |
| 120 |
|
| 121 |
//! Extract a list of entries in a specified local row of the graph. Put into storage allocated by calling routine. |
| 122 |
void getLocalRowCopy(LocalOrdinal LocalRow, const Teuchos::ArrayView<LocalOrdinal> &Indices, const Teuchos::ArrayView<Scalar> &Values, size_t &NumEntries) const { |
| 123 |
throw std::runtime_error("Not implemented."); |
| 124 |
}; |
| 125 |
|
| 126 |
//! Extract a const, non-persisting view of global indices in a specified row of the matrix. |
| 127 |
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &indices, ArrayView<const Scalar> &values) const { |
| 128 |
throw std::runtime_error("Not implemented."); |
| 129 |
}; |
| 130 |
|
| 131 |
//! Extract a const, non-persisting view of local indices in a specified row of the matrix. |
| 132 |
void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices, ArrayView<const Scalar> &values) const { |
| 133 |
throw std::runtime_error("Not implemented."); |
| 134 |
}; |
| 135 |
|
| 136 |
//! Get a copy of the diagonal entries owned by this node, with local row indices. |
| 137 |
void getLocalDiagCopy(Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &diag) const { |
| 138 |
throw std::runtime_error("Not implemented."); |
| 139 |
}; |
| 140 |
|
| 141 |
//@} |
| 142 |
|
| 143 |
//! @name Mathematical Methods |
| 144 |
//@{ |
| 145 |
|
| 146 |
//! Returns the Frobenius norm of the matrix. |
| 147 |
typename ScalarTraits<Scalar>::magnitudeType getFrobeniusNorm() const { |
| 148 |
throw std::runtime_error("Not implemented."); |
| 149 |
}; |
| 150 |
|
| 151 |
//@} |
| 152 |
|
| 153 |
}; // RowMatrix class |
| 154 |
|
| 155 |
} // namespace Xpetra |
| 156 |
|
| 157 |
#endif |