Hermes2D  3.0
newton_solver.h
1 // This file is part of Hermes2D
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_SOLVER_NEWTON_H_
23 #define __H2D_SOLVER_NEWTON_H_
24 
25 #include "solvers/newton_matrix_solver.h"
26 #include "solver.h"
27 
28 namespace Hermes
29 {
30  namespace Hermes2D
31  {
47  // Just call solve().<br>
51  // Get the solution vector from the solver.<br>
55  // Translate the solution vector into the previously initialized Solution<double> using the static method vector_to_solution.<br>
71  template<typename Scalar>
72  class HERMES_API NewtonSolver :
73  public Hermes::Hermes2D::Solver<Scalar>,
74  public Hermes::Solvers::NewtonMatrixSolver < Scalar >
75  {
76  public:
77  NewtonSolver();
81  virtual ~NewtonSolver();
82 
83  // See the base class for details, the following serves only for avoiding C++ name-hiding.
85 
88  virtual void solve(Scalar* coeff_vec);
89 
91  Scalar* get_sln_vector();
92 
94  virtual void set_spaces(std::vector<SpaceSharedPtr<Scalar> > spaces);
95 
97  virtual void set_weak_formulation(WeakFormSharedPtr<Scalar> wf);
98 
100  virtual void set_verbose_output(bool to_set);
101 
102  virtual void assemble_residual(bool store_previous_residual);
104  virtual bool assemble_jacobian(bool store_previous_jacobian);
106  virtual bool assemble(bool store_previous_jacobian, bool store_previous_residual);
107 
109  virtual void init_solving(Scalar* coeff_vec);
110 
112  virtual bool isOkay() const;
113  inline std::string getClassName() const { return "NewtonSolver"; }
114  };
115  }
116 }
117 #endif
Definition: adapt.h:24
Used to pass the instances of Space around.
Definition: space.h:34
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.