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 
00046 #ifdef TEUCHOS_DEBUG
00047 // 2007/09/19: If building with --enable-teuchos-debug, then you need to have
00048 // your type T fully defined if you dereference an RCP.  This was flagged on
00049 // the SGI compiler on sasg5000.  Note that this problem goes away if these
00050 // functions where defined in the *.cpp file instead of in the header file.
00051 #include "Epetra_RowMatrix.h"
00052 #endif
00053 
00055 
00076 class Ifpack_Amesos : public Ifpack_Preconditioner {
00077       
00078 public:
00079 
00081 
00083   Ifpack_Amesos(Epetra_RowMatrix* Matrix);
00084 
00086   Ifpack_Amesos(const Ifpack_Amesos& rhs);
00087 
00089   Ifpack_Amesos& operator=(const Ifpack_Amesos& rhs);
00090 
00092 
00093   virtual ~Ifpack_Amesos() {};
00094 
00096 
00098 
00100 
00110   virtual int SetUseTranspose(bool UseTranspose);
00112   
00114 
00116 
00124     virtual int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00125 
00127 
00138     virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00139 
00141     virtual double NormInf() const;
00143   
00145 
00147     virtual const char * Label() const;
00148 
00150     virtual bool UseTranspose() const;
00151 
00153     virtual bool HasNormInf() const;
00154 
00156     virtual const Epetra_Comm & Comm() const;
00157 
00159     virtual const Epetra_Map & OperatorDomainMap() const;
00160 
00162     virtual const Epetra_Map & OperatorRangeMap() const;
00163 
00165 
00167  
00169   virtual bool IsInitialized() const
00170   {
00171     return(IsInitialized_);
00172   }
00173 
00175 
00178   virtual int Initialize();
00179 
00181   virtual bool IsComputed() const
00182   {
00183     return(IsComputed_);
00184   }
00185 
00187 
00190   virtual int Compute();
00191 
00193 
00200   virtual int SetParameters(Teuchos::ParameterList& List);
00201 
00203 
00205 
00207   virtual const Epetra_RowMatrix& Matrix() const
00208   {
00209     return(*Matrix_);
00210   }
00211 
00213   virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00214                          const int MaxIters = 1550,
00215                          const double Tol = 1e-9,
00216              Epetra_RowMatrix* Matrix= 0);
00217   
00219   virtual double Condest() const
00220   {
00221     return(Condest_);
00222   }
00223 
00225   virtual int NumInitialize() const
00226   {
00227     return(NumInitialize_);
00228   }
00229 
00231   virtual int NumCompute() const
00232   {
00233     return(NumCompute_);
00234   }
00235 
00237   virtual int NumApplyInverse() const
00238   {
00239     return(NumApplyInverse_);
00240   }
00241 
00243   virtual double InitializeTime() const
00244   {
00245     return(InitializeTime_);
00246   }
00247 
00249   virtual double ComputeTime() const
00250   {
00251     return(ComputeTime_);
00252   }
00253 
00255   virtual double ApplyInverseTime() const
00256   {
00257     return(ApplyInverseTime_);
00258   }
00259 
00261   virtual double InitializeFlops() const
00262   {
00263     return(0.0);
00264   }
00265 
00267   virtual double ComputeFlops() const
00268   {
00269     return(ComputeFlops_);
00270   }
00271 
00273   virtual double ApplyInverseFlops() const
00274   {
00275     return(ApplyInverseFlops_);
00276   }
00277 
00278   // Returns a constant reference to the internally stored 
00279   virtual const Teuchos::ParameterList& List() const 
00280   {
00281     return(List_);
00282   }
00283 
00285   virtual std::ostream& Print(std::ostream& os) const;
00286 
00288 
00289 protected:
00290   
00292 
00294   inline void SetLabel(const char* Label) 
00295   {
00296     Label_ = Label;
00297   }
00298 
00300   inline void SetIsInitialized(const bool IsInitialized)
00301   {
00302     IsInitialized_ = IsInitialized;
00303   }
00304 
00306   inline void SetIsComputed(const int IsComputed)
00307   {
00308     IsComputed_ = IsComputed;
00309   }
00310 
00312   inline void SetNumInitialize(const int NumInitialize)
00313   {
00314     NumInitialize_ = NumInitialize;
00315   }
00316 
00318   inline void SetNumCompute(const int NumCompute)
00319   {
00320     NumCompute_ = NumCompute;
00321   }
00322 
00324   inline void SetNumApplyInverse(const int NumApplyInverse)
00325   {
00326     NumApplyInverse_ = NumApplyInverse;
00327   }
00328 
00330   inline void SetInitializeTime(const double InitializeTime)
00331   {
00332     InitializeTime_ = InitializeTime;
00333   }
00334 
00336   inline void SetComputeTime(const double ComputeTime)
00337   {
00338     ComputeTime_ = ComputeTime;
00339   }
00340 
00342   inline void SetApplyInverseTime(const double ApplyInverseTime)
00343   {
00344     ApplyInverseTime_ = ApplyInverseTime;
00345   }
00346 
00348   inline void SetComputeFlops(const double ComputeFlops)
00349   {
00350     ComputeFlops_ = ComputeFlops;
00351   }
00352 
00354   inline void SetApplyInverseFlops(const double ApplyInverseFlops)
00355   {
00356     ApplyInverseFlops_ = ApplyInverseFlops;
00357   }
00358 
00360   inline void SetList(const Teuchos::ParameterList& List)
00361   {
00362     List_ = List;
00363   }
00365   
00366 private:
00367 
00369   Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
00370 
00372   Teuchos::RefCountPtr<Amesos_BaseSolver> Solver_;
00374   Teuchos::RefCountPtr<Epetra_LinearProblem> Problem_;
00376   Teuchos::ParameterList List_;
00377 
00379   string Label_;
00381   bool IsInitialized_;
00383   bool IsComputed_;
00385   bool UseTranspose_;
00386 
00388   int NumInitialize_;
00390   int NumCompute_;
00392   mutable int NumApplyInverse_;
00393 
00395   double InitializeTime_;
00397   double ComputeTime_;
00399   mutable double ApplyInverseTime_;
00401   Teuchos::RefCountPtr<Epetra_Time> Time_;
00402 
00404   double ComputeFlops_;
00406   double ApplyInverseFlops_;
00407 
00409   double Condest_;
00410 };
00411 
00412 #endif // IFPACK_AMESOS_H

Generated on Tue Oct 20 12:48:53 2009 for IFPACK by doxygen 1.4.7