HermesCommon  3.0
umfpack_solver.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://www.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_UMFPACK_SOLVER_H_
23 #define __HERMES_COMMON_UMFPACK_SOLVER_H_
24 #include "config.h"
25 #ifdef WITH_UMFPACK
27 #include "algebra/cs_matrix.h"
28 
29 extern "C"
30 {
31 #include <umfpack.h>
32 }
33 
34 using namespace Hermes::Algebra;
35 
36 namespace Hermes
37 {
38  namespace Solvers
39  {
40  template <typename Scalar> class HERMES_API UMFPackLinearMatrixSolver;
41  }
42 
43  namespace Solvers
44  {
47  template <typename Scalar>
48  class HERMES_API UMFPackLinearMatrixSolver : public DirectSolver < Scalar >
49  {
50  public:
55  virtual ~UMFPackLinearMatrixSolver();
56  virtual void solve();
57  virtual void free();
58  virtual int get_matrix_size();
59 
64 
67  void *symbolic;
69  void *numeric;
70 
72  void free_factorization_data();
74  bool setup_factorization();
75  template <typename T> friend class Hermes::Algebra::CSCMatrix;
76  template <typename T> friend class Hermes::Algebra::SimpleVector;
77  template<typename T> friend LinearMatrixSolver<T>* create_linear_solver(Matrix<T>* matrix, Vector<T>* rhs, bool use_direct_solver);
78  char* check_status(const char *fn_name, int status);
79 
81  void set_output_level(double level);
82 
84  double Info[UMFPACK_INFO];
85  double Control[UMFPACK_CONTROL];
86  };
87  }
88 }
89 #endif
90 #endif
General (abstract) matrix representation in Hermes.
Definition: matrix.h:36
General namespace for the Hermes library.
void * numeric
LU factorization of matrix A.
Linear matrix solver functionality.
General (abstract) vector representation in Hermes.
Namespace containing classes for vector / matrix operations.
Basic cs (Compressed sparse) matrix classes and operations.
Vector used with MUMPS solver.
Definition: vector.h:116
General CSC Matrix class. (can be used in umfpack, in that case use the CSCMatrix subclass...
Definition: cs_matrix.h:131
SimpleVector< Scalar > * rhs
Right hand side vector.
void * symbolic
Reusable factorization information (A denotes matrix represented by the pointer 'm'). Reordering of matrix A to reduce fill-in during factorization.
HERMES_API LinearMatrixSolver< Scalar > * create_linear_solver(Matrix< Scalar > *matrix, Vector< Scalar > *rhs, bool use_direct_solver=false)
Function returning a solver according to the users's choice.
Abstract class for defining solver interface.
CSCMatrix< Scalar > * m
Matrix to solve.
Encapsulation of UMFPACK linear solver.