HermesCommon  2.0
precond_ml.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_PRECOND_ML_H_
23 #define __HERMES_COMMON_PRECOND_ML_H_
24 #include "../config.h"
25 #ifdef HAVE_ML
26 #include "precond.h"
27 #include "epetra.h"
28 #include <ml_MultiLevelPreconditioner.h>
29 
30 namespace Hermes
31 {
32  namespace Preconditioners
33  {
34  using namespace Hermes::Solvers;
38  template <typename Scalar>
39  class HERMES_API MlPrecond : public Precond<Scalar>
40  {
41  public:
45  MlPrecond(const char *type);
47  MlPrecond(ML_Epetra::MultiLevelPreconditioner *mpc);
48  virtual ~MlPrecond();
49 
50  void set_param(const char *name, const char *value);
51  void set_param(const char *name, int value);
52  void set_param(const char *name, double value);
53  protected:
54  virtual Epetra_Operator *get_obj() { return prec; }
55 
57  virtual void create(Matrix<Scalar> *mat);
59  virtual void destroy();
61  virtual void compute();
62 
63  void print_unused();
64 
65  // Epetra_Operator interface
66  virtual int ApplyInverse(const Epetra_MultiVector &r, Epetra_MultiVector &z) const;
67  virtual const Epetra_Comm &Comm() const;
68  virtual const Epetra_Map &OperatorDomainMap() const;
69  virtual const Epetra_Map &OperatorRangeMap() const;
70 
71  ML_Epetra::MultiLevelPreconditioner *prec;
72  Teuchos::ParameterList mlist;
73  EpetraMatrix<Scalar> *mat;
74  unsigned owner:1;
75 
76  friend class AztecOOSolver<Scalar>;
77  };
78  }
79 }
80 #endif
81 #endif