trilinos_epetra_matrix.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_EPETRA_MATRIX_H
21 #define LIBMESH_TRILINOS_EPETRA_MATRIX_H
22 
23 #include "libmesh/libmesh_common.h"
24 
25 #ifdef LIBMESH_HAVE_TRILINOS
26 
27 // Trilinos includes
28 #include <Epetra_FECrsMatrix.h>
29 #include <Epetra_Map.h>
30 #include <EpetraExt_MatrixMatrix.h>
31 #include <Epetra_MpiComm.h>
32 
33 // Local includes
34 #include "libmesh/sparse_matrix.h"
35 
36 // C++ includes
37 #include <algorithm>
38 #include <cstddef>
39 
40 namespace libMesh
41 {
42 
43 // Forward Declarations
44 template <typename T> class DenseMatrix;
45 
46 
47 
56 template <typename T>
57 class EpetraMatrix : public SparseMatrix<T>
58 {
59 public:
76  LIBMESH_CAN_DEFAULT_TO_COMMWORLD);
77 
85  EpetraMatrix (Epetra_FECrsMatrix * m,
87  LIBMESH_CAN_DEFAULT_TO_COMMWORLD);
88 
94  virtual ~EpetraMatrix ();
95 
100  { return true; }
101 
108 
119  void init (const numeric_index_type m,
120  const numeric_index_type n,
121  const numeric_index_type m_l,
122  const numeric_index_type n_l,
123  const numeric_index_type nnz=30,
124  const numeric_index_type noz=10,
125  const numeric_index_type blocksize=1);
126 
130  void init ();
131 
138  void clear ();
139 
144  void zero ();
145 
151  void close () const;
152 
157  numeric_index_type m () const;
158 
163  numeric_index_type n () const;
164 
169  numeric_index_type row_start () const;
170 
175  numeric_index_type row_stop () const;
176 
183  void set (const numeric_index_type i,
184  const numeric_index_type j,
185  const T value);
186 
195  void add (const numeric_index_type i,
196  const numeric_index_type j,
197  const T value);
198 
206  void add_matrix (const DenseMatrix<T> &dm,
207  const std::vector<numeric_index_type> &rows,
208  const std::vector<numeric_index_type> &cols);
209 
214  void add_matrix (const DenseMatrix<T> &dm,
215  const std::vector<numeric_index_type> &dof_indices);
216 
226  void add (const T a, SparseMatrix<T> &X);
227 
236  const numeric_index_type j) const;
237 
249  Real l1_norm () const;
250 
263  Real linfty_norm () const;
264 
269  bool closed() const;
270 
274  void print_personal(std::ostream& os=libMesh::out) const;
275 
282  void print_matlab(const std::string name="NULL") const;
283 
287  void get_diagonal (NumericVector<T>& dest) const;
288 
293  virtual void get_transpose (SparseMatrix<T>& dest) const;
294 
298  void swap (EpetraMatrix<T> &);
299 
305  Epetra_FECrsMatrix * mat () { libmesh_assert(_mat); return _mat; }
306 
307  const Epetra_FECrsMatrix * mat () const { libmesh_assert(_mat); return _mat; }
308 
309 
310 private:
311 
316  Epetra_FECrsMatrix * _mat;
317 
321  Epetra_Map * _map;
322 
326  Epetra_CrsGraph * _graph;
327 
333 
339 };
340 
341 } // namespace libMesh
342 
343 #endif // #ifdef LIBMESH_HAVE_TRILINOS
344 #endif // LIBMESH_TRILINOS_EPETRA_MATRIX_H

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

Hosted By:
SourceForge.net Logo