Ifpack_LocalFilter.h

00001 #ifndef IFPACK_LOCALFILTER_H
00002 #define IFPACK_LOCALFILTER_H
00003 
00004 #include "Ifpack_ConfigDefs.h"
00005 #ifdef HAVE_MPI
00006 #include "Epetra_MpiComm.h"
00007 #else
00008 #include "Epetra_SerialComm.h"
00009 #endif
00010 #include "Epetra_RowMatrix.h"
00011 class Epetra_Map;
00012 class Epetra_MultiVector;
00013 class Epetra_Vector;
00014 class Epetra_Import;
00015 class Epetra_BlockMap;
00016 
00018 
00054 class Ifpack_LocalFilter : public virtual Epetra_RowMatrix {
00055 
00056 public:
00058 
00059   Ifpack_LocalFilter(const Epetra_RowMatrix* Matrix);
00060 
00062 
00063 
00064   virtual ~Ifpack_LocalFilter();
00065 
00067 
00069 
00071 
00079   virtual int NumMyRowEntries(int MyRow, int & NumEntries) const
00080   {
00081     NumEntries = NumEntries_[MyRow];
00082     return(0);
00083   }
00084 
00086   virtual int MaxNumEntries() const
00087   {
00088     return(MaxNumEntries_);
00089   }
00090 
00092 
00106   virtual inline int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
00107 
00109 
00115   virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const;
00117 
00119 
00121 
00131   virtual int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const
00132   {
00133     if (TransA == true) {
00134       IFPACK_CHK_ERR(-1);
00135     }
00136 
00137     IFPACK_CHK_ERR(Apply(X,Y));
00138     return(0);
00139   }
00140 
00142   virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector& X, 
00143             Epetra_MultiVector& Y) const
00144   {
00145     IFPACK_RETURN(-1); // not implemented 
00146   }
00147 
00148   virtual int Apply(const Epetra_MultiVector& X,
00149             Epetra_MultiVector& Y) const;
00150 
00151   virtual int ApplyInverse(const Epetra_MultiVector& X,
00152                Epetra_MultiVector& Y) const;
00154   virtual int InvRowSums(Epetra_Vector& x) const
00155   {
00156     IFPACK_RETURN(-1); // not implemented
00157   }
00158 
00160   virtual int LeftScale(const Epetra_Vector& x)
00161   {
00162     IFPACK_RETURN(-1); // not implemented
00163   }
00164 
00166   virtual int InvColSums(Epetra_Vector& x) const
00167   {
00168     IFPACK_RETURN(-1); // not implemented
00169   }
00170 
00171 
00173   virtual int RightScale(const Epetra_Vector& x) 
00174   {
00175     IFPACK_RETURN(-1); // not implemented
00176   }
00177 
00179 
00181 
00183   virtual bool Filled() const
00184   {
00185     return true;
00186   }
00187 
00189   /* Returns the quantity \f$ \| A \|_\infty\f$ such that
00190      \f[\| A \|_\infty = \max_{1\lei\len} \sum_{i=1}^m |a_{ij}| \f].
00191      */ 
00192   virtual double NormInf() const
00193   {
00194     return(-1.0);
00195   }
00196 
00198   /* Returns the quantity \f$ \| A \|_1\f$ such that
00199      \f[\| A \|_1= \max_{1\lej\len} \sum_{j=1}^n |a_{ij}| \f].
00200      */ 
00201   virtual double NormOne() const
00202   {
00203     IFPACK_RETURN(-1.0);
00204   }
00205 
00207   virtual int NumGlobalNonzeros() const
00208   {
00209     return(NumNonzeros_);
00210   }
00211 
00213   virtual int NumGlobalRows() const
00214   {
00215     return(NumRows_);
00216   }
00217 
00219   virtual int NumGlobalCols() const
00220   {
00221     return(NumRows_);
00222   }
00223 
00225   virtual int NumGlobalDiagonals() const
00226   {
00227     return(NumRows_);
00228   }
00229 
00231   virtual int NumMyNonzeros() const
00232   {
00233     return(NumNonzeros_);
00234   }
00235 
00237   virtual int NumMyRows() const
00238   {
00239     return(NumRows_);
00240   }
00241 
00243   virtual int NumMyCols() const
00244   {
00245     return(NumRows_);
00246   }
00247 
00249   virtual int NumMyDiagonals() const
00250   {
00251     return(NumRows_);
00252   }
00253 
00255   virtual bool LowerTriangular() const
00256   {
00257     return(Matrix_->LowerTriangular());
00258   }
00259 
00261   virtual bool UpperTriangular() const
00262   {
00263     return(Matrix_->UpperTriangular());
00264   }
00265 
00267   virtual const Epetra_Map & RowMatrixRowMap() const
00268   {
00269     return(*Map_);
00270   }
00271 
00273   virtual const Epetra_Map & RowMatrixColMap() const
00274   {
00275     return(*Map_);
00276   }
00277 
00279   virtual const Epetra_Import * RowMatrixImporter() const
00280   {
00281     return(0);
00282   }
00284 
00285   // following functions are required to derive Epetra_RowMatrix objects.
00286 
00288   int SetOwnership(bool ownership)
00289   {
00290     IFPACK_RETURN(-1);
00291   }
00292 
00294   int SetUseTranspose(bool UseTranspose)
00295   {
00296     UseTranspose_ = UseTranspose;
00297     return(0);
00298   }
00299 
00301   bool UseTranspose() const 
00302   {
00303     return(UseTranspose_);
00304   }
00305 
00307   bool HasNormInf() const
00308   {
00309     return(false);
00310   }
00311 
00313   const Epetra_Comm & Comm() const
00314   {
00315     return(*SerialComm_);
00316   }
00317 
00319   const Epetra_Map & OperatorDomainMap() const 
00320   {
00321     return(*Map_);
00322   }
00323 
00325   const Epetra_Map & OperatorRangeMap() const 
00326   {
00327     return(*Map_);
00328   }
00330 
00331 const Epetra_BlockMap& Map() const;
00332 
00333 const char* Label() const{
00334   return(Label_);
00335 };
00336 
00337 private:
00338 
00340   const Epetra_RowMatrix* Matrix_;
00341 #ifdef HAVE_MPI
00342 
00343   Epetra_MpiComm* SerialComm_;
00344 #else
00345 
00346   Epetra_SerialComm* SerialComm_;
00347 #endif
00348 
00349   Epetra_Map* Map_;
00351   int NumRows_;
00353   int NumNonzeros_;
00355   int MaxNumEntries_;
00357   int MaxNumEntriesA_;
00359   vector<int> NumEntries_;
00361   mutable vector<int> Indices_;
00363   mutable vector<double> Values_;
00365   bool UseTranspose_;
00367   char Label_[80];
00368   Epetra_Vector* Diagonal_;
00369   double NormOne_;
00370   double NormInf_;
00371 
00372 };
00373 
00374 #endif /* IFPACK_LOCALFILTER_H */

Generated on Thu Sep 18 12:37:07 2008 for IFPACK by doxygen 1.3.9.1