laspack_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_LASPACK_MATRIX_H
21 #define LIBMESH_LASPACK_MATRIX_H
22 
23 #include "libmesh/libmesh_config.h"
24 
25 #ifdef LIBMESH_HAVE_LASPACK
26 
27 // Local includes
28 #include "libmesh/sparse_matrix.h"
29 
30 // Laspack includes
31 #include <qmatrix.h>
32 
33 // C++ includes
34 #include <algorithm>
35 #include <cstddef>
36 
37 namespace libMesh
38 {
39 
40 
41 
42 // Forward declarations
43 template <typename T> class DenseMatrix;
44 template <typename T> class LaspackVector;
45 template <typename T> class LaspackLinearSolver;
46 
47 
48 
58 template <typename T>
59 class LaspackMatrix : public SparseMatrix<T>
60 {
61 
62 public:
79  LIBMESH_CAN_DEFAULT_TO_COMMWORLD);
80 
86  ~LaspackMatrix ();
87 
92  { return true; }
93 
100 
111  void init (const numeric_index_type m,
112  const numeric_index_type n,
113  const numeric_index_type m_l,
114  const numeric_index_type n_l,
115  const numeric_index_type nnz=30,
116  const numeric_index_type noz=10,
117  const numeric_index_type blocksize=1);
118 
122  void init ();
123 
130  void clear ();
131 
135  void zero ();
136 
142  void close () const { const_cast<LaspackMatrix<T>*>(this)->_closed = true; }
143 
148  numeric_index_type m () const;
149 
154  numeric_index_type n () const;
155 
160  numeric_index_type row_start () const;
161 
166  numeric_index_type row_stop () const;
167 
174  void set (const numeric_index_type i,
175  const numeric_index_type j,
176  const T value);
177 
186  void add (const numeric_index_type i,
187  const numeric_index_type j,
188  const T value);
189 
197  void add_matrix (const DenseMatrix<T> &dm,
198  const std::vector<numeric_index_type> &rows,
199  const std::vector<numeric_index_type> &cols);
200 
205  void add_matrix (const DenseMatrix<T> &dm,
206  const std::vector<numeric_index_type> &dof_indices);
207 
215  void add (const T a, SparseMatrix<T> &X);
216 
225  const numeric_index_type j) const;
226 
237  Real l1_norm () const { libmesh_error(); return 0.; }
238 
250  Real linfty_norm () const { libmesh_error(); return 0.; }
251 
256  bool closed() const { return _closed; }
257 
262  void print_personal(std::ostream& os=libMesh::out) const { this->print(os); }
263 
267  virtual void get_diagonal (NumericVector<T>& dest) const;
268 
273  virtual void get_transpose (SparseMatrix<T>& dest) const;
274 
275 private:
276 
282  const numeric_index_type j) const;
283 
287  QMatrix _QMat;
288 
292  std::vector<numeric_index_type> _csr;
293 
298  std::vector<std::vector<numeric_index_type>::const_iterator> _row_start;
299 
303  bool _closed;
304 
308  friend class LaspackVector<T>;
309  friend class LaspackLinearSolver<T>;
310 };
311 
312 } // namespace libMesh
313 
314 #endif // #ifdef LIBMESH_HAVE_LASPACK
315 #endif // #ifdef LIBMESH_LASPACK_MATRIX_H

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

Hosted By:
SourceForge.net Logo