opm-common
Loading...
Searching...
No Matches
WListManager.hpp
1/*
2 Copyright 2019 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#ifndef WLISTMANAGER_HPP
20#define WLISTMANAGER_HPP
21
22#include <opm/input/eclipse/Schedule/Well/WList.hpp>
23
24#include <cstddef>
25#include <map>
26#include <string>
27#include <vector>
28
29namespace Opm::RestartIO {
30 struct RstState;
31} // namespace Opm::RestartIO
32
33namespace Opm {
34
35class WListManager
36{
37public:
38 WListManager() = default;
39 explicit WListManager(const RestartIO::RstState& rst_state);
40 static WListManager serializationTestObject();
41
42 std::size_t WListSize() const;
43
54 bool hasWell(const std::string& pattern) const;
55
56 bool hasList(const std::string&) const;
57 WList& getList(const std::string& name);
58 const WList& getList(const std::string& name) const;
59 WList& newList(const std::string& name, const std::vector<std::string>& wname);
60
61 const std::vector<std::string>& getWListNames(const std::string& wname) const;
62 std::size_t getNoWListsWell(const std::string& wname) const;
63 bool hasWList(const std::string& wname) const;
64 void addWListWell(const std::string& wname, const std::string& wlname);
65 void addOrCreateWellList(const std::string& wlname, const std::vector<std::string>& wnames);
66 void delWell(const std::string& wname);
67 void delWListWell(const std::string& wname, const std::string& wlname);
68
69 bool operator==(const WListManager& data) const;
70 std::vector<std::string> wells(const std::string& wlist_pattern) const;
71 template<class Serializer>
72 void serializeOp(Serializer& serializer)
73 {
74 serializer(wlists);
75 serializer(well_wlist_names);
76 serializer(no_wlists_well);
77 }
78
79private:
80 std::map<std::string, WList> wlists;
81 std::map<std::string, std::vector<std::string>> well_wlist_names;
82 std::map<std::string, std::size_t> no_wlists_well;
83
95 void resetExistingWList(const std::string& wlistName,
96 const std::vector<std::string>& newWells);
97
104 void clearExistingWList(const std::string& wlistName);
105
115 void createNewWList(const std::string& wlistName,
116 const std::vector<std::string>& newWells);
117};
118
119} // namespace Opm
120
121#endif // WLISTMANAGER_HPP
Class for (de-)serializing.
Definition Serializer.hpp:94
bool hasWell(const std::string &pattern) const
Whether or not one or more wells matching a well list name or well list template exists.
Definition WListManager.cpp:57
Definition WList.hpp:30
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition state.hpp:57