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