DOLFIN
DOLFIN C++ interface
GenericLinearOperator.h
1// Copyright (C) 2012 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// First added: 2012-08-20
19// Last changed: 2012-12-12
20
21#ifndef __GENERIC_LINEAR_OPERATOR_H
22#define __GENERIC_LINEAR_OPERATOR_H
23
24#include "LinearAlgebraObject.h"
25
26namespace dolfin
27{
28
29 // Forward declarations
30 class GenericVector;
31 class GenericLinearAlgebraFactory;
32
41
43 {
44 public:
45
46 // Destructor
47 virtual ~GenericLinearOperator() {}
48
50 virtual std::size_t size(std::size_t dim) const = 0;
51
53 virtual void mult(const GenericVector& x, GenericVector& y) const = 0;
54
56 virtual std::string str(bool verbose) const = 0;
57
58 protected:
59
60 friend class LinearOperator;
61
64 virtual void init_layout(const GenericVector& x,
65 const GenericVector& y,
66 GenericLinearOperator* wrapper)
67 {
68 dolfin_error("GenericLinearOperator.h",
69 "initialize backend implementation of linear operator",
70 "Missing init_layout() function for backend");
71 }
72
73 };
74
75}
76
77#endif
Definition: GenericLinearOperator.h:43
virtual std::string str(bool verbose) const =0
Return informal string representation (pretty-print)
virtual void mult(const GenericVector &x, GenericVector &y) const =0
Compute matrix-vector product y = Ax.
virtual void init_layout(const GenericVector &x, const GenericVector &y, GenericLinearOperator *wrapper)
Definition: GenericLinearOperator.h:64
virtual std::size_t size(std::size_t dim) const =0
Return size of given dimension.
This class defines a common interface for vectors.
Definition: GenericVector.h:48
Definition: LinearAlgebraObject.h:37
Definition: LinearOperator.h:41
Definition: adapt.h:30
void dolfin_error(std::string location, std::string task, std::string reason,...)
Definition: log.cpp:129