Hermes2D  3.0
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 __H2D_SOLVER_H_
23 #define __H2D_SOLVER_H_
24 
25 #include "discrete_problem/discrete_problem.h"
26 #include "global.h"
27 
28 namespace Hermes
29 {
30  namespace Hermes2D
31  {
36  template <typename Scalar>
37  class Solver :
38  public virtual Hermes::Mixins::TimeMeasurable,
39  public Hermes::Mixins::SettableComputationTime,
41  public virtual Hermes::Mixins::OutputAttachable,
42  public Hermes::Algebra::Mixins::MatrixRhsOutput<Scalar>,
43  public Hermes::Mixins::IntegrableWithGlobalOrder,
44  public virtual Hermes::Mixins::StateQueryable,
46  {
47  public:
48  Solver(bool initialize_discrete_problem = true);
49  Solver(DiscreteProblem<Scalar>* dp);
50  Solver(WeakFormSharedPtr<Scalar> wf, SpaceSharedPtr<Scalar> space);
51  Solver(WeakFormSharedPtr<Scalar> wf, std::vector<SpaceSharedPtr<Scalar> > spaces);
52  virtual ~Solver();
53 
55  virtual void solve();
56 
59  virtual void solve(Scalar* coeff_vec) = 0;
60 
62  virtual Scalar* get_sln_vector() = 0;
63 
66  virtual void solve(MeshFunctionSharedPtr<Scalar> initial_guess);
67 
70  virtual void solve(std::vector<MeshFunctionSharedPtr<Scalar> > initial_guess);
71 
73  virtual void set_time(double time);
74  virtual void set_time_step(double time_step);
75 
77  virtual void set_spaces(std::vector<SpaceSharedPtr<Scalar> > spaces);
78  virtual std::vector<SpaceSharedPtr<Scalar> > get_spaces();
79 
81  virtual void set_weak_formulation(WeakFormSharedPtr<Scalar> wf);
82 
83  protected:
84  virtual bool isOkay() const;
85 
88 
90  bool own_dp;
91 
92  template<typename Scalar2, typename SolverType> friend class AdaptSolver;
93  };
94  }
95 }
96 #endif
Definition: adapt.h:24
virtual Scalar * get_sln_vector()=0
Get sln vector.
virtual void set_weak_formulation(WeakFormSharedPtr< Scalar > wf)
DiscreteProblemWeakForm helper.
Definition: solver.cpp:111
virtual void set_time(double time)
set time information for time-dependent problems.
Definition: solver.cpp:104
WeakFormSharedPtr< Scalar > wf
Weak formulation.
Common definitions for Hermes2D.
::xsd::cxx::tree::time< char, simple_type > time
C++ type corresponding to the time XML Schema built-in type.
virtual void set_spaces(std::vector< SpaceSharedPtr< Scalar > > spaces)
SettableSpaces helper.
Definition: solver.cpp:123
DiscreteProblem< Scalar > * dp
FE problem being solved.
Definition: solver.h:87
virtual std::vector< SpaceSharedPtr< Scalar > > get_spaces()
Get all spaces as a std::vector.
Definition: solver.cpp:129
bool own_dp
This instance owns its DP.
Definition: solver.h:90
virtual void solve()
Basic solve method.
Definition: solver.cpp:72