My Project
Loading...
Searching...
No Matches
ExtNetwork.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 EXT_NETWORK_HPP
21#define EXT_NETWORK_HPP
22
23#include <opm/input/eclipse/Schedule/Network/Branch.hpp>
24#include <opm/input/eclipse/Schedule/Network/Node.hpp>
25
26#include <functional>
27#include <map>
28#include <optional>
29#include <set>
30#include <string>
31#include <vector>
32
33namespace Opm {
34 class Schedule;
35} // namespace Opm
36
37namespace Opm::Network {
38
40{
41public:
42 ExtNetwork() = default;
43 bool active() const;
44 bool is_standard_network() const;
45 void set_standard_network(bool is_standard_network);
46 void add_branch(Branch branch);
47 void add_or_replace_branch(Branch branch);
48 void drop_branch(const std::string& uptree_node, const std::string& downtree_node);
49 bool has_node(const std::string& name) const;
50 void update_node(Node node);
51 const Node& node(const std::string& name) const;
52 std::vector<std::reference_wrapper<const Node>> roots() const;
53 std::vector<Branch> downtree_branches(const std::string& node) const;
54 std::vector<const Branch*> branches() const;
55 std::optional<Branch> uptree_branch(const std::string& node) const;
56 const std::vector<std::string>& node_names() const;
57 std::set<std::string> leaf_nodes() const;
58 int NoOfBranches() const;
59 int NoOfNodes() const;
60
61 bool operator==(const ExtNetwork& other) const;
62 static ExtNetwork serializationTestObject();
63
64 template<class Serializer>
65 void serializeOp(Serializer& serializer)
66 {
67 serializer(m_branches);
68 serializer(insert_indexed_node_names);
69 serializer(m_nodes);
70 serializer(m_is_standard_network);
71 }
72
73private:
74 std::vector<Branch> m_branches;
75 std::vector<std::string> insert_indexed_node_names;
76 std::map<std::string, Node> m_nodes;
77 bool m_is_standard_network{false};
78
79 bool has_indexed_node_name(const std::string& name) const;
80 void add_indexed_node_name(const std::string& name);
81};
82
83} // namespace Opm::Network
84
85#endif // EXT_NETWORK_HPP
Definition Branch.hpp:30
Definition ExtNetwork.hpp:40
Definition Node.hpp:30
Class for (de-)serializing.
Definition Serializer.hpp:94
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30