HermesCommon  2.0
aztecoo_solver.h
Go to the documentation of this file.
1 // This file is part of HermesCommon
2 //
3 // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR).
4 // Email: hpfem-group@unr.edu, home page: http://hpfem.org/.
5 //
6 // Hermes2D is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published
8 // by the Free Software Foundation; either version 2 of the License,
9 // or (at your option) any later version.
10 //
11 // Hermes2D is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with Hermes2D; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef __HERMES_COMMON_AZTECOO_SOLVER_H_
23 #define __HERMES_COMMON_AZTECOO_SOLVER_H_
24 #include "../config.h"
25 #ifdef HAVE_AZTECOO
26 #include "epetra.h"
27 #include "linear_matrix_solver.h"
28 #include "precond_ifpack.h"
29 #include <AztecOO.h>
30 
31 namespace Hermes
32 {
33  namespace Solvers
34  {
38  template <typename Scalar>
39  class HERMES_API AztecOOSolver : public IterSolver<Scalar>
40  {
41  public:
42 
45  void set_solver(const char *solver);
48  void set_tolerance(double tol);
51  void set_max_iters(int iters);
52 
55  virtual void set_precond(const char *name);
56 
57  AztecOOSolver(EpetraMatrix<Scalar> *m, EpetraVector<Scalar> *rhs);
58  virtual ~AztecOOSolver();
59  virtual bool solve();
60  virtual int get_matrix_size();
61  protected:
62  virtual int get_num_iters();
63  virtual double get_residual();
64 
67  virtual void set_precond(Precond<Scalar> *pc);
68 
70  void set_option(int option, int value);
71 
73  void set_param(int param, double value);
74 
75  AztecOO aztec;
76  EpetraMatrix<Scalar> *m;
77  EpetraVector<Scalar> *rhs;
78 
79  Precond<Scalar> *pc;
80 
81  template<typename T> friend LinearMatrixSolver<T>* create_linear_solver(Matrix<T>* matrix, Vector<T>* rhs);
82  };
83  }
84 }
85 #endif
86 #endif