My Project
Keywords.hpp
1 /*
2  Copyright 2020 Equinor AS.
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_KEYWORDS_HPP
21 #define OPM_KEYWORDS_HPP
22 
23 #include <optional>
24 
25 namespace Opm
26 {
27 
28 namespace Fieldprops
29 {
30 
31 namespace keywords {
32 
33 template <typename T>
34 struct keyword_info {
35  std::optional<std::string> unit = std::nullopt;
36  std::optional<T> scalar_init = std::nullopt;
37  bool multiplier = false;
38  bool top = false;
39  bool global = false;
40 
41  bool operator==(const keyword_info& other) const {
42  return this->unit == other.unit &&
43  this->scalar_init == other.scalar_init &&
44  this->multiplier == other.multiplier &&
45  this->top == other.top &&
46  this->global == other.global;
47  }
48 
49 
50  keyword_info<T>& init(T init_value) {
51  this->scalar_init = init_value;
52  return *this;
53  }
54 
55  keyword_info<T>& unit_string(const std::string& unit_string) {
56  this->unit = unit_string;
57  return *this;
58  }
59 
60  keyword_info<T>& distribute_top(bool dtop) {
61  this->top = dtop;
62  return *this;
63  }
64 
65  keyword_info<T>& mult(bool m) {
66  this->multiplier = m;
67  return *this;
68  }
69 
70  keyword_info<T>& global_kw(bool g) {
71  this->global = g;
72  return *this;
73  }
74 };
75 } // end namespace Keywords
76 } // end namespace Fieldprops
77 } //end namespace Opm
78 #endif //OPM_KEYWORDS_HPP
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29
Definition: Keywords.hpp:34