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 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00038 //
00039 // ***********************************************************************
00040 //@HEADER
00041 */
00042 
00043 #ifndef IFPACK_AMESOS_H
00044 #define IFPACK_AMESOS_H
00045 
00046 #include "Ifpack_ConfigDefs.h"
00047 #include "Ifpack_Preconditioner.h"
00048 #include "Epetra_Operator.h"
00049 #include "Teuchos_ParameterList.hpp"
00050 #include "Teuchos_RefCountPtr.hpp"
00051 
00052 class Epetra_Map;
00053 class Epetra_Time;
00054 class Epetra_Comm;
00055 class Amesos_BaseSolver;
00056 class Epetra_LinearProblem;
00057 class Epetra_RowMatrix;
00058 
00060 
00081 class Ifpack_Amesos : public Ifpack_Preconditioner {
00082       
00083 public:
00084 
00086 
00088   Ifpack_Amesos(Epetra_RowMatrix* Matrix);
00089 
00091   Ifpack_Amesos(const Ifpack_Amesos& rhs);
00092 
00094   Ifpack_Amesos& operator=(const Ifpack_Amesos& rhs);
00095 
00097 
00098   virtual ~Ifpack_Amesos() {};
00099 
00101 
00103 
00105 
00115   virtual int SetUseTranspose(bool UseTranspose_in);
00117   
00119 
00121 
00129     virtual int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00130 
00132 
00143     virtual int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00144 
00146     virtual double NormInf() const;
00148   
00150 
00152     virtual const char * Label() const;
00153 
00155     virtual bool UseTranspose() const;
00156 
00158     virtual bool HasNormInf() const;
00159 
00161     virtual const Epetra_Comm & Comm() const;
00162 
00164     virtual const Epetra_Map & OperatorDomainMap() const;
00165 
00167     virtual const Epetra_Map & OperatorRangeMap() const;
00168 
00170 
00172  
00174   virtual bool IsInitialized() const
00175   {
00176     return(IsInitialized_);
00177   }
00178 
00180 
00183   virtual int Initialize();
00184 
00186   virtual bool IsComputed() const
00187   {
00188     return(IsComputed_);
00189   }
00190 
00192 
00195   virtual int Compute();
00196 
00198 
00205   virtual int SetParameters(Teuchos::ParameterList& List);
00206 
00208 
00210 
00212   virtual const Epetra_RowMatrix& Matrix() const
00213   {
00214     return(*Matrix_);
00215   }
00216 
00218   virtual double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
00219                          const int MaxIters = 1550,
00220                          const double Tol = 1e-9,
00221              Epetra_RowMatrix* Matrix_in= 0);
00222   
00224   virtual double Condest() const
00225   {
00226     return(Condest_);
00227   }
00228 
00230   virtual int NumInitialize() const
00231   {
00232     return(NumInitialize_);
00233   }
00234 
00236   virtual int NumCompute() const
00237   {
00238     return(NumCompute_);
00239   }
00240 
00242   virtual int NumApplyInverse() const
00243   {
00244     return(NumApplyInverse_);
00245   }
00246 
00248   virtual double InitializeTime() const
00249   {
00250     return(InitializeTime_);
00251   }
00252 
00254   virtual double ComputeTime() const
00255   {
00256     return(ComputeTime_);
00257   }
00258 
00260   virtual double ApplyInverseTime() const
00261   {
00262     return(ApplyInverseTime_);
00263   }
00264 
00266   virtual double InitializeFlops() const
00267   {
00268     return(0.0);
00269   }
00270 
00272   virtual double ComputeFlops() const
00273   {
00274     return(ComputeFlops_);
00275   }
00276 
00278   virtual double ApplyInverseFlops() const
00279   {
00280     return(ApplyInverseFlops_);
00281   }
00282 
00283   // Returns a constant reference to the internally stored 
00284   virtual const Teuchos::ParameterList& List() const 
00285   {
00286     return(List_);
00287   }
00288 
00290   virtual std::ostream& Print(std::ostream& os) const;
00291 
00293 
00294 protected:
00295   
00297 
00299   inline void SetLabel(const char* Label_in) 
00300   {
00301     Label_ = Label_in;
00302   }
00303 
00305   inline void SetIsInitialized(const bool IsInitialized_in)
00306   {
00307     IsInitialized_ = IsInitialized_in;
00308   }
00309 
00311   inline void SetIsComputed(const int IsComputed_in)
00312   {
00313     IsComputed_ = IsComputed_in;
00314   }
00315 
00317   inline void SetNumInitialize(const int NumInitialize_in)
00318   {
00319     NumInitialize_ = NumInitialize_in;
00320   }
00321 
00323   inline void SetNumCompute(const int NumCompute_in)
00324   {
00325     NumCompute_ = NumCompute_in;
00326   }
00327 
00329   inline void SetNumApplyInverse(const int NumApplyInverse_in)
00330   {
00331     NumApplyInverse_ = NumApplyInverse_in;
00332   }
00333 
00335   inline void SetInitializeTime(const double InitializeTime_in)
00336   {
00337     InitializeTime_ = InitializeTime_in;
00338   }
00339 
00341   inline void SetComputeTime(const double ComputeTime_in)
00342   {
00343     ComputeTime_ = ComputeTime_in;
00344   }
00345 
00347   inline void SetApplyInverseTime(const double ApplyInverseTime_in)
00348   {
00349     ApplyInverseTime_ = ApplyInverseTime_in;
00350   }
00351 
00353   inline void SetComputeFlops(const double ComputeFlops_in)
00354   {
00355     ComputeFlops_ = ComputeFlops_in;
00356   }
00357 
00359   inline void SetApplyInverseFlops(const double ApplyInverseFlops_in)
00360   {
00361     ApplyInverseFlops_ = ApplyInverseFlops_in;
00362   }
00363 
00365   inline void SetList(const Teuchos::ParameterList& List_in)
00366   {
00367     List_ = List_in;
00368   }
00370   
00371 private:
00372 
00374   Teuchos::RefCountPtr<const Epetra_RowMatrix> Matrix_;
00375 
00377   Teuchos::RefCountPtr<Epetra_LinearProblem> Problem_;
00379   Teuchos::RefCountPtr<Amesos_BaseSolver> Solver_;
00381   Teuchos::ParameterList List_;
00382 
00384   string Label_;
00386   bool IsEmpty_;
00388   bool IsInitialized_;
00390   bool IsComputed_;
00392   bool UseTranspose_;
00393 
00395   int NumInitialize_;
00397   int NumCompute_;
00399   mutable int NumApplyInverse_;
00400 
00402   double InitializeTime_;
00404   double ComputeTime_;
00406   mutable double ApplyInverseTime_;
00408   Teuchos::RefCountPtr<Epetra_Time> Time_;
00409 
00411   double ComputeFlops_;
00413   double ApplyInverseFlops_;
00414 
00416   double Condest_;
00417 };
00418 
00419 #endif // IFPACK_AMESOS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends