DOLFIN
DOLFIN C++ interface
Loading...
Searching...
No Matches
solve.h
1// Copyright (C) 2007-2011 Anders Logg
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 Ola Skavhaug 2008.
19// Modified by Garth N. Wells 2011.
20//
21// First added: 2007-04-30
22// Last changed: 2011-10-19
23
24#ifndef __SOLVE_LA_H
25#define __SOLVE_LA_H
26
27#include <map>
28#include <string>
29#include <vector>
30#include <dolfin/common/types.h>
31
32namespace dolfin
33{
34
35 // Forward declarations
36 class GenericLinearOperator;
37 class GenericVector;
38
40 std::size_t solve(const GenericLinearOperator& A, GenericVector& x,
41 const GenericVector& b,
42 std::string method = "lu",
43 std::string preconditioner = "none");
44
47
50
53
56
60
62 bool has_linear_algebra_backend(std::string backend);
63
66 bool has_lu_solver_method(std::string method);
67
70 bool has_krylov_solver_method(std::string method);
71
74 bool has_krylov_solver_preconditioner(std::string preconditioner);
75
77 std::map<std::string, std::string> linear_algebra_backends();
78
81 std::map<std::string, std::string> linear_solver_methods();
82
85 std::map<std::string, std::string> lu_solver_methods();
86
89 std::map<std::string, std::string> krylov_solver_methods();
90
93 std::map<std::string, std::string> krylov_solver_preconditioners();
94
96 double residual(const GenericLinearOperator& A, const GenericVector& x,
97 const GenericVector& b);
98
101 double norm(const GenericVector& x, std::string norm_type="l2");
102
104 double normalize(GenericVector& x,
105 std::string normalization_type = "average");
106
107}
108
109#endif
Definition adapt.h:30
void list_lu_solver_methods()
List available LU methods for current linear algebra backend.
Definition solve.cpp:63
std::map< std::string, std::string > krylov_solver_methods()
Definition solve.cpp:132
void solve(const Equation &equation, Function &u, const double tol, GoalFunctional &M)
Definition adaptivesolve.cpp:33
bool has_krylov_solver_preconditioner(std::string preconditioner)
Definition solve.cpp:156
bool has_krylov_solver_method(std::string method)
Definition solve.cpp:149
std::map< std::string, std::string > lu_solver_methods()
Definition solve.cpp:127
void list_krylov_solver_methods()
List available Krylov methods for current linear algebra backend.
Definition solve.cpp:75
void list_krylov_solver_preconditioners()
Definition solve.cpp:87
std::map< std::string, std::string > linear_solver_methods()
Definition solve.cpp:100
bool has_lu_solver_method(std::string method)
Definition solve.cpp:142
void list_linear_solver_methods()
List available solver methods for current linear algebra backend.
Definition solve.cpp:51
std::map< std::string, std::string > linear_algebra_backends()
Return available linear algebra backends.
Definition solve.cpp:244
void list_linear_algebra_backends()
List available linear algebra backends.
Definition solve.cpp:233
double norm(const GenericVector &x, std::string norm_type="l2")
Definition solve.cpp:173
std::map< std::string, std::string > krylov_solver_preconditioners()
Definition solve.cpp:137
double normalize(GenericVector &x, std::string normalization_type="average")
Normalize vector according to given normalization type.
Definition solve.cpp:178
double residual(const GenericLinearOperator &A, const GenericVector &x, const GenericVector &b)
Compute residual ||Ax - b||.
Definition solve.cpp:163
bool has_linear_algebra_backend(std::string backend)
Return true if a specific linear algebra backend is supported.
Definition solve.cpp:209