My Project
Loading...
Searching...
No Matches
SummaryNode.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#ifndef OPM_IO_SUMMARYNODE_HPP
21#define OPM_IO_SUMMARYNODE_HPP
22
23#include <array>
24#include <functional>
25#include <limits>
26#include <optional>
27#include <string>
28
29namespace Opm { namespace EclIO {
30
31 struct lgr_info {
32 std::string name {};
33 std::array<int, 3> ijk {};
34 };
35
37 enum class Category {
38 Well,
39 Group,
40 Field,
41 Region,
42 Block,
44 Completion,
45 Segment,
46 Aquifer,
47 Node,
48 Miscellaneous,
49 };
50
51 enum class Type {
52 Rate,
53 Total,
54 Ratio,
55 Pressure,
56 Count,
57 Mode,
58 ProdIndex,
59 Undefined,
60 };
61
62 std::string keyword {};
63 Category category { Category::Miscellaneous };
64 Type type { Type::Undefined };
65 std::string wgname {};
66 int number {};
67 std::optional<std::string> fip_region {};
68 std::optional<lgr_info> lgr {};
69
70 constexpr static int default_number { std::numeric_limits<int>::min() };
71
72 std::string unique_key() const;
73
74 using number_renderer = std::function<std::string(const SummaryNode&)>;
75 std::string unique_key(number_renderer) const;
76
77 bool is_user_defined() const;
78
79 static Category category_from_keyword(const std::string&);
80
81 static std::string normalise_keyword(const Category category,
82 const std::string& keyword);
83
84 static std::string normalise_region_keyword(const std::string& keyword);
85
86 static inline std::string normalise_keyword(const std::string& keyword)
87 {
88 return normalise_keyword(category_from_keyword(keyword), keyword);
89 }
90
91 // Return true for keywords which should be Miscellaneous, although the
92 // naive first-character-based classification suggests something else.
93 static bool miscellaneous_exception(const std::string& keyword);
94
95 std::optional<std::string> display_name() const;
96 std::optional<std::string> display_number() const;
97 std::optional<std::string> display_number(number_renderer) const;
98};
99
100}} // namespace Opm::EclIO
101
102#endif // OPM_IO_SUMMARYNODE_HPP
Definition Connection.hpp:53
Definition Group.hpp:47
Definition Segment.hpp:63
Definition Well.hpp:78
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition SummaryNode.hpp:36
Definition SummaryNode.hpp:31