HermesCommon  2.0
precond.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_H_
23 #define __HERMES_COMMON_PRECOND_H_
24 
25 #include "common.h" // Also includes preprocessor definitions for the various
26 // solver libraries via config.h.
27 
28 #include "matrix.h"
29 
30 #ifdef HAVE_EPETRA
31 #include <Epetra_Operator.h>
32 #endif
33 
34 using namespace Hermes::Algebra;
35 
36 namespace Hermes
37 {
39  namespace Preconditioners
40  {
44  template <typename Scalar>
45  class Precond
46 #ifdef HAVE_EPETRA
47  : public Epetra_Operator
48 #endif
49  {
50  public:
51  virtual void create(Matrix<Scalar> *mat) = 0;
52  virtual void destroy() = 0;
53  virtual void compute() = 0;
54 
55 #ifdef HAVE_EPETRA
56  virtual Epetra_Operator *get_obj() = 0;
57 
58  // Epetra_Operator interface
59  virtual int SetUseTranspose(bool UseTranspose) { return 0; }
60  virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const { return 0; }
61  virtual int ApplyInverse(const Epetra_MultiVector &r, Epetra_MultiVector &z) const { return 0; }
62  virtual double NormInf() const { return 0.0; }
63  virtual const char *Label() const { return NULL; }
64  virtual bool UseTranspose() const { return false; }
65  virtual bool HasNormInf() const { return false; }
66  virtual const Epetra_Comm &Comm() const = 0;
67  virtual const Epetra_Map &OperatorDomainMap() const = 0;
68  virtual const Epetra_Map &OperatorRangeMap() const = 0;
69 #endif
70  };
71  }
72 }
73 #endif