opm-common/opm/io/eclipse/SummaryNode.hpp
Bård Skaflestad d46628e8a1 Summary Config: Recognize Subset of Node-Level Keywords
This commit adds support for recognizing a small subset of the
summary quantities that are reported at the node level of an
extended network--especially the 'GPR' keyword.

Briefly, we add a new 'Node' config category and a processor for
this category which knows about the distinction between nodes and
groups.  It uses member function ExtNetwork::node_names() to produce
configuration nodes whose named entity is the node rather than a
group.  Deriving this list of node names across all timesteps is
potentially expensive, so perform this operation at most once and
pass the result into the processor from the SummaryConfig
constructor.

Add a simple unit test for demonstration purposes.
2020-09-22 10:08:44 +02:00

80 lines
2.0 KiB
C++

/*
Copyright 2020 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_IO_SUMMARYNODE_HPP
#define OPM_IO_SUMMARYNODE_HPP
#include <functional>
#include <optional>
#include <string>
#include <unordered_set>
namespace Opm { namespace EclIO {
struct SummaryNode {
enum class Category {
Well,
Group,
Field,
Region,
Block,
Connection,
Segment,
Aquifer,
Node,
Miscellaneous,
};
enum class Type {
Rate,
Total,
Ratio,
Pressure,
Count,
Mode,
Undefined,
};
std::string keyword;
Category category;
Type type;
std::string wgname;
int number;
std::string fip_region;
constexpr static int default_number { std::numeric_limits<int>::min() };
std::string unique_key() const;
using number_renderer = std::function<std::string(const SummaryNode&)>;
std::string unique_key(number_renderer) const;
bool is_user_defined() const;
static Category category_from_keyword(const std::string&, const std::unordered_set<std::string> &miscellaneous_keywords = {});
std::optional<std::string> display_name() const;
std::optional<std::string> display_number() const;
std::optional<std::string> display_number(number_renderer) const;
};
}} // namespace Opm::EclIO
#endif // OPM_IO_SUMMARYNODE_HPP