HermesCommon  3.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://www.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 "solvers/precond.h"
28 #include <ml_MultiLevelPreconditioner.h>
29 
30 namespace Hermes
31 {
32  namespace Preconditioners
33  {
34  using namespace Hermes::Solvers;
37  template <typename Scalar>
38  class HERMES_API MlPrecond : public EpetraPrecond < Scalar >
39  {
40  public:
44  MlPrecond(const char *type);
46  MlPrecond(ML_Epetra::MultiLevelPreconditioner *mpc);
47  virtual ~MlPrecond();
48 
49  void set_param(const char *name, const char *value);
50  void set_param(const char *name, int value);
51  void set_param(const char *name, bool 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();
63  virtual void recompute();
64 
65  void print_unused();
66 
67  // Epetra_Operator interface
68  virtual int ApplyInverse(const Epetra_MultiVector &r, Epetra_MultiVector &z) const;
69  virtual const Epetra_Comm &Comm() const;
70  virtual const Epetra_Map &OperatorDomainMap() const;
71  virtual const Epetra_Map &OperatorRangeMap() const;
72 
73  ML_Epetra::MultiLevelPreconditioner *prec;
74  Teuchos::ParameterList mlist;
76  unsigned owner : 1;
77 
78  friend class AztecOOSolver < Scalar > ;
79  };
80  }
81 }
82 #endif
83 #endif
General (abstract) matrix representation in Hermes.
Definition: matrix.h:36
General namespace for the Hermes library.
Encapsulation of AztecOO linear solver.
Abstract class for Epetra preconditioners.
Definition: precond.h:66
Namespace for linear / nonlinear / iterative solvers.
Definition: amesos_solver.h:34
Preconditioners built on ML.
Definition: epetra.h:51
General functionality for preconditioners. Contains class Precond.
EpetraMatrix and EpetraVector storage classes for Amesos, AztecOO, ... .