Reference documentation for deal.II version 8.1.0
sparse_direct.h
1 // ---------------------------------------------------------------------
2 // @f$Id: sparse_direct.h 31932 2013-12-08 02:15:54Z heister @f$
3 //
4 // Copyright (C) 2001 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__sparse_direct_h
18 #define __deal2__sparse_direct_h
19 
20 
21 
22 #include <deal.II/base/config.h>
24 #include <deal.II/base/subscriptor.h>
25 #include <deal.II/base/thread_management.h>
26 #include <deal.II/lac/vector.h>
27 #include <deal.II/lac/sparse_matrix.h>
28 #include <deal.II/lac/sparse_matrix_ez.h>
29 #include <deal.II/lac/block_sparse_matrix.h>
30 
31 #ifdef DEAL_II_WITH_MUMPS
32 # include <deal.II/base/utilities.h>
33 # include <dmumps_c.h>
34 #endif
35 
37 
84 {
85 public:
90 
96  {};
97 
98 
104 
109 
121  void initialize (const SparsityPattern &sparsity_pattern);
122 
141  template <class Matrix>
142  void factorize (const Matrix &matrix);
143 
147  template <class Matrix>
148  void initialize(const Matrix &matrix,
149  const AdditionalData additional_data = AdditionalData());
150 
172  void vmult (Vector<double> &dst,
173  const Vector<double> &src) const;
174 
178  void vmult (BlockVector<double> &dst,
179  const BlockVector<double> &src) const;
180 
185  void Tvmult (Vector<double> &dst,
186  const Vector<double> &src) const;
187 
191  void Tvmult (BlockVector<double> &dst,
192  const BlockVector<double> &src) const;
193 
198  void vmult_add (Vector<double> &dst,
199  const Vector<double> &src) const;
200 
205  void Tvmult_add (Vector<double> &dst,
206  const Vector<double> &src) const;
207 
236  void solve (Vector<double> &rhs_and_solution, bool transpose = false) const;
237 
241  void solve (BlockVector<double> &rhs_and_solution, bool transpose = false) const;
242 
249  template <class Matrix>
250  void solve (const Matrix &matrix,
251  Vector<double> &rhs_and_solution,
252  bool transpose = false);
253 
257  template <class Matrix>
258  void solve (const Matrix &matrix,
259  BlockVector<double> &rhs_and_solution,
260  bool transpose = false);
261 
271  DeclException2 (ExcUMFPACKError, char *, int,
272  << "UMFPACK routine " << arg1
273  << " returned error status " << arg2
274  << ". See the file <bundled/umfpack/UMFPACK/Include/umfpack.h>"
275  << " for a description of 'status codes'.");
276 
277 private:
285  void *numeric_decomposition;
286 
290  void clear ();
291 
298  template <typename number>
299  void sort_arrays (const SparseMatrixEZ<number> &);
300 
301  template <typename number>
302  void sort_arrays (const SparseMatrix<number> &);
303 
304  template <typename number>
305  void sort_arrays (const BlockSparseMatrix<number> &);
306 
310  std::vector<long int> Ap;
311  std::vector<long int> Ai;
312  std::vector<double> Ax;
313 
317  std::vector<double> control;
318 };
319 
320 
341 {
342 private:
343 
344 #ifdef DEAL_II_WITH_MUMPS
345  DMUMPS_STRUC_C id;
346 #endif // DEAL_II_WITH_MUMPS
347 
348  double *a;
349  std::vector<double> rhs;
350  int *irn;
351  int *jcn;
354 
359  template<class Matrix>
360  void initialize_matrix (const Matrix &matrix);
361 
365  void copy_solution (Vector<double> &vector);
366 
370  void copy_rhs_to_mumps(const Vector<double> &rhs);
371 
377 
378 public:
383 
388 
392  ~SparseDirectMUMPS ();
393 
397  DeclException0 (ExcInitializeAlreadyCalled);
398 
404  template <class Matrix>
405  void initialize (const Matrix &matrix,
406  const Vector<double> &vector);
407 
412  template <class Matrix>
413  void initialize (const Matrix &matrix);
414 
420  void solve (Vector<double> &vector);
421 
427  void vmult (Vector<double> &dst, const Vector<double> &src);
428 };
429 
430 DEAL_II_NAMESPACE_CLOSE
431 
432 #endif // __deal2__sparse_direct_h
types::global_dof_index size_type
Definition: sparse_direct.h:89
void Tvmult_add(Vector< double > &dst, const Vector< double > &src) const
void Tvmult(Vector< double > &dst, const Vector< double > &src) const
void factorize(const Matrix &matrix)
std::vector< long int > Ap
unsigned int global_dof_index
Definition: types.h:100
void solve(Vector< double > &rhs_and_solution, bool transpose=false) const
#define DeclException0(Exception0)
Definition: exceptions.h:505
void vmult_add(Vector< double > &dst, const Vector< double > &src) const
std::vector< double > control
DeclException2(ExcUMFPACKError, char *, int,<< "UMFPACK routine "<< arg1<< " returned error status "<< arg2<< ". See the file <bundled/umfpack/UMFPACK/Include/umfpack.h>"<< " for a description of 'status codes'.")
void initialize(const SparsityPattern &sparsity_pattern)
void sort_arrays(const SparseMatrixEZ< number > &)
void vmult(Vector< double > &dst, const Vector< double > &src) const
types::global_dof_index size_type