DOLFIN
DOLFIN C++ interface
Toggle main menu visibility
Loading...
Searching...
No Matches
dolfin
la
PETScLinearOperator.h
1
// Copyright (C) 2005-2012 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 Andy R. Terrel 2005
19
//
20
// First added: 2005-01-17
21
// Last changed: 2012-12-11
22
23
#ifndef __PETSC_LINEAR_OPERATOR_H
24
#define __PETSC_LINEAR_OPERATOR_H
25
26
#ifdef HAS_PETSC
27
28
#include <string>
29
#include <dolfin/common/types.h>
30
#include "PETScBaseMatrix.h"
31
#include "GenericLinearOperator.h"
32
33
namespace
dolfin
34
{
35
36
class
PETScVector
;
37
39
44
class
PETScLinearOperator
:
public
PETScBaseMatrix
,
45
public
GenericLinearOperator
46
{
47
public
:
48
50
explicit
PETScLinearOperator
(MPI_Comm comm);
51
52
//--- Implementation of the GenericLinearOperator interface ---
53
55
virtual
std::size_t
size
(std::size_t dim)
const
;
56
58
virtual
void
mult
(
const
GenericVector
& x,
GenericVector
& y)
const
;
59
61
virtual
MPI_Comm
mpi_comm
()
const
62
{
return
PETScBaseMatrix::mpi_comm
(); }
63
65
virtual
std::string
str
(
bool
verbose)
const
;
66
67
//--- Special functions ---
68
70
virtual
const
GenericLinearOperator
*
wrapper
()
const
;
71
73
virtual
GenericLinearOperator
*
wrapper
();
74
75
protected
:
76
77
// Initialization
78
void
init_layout
(
const
GenericVector
& x,
79
const
GenericVector
& y,
80
GenericLinearOperator
*
wrapper
);
81
82
// Pointer to wrapper
83
GenericLinearOperator
* _wrapper;
84
85
};
86
87
}
88
89
#endif
90
91
#endif
dolfin::GenericLinearOperator
Definition
GenericLinearOperator.h:43
dolfin::GenericVector
This class defines a common interface for vectors.
Definition
GenericVector.h:48
dolfin::PETScBaseMatrix::size
std::pair< std::int64_t, std::int64_t > size() const
Definition
PETScBaseMatrix.cpp:79
dolfin::PETScBaseMatrix::PETScBaseMatrix
PETScBaseMatrix()
Constructor.
Definition
PETScBaseMatrix.h:54
dolfin::PETScBaseMatrix::mpi_comm
MPI_Comm mpi_comm() const
Return the MPI communicator.
Definition
PETScBaseMatrix.cpp:141
dolfin::PETScLinearOperator::mpi_comm
virtual MPI_Comm mpi_comm() const
Return MPI communicator.
Definition
PETScLinearOperator.h:61
dolfin::PETScLinearOperator::PETScLinearOperator
PETScLinearOperator(MPI_Comm comm)
Constructor.
Definition
PETScLinearOperator.cpp:63
dolfin::PETScLinearOperator::mult
virtual void mult(const GenericVector &x, GenericVector &y) const
Compute matrix-vector product y = Ax.
Definition
PETScLinearOperator.cpp:76
dolfin::PETScLinearOperator::str
virtual std::string str(bool verbose) const
Return informal string representation (pretty-print).
Definition
PETScLinearOperator.cpp:81
dolfin::PETScLinearOperator::wrapper
virtual const GenericLinearOperator * wrapper() const
Return pointer to wrapper (const version).
Definition
PETScLinearOperator.cpp:100
dolfin::PETScLinearOperator::init_layout
void init_layout(const GenericVector &x, const GenericVector &y, GenericLinearOperator *wrapper)
Definition
PETScLinearOperator.cpp:110
dolfin::PETScVector
Definition
PETScVector.h:61
dolfin
Definition
adapt.h:30
Generated by
1.17.0