Ifpack_OverlappingRowMatrix.h

00001 /*@HEADER
00002 // ***********************************************************************
00003 //
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2002) Sandia Corporation
00006 //
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 //
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00025 //
00026 // ***********************************************************************
00027 //@HEADER
00028 */
00029 
00030 #ifndef IFPACK_OVERLAPPINGROWMATRIX_H
00031 #define IFPACK_OVERLAPPINGROWMATRIX_H
00032 
00033 #include "Ifpack_ConfigDefs.h"
00034 #include "Epetra_RowMatrix.h"
00035 #include "Epetra_CombineMode.h"
00036 #include "Teuchos_RefCountPtr.hpp"
00037 #include "Epetra_Import.h"
00038 
00039 class Epetra_Map;
00040 class Epetra_BlockMap;
00041 class Epetra_CrsMatrix;
00042 class Epetra_Comm;
00043 
00044 class Ifpack_OverlappingRowMatrix : public virtual Epetra_RowMatrix {
00045 
00046 public:
00047 
00049   Ifpack_OverlappingRowMatrix(const Teuchos::RefCountPtr<const Epetra_RowMatrix>& Matrix_in,
00050                               int OverlapLevel_in);
00051 
00052   ~Ifpack_OverlappingRowMatrix() {};
00054 
00056 
00058 
00066   virtual int NumMyRowEntries(int MyRow, int & NumEntries) const;
00067 
00069   virtual int MaxNumEntries() const
00070   {
00071     return(MaxNumEntries_);
00072   }
00073 
00075 
00089   virtual int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
00090 
00092 
00098   virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const;
00100 
00102 
00104 
00114   virtual int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00115 
00117   virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector& X, 
00118             Epetra_MultiVector& Y) const
00119   {
00120     IFPACK_RETURN(-1); // not implemented 
00121   }
00122 
00123   virtual int Apply(const Epetra_MultiVector& X,
00124             Epetra_MultiVector& Y) const;
00125 
00126   virtual int ApplyInverse(const Epetra_MultiVector& X,
00127                Epetra_MultiVector& Y) const;
00129   virtual int InvRowSums(Epetra_Vector& x) const
00130   {
00131     IFPACK_RETURN(-1); // not implemented
00132   }
00133 
00135   virtual int LeftScale(const Epetra_Vector& x)
00136   {
00137     IFPACK_RETURN(-1); // not implemented
00138   }
00139 
00141   virtual int InvColSums(Epetra_Vector& x) const
00142   {
00143     IFPACK_RETURN(-1); // not implemented
00144   }
00145 
00146 
00148   virtual int RightScale(const Epetra_Vector& x) 
00149   {
00150     IFPACK_RETURN(-1); // not implemented
00151   }
00152 
00154 
00156 
00158   virtual bool Filled() const
00159   {
00160     return(true);
00161   }
00162 
00164   /* Returns the quantity \f$ \| A \|_\infty\f$ such that
00165      \f[\| A \|_\infty = \max_{1\lei\len} \sum_{i=1}^m |a_{ij}| \f].
00166      */ 
00167   virtual double NormInf() const
00168   {
00169     return(A().NormInf());
00170   }
00171 
00173   /* Returns the quantity \f$ \| A \|_1\f$ such that
00174      \f[\| A \|_1= \max_{1\lej\len} \sum_{j=1}^n |a_{ij}| \f].
00175      */ 
00176   virtual double NormOne() const
00177   {
00178     IFPACK_RETURN(A().NormOne());
00179   }
00180 
00182   virtual int NumGlobalNonzeros() const
00183   {
00184     return(NumGlobalNonzeros_);
00185   }
00186 
00188   virtual int NumGlobalRows() const
00189   {
00190     return(A().NumGlobalRows());
00191   }
00192 
00194   virtual int NumGlobalCols() const
00195   {
00196     return(A().NumGlobalCols());
00197   }
00198 
00200   virtual int NumGlobalDiagonals() const
00201   {
00202     return(A().NumGlobalDiagonals());
00203   }
00204 
00206   virtual int NumMyNonzeros() const
00207   {
00208     return(NumMyNonzeros_);
00209   }
00210 
00212   virtual int NumMyRows() const
00213   {
00214     return(NumMyRows_);
00215   }
00216 
00218   virtual int NumMyCols() const
00219   {
00220     return(NumMyCols_);
00221   }
00222 
00224   virtual int NumMyDiagonals() const
00225   {
00226     return(NumMyDiagonals_);
00227   }
00228 
00230   virtual bool LowerTriangular() const
00231   {
00232     return(A().LowerTriangular());
00233   }
00234 
00236   virtual bool UpperTriangular() const
00237   {
00238     return(A().UpperTriangular());
00239   }
00240 
00242   virtual const Epetra_Map & RowMatrixRowMap() const
00243   {
00244     return(*Map_);
00245   }
00246 
00248   virtual const Epetra_Map & RowMatrixColMap() const
00249   {
00250     return(*Map_);
00251   }
00252 
00254   virtual const Epetra_Import * RowMatrixImporter() const
00255   {
00256     return(&*Importer_);
00257   }
00259 
00260   // following functions are required to derive Epetra_RowMatrix objects.
00261 
00263   int SetOwnership(bool ownership)
00264   {
00265     IFPACK_RETURN(-1);
00266   }
00267 
00269   int SetUseTranspose(bool UseTranspose_in)
00270   {
00271     UseTranspose_ = UseTranspose_in;
00272     return(0);
00273   }
00274 
00276   bool UseTranspose() const 
00277   {
00278     return(UseTranspose_);
00279   }
00280 
00282   bool HasNormInf() const
00283   {
00284     return(A().HasNormInf());
00285   }
00286 
00288   const Epetra_Comm & Comm() const
00289   {
00290     return(A().Comm());
00291   }
00292 
00294   const Epetra_Map & OperatorDomainMap() const 
00295   {
00296     return(*Map_);
00297   }
00298 
00300   const Epetra_Map & OperatorRangeMap() const 
00301   {
00302     return(*Map_);
00303   }
00305 
00306 const Epetra_BlockMap& Map() const;
00307 
00308 const char* Label() const{
00309   return(Label_.c_str());
00310 };
00311 
00312 int OverlapLevel() const
00313 {
00314   return(OverlapLevel_);
00315 }
00316 
00317 int ImportMultiVector(const Epetra_MultiVector& X,
00318                       Epetra_MultiVector& OvX,
00319                       Epetra_CombineMode CM = Insert);
00320 
00321 int ExportMultiVector(const Epetra_MultiVector& OvX,
00322                       Epetra_MultiVector& X,
00323                       Epetra_CombineMode CM = Add);
00324 private:
00325 
00326   inline const Epetra_RowMatrix& A() const 
00327   {
00328     return(*Matrix_);
00329   }
00330 
00331   inline Epetra_RowMatrix& B() const;
00332 
00333   int NumMyRows_;
00334   int NumMyCols_;
00335   int NumMyDiagonals_;
00336   int NumMyNonzeros_;
00337 
00338   int NumGlobalNonzeros_;
00339   int MaxNumEntries_;
00340 
00341   int NumMyRowsA_;
00342   int NumMyRowsB_;
00343 
00344   bool UseTranspose_;
00345 
00346   Teuchos::RefCountPtr<const Epetra_Map> Map_;
00347   Teuchos::RefCountPtr<const Epetra_Import> Importer_;
00348 
00349   Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
00350   Teuchos::RefCountPtr<Epetra_CrsMatrix> ExtMatrix_;
00351   Teuchos::RefCountPtr<Epetra_Map> ExtMap_;
00352   Teuchos::RefCountPtr<Epetra_Import> ExtImporter_;
00353 
00354   int OverlapLevel_;
00355   string Label_;
00356 
00357 }; // class Ifpack_OverlappingRowMatrix
00358 
00359 #endif // IFPACK_OVERLAPPINGROWMATRIX_H

Generated on Wed May 12 21:46:03 2010 for IFPACK by  doxygen 1.4.7