opm-common
RegionCache.hpp
1 /*
2  Copyright 2016 Statoil 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 OPM_REGION_CACHE_HPP
21 #define OPM_REGION_CACHE_HPP
22 
23 #include <cstddef>
24 #include <map>
25 #include <set>
26 #include <string>
27 #include <vector>
28 
29 namespace Opm {
30  class Schedule;
31  class EclipseGrid;
32  class FieldPropsManager;
33 } // namespace Opm
34 
35 namespace Opm { namespace out {
36  class RegionCache {
37  public:
38  RegionCache() = default;
39  RegionCache(const std::set<std::string>& fip_regions,
40  const FieldPropsManager& fp,
41  const EclipseGrid& grid,
42  const Schedule& schedule);
43 
44  void buildCache(const std::set<std::string>& fip_regions,
45  const FieldPropsManager& fp,
46  const EclipseGrid& grid,
47  const Schedule& schedule);
48 
49  const std::vector<std::pair<std::string, std::size_t>>&
50  connections(const std::string& region_name, int region_id) const;
51 
52  // A well is assigned to the region_id of its first connection.
53  std::vector<std::string> wells(const std::string& region_name, int region_id) const;
54 
55  private:
56  using RegID = std::pair<std::string, int>; // { Region set, region ID }
57  using WellConn = std::pair<std::string, std::size_t>; // { Well name, cell ID }
58 
59  std::vector<WellConn> connections_empty{};
60  std::map<RegID, std::vector<WellConn>> connection_map{};
61  std::map<RegID, std::vector<std::string>> well_map{};
62  };
63 }} // namespace Opm::out
64 
65 #endif // OPM_REGION_CACHE_HPP
Definition: Schedule.hpp:100
Definition: FieldPropsManager.hpp:42
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition: EclipseGrid.hpp:62
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: RegionCache.hpp:36