HermesCommon  3.0
precond_ifpack.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_IFPACK_H_
23 #define __HERMES_COMMON_PRECOND_IFPACK_H_
24 #include "../../config.h"
25 #ifdef HAVE_IFPACK
26 
27 #include "solvers/precond.h"
29 #include <Ifpack_Preconditioner.h>
30 
31 namespace Hermes
32 {
33  namespace Preconditioners
34  {
35  using namespace Hermes::Solvers;
38  template <typename Scalar>
39  class HERMES_API IfpackPrecond : public EpetraPrecond < Scalar >
40  {
41  public:
46  IfpackPrecond(const char *cls, const char *type = "Jacobi");
51  IfpackPrecond(const char *cls, const char *type, int overlap);
53  IfpackPrecond(Ifpack_Preconditioner *ipc);
54  virtual ~IfpackPrecond();
55 
56  void set_param(const char *name, const char *value);
57  void set_param(const char *name, int value);
58  void set_param(const char *name, double value);
59  protected:
60 
61  virtual Epetra_Operator *get_obj() { return prec; }
62 
63  virtual void create(Matrix<Scalar> *mat);
64  virtual void destroy() { }
65  virtual void compute();
66  virtual void recompute() { destroy(); compute(); }
67 
68  // Epetra_Operator interface
69  virtual int ApplyInverse(const Epetra_MultiVector &r, Epetra_MultiVector &z) const;
70  virtual const Epetra_Comm &Comm() const;
71  virtual const Epetra_Map &OperatorDomainMap() const;
72  virtual const Epetra_Map &OperatorRangeMap() const;
73 
74  void create_point_relax(EpetraMatrix<Scalar> *a, const char *name);
75  void create_block_relax(EpetraMatrix<Scalar> *a, const char *name);
76  void create_add_schwartz(EpetraMatrix<Scalar> *a, const char *name, int overlap);
77  int initialize();
78  void apply_params();
79  Ifpack_Preconditioner *prec;
80  Teuchos::ParameterList ilist;
82  unsigned owner : 1;
83  // class of the preconditioner
84  const char *cls;
85  const char *type;
86  int overlap;
87 
88  friend class AztecOOSolver < Scalar > ;
89  };
90  }
91 }
92 #endif
93 #endif
General (abstract) matrix representation in Hermes.
Definition: matrix.h:36
General namespace for the Hermes library.
Encapsulation of AztecOO linear solver.
Preconditioners built on IFPACK.
Definition: epetra.h:50
Abstract class for Epetra preconditioners.
Definition: precond.h:66
Namespace for linear / nonlinear / iterative solvers.
Definition: amesos_solver.h:34
General functionality for preconditioners. Contains class Precond.
EpetraMatrix and EpetraVector storage classes for Amesos, AztecOO, ... .