DOLFIN
DOLFIN C++ interface
Toggle main menu visibility
Loading...
Searching...
No Matches
dolfin
la
PETScFactory.h
1
// Copyright (C) 2007 Ola Skavhaug
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 Anders Logg 2011-2012
19
//
20
// First added: 2007-11-30
21
// Last changed: 2012-08-20
22
23
#ifdef HAS_PETSC
24
25
#ifndef __PETSC_FACTORY_H
26
#define __PETSC_FACTORY_H
27
28
#include <string>
29
#include <memory>
30
#include <dolfin/common/types.h>
31
#include "PETScKrylovSolver.h"
32
#include "PETScLUSolver.h"
33
#include "PETScMatrix.h"
34
#include "PETScVector.h"
35
#include "TensorLayout.h"
36
#include "GenericLinearAlgebraFactory.h"
37
38
namespace
dolfin
39
{
40
42
43
class
PETScFactory :
public
GenericLinearAlgebraFactory
44
{
45
public
:
46
48
virtual
~PETScFactory
() {}
49
51
std::shared_ptr<GenericMatrix>
create_matrix
(MPI_Comm comm)
const
;
52
54
std::shared_ptr<GenericVector>
create_vector
(MPI_Comm comm)
const
;
55
57
std::shared_ptr<TensorLayout>
create_layout
(MPI_Comm comm,
58
std::size_t rank)
const
;
59
61
std::shared_ptr<GenericLinearOperator>
62
create_linear_operator
(MPI_Comm comm)
const
;
63
65
std::shared_ptr<GenericLinearSolver>
66
create_lu_solver
(MPI_Comm comm, std::string method)
const
;
67
69
std::shared_ptr<GenericLinearSolver>
70
create_krylov_solver
(MPI_Comm comm,
71
std::string method,
72
std::string preconditioner)
const
;
73
75
std::map<std::string, std::string>
lu_solver_methods
()
const
;
76
78
std::map<std::string, std::string>
krylov_solver_methods
()
const
;
79
81
std::map<std::string, std::string>
krylov_solver_preconditioners
()
const
;
82
84
static
PETScFactory&
instance
()
85
{
return
factory; }
86
87
private
:
88
90
PETScFactory
() {}
91
static
PETScFactory factory;
92
93
};
94
95
}
96
97
#endif
98
99
#endif
dolfin::GenericLinearAlgebraFactory::GenericLinearAlgebraFactory
GenericLinearAlgebraFactory()
Constructor.
Definition
GenericLinearAlgebraFactory.h:51
dolfin::PETScFactory
PETSc linear algebra factory.
Definition
PETScFactory.h:44
dolfin::PETScFactory::create_lu_solver
std::shared_ptr< GenericLinearSolver > create_lu_solver(MPI_Comm comm, std::string method) const
Create LU solver.
Definition
PETScFactory.cpp:64
dolfin::PETScFactory::create_matrix
std::shared_ptr< GenericMatrix > create_matrix(MPI_Comm comm) const
Create empty matrix.
Definition
PETScFactory.cpp:38
dolfin::PETScFactory::create_vector
std::shared_ptr< GenericVector > create_vector(MPI_Comm comm) const
Create empty vector.
Definition
PETScFactory.cpp:43
dolfin::PETScFactory::~PETScFactory
virtual ~PETScFactory()
Destructor.
Definition
PETScFactory.h:48
dolfin::PETScFactory::create_layout
std::shared_ptr< TensorLayout > create_layout(MPI_Comm comm, std::size_t rank) const
Create empty tensor layout.
Definition
PETScFactory.cpp:49
dolfin::PETScFactory::instance
static PETScFactory & instance()
Return singleton instance.
Definition
PETScFactory.h:84
dolfin::PETScFactory::create_linear_operator
std::shared_ptr< GenericLinearOperator > create_linear_operator(MPI_Comm comm) const
Create empty linear operator.
Definition
PETScFactory.cpp:58
dolfin::PETScFactory::create_krylov_solver
std::shared_ptr< GenericLinearSolver > create_krylov_solver(MPI_Comm comm, std::string method, std::string preconditioner) const
Create Krylov solver.
Definition
PETScFactory.cpp:70
dolfin
Definition
adapt.h:30
dolfin::krylov_solver_methods
std::map< std::string, std::string > krylov_solver_methods()
Definition
solve.cpp:132
dolfin::lu_solver_methods
std::map< std::string, std::string > lu_solver_methods()
Definition
solve.cpp:127
dolfin::krylov_solver_preconditioners
std::map< std::string, std::string > krylov_solver_preconditioners()
Definition
solve.cpp:137
Generated by
1.18.0