Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_VbrRowMatrix.h
Go to the documentation of this file.
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Epetra: Linear Algebra Services Package
6 // Copyright 2011 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 Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 */
43 
44 #ifndef EPETRA_VBRROWMATRIX_H
45 #define EPETRA_VBRROWMATRIX_H
46 
47 #if defined(Epetra_SHOW_DEPRECATED_WARNINGS)
48 #ifdef __GNUC__
49 #warning "The Epetra package is deprecated"
50 #endif
51 #endif
52 
53 
54 
55 #include "Epetra_BasicRowMatrix.h"
56 #include "Epetra_VbrMatrix.h"
57 #include "Epetra_Map.h"
58 #include "Epetra_Comm.h"
59 #include "Epetra_Vector.h"
60 #include "Epetra_MultiVector.h"
61 
63 
77 
78  public:
79 
81 
82  /* The constructor for this class requires a pointer to a fully constructed instance of an Epetra_VbrMatrix
84  object.
85  \param Matrix (In) Pointer to an existing Epetra_VbrMatrix. The input matrix must be retained by the user
86  throughout the existance of the dependent Epetra_VbrRowmatrix object.
87  \pre Matrix must have Matrix->Filled()==true.
88  */
90  if (Matrix==0) throw Matrix->RowMatrixRowMap().ReportError("Input matrix must have called FillComplete()", -1);
91  SetMaps(Matrix->RowMatrixRowMap(), Matrix->RowMatrixColMap(), Matrix->OperatorDomainMap(), Matrix->OperatorRangeMap());
92  if (!Matrix->Filled()) throw Matrix->RowMatrixRowMap().ReportError("Input matrix must have called FillComplete()", -1);
93  SetLabel("Epetra::VbrRowMatrix");
94 }
95 
99 
101 
102  /* Updates the matrix that the Epetra_VbrRowMatrix will use to satisfy the Epetra_RowMatrix functionality.
104  \param Matrix (In) A pointer to an existing, fully constructed Epetra_VbrMatrix.
105  \pre Matrix must have Matrix->Filled()==true.
106  */
108  if (Matrix ==0) {
109  EPETRA_CHK_ERR(-1);
110  }
111  else matrix_ = Matrix;
112  return(0);
113  }
115 
117 
118 
120 
129  int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const {
130 
131  EPETRA_CHK_ERR(matrix_->ExtractMyRowCopy(MyRow, Length, NumEntries, Values, Indices));
132  return(0);
133  }
134 
136 
144  int ExtractMyEntryView(int CurEntry, double * &Value, int & RowIndex, int & ColIndex) {
145  return(-1);
146  }
147 
149 
157  int ExtractMyEntryView(int CurEntry, double const * & Value, int & RowIndex, int & ColIndex) const {
158  return(-1);
159  }
160 
162 
171  int NumMyRowEntries(int MyRow, int & NumEntries) const {
172  EPETRA_CHK_ERR(matrix_->NumMyRowEntries(MyRow, NumEntries));
173  return(0);
174  }
175 
177 
179 
180 
182 
189  int RightScale(const Epetra_Vector& x){
190  HaveNumericConstants_ = false;
193  return(0);
194  }
195 
197 
204  int LeftScale(const Epetra_Vector& x){
205  HaveNumericConstants_ = false;
208  return(0);
209  }
210 
212 
222  int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const{
223  EPETRA_CHK_ERR(matrix_->Multiply(TransA, X, Y));
224  return(0);
225  }
226 
228 
242  int Solve(bool Upper, bool Trans, bool UnitDiagonal,
243  const Epetra_MultiVector& X,
244  Epetra_MultiVector& Y) const {
245  EPETRA_CHK_ERR(matrix_->Solve(Upper, Trans, UnitDiagonal, X, Y));
246  return(0);
247  } //@}
248 
249 
250 
251  private:
252 
254 
255 };
256 #endif /* EPETRA_VBRROWMATRIX_H */
int ExtractMyEntryView(int CurEntry, double const *&Value, int &RowIndex, int &ColIndex) const
Returns a const reference to the ith entry in the matrix, along with its row and column index...
Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const
Returns a copy of the specified local row in user-provided arrays.
Epetra_VbrMatrix * matrix_
int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_VbrMatrix multiplied by a Epetra_MultiVector X in Y.
void SetMaps(const Epetra_Map &RowMap, const Epetra_Map &ColMap)
Set maps (Version 1); call this function or the next, but not both.
const Epetra_Map & RowMatrixColMap() const
Returns the Epetra_Map object associated with columns of this matrix.
int RightScale(const Epetra_Vector &x)
Scales the Epetra_VbrMatrix on the right with a Epetra_Vector x.
int NumMyRowEntries(int MyRow, int &NumEntries) const
Return the current number of values stored for the specified local row.
virtual const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this matrix.
virtual void SetLabel(const char *const Label)
Epetra_Object Label definition using char *.
#define EPETRA_CHK_ERR(a)
virtual int NumGlobalNonzeros() const
Returns the number of nonzero entries in the global matrix.
Epetra_VbrMatrix: A class for the construction and use of real-valued double-precision variable block...
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
bool Filled() const
If FillComplete() has been called, this query returns true, otherwise it returns false.
Epetra_VbrRowMatrix: A class for using an existing Epetra_VbrMatrix object as an Epetra_RowMatrix obj...
int UpdateMatrix(Epetra_VbrMatrix *Matrix)
Update the matrix to which this object points.
int RightScale(const Epetra_Vector &x)
Scales the Epetra_VbrMatrix on the right with a Epetra_Vector x.
int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_Vector &x, Epetra_Vector &y) const
Returns the result of a solve using the Epetra_VbrMatrix on a Epetra_Vector x in y.
int ExtractMyEntryView(int CurEntry, double *&Value, int &RowIndex, int &ColIndex)
Returns a reference to the ith entry in the matrix, along with its row and column index...
int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_VbrRowMatrix solve with a Epetra_MultiVector X in Y (not implemented)...
Epetra_BasicRowMatrix: A class for simplifying the development of Epetra_RowMatrix adapters...
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.
const Epetra_Map & RowMatrixRowMap() const
Returns the EpetraMap object associated with the rows of this matrix.
int NumMyRowEntries(int MyRow, int &NumEntries) const
Return the current number of values stored for the specified local row.
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator. ...
int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_VbrRowMatrix multiplied by a Epetra_MultiVector X in Y...
virtual ~Epetra_VbrRowMatrix()
Epetra_VbrRowMatrix Destructor.
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
Epetra_VbrRowMatrix(Epetra_VbrMatrix *Matrix)
Epetra_VbrRowMatrix constuctor.
int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const
Returns a copy of the specified local row in user-provided arrays.
int LeftScale(const Epetra_Vector &x)
Scales the Epetra_VbrMatrix on the left with a Epetra_Vector x.
int LeftScale(const Epetra_Vector &x)
Scales the Epetra_VbrMatrix on the left with a Epetra_Vector x.
void UpdateFlops(int Flops_in) const
Increment Flop count for this object.