• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ml_RowMatrix.h

Go to the documentation of this file.
00001 /* ******************************************************************** */
00002 /* See the file COPYRIGHT for a complete copyright notice, contact      */
00003 /* person and disclaimer.                                               */        
00004 /* ******************************************************************** */
00005 #ifndef ML_ROWMATRIX_H
00006 #define ML_ROWMATRIX_H
00007 
00012 #include "ml_include.h"
00013 
00014 #if defined(HAVE_ML_EPETRA)
00015 
00016 #include <vector>
00017 #ifdef HAVE_MPI
00018 #include "Epetra_MpiComm.h"
00019 #else
00020 #include "Epetra_SerialComm.h"
00021 #endif
00022 #include "ml_epetra.h"
00023 #include "Epetra_Operator.h"
00024 class Epetra_MultiVector;
00025 #include "Epetra_RowMatrix.h"
00026 #include "Epetra_BlockMap.h"
00027 #include "Epetra_Map.h"
00028 
00029 class Epetra_Vector;
00030 class Epetra_Importer;
00031 
00032 namespace ML_Epetra {
00033 
00044 class RowMatrix : public virtual Epetra_RowMatrix {
00045       
00046  public:
00048 
00049     RowMatrix(ML_Operator* Op, const Epetra_Comm* Comm = 0,
00050               const bool cheap = false, const USR_COMM =
00051 #ifdef HAVE_MPI
00052               MPI_COMM_WORLD
00053 #else
00054               0
00055 #endif
00056               );
00057 
00059 
00060 
00061     virtual ~RowMatrix();
00062 
00064   
00066 
00068 
00076     virtual int NumMyRowEntries(int MyRow, int & NumEntries) const; 
00077 
00078 
00080     virtual int MaxNumEntries() const;
00081 
00083 
00097     virtual int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
00098 
00100 
00106     virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const;
00108   
00110 
00112 
00122     virtual int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00123 
00125 
00140     virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector& X, 
00141           Epetra_MultiVector& Y) const
00142     {
00143       ML_RETURN(-1); // not implemented 
00144     }
00145 
00146     virtual int Apply(const Epetra_MultiVector& X,
00147           Epetra_MultiVector& Y) const
00148     {
00149       ML_RETURN(Multiply(false,X,Y));
00150     }
00151 
00152     virtual int ApplyInverse(const Epetra_MultiVector& X,
00153            Epetra_MultiVector& Y) const
00154     {
00155       ML_RETURN(-1);
00156     }
00158 
00168     virtual int InvRowSums(Epetra_Vector& x) const
00169     {
00170       ML_RETURN(-1); // not implemented
00171     }
00172 
00174 
00181     virtual int LeftScale(const Epetra_Vector& x)
00182     {
00183       ML_RETURN(-1); // not implemented
00184     }
00185 
00187 
00197     virtual int InvColSums(Epetra_Vector& x) const
00198     {
00199       ML_RETURN(-1); // not implemented
00200     }
00201     
00202 
00204 
00211     virtual int RightScale(const Epetra_Vector& x) 
00212     {
00213       ML_RETURN(-1); // not implemented
00214     }
00215 
00217   
00219 
00221     virtual bool Filled() const
00222     {
00223       return true;
00224     }
00225 
00227     /* Returns the quantity \f$ \| A \|_\infty\f$ such that
00228        \f[\| A \|_\infty = \max_{1\lei\len} \sum_{i=1}^m |a_{ij}| \f].
00229     */ 
00230     virtual double NormInf() const;
00231 
00233     /* Returns the quantity \f$ \| A \|_1\f$ such that
00234        \f[\| A \|_1= \max_{1\lej\len} \sum_{j=1}^n |a_{ij}| \f].
00235     */ 
00236     virtual double NormOne() const
00237     {
00238       return(-1.0);
00239     }
00240 
00242     virtual int NumGlobalNonzeros() const;
00243 
00245     virtual int NumGlobalRows() const;
00246 
00248     virtual int NumGlobalCols() const;
00249 
00251     virtual int NumGlobalDiagonals() const;
00252     
00254     virtual int NumMyNonzeros() const;
00255 
00257     virtual int NumMyRows() const;
00258 
00260     virtual int NumMyCols() const;
00261 
00263     virtual int NumMyDiagonals() const;
00264 
00266     virtual bool LowerTriangular() const;
00267 
00269     virtual bool UpperTriangular() const;
00270 
00272     virtual const Epetra_Map & RowMatrixRowMap() const;
00273 
00275     virtual const Epetra_Map & RowMatrixColMap() const;
00276 
00278     virtual const Epetra_Import * RowMatrixImporter() const;
00280   
00281   // following functions are required to derive Epetra_RowMatrix objects.
00282 
00284   int SetOwnership(bool ownership){return(-1);};
00285 
00287   int SetUseTranspose(bool UseTranspose){return(-1);}
00288 
00290   bool UseTranspose() const {return(false);};
00291   
00293   bool HasNormInf() const{return(false);};
00294   
00296   const Epetra_Comm & Comm() const{return(*Comm_);};
00297   
00299   const Epetra_Map & OperatorDomainMap() const {return(*DomainMap_);};
00300   
00302   const Epetra_Map & OperatorRangeMap() const {return(*RangeMap_);};
00304 
00305   void SetLabel(const char* label) 
00306   {
00307     strcpy(Label_,label);
00308   };
00309 
00310   const char* Label() const{
00311     return(Label_);
00312   };
00313 
00315   const Epetra_BlockMap & Map() const
00316   {
00317     return(*DomainMap_);
00318   }
00319 
00320 private:
00321 
00323   ML_Operator* Op_;
00325   const Epetra_Comm* Comm_;
00327   bool FreeCommObject_;
00329   int NumMyRows_;
00331   int NumGlobalRows_;
00333   int NumMyCols_;
00335   int NumGlobalCols_;
00337   Epetra_Map* DomainMap_;
00339   Epetra_Map* RangeMap_;
00341   Epetra_Map* ColMap_;
00343   int MaxNumEntries_;
00345   std::vector<double> Diagonal_;
00347   std::vector<int> NumMyRowEntries_;
00349   mutable int Allocated_;
00351   mutable std::vector<int> Indices_;
00353   mutable std::vector<double> Values_;
00355   double NormInf_;
00357   int NumMyNonzeros_;
00359   int NumGlobalNonzeros_;
00361   int NumMyDiagonals_;
00363   int NumGlobalDiagonals_;
00365   mutable Epetra_Import* Importer_;
00367   char* Label_;
00368 
00369 }; // class RowMatrix
00370 
00371 } // namespace ML_Epetra
00372 
00373 #endif /* HAVE_ML_EPETRA */
00374 #endif /* ML_ROWMATRIX_H */