Epetra_VbrRowMatrix.h

Go to the documentation of this file.
00001 
00002 //@HEADER
00003 /*
00004 ************************************************************************
00005 
00006               Epetra: Linear Algebra Services Package 
00007                 Copyright (2001) Sandia Corporation
00008 
00009 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00010 license for use of this work by or on behalf of the U.S. Government.
00011 
00012 This library is free software; you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as
00014 published by the Free Software Foundation; either version 2.1 of the
00015 License, or (at your option) any later version.
00016  
00017 This library is distributed in the hope that it will be useful, but
00018 WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 Lesser General Public License for more details.
00021  
00022 You should have received a copy of the GNU Lesser General Public
00023 License along with this library; if not, write to the Free Software
00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 USA
00026 Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00027 
00028 ************************************************************************
00029 */
00030 //@HEADER
00031 
00032 #ifndef EPETRA_VBRROWMATRIX_H
00033 #define EPETRA_VBRROWMATRIX_H
00034 
00035 #include "Epetra_BasicRowMatrix.h"
00036 #include "Epetra_VbrMatrix.h"
00037 #include "Epetra_Map.h"
00038 #include "Epetra_Comm.h"
00039 #include "Epetra_Vector.h"
00040 #include "Epetra_MultiVector.h"
00041 
00043 
00056 class Epetra_VbrRowMatrix: public Epetra_BasicRowMatrix {
00057       
00058  public:
00059 
00061 
00062 
00063   /* The constructor for this class requires a pointer to a fully constructed instance of an Epetra_VbrMatrix
00064      object.
00065      \param Matrix (In) Pointer to an existing Epetra_VbrMatrix. The input matrix must be retained by the user
00066      throughout the existance of the dependent Epetra_VbrRowmatrix object.
00067      \pre Matrix must have Matrix->Filled()==true.
00068   */
00069   Epetra_VbrRowMatrix(Epetra_VbrMatrix * Matrix): Epetra_BasicRowMatrix(Matrix->Comm()), matrix_(Matrix) {
00070   if (Matrix==0) throw Matrix->RowMatrixRowMap().ReportError("Input matrix must have called FillComplete()", -1);
00071   SetMaps(Matrix->RowMatrixRowMap(), Matrix->RowMatrixColMap(), Matrix->OperatorDomainMap(), Matrix->OperatorRangeMap());
00072   if (!Matrix->Filled()) throw Matrix->RowMatrixRowMap().ReportError("Input matrix must have called FillComplete()", -1);
00073   SetLabel("Epetra::VbrRowMatrix");
00074 }
00075 
00077     virtual ~Epetra_VbrRowMatrix(){}
00079   
00081 
00082 
00083   /* Updates the matrix that the Epetra_VbrRowMatrix will use to satisfy the Epetra_RowMatrix functionality.
00084      \param Matrix (In) A pointer to an existing, fully constructed Epetra_VbrMatrix.
00085      \pre Matrix must have Matrix->Filled()==true.
00086   */ 
00087   int UpdateMatrix(Epetra_VbrMatrix * Matrix){ 
00088     if (Matrix ==0) {
00089       EPETRA_CHK_ERR(-1);
00090     }
00091     else matrix_ = Matrix;
00092     return(0);
00093   }
00095   
00097 
00098 
00100 
00109   int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const {
00110   
00111     EPETRA_CHK_ERR(matrix_->ExtractMyRowCopy(MyRow, Length, NumEntries, Values, Indices));
00112     return(0);
00113   }
00114 
00116 
00124     int ExtractMyEntryView(int CurEntry, double * &Value, int & RowIndex, int & ColIndex) {
00125       return(-1);
00126     }
00127 
00129 
00137     int ExtractMyEntryView(int CurEntry, double const * & Value, int & RowIndex, int & ColIndex) const { 
00138       return(-1);
00139     }
00140 
00142 
00151     int NumMyRowEntries(int MyRow, int & NumEntries) const {
00152       EPETRA_CHK_ERR(matrix_->NumMyRowEntries(MyRow, NumEntries));
00153       return(0);
00154     }
00155 
00157 
00159 
00160 
00162 
00169     int RightScale(const Epetra_Vector& x){
00170       HaveNumericConstants_ = false;
00171       UpdateFlops(NumGlobalNonzeros());
00172       EPETRA_CHK_ERR(matrix_->RightScale(x));
00173       return(0);
00174     }
00175 
00177 
00184     int LeftScale(const Epetra_Vector& x){
00185       HaveNumericConstants_ = false;
00186       UpdateFlops(NumGlobalNonzeros());
00187       EPETRA_CHK_ERR(matrix_->LeftScale(x));
00188       return(0);
00189     }
00190 
00192 
00202     int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const{
00203       EPETRA_CHK_ERR(matrix_->Multiply(TransA, X, Y));
00204       return(0);
00205     }
00206 
00208 
00222     int Solve(bool Upper, bool Trans, bool UnitDiagonal,
00223               const Epetra_MultiVector& X,
00224               Epetra_MultiVector& Y) const {
00225       EPETRA_CHK_ERR(matrix_->Solve(Upper, Trans, UnitDiagonal, X, Y));
00226       return(0);
00227     }  //@}
00228 
00229 
00230 
00231  private:
00232 
00233     Epetra_VbrMatrix * matrix_;
00234 
00235 };
00236 #endif /* EPETRA_VBRROWMATRIX_H */

Generated on Wed May 12 21:41:05 2010 for Epetra Package Browser (Single Doxygen Collection) by  doxygen 1.4.7