HermesCommon  3.0
matrix_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_MATRIX_SOLVER_H_
23 #define __HERMES_COMMON_MATRIX_SOLVER_H_
24 
25 #include "mixins.h"
26 #include "util/compat.h"
27 #include "linear_matrix_solver.h"
28 
29 namespace Hermes
30 {
31  namespace Solvers
32  {
34  template <typename Scalar>
35  class HERMES_API MatrixSolver : public Hermes::Mixins::Loggable
36  {
37  public:
38  MatrixSolver(bool force_use_direct_solver = false);
39  virtual ~MatrixSolver();
40 
43  {
44  FactorizationSize = 0,
45  PeakMemoryUsage = 1,
46  Flops = 2
47  };
48 
50  virtual Scalar *get_sln_vector();
51 
53  void set_jacobian_constant(bool to_set = true);
54 
55  virtual LinearMatrixSolver<Scalar>* get_linear_matrix_solver();
56 
57 #ifdef WITH_UMFPACK
58  virtual void set_UMFPACK_output(bool to_set = true, bool with_output = false);
61 
64  virtual double get_UMFPACK_reporting_data(UMFPACK_reporting_data_value data_value);
65 #endif
66 
68  SparseMatrix<Scalar>* get_jacobian();
70  Vector<Scalar>* get_residual();
71 
73  virtual void set_verbose_output(bool to_set);
74 
76  Scalar* sln_vector;
77 
78  protected:
81 
84 
87 
90 
91 #ifdef WITH_UMFPACK
92  bool do_UMFPACK_reporting;
96  void handle_UMFPACK_reports();
97 
100  double UMFPACK_reporting_data[3];
101 #endif
102  };
103  }
104 }
105 #endif
General namespace for the Hermes library.
Linear matrix solver functionality.
General (abstract) vector representation in Hermes.
UMFPACK_reporting_data_value
Data values (types) for UMFPACK reporting.
Definition: matrix_solver.h:42
General (abstract) sparse matrix representation in Hermes.
bool jacobian_reusable
Jacobian is ready to be reused if desirable.
Definition: matrix_solver.h:86
interface for both linear and nonlinear algebraic solvers.
Definition: matrix_solver.h:35
Abstract class for defining solver interface.
Scalar * sln_vector
The solution vector.
Definition: matrix_solver.h:76
File containing platform compatibility layer, especially for Win / MSVC.
Mix-in classes for one functionality, for various classes to be derived from.
Hermes::Solvers::LinearMatrixSolver< Scalar > * linear_matrix_solver
Linear solver.
Definition: matrix_solver.h:80
int problem_size
Number of equations.
Definition: matrix_solver.h:89
bool constant_jacobian
Jacobian can be reused if possible.
Definition: matrix_solver.h:83
Class the output of which is loggable, i.e. that uses functionality of info(), warn() Contains the cl...
Definition: mixins.h:62