Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef TSFAZTECSOLVER_HPP
00030 #define TSFAZTECSOLVER_HPP
00031
00032 #include "SundanceDefs.hpp"
00033 #include "TSFLinearSolverBaseDecl.hpp"
00034 #include "SundanceHandleable.hpp"
00035 #include "SundancePrintable.hpp"
00036 #include "Teuchos_Describable.hpp"
00037
00038 #include "Teuchos_Array.hpp"
00039 #include "Teuchos_RefCountPtr.hpp"
00040 #include "Teuchos_ParameterList.hpp"
00041 #include <map>
00042
00043 #include "AztecOO.h"
00044
00045 #define AZ_recursive_iterate 10001
00046
00047 #define HAVE_ML
00048
00049
00050 namespace TSFExtended
00051 {
00052 using namespace Teuchos;
00053
00054
00055
00056
00057 class AztecSolver : public LinearSolverBase<double>,
00058 public Sundance::Handleable<LinearSolverBase<double> >,
00059 public Printable,
00060 public Describable
00061 {
00062 public:
00063
00064 AztecSolver(const Teuchos::map<int, int>& aztecOptions,
00065 const Teuchos::map<int, double>& aztecParameters);
00066
00067
00068 AztecSolver(const Teuchos::ParameterList& params);
00069
00070
00071 virtual ~AztecSolver(){;}
00072
00073
00074 virtual void updateTolerance(const double& tol);
00075
00076
00077
00078 void setUserPrec(const LinearOperator<double>& P,
00079 const LinearSolver<double>& pSolver);
00080
00081
00082
00083
00084 void print(std::ostream& os) const
00085 {
00086 os << description() << std::endl;
00087 }
00088
00089
00090
00091
00092
00093 std::string description() const {return "AztecSolver";}
00094
00095
00096
00097
00098
00099 virtual SolverState<double> solve(const LinearOperator<double>& op,
00100 const Vector<double>& rhs,
00101 Vector<double>& soln) const ;
00102
00103
00104
00105
00106 virtual RCP<LinearSolverBase<double> > getRcp()
00107 {return rcp(this);}
00108
00109
00110
00111 protected:
00112
00113 private:
00114
00115 void setupML(Epetra_RowMatrix* A) const ;
00116
00117
00118 mutable Array<int> options_;
00119
00120
00121 mutable Array<double> parameters_;
00122
00123
00124 bool useML_;
00125
00126
00127 bool useIfpack_;
00128
00129
00130 bool useUserPrec_;
00131
00132
00133
00134 bool aztec_recursive_iterate_;
00135
00136
00137 mutable ParameterList precParams_;
00138
00139
00140 mutable RCP<Epetra_Operator> userPrec_;
00141
00142
00143 mutable Array<double> aztec_status;
00144
00145
00146 mutable Array<int> aztec_proc_config;
00147
00148
00149
00150 static Teuchos::map<string,int>& paramMap()
00151 {static Teuchos::map<string,int> rtn; return rtn;}
00152
00153
00154 static void initParamMap();
00155
00156
00157 };
00158
00159 }
00160
00161 #endif