IFPACK Development
Ifpack_DiagonalFilter.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_DIAGONALFILTER_H
00031 #define IFPACK_DIAGONALFILTER_H
00032 
00033 #include "Ifpack_ConfigDefs.h"
00034 #include "Epetra_ConfigDefs.h"
00035 #include "Epetra_RowMatrix.h"
00036 #include "Epetra_Time.h"
00037 #include "Teuchos_RefCountPtr.hpp"
00038 
00039 class Epetra_Comm;
00040 class Epetra_Map;
00041 class Epetra_MultiVector;
00042 class Epetra_Import;
00043 class Epetra_BlockMap;
00044 
00046 
00067 class Ifpack_DiagonalFilter : public virtual Epetra_RowMatrix {
00068 
00069 public:
00071   Ifpack_DiagonalFilter(const Teuchos::RefCountPtr<Epetra_RowMatrix>& Matrix,
00072                         double AbsoluteThreshold,
00073                         double RelativeThreshold);
00074   
00076   virtual ~Ifpack_DiagonalFilter() {};
00077 
00079   virtual int NumMyRowEntries(int MyRow, int& NumEntries) const
00080   {
00081     return(A_->NumMyRowEntries(MyRow, NumEntries));
00082   }
00083 
00085   virtual int MaxNumEntries() const
00086   {
00087     return(A_->MaxNumEntries());
00088   }
00089 
00090   inline virtual int ExtractMyRowCopy(int MyRow, int Length, int& NumEntries, 
00091                                double* Values, int* Indices) const;
00092 
00093   virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const
00094   {
00095     IFPACK_RETURN(A_->ExtractDiagonalCopy(Diagonal));
00096   }
00097 
00098   virtual int Multiply(bool TransA, const Epetra_MultiVector& X, 
00099                Epetra_MultiVector& Y) const;
00100 
00101   virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, 
00102             const Epetra_MultiVector& X,
00103             Epetra_MultiVector& Y) const
00104   {
00105     IFPACK_CHK_ERR(-1);
00106   }
00107 
00108   virtual int Apply(const Epetra_MultiVector& X,
00109             Epetra_MultiVector& Y) const
00110   {
00111     IFPACK_RETURN(Multiply(UseTranspose(),X,Y));
00112   }
00113 
00114   virtual int ApplyInverse(const Epetra_MultiVector& X,
00115                Epetra_MultiVector& Y) const
00116   {
00117     IFPACK_CHK_ERR(-1);
00118   }
00119 
00120   virtual int InvRowSums(Epetra_Vector& x) const
00121   {
00122     IFPACK_CHK_ERR(-1);
00123   }
00124 
00125   virtual int LeftScale(const Epetra_Vector& x)
00126   {
00127     return(A_->LeftScale(x));
00128   }
00129 
00130   virtual int InvColSums(Epetra_Vector& x) const
00131   {
00132     IFPACK_CHK_ERR(-1);;
00133   }
00134 
00135   virtual int RightScale(const Epetra_Vector& x) 
00136   {
00137     return(A_->RightScale(x));
00138   }
00139 
00140   virtual bool Filled() const
00141   {
00142     return(A_->Filled());
00143   }
00144 
00146   virtual double NormInf() const
00147   {
00148     return(-1.0);
00149   }
00150 
00152   virtual double NormOne() const
00153   {
00154     return(-1.0);
00155   }
00156 
00157 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00158   virtual int NumGlobalNonzeros() const
00159   {
00160     return(A_->NumGlobalNonzeros());
00161   }
00162 
00163   virtual int NumGlobalRows() const
00164   {
00165     return(A_->NumGlobalRows());
00166   }
00167 
00168   virtual int NumGlobalCols() const
00169   {
00170     return(A_->NumGlobalCols());
00171   }
00172 
00173   virtual int NumGlobalDiagonals() const
00174   {
00175     return(A_->NumGlobalDiagonals());
00176   }
00177 #endif
00178 
00179   virtual long long NumGlobalNonzeros64() const
00180   {
00181     return(A_->NumGlobalNonzeros64());
00182   }
00183 
00184   virtual long long NumGlobalRows64() const
00185   {
00186     return(A_->NumGlobalRows64());
00187   }
00188 
00189   virtual long long NumGlobalCols64() const
00190   {
00191     return(A_->NumGlobalCols64());
00192   }
00193 
00194   virtual long long NumGlobalDiagonals64() const
00195   {
00196     return(A_->NumGlobalDiagonals64());
00197   }
00198 
00199   virtual int NumMyNonzeros() const
00200   {
00201     return(A_->NumMyNonzeros());
00202   }
00203 
00204   virtual int NumMyRows() const
00205   {
00206     return(A_->NumMyRows());
00207   }
00208 
00209   virtual int NumMyCols() const
00210   {
00211     return(A_->NumMyCols());
00212   }
00213 
00214   virtual int NumMyDiagonals() const
00215   {
00216     return(A_->NumMyDiagonals());
00217   }
00218 
00219   virtual bool LowerTriangular() const
00220   {
00221     return(A_->LowerTriangular());
00222   }
00223 
00224   virtual bool UpperTriangular() const
00225   {
00226     return(A_->UpperTriangular());
00227   }
00228 
00229   virtual const Epetra_Map& RowMatrixRowMap() const
00230   {
00231     return(A_->RowMatrixRowMap());
00232   }
00233 
00234   virtual const Epetra_Map& RowMatrixColMap() const
00235   {
00236     return(A_->RowMatrixColMap());
00237   }
00238 
00239   virtual const Epetra_Import* RowMatrixImporter() const
00240   {
00241     return(A_->RowMatrixImporter());
00242   }
00243 
00244   int SetUseTranspose(bool UseTranspose_in)
00245   {
00246     return(A_->SetUseTranspose(UseTranspose_in));
00247   }
00248 
00249   bool UseTranspose() const 
00250   {
00251     return(A_->UseTranspose());
00252   }
00253 
00255   bool HasNormInf() const
00256   {
00257     return(false);
00258   }
00259 
00260   const Epetra_Comm& Comm() const
00261   {
00262     return(A_->Comm());
00263   }
00264 
00265   const Epetra_Map& OperatorDomainMap() const 
00266   {
00267     return(A_->OperatorDomainMap());
00268   }
00269 
00270   const Epetra_Map& OperatorRangeMap() const 
00271   {
00272     return(A_->OperatorRangeMap());
00273   }
00274 
00275   const Epetra_BlockMap& Map() const 
00276   {
00277     return(A_->Map());
00278   }
00279 
00280   const char* Label() const{
00281     return(A_->Label());
00282   }
00283 
00284 private:
00285 
00287   Teuchos::RefCountPtr<Epetra_RowMatrix> A_;
00289   double AbsoluteThreshold_;
00291   double RelativeThreshold_;
00293   std::vector<int> pos_;
00295   std::vector<double> val_;
00296 
00297 };
00298 
00299 
00300 #endif /* IFPACK_DIAGONALFILTER_H */
 All Classes Files Functions Variables Enumerations Friends