Hermes2D  3.0
linear_solver.h
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 __H2D_LINEAR_SOLVER_H_
23 #define __H2D_LINEAR_SOLVER_H_
24 
25 #include "solver.h"
26 
27 namespace Hermes
28 {
29  namespace Hermes2D
30  {
40  // Just call solve().<br>
44  // Get the solution vector from the solver.<br>
48  // Translate the solution vector into the previously initialized Solution<double> using the static method vector_to_solution.<br>
64  template <typename Scalar>
65  class LinearSolver : public Solver<Scalar>, public Hermes::Solvers::MatrixSolver < Scalar >
66  {
67  public:
68  LinearSolver(bool force_use_direct_solver = false);
69  LinearSolver(DiscreteProblem<Scalar>* dp, bool force_use_direct_solver = false);
70  LinearSolver(WeakFormSharedPtr<Scalar> wf, SpaceSharedPtr<Scalar> space, bool force_use_direct_solver = false);
71  LinearSolver(WeakFormSharedPtr<Scalar> wf, std::vector<SpaceSharedPtr<Scalar> > spaces, bool force_use_direct_solver = false);
72  virtual ~LinearSolver();
73 
74  // See the base class for details, the following serves only for avoiding C++ name-hiding.
76 
79  virtual void solve(Scalar* coeff_vec);
80 
82  Scalar* get_sln_vector();
83 
85  virtual void set_spaces(std::vector<SpaceSharedPtr<Scalar> > spaces);
86 
89 
91  virtual void set_verbose_output(bool to_set);
92 
93  protected:
95  virtual bool isOkay() const;
96  inline std::string getClassName() const { return "LinearSolver"; }
97  };
98  }
99 }
100 #endif
Definition: adapt.h:24
Scalar * get_sln_vector()
Get sln vector.
Used to pass the instances of Space around.
Definition: space.h:34
WeakFormSharedPtr< Scalar > wf
Weak formulation.
virtual void set_weak_formulation(WeakFormSharedPtr< Scalar > wf)
DiscreteProblemWeakForm helper.
virtual void set_verbose_output(bool to_set)
See Hermes::Mixins::Loggable.
DiscreteProblem< Scalar > * dp
FE problem being solved.
Definition: solver.h:87
Used to pass the instances of WeakForm around.
Definition: weakform.h:55
General solver functionality.
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
virtual void set_spaces(std::vector< SpaceSharedPtr< Scalar > > spaces)
DiscreteProblemWeakForm helper.
virtual void solve()
Basic solve method.
Definition: solver.cpp:72
virtual bool isOkay() const
State querying helpers.