EndpointScaling.hpp
Go to the documentation of this file.
1/*
2 Copyright 2017 Statoil ASA.
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 it under the terms
7 of the GNU General Public License as published by the Free Software
8 Foundation, either version 3 of the License, or (at your option) any later
9 version.
10
11 OPM is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along with
16 OPM. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef OPM_ENDPOINTSCALING_HPP
20#define OPM_ENDPOINTSCALING_HPP
21
22#include <bitset>
23
24namespace Opm {
25class Deck;
26
27
29 public:
30 EndpointScaling() noexcept = default;
31 explicit EndpointScaling( const Deck& );
32
34
35 /* true if endpoint scaling is enabled, otherwise false */
36 operator bool() const noexcept;
37
38 bool directional() const noexcept;
39 bool nondirectional() const noexcept;
40 bool reversible() const noexcept;
41 bool irreversible() const noexcept;
42 bool twopoint() const noexcept;
43 bool threepoint() const noexcept;
44
45 bool operator==(const EndpointScaling& data) const;
46
47 template<class Serializer>
48 void serializeOp(Serializer& serializer)
49 {
50 if (serializer.isSerializing())
51 serializer(options.to_ulong());
52 else {
53 unsigned long bits = 0;
54 serializer(bits);
55 options = std::bitset<4>(bits);
56 }
57 }
58
59 private:
60 enum class option {
61 any = 0,
62 directional = 1,
63 reversible = 2,
64 threepoint = 3,
65 };
66
67 using ue = std::underlying_type< option >::type;
68 std::bitset< 4 > options;
69};
70}
71
72#endif
Definition: Deck.hpp:115
Definition: EndpointScaling.hpp:28
bool directional() const noexcept
void serializeOp(Serializer &serializer)
Definition: EndpointScaling.hpp:48
static EndpointScaling serializeObject()
bool reversible() const noexcept
bool irreversible() const noexcept
bool twopoint() const noexcept
EndpointScaling() noexcept=default
bool threepoint() const noexcept
bool nondirectional() const noexcept
Definition: Serializer.hpp:38
Definition: A.hpp:4
static std::string data()
Definition: exprtk.hpp:40022