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  Copyright (C) 2011-2013 by Andreas Lauser
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 2 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
25 #ifndef EWOMS_OVERLAPPING_OPERATOR_HH
26 #define EWOMS_OVERLAPPING_OPERATOR_HH
27 
28 #include <dune/istl/operators.hh>
29 
30 namespace Ewoms {
31 namespace Linear {
32 
36 template <class OverlappingMatrix, class DomainVector, class RangeVector>
38  : public Dune::AssembledLinearOperator<OverlappingMatrix, DomainVector, RangeVector>
39 {
40  typedef typename OverlappingMatrix::Overlap Overlap;
41 
42 public:
44  typedef DomainVector domain_type;
45  typedef typename domain_type::field_type field_type;
46 
47  // redefine the category, that is the only difference
48  enum { category = Dune::SolverCategory::overlapping };
49 
50  OverlappingOperator(const OverlappingMatrix &A) : A_(A)
51  {}
52 
54  virtual void apply(const DomainVector &x, RangeVector &y) const
55  {
56  A_.mv(x, y);
57  y.sync();
58  }
59 
61  virtual void applyscaleadd(field_type alpha, const DomainVector &x,
62  RangeVector &y) const
63  {
64  A_.usmv(alpha, x, y);
65  y.sync();
66  }
67 
69  virtual const OverlappingMatrix &getmat() const
70  { return A_; }
71 
72  const Overlap &overlap() const
73  { return A_.overlap(); }
74 
75 private:
76  const OverlappingMatrix &A_;
77 };
78 
79 } // namespace Linear
80 } // namespace Ewoms
81 
82 #endif
OverlappingOperator(const OverlappingMatrix &A)
Definition: overlappingoperator.hh:50
Definition: overlappingoperator.hh:48
virtual void apply(const DomainVector &x, RangeVector &y) const
apply operator to x:
Definition: overlappingoperator.hh:54
DomainVector domain_type
export types
Definition: overlappingoperator.hh:44
Definition: baseauxiliarymodule.hh:35
const Overlap & overlap() const
Definition: overlappingoperator.hh:72
virtual void applyscaleadd(field_type alpha, const DomainVector &x, RangeVector &y) const
apply operator to x, scale and add:
Definition: overlappingoperator.hh:61
virtual const OverlappingMatrix & getmat() const
returns the matrix
Definition: overlappingoperator.hh:69
domain_type::field_type field_type
Definition: overlappingoperator.hh:45
An overlap aware linear operator usable by ISTL.
Definition: overlappingoperator.hh:37