Ifpack_Euclid.h

Go to the documentation of this file.
00001 /*@HEADER
00002 // ***********************************************************************
00003 // 
00004 //       Ifpack: Object-Oriented Algebraic Preconditioner Package
00005 //                 Copyright (2009) 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_EUCLID_H
00031 #define IFPACK_EUCLID_H
00032 
00033 #include "Ifpack_ConfigDefs.h"
00034 #ifdef HAVE_EUCLID
00035 
00036 #include "Ifpack_Condest.h"
00037 #include "Ifpack_ScalingType.h"
00038 #include "Epetra_CompObject.h"
00039 #include "Epetra_MultiVector.h"
00040 #include "Epetra_Vector.h"
00041 #include "Epetra_CrsGraph.h"
00042 #include "Epetra_CrsMatrix.h"
00043 #include "Epetra_BlockMap.h"
00044 #include "Epetra_Map.h"
00045 #include "Epetra_Object.h"
00046 #include "Epetra_Comm.h"
00047 #include "Epetra_CrsMatrix.h"
00048 #include "Epetra_Time.h"
00049 #include "Teuchos_RefCountPtr.hpp"
00050 #include "Teuchos_ParameterList.hpp"
00051 #include "Epetra_MpiComm.h"
00052 
00053 #include "Mem_dh.h"
00054 #include "io_dh.h"
00055 #include "TimeLog_dh.h"
00056 #include "Parser_dh.h"
00057 #include "Euclid_dh.h"
00058 
00059 namespace Teuchos {
00060   class ParameterList;
00061 }
00062 
00064 
00069   //The other files that were modified for Trilinos are getRow.c, call_epetra.{cpp,h}.
00070 
00071 class Ifpack_Euclid: public Epetra_Object, public Epetra_CompObject, public virtual Epetra_Operator {
00072       
00073   friend ostream& operator << (ostream& os, const Ifpack_Euclid& A);
00074 
00075 public:
00076   // @{ Constructors and destructors.
00078   Ifpack_Euclid(Epetra_CrsMatrix* A);
00079   
00081   ~Ifpack_Euclid(){ Destroy();}
00082 
00083   // @}
00084   // @{ Construction methods
00085   
00087   int Initialize();
00088   
00090   bool IsInitialized() const{ return(IsInitialized_);}
00091 
00093 
00095   int Compute();
00096 
00098   bool IsComputed() const{ return(IsComputed_);}
00099 
00100 
00102 
00114   int SetParameters(Teuchos::ParameterList& parameterlist);
00115 
00117 
00123   int SetParameter(string name, int Value);
00124 
00126 
00132   int SetParameter(string name, double Value);
00133 
00135   int SetUseTranspose(bool UseTranspose_in) {UseTranspose_ = UseTranspose_in; return(0);};
00136   // @}
00137 
00138   // @{ Mathematical functions.
00139   // Applies the matrix to X, returns the result in Y.
00140   int Apply(const Epetra_MultiVector& X, 
00141          Epetra_MultiVector& Y) const{ return(Multiply(false,X,Y));}
00142 
00144 
00154   int Multiply(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const{ return A_->Multiply(Trans, X, Y); }
00155 
00157 
00170   int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00171 
00173   double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,  const int MaxIters = 1550,
00174                  const double Tol = 1e-9, Epetra_RowMatrix* Matrix_in = 0);
00175 
00177   double Condest() const{ return(Condest_);}
00178 
00179   // @}
00180   // @{ Query methods
00181   
00183   const char* Label() const {return(Label_);}
00184 
00186   void SetLabel(const char* Label_in){ strcpy(Label_,Label_in);}
00187   
00189   const Epetra_Map &OperatorDomainMap() const{return A_->DomainMap();}
00190 
00192   const Epetra_Map &OperatorRangeMap() const{return A_->RangeMap();}
00193 
00195   double NormInf() const {return(0.0);};
00196 
00198   bool HasNormInf() const {return(false);};
00199 
00201   bool UseTranspose() const {return(UseTranspose_);};
00202 
00204   const Epetra_Comm & Comm() const{return(A_->Comm());};
00205 
00207   const Epetra_CrsMatrix& Matrix() const{ return(*A_);}
00208 
00210   virtual int NumInitialize() const{ return(NumInitialize_);}
00211 
00213   virtual int NumCompute() const{ return(NumCompute_);}
00214 
00216   virtual int NumApplyInverse() const{ return(NumApplyInverse_);}
00217 
00219   virtual double InitializeTime() const{ return(InitializeTime_);}
00220 
00222   virtual double ComputeTime() const{ return(ComputeTime_);}
00223 
00225   virtual double ApplyInverseTime() const{ return(ApplyInverseTime_);}
00226 
00228   virtual double InitializeFlops() const{ return(0.0);}
00229 
00231   virtual double ComputeFlops() const{ return(ComputeFlops_);}
00232 
00234   virtual double ApplyInverseFlops() const{ return(ApplyInverseFlops_);}
00235 
00236 private:
00237 
00238   // @}
00239   // @{ Private methods
00240 
00242   Ifpack_Euclid(const Ifpack_Euclid& RHS) : Time_(RHS.Comm()){}
00243 
00245   Ifpack_Euclid& operator=(const Ifpack_Euclid& RHS){ return(*this);}
00246 
00248   void Destroy();
00249 
00251   MPI_Comm GetMpiComm() const{ return (dynamic_cast<const Epetra_MpiComm*>(&A_->Comm()))->GetMpiComm();}
00252 
00254   int CallEuclid(double *x, double *y) const;
00255 
00257 
00267   int Solve(bool Trans, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00268 
00270   int NumGlobalRows() const {return(A_->NumGlobalRows());};
00271   
00273   int NumGlobalCols() const {return(A_->NumGlobalCols());};
00274   
00276   int NumMyRows() const {return(A_->NumMyRows());};
00277   
00279   int NumMyCols() const {return(A_->NumMyCols());};
00280   
00281   // @}
00282   // @{ Internal data
00283   
00285   Teuchos::RefCountPtr<Epetra_CrsMatrix> A_;
00287   Teuchos::ParameterList List_;
00289   bool UseTranspose_;
00291   double Condest_;
00293   bool IsInitialized_;
00295   bool IsComputed_;
00297   char Label_[160];
00299   int NumInitialize_;
00301   int NumCompute_;
00303   mutable int NumApplyInverse_;
00305   double InitializeTime_;
00307   double ComputeTime_;
00309   mutable double ApplyInverseTime_;
00311   double ComputeFlops_;
00313   mutable double ApplyInverseFlops_;
00315   mutable Epetra_Time Time_;
00317   Euclid_dh eu;
00319   int SetLevel_;
00321   int SetBJ_;
00323   int SetStats_;
00325   int SetMem_;
00327   double SetSparse_;
00329   int SetRowScale_;
00331   double SetILUT_;
00332 };
00333 
00335 ostream& operator << (ostream& os, const Ifpack_Euclid& A);
00336 
00337 #endif // HAVE_EUCLID
00338 #endif /* IFPACK_EUCLID_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 10:05:34 2011 for Ifpack Package Browser (Single Doxygen Collection) by  doxygen 1.6.3