Epetra_FastCrsMatrix.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_FASTCRSMATRIX_H
00033 #define EPETRA_FASTCRSMATRIX_H
00034 
00035 #include "Epetra_Operator.h"
00036 #include "Epetra_CrsMatrix.h"
00037 class Epetra_Vector;
00038 class Epetra_MultiVector;
00039 
00041 
00047 class Epetra_FastCrsOperator: public Epetra_CompObject, public virtual Epetra_Operator  {
00048       
00049  public:
00050 
00052 
00053 
00054   Epetra_FastCrsOperator(const Epetra_CrsMatrix & Matrix, bool UseFloats = false);
00055 
00057   virtual ~Epetra_FastCrsOperator();
00059   
00061 
00062 
00063   /* Updates the values only using a matrix that has exactly the same structure as
00064      the matrix used to construct this Epetra_FastCrsOperator object.
00065   */ 
00066   int UpdateValues(const Epetra_CrsMatrix & Matrix);
00068   
00070 
00071 
00073     char * Label() const {return(CrsMatrix_.Label());};
00074     
00076 
00085   int SetUseTranspose(bool UseTranspose) {return(CrsMatrix_.SetUseTranspose());};
00086 
00088   /* Returns the quantity \f$ \| A \|_\infty\f$ such that
00089      \f[\| A \|_\infty = \max_{1\lei\lem} \sum_{j=1}^n |a_{ij}| \f].
00090   */ 
00091   double NormInf() const {return(CrsMatrix_.NormInf());};
00092   
00094   const Epetra_Comm & Comm() const {return(CrsMatrix_.Comm());};
00095   
00097 
00103   int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00104 
00106 
00113   int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00114 
00116   bool HasNormInf() const {return(CrsMatrix_.HasNormInf());};
00117   
00119   bool UseTranspose() const {return(CrsMatrix_.UseTranspose());};
00120   
00122   const Epetra_Map & OperatorDomainMap() const {return(CrsMatrix_.OperatorDomainMap());};
00123   
00125   const Epetra_Map & OperatorRangeMap() const {return(CrsMatrix_.OperatorRangeMap());};
00126 
00128 
00129 
00130  protected:
00131   int Allocate(bool UseFloats);
00132   const Epetra_CrsMatrix & CrsMatrix_;
00133   int NumMyRows_;
00134   int NumMyNonzeros_;
00135   double *Values_;
00136   float * FloatValues_;
00137   int * Indices_;
00138   unsigned short * ShortIndices_;
00139 
00140   bool UsingFloats_;
00141   bool UsingShorts_;
00142   bool ValuesAllocated_;
00143     
00144 
00145   mutable Epetra_MultiVector * ImportVector_;
00146   mutable Epetra_MultiVector * ExportVector_;
00147 
00148 };
00149 #endif /* EPETRA_FASTCRSMATRIX_H */

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