opm-common
WellMatcher.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 WELL_MATCHER_HPP
20 #define WELL_MATCHER_HPP
21 
22 #include <opm/input/eclipse/Schedule/Well/NameOrder.hpp>
23 #include <opm/input/eclipse/Schedule/Well/WListManager.hpp>
24 
25 #include <functional>
26 #include <initializer_list>
27 #include <memory>
28 #include <optional>
29 #include <string>
30 #include <unordered_map>
31 #include <vector>
32 
33 namespace Opm {
34 
35 class WellMatcher
36 {
37 public:
39  WellMatcher() = default;
40 
47  explicit WellMatcher(NameOrder&& well_order);
48 
58  explicit WellMatcher(const NameOrder* well_order);
59 
63  explicit WellMatcher(std::initializer_list<std::string> wells);
64 
68  explicit WellMatcher(const std::vector<std::string>& wells);
69 
82  WellMatcher(const NameOrder* well_order, const WListManager& wlm);
83 
87  WellMatcher(const WellMatcher& rhs);
88 
92  WellMatcher(WellMatcher&& rhs);
93 
95  ~WellMatcher();
96 
102  WellMatcher& operator=(const WellMatcher& rhs);
103 
109  WellMatcher& operator=(WellMatcher&& rhs);
110 
124  bool hasWell(const std::string& pattern) const;
125 
133  std::vector<std::string> sort(std::vector<std::string> wells) const;
134 
142  std::vector<std::string> wells(const std::string& pattern) const;
143 
145  const std::vector<std::string>& wells() const;
146 
147 private:
148  // Note to maintainers: If you make any changes here, please carefully
149  // update the constructors and assignment operators accordingly.
150 
158  std::unique_ptr<NameOrder> m_wo{};
159 
166  const NameOrder* m_well_order{nullptr};
167 
174  std::optional<std::reference_wrapper<const WListManager>> m_wlm{};
175 };
176 
177 } // namespace Opm
178 
179 #endif // WELL_MATCHER_HPP
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30