Xpetra_TpetraRowMatrix.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Xpetra: A linear algebra interface package
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef XPETRA_TPETRAROWMATRIX_HPP
47 #define XPETRA_TPETRAROWMATRIX_HPP
48 
49 /* this file is automatically generated - do not edit (see script/tpetra.py) */
50 
51 // WARNING: This code is experimental. Backwards compatibility should not be expected.
52 
53 #include <Teuchos_Describable.hpp>
54 #include "Xpetra_ConfigDefs.hpp"
55 #include "Xpetra_Map.hpp"
56 #include "Xpetra_RowGraph.hpp"
57 #include "Xpetra_Vector.hpp"
58 
60 #include "Xpetra_TpetraMap.hpp"
61 
62 #include "Tpetra_RowMatrix.hpp"
63 
64 #include "Xpetra_RowMatrix.hpp"
65 #include "Xpetra_Exceptions.hpp"
66 
67 namespace Xpetra {
68 
69  template<class Scalar = RowMatrix<>::scalar_type,
70  class LocalOrdinal = typename RowMatrix<Scalar>::local_ordinal_type,
71  class GlobalOrdinal = typename RowMatrix<Scalar, LocalOrdinal>::global_ordinal_type,
74  : public RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>
75  {
76 
77  public:
78 
80 
81 
83  virtual ~TpetraRowMatrix() { }
84 
86 
88 
89 
91  const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { XPETRA_MONITOR("TpetraRowMatrix::getRowMap"); return toXpetra(mtx_->getRowMap()); }
92 
94  const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { XPETRA_MONITOR("TpetraRowMatrix::getColMap"); return toXpetra(mtx_->getColMap()); }
95 
97  Tpetra::global_size_t getGlobalNumRows() const { XPETRA_MONITOR("TpetraRowMatrix::getGlobalNumRows"); return mtx_->getGlobalNumRows(); }
98 
100  Tpetra::global_size_t getGlobalNumCols() const { XPETRA_MONITOR("TpetraRowMatrix::getGlobalNumCols"); return mtx_->getGlobalNumCols(); }
101 
103  size_t getNodeNumRows() const { XPETRA_MONITOR("TpetraRowMatrix::getNodeNumRows"); return mtx_->getNodeNumRows(); }
104 
106  size_t getNodeNumCols() const { XPETRA_MONITOR("TpetraRowMatrix::getNodeNumCols"); return mtx_->getNodeNumCols(); }
107 
109  Tpetra::global_size_t getGlobalNumEntries() const { XPETRA_MONITOR("TpetraRowMatrix::getGlobalNumEntries"); return mtx_->getGlobalNumEntries(); }
110 
112  size_t getNodeNumEntries() const { XPETRA_MONITOR("TpetraRowMatrix::getNodeNumEntries"); return mtx_->getNodeNumEntries(); }
113 
115  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("TpetraRowMatrix::getNumEntriesInLocalRow"); return mtx_->getNumEntriesInLocalRow(localRow); }
116 
118  size_t getGlobalMaxNumRowEntries() const { XPETRA_MONITOR("TpetraRowMatrix::getGlobalMaxNumRowEntries"); return mtx_->getGlobalMaxNumRowEntries(); }
119 
121  size_t getNodeMaxNumRowEntries() const { XPETRA_MONITOR("TpetraRowMatrix::getNodeMaxNumRowEntries"); return mtx_->getNodeMaxNumRowEntries(); }
122 
124  bool isLocallyIndexed() const { XPETRA_MONITOR("TpetraRowMatrix::isLocallyIndexed"); return mtx_->isLocallyIndexed(); }
125 
127  bool isGloballyIndexed() const { XPETRA_MONITOR("TpetraRowMatrix::isGloballyIndexed"); return mtx_->isGloballyIndexed(); }
128 
130  bool isFillComplete() const { XPETRA_MONITOR("TpetraRowMatrix::isFillComplete"); return mtx_->isFillComplete(); }
131 
133  bool supportsRowViews() const { XPETRA_MONITOR("TpetraRowMatrix::supportsRowViews"); return mtx_->supportsRowViews(); }
134 
136 
138 
139 
141  void getLocalRowCopy(LocalOrdinal LocalRow, const Teuchos::ArrayView< LocalOrdinal > &Indices, const Teuchos::ArrayView< Scalar > &Values, size_t &NumEntries) const { XPETRA_MONITOR("TpetraRowMatrix::getLocalRowCopy"); mtx_->getLocalRowCopy(LocalRow, Indices, Values, NumEntries);}
142 
144  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const { XPETRA_MONITOR("TpetraRowMatrix::getGlobalRowView"); mtx_->getGlobalRowView(GlobalRow, indices, values); }
145 
147  void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const { XPETRA_MONITOR("TpetraRowMatrix::getLocalRowView"); mtx_->getLocalRowView(LocalRow, indices, values); }
148 
151  //{ XPETRA_MONITOR("TpetraRowMatrix::getLocalDiagCopy"); mtx_->getLocalDiagCopy(diag); }
152 
154 
156 
157 
159  typename ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const { XPETRA_MONITOR("TpetraRowMatrix::getFrobeniusNorm"); return mtx_->getFrobeniusNorm(); }
160 
162 
164 
165 
167  const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const { XPETRA_MONITOR("TpetraRowMatrix::getDomainMap"); return toXpetra(mtx_->getDomainMap()); }
168 
170  const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const { XPETRA_MONITOR("TpetraRowMatrix::getRangeMap"); return toXpetra(mtx_->getRangeMap()); }
171 
174  //{ XPETRA_MONITOR("TpetraRowMatrix::apply"); mtx_->apply(X, Y, mode, alpha, beta); }
175 
177 
179 
180 
182  TpetraRowMatrix(const Teuchos::RCP<Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &mtx) : mtx_(mtx) { }
183 
186 
189 
191 
192  private:
193 
195 
196  }; // TpetraRowMatrix class
197 
198 } // Xpetra namespace
199 
200 #define XPETRA_TPETRAROWMATRIX_SHORT
201 #endif // XPETRA_TPETRAROWMATRIX_HPP
Xpetra
Xpetra namespace
Definition: Xpetra_BlockedCrsMatrix.hpp:86
Xpetra::RowMatrix::global_ordinal_type
GlobalOrdinal global_ordinal_type
Definition: Xpetra_RowMatrix.hpp:69
Xpetra::TpetraRowMatrix::getRangeMap
const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the range of this operator, which must be compatible with Y....
Definition: Xpetra_TpetraRowMatrix.hpp:170
Xpetra::global_size_t
size_t global_size_t
Global size_t object.
Definition: Xpetra_ConfigDefs.hpp:170
Xpetra_RowMatrix.hpp
Xpetra::TpetraRowMatrix::getTpetra_RowMatrix
RCP< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_RowMatrix() const
Get the underlying Tpetra matrix.
Definition: Xpetra_TpetraRowMatrix.hpp:185
Xpetra::MultiVector
Definition: Xpetra_MultiVector.hpp:76
Xpetra::TpetraRowMatrix::apply
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, 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
Computes the operator-multivector application.
Definition: Xpetra_TpetraRowMatrix.hpp:173
Xpetra::RowMatrix::node_type
Node node_type
Definition: Xpetra_RowMatrix.hpp:70
Xpetra::TpetraRowMatrix::isFillComplete
bool isFillComplete() const
Returns true if fillComplete() has been called.
Definition: Xpetra_TpetraRowMatrix.hpp:130
Xpetra::TpetraRowMatrix::getNodeNumCols
size_t getNodeNumCols() const
Returns the number of columns needed to apply the forward operator on this node, i....
Definition: Xpetra_TpetraRowMatrix.hpp:106
Teuchos::NO_TRANS
NO_TRANS
Xpetra::TpetraRowMatrix::getGlobalMaxNumRowEntries
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
Definition: Xpetra_TpetraRowMatrix.hpp:118
Xpetra::toXpetra
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
Definition: Xpetra_EpetraCrsGraph.cpp:168
Xpetra::TpetraRowMatrix::getColMap
const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
Definition: Xpetra_TpetraRowMatrix.hpp:94
Xpetra::TpetraRowMatrix::isGloballyIndexed
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
Definition: Xpetra_TpetraRowMatrix.hpp:127
Teuchos::ArrayView
Teuchos::RCP
Xpetra_RowGraph.hpp
Xpetra_TpetraMap.hpp
Xpetra::Vector
Definition: Xpetra_Vector_fwd.hpp:51
Xpetra::TpetraRowMatrix::getLocalRowCopy
void getLocalRowCopy(LocalOrdinal LocalRow, const Teuchos::ArrayView< LocalOrdinal > &Indices, const Teuchos::ArrayView< Scalar > &Values, size_t &NumEntries) const
Extract a list of entries in a specified local row of the graph. Put into storage allocated by callin...
Definition: Xpetra_TpetraRowMatrix.hpp:141
Teuchos::ScalarTraits
Xpetra::Exceptions::NotImplemented
Exception throws when you call an unimplemented method of Xpetra.
Definition: Xpetra_Exceptions.hpp:94
Xpetra::TpetraRowMatrix::getGlobalNumCols
Tpetra::global_size_t getGlobalNumCols() const
Returns the number of global columns in this matrix.
Definition: Xpetra_TpetraRowMatrix.hpp:100
Xpetra::TpetraRowMatrix::getLocalRowView
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
Definition: Xpetra_TpetraRowMatrix.hpp:147
Xpetra::TpetraRowMatrix::getRowMap
const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
Definition: Xpetra_TpetraRowMatrix.hpp:91
Xpetra::TpetraRowMatrix::TpetraRowMatrix
TpetraRowMatrix(const Teuchos::RCP< Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &mtx)
TpetraCrsMatrix constructor to wrap a Tpetra::CrsMatrix object.
Definition: Xpetra_TpetraRowMatrix.hpp:182
Xpetra::TpetraRowMatrix::getNodeMaxNumRowEntries
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
Definition: Xpetra_TpetraRowMatrix.hpp:121
Xpetra_ConfigDefs.hpp
Xpetra::TpetraRowMatrix
Definition: Xpetra_TpetraRowMatrix.hpp:73
Xpetra::TpetraRowMatrix::supportsRowViews
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
Definition: Xpetra_TpetraRowMatrix.hpp:133
Xpetra_Vector.hpp
Xpetra_TpetraConfigDefs.hpp
Xpetra::TpetraRowMatrix::getDomainMap
const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator, which must be compatible with X....
Definition: Xpetra_TpetraRowMatrix.hpp:167
Xpetra::TpetraRowMatrix::getGlobalRowView
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
Definition: Xpetra_TpetraRowMatrix.hpp:144
Xpetra::TpetraRowMatrix::getFrobeniusNorm
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
Definition: Xpetra_TpetraRowMatrix.hpp:159
Xpetra_Exceptions.hpp
Xpetra::RowMatrix
Definition: Xpetra_RowMatrix.hpp:65
Xpetra::TpetraRowMatrix::~TpetraRowMatrix
virtual ~TpetraRowMatrix()
Destructor.
Definition: Xpetra_TpetraRowMatrix.hpp:83
Xpetra::TpetraRowMatrix::getNumEntriesInLocalRow
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
Definition: Xpetra_TpetraRowMatrix.hpp:115
Xpetra::TpetraRowMatrix::getNodeNumEntries
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
Definition: Xpetra_TpetraRowMatrix.hpp:112
Xpetra::RowMatrix::local_ordinal_type
LocalOrdinal local_ordinal_type
Definition: Xpetra_RowMatrix.hpp:68
Xpetra::TpetraRowMatrix::getTpetra_RowMatrixNonConst
RCP< Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_RowMatrixNonConst() const
Get the underlying Tpetra matrix.
Definition: Xpetra_TpetraRowMatrix.hpp:188
Xpetra::TpetraRowMatrix::getGlobalNumRows
Tpetra::global_size_t getGlobalNumRows() const
Returns the number of global rows in this matrix.
Definition: Xpetra_TpetraRowMatrix.hpp:97
Teuchos::ScalarTraits::magnitudeType
T magnitudeType
Xpetra::TpetraRowMatrix::getNodeNumRows
size_t getNodeNumRows() const
Returns the number of rows owned on the calling node.
Definition: Xpetra_TpetraRowMatrix.hpp:103
Xpetra::TpetraRowMatrix::getGlobalNumEntries
Tpetra::global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
Definition: Xpetra_TpetraRowMatrix.hpp:109
Xpetra::TpetraRowMatrix::getLocalDiagCopy
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row indices.
Definition: Xpetra_TpetraRowMatrix.hpp:150
Xpetra::TpetraRowMatrix::mtx_
RCP< Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > mtx_
Definition: Xpetra_TpetraRowMatrix.hpp:194
TEUCHOS_TEST_FOR_EXCEPTION
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
XPETRA_MONITOR
#define XPETRA_MONITOR(funcName)
Definition: Xpetra_ConfigDefs.hpp:128
Xpetra::TpetraRowMatrix::isLocallyIndexed
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
Definition: Xpetra_TpetraRowMatrix.hpp:124
Teuchos::ETransp
ETransp
Xpetra_Map.hpp