overlappingoperator.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
27#ifndef EWOMS_OVERLAPPING_OPERATOR_HH
28#define EWOMS_OVERLAPPING_OPERATOR_HH
29
30#include <dune/istl/operators.hh>
31#include <dune/common/version.hh>
32
33namespace Opm {
34namespace Linear {
35
39template <class OverlappingMatrix, class DomainVector, class RangeVector>
41 : public Dune::AssembledLinearOperator<OverlappingMatrix, DomainVector, RangeVector>
42{
43 using Overlap = typename OverlappingMatrix::Overlap;
44
45public:
47 using domain_type = DomainVector;
48 using field_type = typename domain_type::field_type;
49
50 OverlappingOperator(const OverlappingMatrix& A) : A_(A)
51 {}
52
54 Dune::SolverCategory::Category category() const override
55 { return Dune::SolverCategory::overlapping; }
56
58 virtual void apply(const DomainVector& x, RangeVector& y) const override
59 {
60 A_.mv(x, y);
61 y.sync();
62 }
63
65 virtual void applyscaleadd(field_type alpha, const DomainVector& x,
66 RangeVector& y) const override
67 {
68 A_.usmv(alpha, x, y);
69 y.sync();
70 }
71
73 virtual const OverlappingMatrix& getmat() const override
74 { return A_; }
75
76 const Overlap& overlap() const
77 { return A_.overlap(); }
78
79private:
80 const OverlappingMatrix& A_;
81};
82
83} // namespace Linear
84} // namespace Opm
85
86#endif
An overlap aware linear operator usable by ISTL.
Definition: overlappingoperator.hh:42
OverlappingOperator(const OverlappingMatrix &A)
Definition: overlappingoperator.hh:50
const Overlap & overlap() const
Definition: overlappingoperator.hh:76
virtual void apply(const DomainVector &x, RangeVector &y) const override
apply operator to x:
Definition: overlappingoperator.hh:58
typename domain_type::field_type field_type
Definition: overlappingoperator.hh:48
virtual const OverlappingMatrix & getmat() const override
returns the matrix
Definition: overlappingoperator.hh:73
Dune::SolverCategory::Category category() const override
the kind of computations supported by the operator. Either overlapping or non-overlapping
Definition: overlappingoperator.hh:54
virtual void applyscaleadd(field_type alpha, const DomainVector &x, RangeVector &y) const override
apply operator to x, scale and add:
Definition: overlappingoperator.hh:65
DomainVector domain_type
export types
Definition: overlappingoperator.hh:47
Definition: blackoilboundaryratevector.hh:37