All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Xpetra_TpetraVbrMatrix.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 // Jeremie Gaidamour (jngaida@sandia.gov)
40 // Jonathan Hu (jhu@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef XPETRA_TPETRAVBRMATRIX_HPP
47 #define XPETRA_TPETRAVBRMATRIX_HPP
48 
49 #include "Xpetra_ConfigDefs.hpp"
50 
51 #ifndef HAVE_XPETRA_TPETRA
52 #error This file should be included only if HAVE_XPETRA_TPETRA is defined.
53 #endif
54 
55 #include "Xpetra_VbrMatrix.hpp"
56 
57 #include <Tpetra_VbrMatrix.hpp>
58 
59 namespace Xpetra {
60 
61  template <class Scalar,
62  class LocalOrdinal = int,
63  class GlobalOrdinal = LocalOrdinal,
67  public VbrMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node, LocalOrdinal> {
68  public:
69 
71 
72 
73  TpetraVbrMatrix(const Teuchos::RCP<const Tpetra::VbrMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps> > &mtx) : mtx_(mtx) { } //TODO
74 
76  virtual ~TpetraVbrMatrix();
77 
79 
81 
82 
84 
86  const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & getDomainMap() const { return mtx_->getDomainMap(); }
87 
89 
91  const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & getRangeMap() const { return mtx_->getRangeMap(); }
92 
94 
102  Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(),
103  Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const { mtx_->apply(X,Y,trans,alpha,beta); }
104 
106 
111  Teuchos::ETransp trans) const { mtx_->applyInverse(Y,X,trans); }
112 
114  bool hasTransposeApply() const { return mtx_->hasTransposeApply(); }
115 
117 
119 
120 
123 
126 
129 
132 
134  const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & getPointRowMap() const { return mtx_->getPointRowMap(); }
135 
137  const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & getPointColMap() const { return mtx_->getPointColMap(); }
138 
140  bool isFillComplete() const { return mtx_->isFillComplete(); }
142 
144 
145 
147 
150  void putScalar(Scalar s) { mtx_->putScalar(s); }
151 
153 
162  void setGlobalBlockEntry(GlobalOrdinal globalBlockRow, GlobalOrdinal globalBlockCol, const Teuchos::SerialDenseMatrix<GlobalOrdinal,Scalar>& blockEntry) { mtx_->setGlobalBlockEntry(globalBlockRow, globalBlockCol, blockEntry); }
163 
165 
172  void setLocalBlockEntry(LocalOrdinal localBlockRow, LocalOrdinal localBlockCol, const Teuchos::SerialDenseMatrix<LocalOrdinal,Scalar>& blockEntry) { mtx_->setLocalBlockEntry(localBlockRow, localBlockCol, blockEntry); }
173 
175 
184  void sumIntoGlobalBlockEntry(GlobalOrdinal globalBlockRow, GlobalOrdinal globalBlockCol, const Teuchos::SerialDenseMatrix<GlobalOrdinal,Scalar>& blockEntry) { mtx_->sumIntoGlobalBlockEntry(globalBlockRow, globalBlockCol, blockEntry); }
185 
187 
194  void sumIntoLocalBlockEntry(LocalOrdinal localBlockRow, LocalOrdinal localBlockCol, const Teuchos::SerialDenseMatrix<LocalOrdinal,Scalar>& blockEntry) { mtx_->sumIntoLocalBlockEntry(localBlockRow, localBlockCol, blockEntry); }
195 
197 
206  void setGlobalBlockEntry(GlobalOrdinal globalBlockRow, GlobalOrdinal globalBlockCol, LocalOrdinal blkRowSize, LocalOrdinal blkColSize, LocalOrdinal LDA, const Teuchos::ArrayView<const Scalar>& blockEntry) { mtx_->setGlobalBlockEntry(globalBlockRow, globalBlockCol, blkRowSize, blkColSize, LDA, blockEntry); }
207 
209 
216  void setLocalBlockEntry(LocalOrdinal localBlockRow, LocalOrdinal localBlockCol, LocalOrdinal blkRowSize, LocalOrdinal blkColSize, LocalOrdinal LDA, const Teuchos::ArrayView<const Scalar>& blockEntry) { mtx_->setLocalBlockEntry(localBlockRow, localBlockCol, blkRowSize, blkColSize, LDA, blockEntry); }
217 
219 
228  void sumIntoGlobalBlockEntry(GlobalOrdinal globalBlockRow, GlobalOrdinal globalBlockCol, LocalOrdinal blkRowSize, LocalOrdinal blkColSize, LocalOrdinal LDA, const Teuchos::ArrayView<const Scalar>& blockEntry) { mtx_->sumIntoGlobalBlockEntry(globalBlockRow, globalBlockCol, blkRowSize, blkColSize, LDA, blockEntry); }
229 
231 
238  void sumIntoLocalBlockEntry(LocalOrdinal localBlockRow, LocalOrdinal localBlockCol, LocalOrdinal blkRowSize, LocalOrdinal blkColSize, LocalOrdinal LDA, const Teuchos::ArrayView<const Scalar>& blockEntry) { mtx_->sumIntoLocalBlockEntry(localBlockRow, localBlockCol, blkRowSize, blkColSize, LDA, blockEntry); }
239 
241 
243 
244 
246 
249  void fillComplete(const Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> >& blockDomainMap, const Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> >& blockRangeMap) { mtx_->fillComplete(blockDomainMap, blockRangeMap); }
250 
252 
255  void fillComplete() { mtx_->fillComplete(); }
257 
259 
260 
262 
270  void getGlobalBlockEntryView(GlobalOrdinal globalBlockRow,
271  GlobalOrdinal globalBlockCol,
272  LocalOrdinal& numPtRows,
273  LocalOrdinal& numPtCols,
274  Teuchos::ArrayRCP<const Scalar>& blockEntry) const { mtx_->getGlobalBlockEntryView(globalBlockRow, globalBlockCol, numPtRows, numPtCols, blockEntry); }
275 
277 
287  void getGlobalBlockEntryViewNonConst(GlobalOrdinal globalBlockRow,
288  GlobalOrdinal globalBlockCol,
289  LocalOrdinal& numPtRows,
290  LocalOrdinal& numPtCols,
291  Teuchos::ArrayRCP<Scalar>& blockEntry) { mtx_->getGlobalBlockEntryViewNonConst(globalBlockRow, globalBlockCol, numPtRows, numPtCols, blockEntry); }
292 
294 
304  void getLocalBlockEntryView(LocalOrdinal localBlockRow,
305  LocalOrdinal localBlockCol,
306  LocalOrdinal& numPtRows,
307  LocalOrdinal& numPtCols,
308  Teuchos::ArrayRCP<const Scalar>& blockEntry) const { mtx_->getLocalBlockEntryView(localBlockRow, localBlockCol, numPtRows, numPtCols, blockEntry); }
309 
311 
327  void getLocalBlockEntryViewNonConst(LocalOrdinal localBlockRow,
328  LocalOrdinal localBlockCol,
329  LocalOrdinal& numPtRows,
330  LocalOrdinal& numPtCols,
331  Teuchos::ArrayRCP<Scalar>& blockEntry) { mtx_->getLocalBlockEntryViewNonConst(localBlockRow, localBlockCol, numPtRows, numPtCols, blockEntry); }
332 
334 
336 
337  std::string description() const { return mtx_->description(); }
338 
343 
345 
346  private:
347 
349 
350  };//class VbrMatrix
351 
352 }//namespace Xpetra
353 
354 #define XPETRA_TPETRAVBRMATRIX_SHORT
355 #endif //XPETRA_VBRMATRIX_DECL_HPP
void sumIntoGlobalBlockEntry(GlobalOrdinal globalBlockRow, GlobalOrdinal globalBlockCol, LocalOrdinal blkRowSize, LocalOrdinal blkColSize, LocalOrdinal LDA, const Teuchos::ArrayView< const Scalar > &blockEntry)
Add the contents of the input block-entry into the matrix.
void sumIntoLocalBlockEntry(LocalOrdinal localBlockRow, LocalOrdinal localBlockCol, LocalOrdinal blkRowSize, LocalOrdinal blkColSize, LocalOrdinal LDA, const Teuchos::ArrayView< const Scalar > &blockEntry)
Add the contents of the input block-entry into the matrix.
void setLocalBlockEntry(LocalOrdinal localBlockRow, LocalOrdinal localBlockCol, const Teuchos::SerialDenseMatrix< LocalOrdinal, Scalar > &blockEntry)
Copy the contents of the input block-entry into the matrix.
virtual ~TpetraVbrMatrix()
Destructor.
void sumIntoLocalBlockEntry(LocalOrdinal localBlockRow, LocalOrdinal localBlockCol, const Teuchos::SerialDenseMatrix< LocalOrdinal, Scalar > &blockEntry)
Add the contents of the input block-entry into the matrix.
void sumIntoGlobalBlockEntry(GlobalOrdinal globalBlockRow, GlobalOrdinal globalBlockCol, const Teuchos::SerialDenseMatrix< GlobalOrdinal, Scalar > &blockEntry)
Add the contents of the input block-entry into the matrix.
const Teuchos::RCP< const BlockMap< LocalOrdinal, GlobalOrdinal, Node > > & getBlockColMap() const
Returns the block-column map.
const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > & getDomainMap() const
Returns the Map associated with the domain of this operator.
void getGlobalBlockEntryView(GlobalOrdinal globalBlockRow, GlobalOrdinal globalBlockCol, LocalOrdinal &numPtRows, LocalOrdinal &numPtCols, Teuchos::ArrayRCP< const Scalar > &blockEntry) const
Returns a const read-only view of a block-entry.
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp trans=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Computes the operator-multivector application.
VbrMatrix: Variable block row matrix.
void setGlobalBlockEntry(GlobalOrdinal globalBlockRow, GlobalOrdinal globalBlockCol, const Teuchos::SerialDenseMatrix< GlobalOrdinal, Scalar > &blockEntry)
Copy the contents of the input block-entry into the matrix.
void getLocalBlockEntryView(LocalOrdinal localBlockRow, LocalOrdinal localBlockCol, LocalOrdinal &numPtRows, LocalOrdinal &numPtCols, Teuchos::ArrayRCP< const Scalar > &blockEntry) const
Returns a const read-only view of a block-entry.
TpetraVbrMatrix(const Teuchos::RCP< const Tpetra::VbrMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps > > &mtx)
void fillComplete()
Transition the matrix to the packed, optimized-storage state.
void putScalar(Scalar s)
Set the specified scalar throughout the matrix.
const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > & getPointColMap() const
Returns the point-column map.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to a FancyOStream object.
const Teuchos::RCP< const BlockMap< LocalOrdinal, GlobalOrdinal, Node > > & getBlockDomainMap() const
Returns the block-domain map.
bool isFillComplete() const
Return true if fillComplete has been called, false otherwise.
void setGlobalBlockEntry(GlobalOrdinal globalBlockRow, GlobalOrdinal globalBlockCol, LocalOrdinal blkRowSize, LocalOrdinal blkColSize, LocalOrdinal LDA, const Teuchos::ArrayView< const Scalar > &blockEntry)
Copy the contents of the input block-entry into the matrix.
void setLocalBlockEntry(LocalOrdinal localBlockRow, LocalOrdinal localBlockCol, LocalOrdinal blkRowSize, LocalOrdinal blkColSize, LocalOrdinal LDA, const Teuchos::ArrayView< const Scalar > &blockEntry)
Copy the contents of the input block-entry into the matrix.
void getGlobalBlockEntryViewNonConst(GlobalOrdinal globalBlockRow, GlobalOrdinal globalBlockCol, LocalOrdinal &numPtRows, LocalOrdinal &numPtCols, Teuchos::ArrayRCP< Scalar > &blockEntry)
Returns a non-const read-write view of a block-entry.
static const EVerbosityLevel verbLevel_default
bool hasTransposeApply() const
Indicates whether this operator supports applying the adjoint operator.
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 BlockMap< LocalOrdinal, GlobalOrdinal, Node > > & getBlockRangeMap() const
Returns the block-range map.
const RCP< const Tpetra::VbrMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps > > mtx_
RCP< const Tpetra::VbrMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node, LocalMatOps > > getTpetra_VbrMatrix() const
Block-entry counterpart to Xpetra::Map.
const Teuchos::RCP< const BlockMap< LocalOrdinal, GlobalOrdinal, Node > > & getBlockRowMap() const
Returns the block-row map.
const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > & getPointRowMap() const
Returns the point-row map.
std::string description() const
void applyInverse(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Teuchos::ETransp trans) const
Triangular Solve – Matrix must be triangular.
void getLocalBlockEntryViewNonConst(LocalOrdinal localBlockRow, LocalOrdinal localBlockCol, LocalOrdinal &numPtRows, LocalOrdinal &numPtCols, Teuchos::ArrayRCP< Scalar > &blockEntry)
Returns a non-const read-write view of a block-entry.
void fillComplete(const Teuchos::RCP< const BlockMap< LocalOrdinal, GlobalOrdinal, Node > > &blockDomainMap, const Teuchos::RCP< const BlockMap< LocalOrdinal, GlobalOrdinal, Node > > &blockRangeMap)
Transition the matrix to the packed, optimized-storage state.