NNC.hpp
Go to the documentation of this file.
1/*
2 Copyright 2015 IRIS
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 3 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
20#ifndef OPM_PARSER_NNC_HPP
21#define OPM_PARSER_NNC_HPP
22
23#include <cstddef>
24#include <memory>
25#include <vector>
26
27namespace Opm
28{
29
30struct NNCdata {
31 NNCdata(size_t c1, size_t c2, double t)
32 : cell1(c1), cell2(c2), trans(t)
33 {}
34 NNCdata() = default;
35
36 bool operator==(const NNCdata& data) const
37 {
38 return cell1 == data.cell1 &&
39 cell2 == data.cell2 &&
40 trans == data.trans;
41 }
42
43 template<class Serializer>
44 void serializeOp(Serializer& serializer)
45 {
46 serializer(cell1);
47 serializer(cell2);
48 serializer(trans);
49 }
50
51 size_t cell1;
52 size_t cell2;
53 double trans;
54};
55
56class Deck;
57
60class NNC
61{
62public:
63 NNC() = default;
64
66 explicit NNC(const Deck& deck);
67
69
70 void addNNC(const size_t cell1, const size_t cell2, const double trans);
71 const std::vector<NNCdata>& data() const { return m_nnc; }
72 size_t numNNC() const;
73 bool hasNNC() const;
74
75 bool operator==(const NNC& data) const;
76
77 template<class Serializer>
78 void serializeOp(Serializer& serializer)
79 {
80 serializer.vector(m_nnc);
81 }
82
83private:
84
85 std::vector<NNCdata> m_nnc;
86};
87
88
89} // namespace Opm
90
91
92#endif // OPM_PARSER_NNC_HPP
Definition: Deck.hpp:115
Definition: NNC.hpp:61
void addNNC(const size_t cell1, const size_t cell2, const double trans)
NNC(const Deck &deck)
Construct from input deck.
size_t numNNC() const
const std::vector< NNCdata > & data() const
Definition: NNC.hpp:71
bool hasNNC() const
static NNC serializeObject()
void serializeOp(Serializer &serializer)
Definition: NNC.hpp:78
bool operator==(const NNC &data) const
NNC()=default
Definition: Serializer.hpp:38
Definition: A.hpp:4
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t t(t+t)") define_sfop3(16
static std::string data()
Definition: exprtk.hpp:40022
Definition: NNC.hpp:30
NNCdata()=default
size_t cell2
Definition: NNC.hpp:52
double trans
Definition: NNC.hpp:53
size_t cell1
Definition: NNC.hpp:51
NNCdata(size_t c1, size_t c2, double t)
Definition: NNC.hpp:31
bool operator==(const NNCdata &data) const
Definition: NNC.hpp:36
void serializeOp(Serializer &serializer)
Definition: NNC.hpp:44