opm-common
UDQToken.hpp
1 /*
2  Copyright 2020 Equinor 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
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 
21 #ifndef UDQ_TOKEN_HPP
22 #define UDQ_TOKEN_HPP
23 
24 #include <string>
25 #include <vector>
26 #include <variant>
27 #include <opm/input/eclipse/Schedule/UDQ/UDQEnums.hpp>
28 
29 namespace Opm {
30 
31 class UDQToken {
32 public:
33  UDQToken() = default;
34  UDQToken(const std::string& string_token, UDQTokenType token_type);
35  UDQToken(const std::string& string_token, const std::vector<std::string>& selector);
36 
37  static UDQToken serializationTestObject();
38 
39  const std::vector<std::string>& selector() const;
40  const std::variant<std::string, double>& value() const;
41  UDQTokenType type() const;
42  std::string str() const;
43 
44  bool operator==(const UDQToken&) const;
45 
46  template<class Serializer>
47  void serializeOp(Serializer& serializer)
48  {
49  serializer(token_type);
50  serializer(m_value);
51  serializer(m_selector);
52  }
53 
54 private:
55  UDQTokenType token_type{UDQTokenType::error};
56  std::variant<std::string,double> m_value;
57  std::vector<std::string> m_selector;
58 };
59 
60 }
61 
62 
63 #endif
Definition: UDQToken.hpp:31
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Class for (de-)serializing.
Definition: Serializer.hpp:94