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 #ifdef TEUCHOS_DEBUG
00045 // 2007/09/19: If building with --enable-teuchos-debug, then you need to have
00046 // your type T fully defined if you dereference an RCP.  This was flagged on
00047 // the SGI compiler on sasg5000.  Note that this problem goes away if these
00048 // functions where defined in the *.cpp file instead of in the header file.
00049 #include "Epetra_Map.h"
00050 #endif
00051 
00052 class Ifpack_OverlappingRowMatrix : public virtual Epetra_RowMatrix {
00053 
00054 public:
00055 
00057   Ifpack_OverlappingRowMatrix(const Teuchos::RefCountPtr<const Epetra_RowMatrix>& Matrix,
00058                               int OverlapLevel);
00059 
00060   ~Ifpack_OverlappingRowMatrix() {};
00062 
00064 
00066 
00074   virtual int NumMyRowEntries(int MyRow, int & NumEntries) const;
00075 
00077   virtual int MaxNumEntries() const
00078   {
00079     return(MaxNumEntries_);
00080   }
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   virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector& X, 
00126             Epetra_MultiVector& Y) const
00127   {
00128     IFPACK_RETURN(-1); // not implemented 
00129   }
00130 
00131   virtual int Apply(const Epetra_MultiVector& X,
00132             Epetra_MultiVector& Y) const;
00133 
00134   virtual int ApplyInverse(const Epetra_MultiVector& X,
00135                Epetra_MultiVector& Y) const;
00137   virtual int InvRowSums(Epetra_Vector& x) const
00138   {
00139     IFPACK_RETURN(-1); // not implemented
00140   }
00141 
00143   virtual int LeftScale(const Epetra_Vector& x)
00144   {
00145     IFPACK_RETURN(-1); // not implemented
00146   }
00147 
00149   virtual int InvColSums(Epetra_Vector& x) const
00150   {
00151     IFPACK_RETURN(-1); // not implemented
00152   }
00153 
00154 
00156   virtual int RightScale(const Epetra_Vector& x) 
00157   {
00158     IFPACK_RETURN(-1); // not implemented
00159   }
00160 
00162 
00164 
00166   virtual bool Filled() const
00167   {
00168     return(true);
00169   }
00170 
00172   /* Returns the quantity \f$ \| A \|_\infty\f$ such that
00173      \f[\| A \|_\infty = \max_{1\lei\len} \sum_{i=1}^m |a_{ij}| \f].
00174      */ 
00175   virtual double NormInf() const
00176   {
00177     return(A().NormInf());
00178   }
00179 
00181   /* Returns the quantity \f$ \| A \|_1\f$ such that
00182      \f[\| A \|_1= \max_{1\lej\len} \sum_{j=1}^n |a_{ij}| \f].
00183      */ 
00184   virtual double NormOne() const
00185   {
00186     IFPACK_RETURN(A().NormOne());
00187   }
00188 
00190   virtual int NumGlobalNonzeros() const
00191   {
00192     return(NumGlobalNonzeros_);
00193   }
00194 
00196   virtual int NumGlobalRows() const
00197   {
00198     return(A().NumGlobalRows());
00199   }
00200 
00202   virtual int NumGlobalCols() const
00203   {
00204     return(A().NumGlobalCols());
00205   }
00206 
00208   virtual int NumGlobalDiagonals() const
00209   {
00210     return(A().NumGlobalDiagonals());
00211   }
00212 
00214   virtual int NumMyNonzeros() const
00215   {
00216     return(NumMyNonzeros_);
00217   }
00218 
00220   virtual int NumMyRows() const
00221   {
00222     return(NumMyRows_);
00223   }
00224 
00226   virtual int NumMyCols() const
00227   {
00228     return(NumMyCols_);
00229   }
00230 
00232   virtual int NumMyDiagonals() const
00233   {
00234     return(NumMyDiagonals_);
00235   }
00236 
00238   virtual bool LowerTriangular() const
00239   {
00240     return(A().LowerTriangular());
00241   }
00242 
00244   virtual bool UpperTriangular() const
00245   {
00246     return(A().UpperTriangular());
00247   }
00248 
00250   virtual const Epetra_Map & RowMatrixRowMap() const
00251   {
00252     return(*Map_);
00253   }
00254 
00256   virtual const Epetra_Map & RowMatrixColMap() const
00257   {
00258     return(*Map_);
00259   }
00260 
00262   virtual const Epetra_Import * RowMatrixImporter() const
00263   {
00264     return(&*Importer_);
00265   }
00267 
00268   // following functions are required to derive Epetra_RowMatrix objects.
00269 
00271   int SetOwnership(bool ownership)
00272   {
00273     IFPACK_RETURN(-1);
00274   }
00275 
00277   int SetUseTranspose(bool UseTranspose)
00278   {
00279     UseTranspose_ = UseTranspose;
00280     return(0);
00281   }
00282 
00284   bool UseTranspose() const 
00285   {
00286     return(UseTranspose_);
00287   }
00288 
00290   bool HasNormInf() const
00291   {
00292     return(A().HasNormInf());
00293   }
00294 
00296   const Epetra_Comm & Comm() const
00297   {
00298     return(A().Comm());
00299   }
00300 
00302   const Epetra_Map & OperatorDomainMap() const 
00303   {
00304     return(*Map_);
00305   }
00306 
00308   const Epetra_Map & OperatorRangeMap() const 
00309   {
00310     return(*Map_);
00311   }
00313 
00314 const Epetra_BlockMap& Map() const;
00315 
00316 const char* Label() const{
00317   return(Label_.c_str());
00318 };
00319 
00320 int OverlapLevel() const
00321 {
00322   return(OverlapLevel_);
00323 }
00324 
00325 int ImportMultiVector(const Epetra_MultiVector& X,
00326                       Epetra_MultiVector& OvX,
00327                       Epetra_CombineMode CM = Insert);
00328 
00329 int ExportMultiVector(const Epetra_MultiVector& OvX,
00330                       Epetra_MultiVector& X,
00331                       Epetra_CombineMode CM = Add);
00332 private:
00333 
00334   inline const Epetra_RowMatrix& A() const 
00335   {
00336     return(*Matrix_);
00337   }
00338 
00339   inline Epetra_RowMatrix& B() const;
00340 
00341   int NumMyRows_;
00342   int NumMyCols_;
00343   int NumMyDiagonals_;
00344   int NumMyNonzeros_;
00345 
00346   int NumGlobalNonzeros_;
00347   int MaxNumEntries_;
00348 
00349   int NumMyRowsA_;
00350   int NumMyRowsB_;
00351 
00352   bool UseTranspose_;
00353 
00354   Teuchos::RefCountPtr<const Epetra_Map> Map_;
00355   Teuchos::RefCountPtr<const Epetra_Import> Importer_;
00356 
00357   Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
00358   Teuchos::RefCountPtr<Epetra_CrsMatrix> ExtMatrix_;
00359   Teuchos::RefCountPtr<Epetra_Map> ExtMap_;
00360   Teuchos::RefCountPtr<Epetra_Import> ExtImporter_;
00361 
00362   int OverlapLevel_;
00363   string Label_;
00364 
00365 }; // class Ifpack_OverlappingRowMatrix
00366 
00367 #endif // IFPACK_OVERLAPPINGROWMATRIX_H

Generated on Tue Oct 20 12:48:54 2009 for IFPACK by doxygen 1.4.7