DOLFIN
DOLFIN C++ interface
MixedLinearVariationalSolver.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 Cecile Daversin-Catty, 2017.
19 //
20 // First added: 2017-07-21
21 // Last changed: 2017-07-21
22 
23 #ifndef __MIXED_LINEAR_VARIATIONAL_SOLVER_H
24 #define __MIXED_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 MixedLinearVariationalProblem;
35  class PETScNestMatrix;
36 
38 
40  {
41  public:
42  typedef std::tuple<std::vector<std::shared_ptr<GenericMatrix>>,
43  std::vector<std::shared_ptr<GenericVector>>,
44  std::vector<std::shared_ptr<GenericVector>> > assembled_system_type;
45 
48  explicit MixedLinearVariationalSolver(std::shared_ptr<MixedLinearVariationalProblem> problem);
49 
51  assembled_system_type assemble_system();
52 
54  void solve();
55  void solve(assembled_system_type assembled_system);
56 
59  {
60  Parameters p("linear_variational_solver");
61 
62  p.add("linear_solver", "default");
63  p.add("preconditioner", "default");
64  p.add("symmetric", false);
65 
66  p.add("print_rhs", false);
67  p.add("print_matrix", false);
70 
71  return p;
72  }
73 
74  private:
75 
76  // The linear problem
77  std::shared_ptr<MixedLinearVariationalProblem> _problem;
78 
79  };
80 
81 }
82 
83 #endif
dolfin::Parameters
Definition: Parameters.h:94
dolfin::Parameters::add
void add(std::string key)
Definition: Parameters.h:128
dolfin::MixedLinearVariationalSolver
This class implements a solver for mixed linear variational problems.
Definition: MixedLinearVariationalSolver.h:39
dolfin::Variable
Common base class for DOLFIN variables.
Definition: Variable.h:35
dolfin::MixedLinearVariationalSolver::MixedLinearVariationalSolver
MixedLinearVariationalSolver()
Create linear variational solver for given problem.
Definition: MixedLinearVariationalSolver.cpp:49
dolfin::MixedLinearVariationalSolver::default_parameters
static Parameters default_parameters()
Default parameter values.
Definition: MixedLinearVariationalSolver.h:58
dolfin::KrylovSolver::default_parameters
static Parameters default_parameters()
Default parameter values.
Definition: KrylovSolver.cpp:32
dolfin::LUSolver::default_parameters
static Parameters default_parameters()
Default parameter values.
Definition: LUSolver.h:68
dolfin::MixedLinearVariationalSolver::assemble_system
assembled_system_type assemble_system()
Block-by-block assembly.
Definition: MixedLinearVariationalSolver.cpp:65
dolfin::MixedLinearVariationalSolver::solve
void solve()
Solve variational problem.
Definition: MixedLinearVariationalSolver.cpp:221
dolfin
Definition: adapt.h:29