IFPACK Development
Ifpack_Amesos.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_AMESOS_H
00031 #define IFPACK_AMESOS_H
00032 
00033 #include "Ifpack_ConfigDefs.h"
00034 #include "Ifpack_Preconditioner.h"
00035 #include "Epetra_Operator.h"
00036 #include "Teuchos_ParameterList.hpp"
00037 #include "Teuchos_RefCountPtr.hpp"
00038 
00039 class Epetra_Map;
00040 class Epetra_Time;
00041 class Epetra_Comm;
00042 class Amesos_BaseSolver;
00043 class Epetra_LinearProblem;
00044 class Epetra_RowMatrix;
00045 
00047 
00068 class Ifpack_Amesos : public Ifpack_Preconditioner {
00069       
00070 public:
00071 
00073 
00075   Ifpack_Amesos(Epetra_RowMatrix* Matrix);
00076 
00078   Ifpack_Amesos(const Ifpack_Amesos& rhs);
00079 
00081   Ifpack_Amesos& operator=(const Ifpack_Amesos& rhs);
00082 
00084 
00085   virtual ~Ifpack_Amesos() {};
00086 
00088 
00090 
00092 
00102   virtual int SetUseTranspose(bool UseTranspose_in);
00104   
00106 
00108 
00116     virtual int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00117 
00119 
00130     virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00131 
00133     virtual double NormInf() const;
00135   
00137 
00139     virtual const char * Label() const;
00140 
00142     virtual bool UseTranspose() const;
00143 
00145     virtual bool HasNormInf() const;
00146 
00148     virtual const Epetra_Comm & Comm() const;
00149 
00151     virtual const Epetra_Map & OperatorDomainMap() const;
00152 
00154     virtual const Epetra_Map & OperatorRangeMap() const;
00155 
00157 
00159  
00161   virtual bool IsInitialized() const
00162   {
00163     return(IsInitialized_);
00164   }
00165 
00167 
00170   virtual int Initialize();
00171 
00173   virtual bool IsComputed() const
00174   {
00175     return(IsComputed_);
00176   }
00177 
00179 
00182   virtual int Compute();
00183 
00185 
00192   virtual int SetParameters(Teuchos::ParameterList& List);
00193 
00195 
00197 
00199   virtual const Epetra_RowMatrix& Matrix() const
00200   {
00201     return(*Matrix_);
00202   }
00203 
00205   virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00206                          const int MaxIters = 1550,
00207                          const double Tol = 1e-9,
00208              Epetra_RowMatrix* Matrix_in= 0);
00209   
00211   virtual double Condest() const
00212   {
00213     return(Condest_);
00214   }
00215 
00217   virtual int NumInitialize() const
00218   {
00219     return(NumInitialize_);
00220   }
00221 
00223   virtual int NumCompute() const
00224   {
00225     return(NumCompute_);
00226   }
00227 
00229   virtual int NumApplyInverse() const
00230   {
00231     return(NumApplyInverse_);
00232   }
00233 
00235   virtual double InitializeTime() const
00236   {
00237     return(InitializeTime_);
00238   }
00239 
00241   virtual double ComputeTime() const
00242   {
00243     return(ComputeTime_);
00244   }
00245 
00247   virtual double ApplyInverseTime() const
00248   {
00249     return(ApplyInverseTime_);
00250   }
00251 
00253   virtual double InitializeFlops() const
00254   {
00255     return(0.0);
00256   }
00257 
00259   virtual double ComputeFlops() const
00260   {
00261     return(ComputeFlops_);
00262   }
00263 
00265   virtual double ApplyInverseFlops() const
00266   {
00267     return(ApplyInverseFlops_);
00268   }
00269 
00270   // Returns a constant reference to the internally stored 
00271   virtual const Teuchos::ParameterList& List() const 
00272   {
00273     return(List_);
00274   }
00275 
00277   virtual std::ostream& Print(std::ostream& os) const;
00278 
00280 
00281 protected:
00282   
00284 
00286   inline void SetLabel(const char* Label_in) 
00287   {
00288     Label_ = Label_in;
00289   }
00290 
00292   inline void SetIsInitialized(const bool IsInitialized_in)
00293   {
00294     IsInitialized_ = IsInitialized_in;
00295   }
00296 
00298   inline void SetIsComputed(const int IsComputed_in)
00299   {
00300     IsComputed_ = IsComputed_in;
00301   }
00302 
00304   inline void SetNumInitialize(const int NumInitialize_in)
00305   {
00306     NumInitialize_ = NumInitialize_in;
00307   }
00308 
00310   inline void SetNumCompute(const int NumCompute_in)
00311   {
00312     NumCompute_ = NumCompute_in;
00313   }
00314 
00316   inline void SetNumApplyInverse(const int NumApplyInverse_in)
00317   {
00318     NumApplyInverse_ = NumApplyInverse_in;
00319   }
00320 
00322   inline void SetInitializeTime(const double InitializeTime_in)
00323   {
00324     InitializeTime_ = InitializeTime_in;
00325   }
00326 
00328   inline void SetComputeTime(const double ComputeTime_in)
00329   {
00330     ComputeTime_ = ComputeTime_in;
00331   }
00332 
00334   inline void SetApplyInverseTime(const double ApplyInverseTime_in)
00335   {
00336     ApplyInverseTime_ = ApplyInverseTime_in;
00337   }
00338 
00340   inline void SetComputeFlops(const double ComputeFlops_in)
00341   {
00342     ComputeFlops_ = ComputeFlops_in;
00343   }
00344 
00346   inline void SetApplyInverseFlops(const double ApplyInverseFlops_in)
00347   {
00348     ApplyInverseFlops_ = ApplyInverseFlops_in;
00349   }
00350 
00352   inline void SetList(const Teuchos::ParameterList& List_in)
00353   {
00354     List_ = List_in;
00355   }
00357   
00358 private:
00359 
00361   Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
00362 
00364   Teuchos::RefCountPtr<Epetra_LinearProblem> Problem_;
00366   Teuchos::RefCountPtr<Amesos_BaseSolver> Solver_;
00368   Teuchos::ParameterList List_;
00369 
00371   string Label_;
00373   bool IsEmpty_;
00375   bool IsInitialized_;
00377   bool IsComputed_;
00379   bool UseTranspose_;
00380 
00382   int NumInitialize_;
00384   int NumCompute_;
00386   mutable int NumApplyInverse_;
00387 
00389   double InitializeTime_;
00391   double ComputeTime_;
00393   mutable double ApplyInverseTime_;
00395   Teuchos::RefCountPtr<Epetra_Time> Time_;
00396 
00398   double ComputeFlops_;
00400   double ApplyInverseFlops_;
00401 
00403   double Condest_;
00404 };
00405 
00406 #endif // IFPACK_AMESOS_H
 All Classes Files Functions Variables Typedefs Enumerations Friends