AssembledConnectionsIteration.hpp
Go to the documentation of this file.
1/*
2 Copyright 2016 SINTEF ICT, Applied Mathematics.
3 Copyright 2016 Statoil ASA.
4
5 This file is part of the Open Porous Media project (OPM).
6
7 OPM is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 OPM is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with OPM. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#ifndef OPM_ASSEMBLEDCONNECTIONSITERATION_HEADER_INCLUDED
22#define OPM_ASSEMBLEDCONNECTIONSITERATION_HEADER_INCLUDED
23
24#include <cassert>
25
26namespace Opm {
27
33 {
35 double weight;
36 };
37
38
39
40
44 {
45 public:
46 NeighbourhoodIterator(const int* neighbour_iter,
47 const double* weight_iter)
48 : neighbour_iter_(neighbour_iter),
49 weight_iter_(weight_iter)
50 {
51 }
52
54 {
55 return { *neighbour_iter_, *weight_iter_ };
56 }
57
58 bool operator!=(const NeighbourhoodIterator& other) const
59 {
60 assert((neighbour_iter_ != other.neighbour_iter_) == (weight_iter_ != other.weight_iter_));
61 return neighbour_iter_ != other.neighbour_iter_;
62 }
63
65 {
66 ++neighbour_iter_;
67 ++weight_iter_;
68 return *this;
69 }
70
71 private:
72 const int* neighbour_iter_;
73 const double* weight_iter_;
74 };
75
76
77
78
81 template <class Iterator>
83 {
84 Iterator begin() const
85 {
86 return begin_;
87 }
88
89 Iterator end() const
90 {
91 return end_;
92 }
93
94 Iterator begin_;
95 Iterator end_;
96 };
97
98
99} // namespace Opm
100
101#endif // OPM_ASSEMBLEDCONNECTIONSITERATION_HEADER_INCLUDED
Definition: AssembledConnectionsIteration.hpp:44
ConnectionData operator*()
Definition: AssembledConnectionsIteration.hpp:53
bool operator!=(const NeighbourhoodIterator &other) const
Definition: AssembledConnectionsIteration.hpp:58
NeighbourhoodIterator(const int *neighbour_iter, const double *weight_iter)
Definition: AssembledConnectionsIteration.hpp:46
NeighbourhoodIterator & operator++()
Definition: AssembledConnectionsIteration.hpp:64
Definition: A.hpp:4
Definition: AssembledConnectionsIteration.hpp:33
int neighbour
Definition: AssembledConnectionsIteration.hpp:34
double weight
Definition: AssembledConnectionsIteration.hpp:35
Definition: AssembledConnectionsIteration.hpp:83
Iterator end_
Definition: AssembledConnectionsIteration.hpp:95
Iterator begin_
Definition: AssembledConnectionsIteration.hpp:94
Iterator begin() const
Definition: AssembledConnectionsIteration.hpp:84
Iterator end() const
Definition: AssembledConnectionsIteration.hpp:89