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