trilinos_preconditioner.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_TRILINOS_PRECONDITIONER_H
21 #define LIBMESH_TRILINOS_PRECONDITIONER_H
22 
23 #include "libmesh/libmesh_config.h"
24 
25 #ifdef LIBMESH_HAVE_TRILINOS
26 
27 // Local includes
28 #include "libmesh/preconditioner.h"
29 #include "libmesh/libmesh_common.h"
33 #include "libmesh/libmesh.h"
34 
35 // Trilinos includes
36 #include "Epetra_Operator.h"
37 #include "Epetra_FECrsMatrix.h"
38 #include "Teuchos_ParameterList.hpp"
39 
40 // C++ includes
41 #include <cstddef>
42 
43 namespace libMesh
44 {
45 
46 // forward declarations
47 template <typename T> class AutoPtr;
48 template <typename T> class SparseMatrix;
49 template <typename T> class NumericVector;
50 template <typename T> class ShellMatrix;
51 
59 template <typename T>
61  public Preconditioner<T>,
62  public Epetra_Operator
63 {
64 public:
65 
70  LIBMESH_CAN_DEFAULT_TO_COMMWORLD);
71 
75  virtual ~TrilinosPreconditioner ();
76 
81  virtual void apply(const NumericVector<T> & x, NumericVector<T> & y);
82 
86  virtual void clear () {}
87 
91  virtual void init ();
92 
93  void set_params(Teuchos::ParameterList & list);
94 
98  Epetra_FECrsMatrix * mat() { return _mat; }
99 
102  void set_preconditioner_type (const PreconditionerType & preconditioner_type);
103 
107  void compute();
108 
109 protected:
110 
114  Epetra_Operator * _prec;
115 
119  Epetra_FECrsMatrix * _mat;
120 
124  Teuchos::ParameterList _param_list;
125 
126  // Epetra_Operator interface
127  virtual int SetUseTranspose(bool UseTranspose);
128  virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const;
129  virtual int ApplyInverse(const Epetra_MultiVector &r, Epetra_MultiVector &z) const;
130  virtual double NormInf() const;
131  virtual const char *Label() const;
132  virtual bool UseTranspose() const;
133  virtual bool HasNormInf() const;
134  virtual const Epetra_Comm &Comm() const;
135  virtual const Epetra_Map &OperatorDomainMap() const;
136  virtual const Epetra_Map &OperatorRangeMap() const;
137 };
138 
139 
140 
141 
142 /*----------------------- inline functions ----------------------------------*/
143 template <typename T>
144 inline
146  Preconditioner<T>(comm),
147  _prec(NULL),
148  _mat(NULL)
149 {
150 }
151 
152 
153 
154 template <typename T>
155 inline
157 {
158  this->clear ();
159 }
160 
161 } // namespace libMesh
162 
163 #endif // #ifdef LIBMESH_HAVE_TRILINOS
164 #endif // LIBMESH_TRILINOS_PRECONDITIONER_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:07 UTC

Hosted By:
SourceForge.net Logo