DOLFIN
DOLFIN C++ interface
LinearVariationalSolver.h
1 // Copyright (C) 2008-2011 Anders Logg and Garth N. Wells
2 //
3 // This file is part of DOLFIN.
4 //
5 // DOLFIN is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // DOLFIN is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // Modified by Marie E. Rognes, 2011.
19 //
20 // First added: 2011-01-14 (2008-12-26 as VariationalProblem)
21 // Last changed: 2011-10-20
22 
23 #ifndef __LINEAR_VARIATIONAL_SOLVER_H
24 #define __LINEAR_VARIATIONAL_SOLVER_H
25 
26 #include <dolfin/common/Variable.h>
27 #include <dolfin/la/LUSolver.h>
28 #include <dolfin/la/KrylovSolver.h>
29 
30 namespace dolfin
31 {
32 
33  // Forward declarations
34  class LinearVariationalProblem;
35 
37 
39  {
40  public:
41 
43  explicit LinearVariationalSolver(std::shared_ptr<LinearVariationalProblem> problem);
44 
46  void solve();
47 
50  {
51  Parameters p("linear_variational_solver");
52 
53  p.add("linear_solver", "default");
54  p.add("preconditioner", "default");
55  p.add("symmetric", false);
56 
57  p.add("print_rhs", false);
58  p.add("print_matrix", false);
59 
62 
63  return p;
64  }
65 
66  private:
67 
68  // The linear problem
69  std::shared_ptr<LinearVariationalProblem> _problem;
70 
71  };
72 
73 }
74 
75 #endif
Common base class for DOLFIN variables.
Definition: Variable.h:35
Definition: adapt.h:29
static Parameters default_parameters()
Default parameter values.
Definition: LinearVariationalSolver.h:49
void add(std::string key)
Definition: Parameters.h:128
void solve()
Solve variational problem.
Definition: LinearVariationalSolver.cpp:48
static Parameters default_parameters()
Default parameter values.
Definition: LUSolver.h:68
This class implements a solver for linear variational problems.
Definition: LinearVariationalSolver.h:38
LinearVariationalSolver(std::shared_ptr< LinearVariationalProblem > problem)
Create linear variational solver for given problem.
Definition: LinearVariationalSolver.cpp:41
Definition: Parameters.h:94
static Parameters default_parameters()
Default parameter values.
Definition: KrylovSolver.cpp:32