Epetra_JadOperator.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_JADOPERATOR_H
00033 #define EPETRA_JADOPERATOR_H
00034 
00035 #include "Epetra_Operator.h"
00036 #include "Epetra_Object.h"
00037 #include "Epetra_CompObject.h"
00038 #include "Epetra_Map.h"
00039 #include "Epetra_Comm.h"
00040 #include "Epetra_SerialDenseVector.h"
00041 #include "Epetra_IntSerialDenseVector.h"
00042 
00043 
00044 class Epetra_Vector;
00045 class Epetra_MultiVector;
00046 class Epetra_RowMatrix;
00047 class Epetra_Import;
00048 class Epetra_Export;
00049 
00051 
00059 class Epetra_JadOperator: public Epetra_CompObject, public Epetra_Object, public virtual Epetra_Operator  {
00060       
00061  public:
00062 
00064 
00065 
00066   /* The constructor for this class requires a fully constructed instance of an Epetra_RowMatrix
00067      object.
00068      \param Matrix (In) An existing Epetra_RowMatrix.
00069      \param UseFloats (In) Optional argument, by default is false.  If set to true, 
00070             matrix values will be stored as floats instead of doubles.
00071      \param UseShorts (In) Optional argument, by default is false.  If set to true and if the local indices are small enough, 
00072             matrix indices will be stored as unsigned shorts instead of ints.
00073       \warning UseFloats and UseShorts are not supported in this version of the code.
00074      \pre Matrix must have Matrix.Filled()==true.
00075   */
00076   Epetra_JadOperator(const Epetra_RowMatrix & Matrix, bool UseFloats = false, bool UseShorts = false);
00077 
00079   virtual ~Epetra_JadOperator();
00081   
00083 
00084 
00085   /* Updates the values only using a matrix that has exactly the same structure as
00086      the matrix used to construct this Epetra_JadOperator object.  Once the constructor
00087      is called, the Matrix argument is no longer needed.
00088      \param Matrix (In) An existing Epetra_RowMatrix with \e identical structure to 
00089             the matrix used to create this Epetra_JadOperator.
00090      \param CheckStructure (In) Optional argument, by default is false.  If set to true, 
00091             the method will check to see if the structure of Matrix is compatible with
00092       the structure of matrix used to create this Epetra_JadOperator.  Performing
00093       this check has signficant overhead, so it should only be turned on for debugging.
00094      \pre Matrix must have Matrix.Filled()==true.
00095   */ 
00096   int UpdateValues(const Epetra_RowMatrix & Matrix, bool CheckStructure = false);
00098   
00100 
00101     
00103 
00112   int SetUseTranspose(bool UseTranspose) {return(UseTranspose_ = UseTranspose);};
00113 
00115   /* Returns the quantity \f$ \| A \|_\infty\f$ such that
00116      \f[\| A \|_\infty = \max_{1\lei\lem} \sum_{j=1}^n |a_{ij}| \f].
00117 
00118      \warning This method is supported if and only if the Epetra_RowMatrix Object that was used to create this supports this method.
00119   */ 
00120   double NormInf() const {return(NormInf_);};
00121   
00123   const char* Label() const {return(Epetra_Object::Label());}
00124 
00126   const Epetra_Comm & Comm() const {return(*Comm_);};
00127   
00129 
00135   int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00136 
00138 
00146   int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const {return(-1);}
00147 
00149   bool HasNormInf() const {return(HasNormInf_);};
00150   
00152   bool UseTranspose() const {return(UseTranspose_);};
00153   
00155   const Epetra_Map & OperatorDomainMap() const {return(OperatorDomainMap_);};
00156   
00158   const Epetra_Map & OperatorRangeMap() const {return(OperatorRangeMap_);};
00159 
00161   
00163 
00164 
00166   const Epetra_Import* Importer() const {return(Importer_);}
00167   
00169   const Epetra_Export* Exporter() const {return(Exporter_);}
00170   
00172   /*
00173     Note that if maps are defined such that some nonzeros appear on
00174     multiple processors, then those nonzeros will be counted multiple
00175     times.
00176   */
00177   inline int NumGlobalNonzeros() const {return(NumGlobalNonzeros_);}
00178 
00180 
00182 
00183 
00185   virtual void Print(ostream& os) const;
00187 
00188  protected:
00189 
00190   void UpdateImportVector(int NumVectors) const;
00191   void UpdateExportVector(int NumVectors) const;
00192   void GeneralMV(bool TransA, double * x, double * y) const;
00193   void GeneralMM(bool TransA, double ** X, int LDX, double ** Y, int LDY, int NumVectors) const;
00194   void GeneralMM3RHS(bool TransA, double ** X, int LDX, double ** Y, int LDY, int NumVectors) const;
00195   void GeneralMM2RHS(bool TransA, double * x, int ldx, double * y, int ldy) const;
00196   double NormInf_;
00197   Epetra_Comm * Comm_;
00198   Epetra_Map OperatorDomainMap_;
00199   Epetra_Map OperatorRangeMap_;
00200   
00201   int Allocate(const Epetra_RowMatrix & Matrix, bool UseFloats);
00202   int NumMyRows_;
00203   int NumMyCols_;
00204   int NumMyNonzeros_;
00205   int NumGlobalNonzeros_;
00206   Epetra_SerialDenseVector Values_;
00207   float * FloatValues_;
00208   Epetra_IntSerialDenseVector Indices_;
00209   unsigned short * ShortIndices_;
00210   Epetra_IntSerialDenseVector IndexOffset_;
00211   Epetra_IntSerialDenseVector RowPerm_;
00212 
00213   bool UseTranspose_;
00214   bool HasNormInf_;
00215   bool UsingFloats_;
00216   bool UsingShorts_;
00217   int NumJaggedDiagonals_;
00218     
00219 
00220   mutable Epetra_MultiVector * ImportVector_;
00221   mutable Epetra_MultiVector * ExportVector_;
00222   Epetra_Import * Importer_;
00223   Epetra_Export * Exporter_;
00224 
00225 };
00226 #endif /* EPETRA_JADOPERATOR_H */

Generated on Thu Sep 18 12:37:57 2008 for Epetra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1