Ifpack_SPARSKIT.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_SPARSKIT_H
00031 #define IFPACK_SPARSKIT_H
00032 
00033 #include "Ifpack_ConfigDefs.h"
00034 #if defined(HAVE_IFPACK_TEUCHOS) && defined(HAVE_IFPACK_SPARSKIT)
00035 #include "Ifpack_CondestType.h"
00036 #include "Ifpack_ScalingType.h"
00037 #include "Ifpack_Preconditioner.h"
00038 #include "Epetra_Vector.h"
00039 #include "Epetra_RowMatrix.h"
00040 class Epetra_Comm;
00041 class Epetra_Map;
00042 class Epetra_MultiVector;
00043 namespace Teuchos {
00044   class ParameterList;
00045 }
00046 
00048 
00049 class Ifpack_SPARSKIT: public Ifpack_Preconditioner {
00050       
00051  public:
00053   Ifpack_SPARSKIT(Epetra_RowMatrix* A);
00054   
00056   virtual ~Ifpack_SPARSKIT();
00057 
00058 #ifdef HAVE_IFPACK_TEUCHOS
00059 
00060   /* This method is only available if the Teuchos package is enabled.
00061      This method recognizes five parameter names: level_fill, drop_tolerance,
00062      absolute_threshold, relative_threshold and overlap_mode. These names are
00063      case insensitive. For level_fill the ParameterEntry must have type int, the 
00064      threshold entries must have type double and overlap_mode must have type
00065      Epetra_CombineMode.
00066   */
00067   int SetParameters(Teuchos::ParameterList& parameterlis);
00068 #endif
00069 
00070   int SetParameter(const string Name, const int Value)
00071   {
00072     IFPACK_CHK_ERR(-98);
00073   }
00074   int SetParameter(const string Name, const double Value)
00075   {
00076     IFPACK_CHK_ERR(-98);
00077   }
00078 
00079   const Epetra_RowMatrix& Matrix() const
00080   {
00081     return(A_);
00082   }
00083 
00084   Epetra_RowMatrix& Matrix()
00085   {
00086     return(A_);
00087   }
00088 
00089   bool IsInitialized() const
00090   {
00091     return(IsInitialized_);
00092   }
00093 
00095   int Initialize();
00096 
00098   int Compute();
00099 
00101   bool IsComputed() const 
00102   {
00103     return(IsComputed_);
00104   }
00105 
00106   // Mathematical functions.
00107   
00109 
00119   int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00120 
00121   int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const
00122   {
00123     IFPACK_CHK_ERR(-1);
00124   }
00125 
00127 
00135   double Condest(const Ifpack_CondestType CT = Ifpack_Cheap, 
00136                  const int MaxIters = 1550, 
00137                  const double Tol = 1e-9,
00138          Epetra_RowMatrix* Matrix = 0);
00139 
00140   double Condest() const
00141   {
00142     return(Condest_);
00143   }
00144 
00145   // Atribute access functions
00146   
00148 
00150 
00159   int SetUseTranspose(bool UseTranspose) {UseTranspose_ = UseTranspose; return(0);};
00160 
00162     double NormInf() const {return(0.0);};
00163 
00165     bool HasNormInf() const {return(false);};
00166 
00168     bool UseTranspose() const {return(UseTranspose_);};
00169 
00171     const Epetra_Map & OperatorDomainMap() const {return(A_.OperatorDomainMap());};
00172 
00174     const Epetra_Map & OperatorRangeMap() const{return(A_.OperatorRangeMap());};
00175 
00177     const Epetra_Comm & Comm() const{return(Comm_);};
00179 
00180     const char* Label() const
00181     {
00182       return(Label_.c_str());
00183     }
00184 
00185     int SetLabel(const char* Label)
00186     {
00187       Label_ = Label;
00188       return(0);
00189     }
00190  
00192   virtual ostream& Print(std::ostream& os) const;
00193 
00195   virtual int NumInitialize() const
00196   {
00197     return(NumInitialize_);
00198   }
00199 
00201   virtual int NumCompute() const
00202   {
00203     return(NumCompute_);
00204   }
00205 
00207   virtual int NumApplyInverse() const
00208   {
00209     return(NumApplyInverse_);
00210   }
00211 
00213   virtual double InitializeTime() const
00214   {
00215     return(InitializeTime_);
00216   }
00217 
00219   virtual double ComputeTime() const
00220   {
00221     return(ComputeTime_);
00222   }
00223 
00225   virtual double ApplyInverseTime() const
00226   {
00227     return(ApplyInverseTime_);
00228   }
00229 
00231   virtual double InitializeFlops() const
00232   {
00233     return(0.0);
00234   }
00235 
00236   virtual double ComputeFlops() const
00237   {
00238     return(0.0);
00239   }
00240 
00241   virtual double ApplyInverseFlops() const
00242   {
00243     return(0.0);
00244   }
00245 
00246 private:
00247   Epetra_RowMatrix& A_;
00248   const Epetra_Comm& Comm_;
00249   bool UseTranspose_;
00250   int lfil_;
00251   double droptol_;
00252   double tol_;
00253   double permtol_;
00254   double alph_;
00255   int mbloc_;
00256   string Type_;
00257 
00258   // Factorization in MSR format.
00259   vector<double> alu_;
00260   vector<int> jlu_;
00261   vector<int> ju_;
00262 
00263   string Label_;
00264   // Permutation vector if required by ILUTP and ILUDP.
00265   vector<int> iperm_;
00266 
00267   double Condest_;
00268 
00269   bool IsInitialized_;
00270   bool IsComputed_;
00271  
00273   int NumInitialize_;
00275   int NumCompute_;
00277   mutable int NumApplyInverse_;
00278 
00280   double InitializeTime_;
00282   double ComputeTime_;
00284   mutable double ApplyInverseTime_;
00285 
00287   double ComputeFlops_;
00289   mutable double ApplyInverseFlops_;
00290 
00291 };
00292 
00293 #endif // HAVE_IFPACK_TEUCHOS && HAVE_IFPACK_SPARSKIT
00294 #endif /* IFPACK_SPARSKIT_H */

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