Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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,
70  class LocalOrdinal,
71  class GlobalOrdinal,
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 
173  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 { TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
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 
185  RCP<const Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getTpetra_RowMatrix() const { return mtx_; }
186 
188  RCP<Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getTpetra_RowMatrixNonConst() const { return mtx_; } //TODO: remove
189 
191 
192  private:
193 
194  RCP< Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > mtx_;
195 
196  }; // TpetraRowMatrix class
197 
198 } // Xpetra namespace
199 
200 #define XPETRA_TPETRAROWMATRIX_SHORT
201 #endif // XPETRA_TPETRAROWMATRIX_HPP
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
RCP< Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > mtx_
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
Tpetra::global_size_t getGlobalNumCols() const
Returns the number of global columns in this matrix.
const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
Tpetra::global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
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...
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...
bool isFillComplete() const
Returns true if fillComplete() has been called.
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.
Exception throws when you call an unimplemented method of Xpetra.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row indices.
size_t global_size_t
Global size_t object.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
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.
Tpetra::global_size_t getGlobalNumRows() const
Returns the number of global rows in this matrix.
TpetraRowMatrix(const Teuchos::RCP< Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &mtx)
TpetraCrsMatrix constructor to wrap a Tpetra::CrsMatrix object.
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.
RCP< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_RowMatrix() const
Get the underlying Tpetra matrix.
#define XPETRA_MONITOR(funcName)
RCP< Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_RowMatrixNonConst() const
Get the underlying Tpetra matrix.
virtual ~TpetraRowMatrix()
Destructor.
size_t getNodeNumRows() const
Returns the number of rows owned on the calling node.
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
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...
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
size_t getNodeNumCols() const
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.