DOLFIN
DOLFIN C++ interface
Toggle main menu visibility
Loading...
Searching...
No Matches
dolfin
la
LUSolver.h
1
// Copyright (C) 2007-2010 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
#ifndef __LU_SOLVER_H
19
#define __LU_SOLVER_H
20
21
#include <string>
22
#include <memory>
23
#include "GenericLinearSolver.h"
24
#include <dolfin/common/MPI.h>
25
26
namespace
dolfin
27
{
28
29
// Forward declarations
30
class
GenericLinearOperator
;
31
class
GenericVector
;
32
34
35
class
LUSolver
:
public
GenericLinearSolver
36
{
37
public
:
38
40
LUSolver
(MPI_Comm comm, std::string method=
"default"
);
41
43
LUSolver
(std::string method=
"default"
);
44
46
LUSolver
(MPI_Comm comm,
47
std::shared_ptr<const GenericLinearOperator> A,
48
std::string method=
"default"
);
49
51
LUSolver
(std::shared_ptr<const GenericLinearOperator> A,
52
std::string method=
"default"
);
53
55
~LUSolver
();
56
58
void
set_operator
(std::shared_ptr<const GenericLinearOperator> A);
59
61
std::size_t
solve
(
GenericVector
& x,
const
GenericVector
& b);
62
64
std::size_t
solve
(
const
GenericLinearOperator
& A,
GenericVector
& x,
65
const
GenericVector
& b);
66
68
static
Parameters
default_parameters
()
69
{
70
Parameters
p(
"lu_solver"
);
71
p.
add
(
"report"
,
true
);
72
p.
add
(
"verbose"
,
false
);
73
p.
add
(
"symmetric"
,
false
);
74
return
p;
75
}
76
78
std::string
parameter_type
()
const
79
{
return
"lu_solver"
; }
80
83
virtual
void
update_parameters
(
const
Parameters
&
parameters
)
84
{
85
this->parameters.
update
(
parameters
);
86
solver->parameters.update(
parameters
);
87
}
88
89
private
:
90
91
// Initialize solver
92
void
init
(MPI_Comm comm, std::string method);
93
94
// Solver
95
std::shared_ptr<GenericLinearSolver> solver;
96
97
};
98
}
99
100
#endif
dolfin::GenericLinearOperator
Definition
GenericLinearOperator.h:43
dolfin::GenericLinearSolver
This class provides a general solver for linear systems Ax = b.
Definition
GenericLinearSolver.h:38
dolfin::GenericVector
This class defines a common interface for vectors.
Definition
GenericVector.h:48
dolfin::LUSolver::default_parameters
static Parameters default_parameters()
Default parameter values.
Definition
LUSolver.h:68
dolfin::LUSolver::set_operator
void set_operator(std::shared_ptr< const GenericLinearOperator > A)
Set operator (matrix).
Definition
LUSolver.cpp:60
dolfin::LUSolver::parameter_type
std::string parameter_type() const
Return parameter type: "krylov_solver" or "lu_solver".
Definition
LUSolver.h:78
dolfin::LUSolver::solve
std::size_t solve(GenericVector &x, const GenericVector &b)
Solve linear system Ax = b.
Definition
LUSolver.cpp:67
dolfin::LUSolver::update_parameters
virtual void update_parameters(const Parameters ¶meters)
Definition
LUSolver.h:83
dolfin::LUSolver::LUSolver
LUSolver(MPI_Comm comm, std::string method="default")
Constructor.
Definition
LUSolver.cpp:28
dolfin::LUSolver::~LUSolver
~LUSolver()
Destructor.
Definition
LUSolver.cpp:55
dolfin::Parameters
Definition
Parameters.h:95
dolfin::Parameters::update
void update(const Parameters ¶meters)
Update parameters with another set of parameters.
Definition
Parameters.cpp:245
dolfin::Parameters::add
void add(std::string key)
Definition
Parameters.h:128
dolfin::Variable::parameters
Parameters parameters
Parameters.
Definition
Variable.h:74
dolfin
Definition
adapt.h:30
dolfin::init
void init(int argc, char *argv[])
Definition
init.cpp:27
Generated by
1.17.0