My Project
ERft.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 it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  OPM is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with OPM. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef OPM_IO_ERFT_HPP
20 #define OPM_IO_ERFT_HPP
21 
22 #include <opm/io/eclipse/EclFile.hpp>
23 
24 #include <ctime>
25 #include <map>
26 #include <set>
27 #include <string>
28 #include <tuple>
29 #include <utility>
30 #include <vector>
31 
32 namespace Opm { namespace EclIO {
33 
34 class ERft : public EclFile
35 {
36 public:
37  explicit ERft(const std::string &filename);
38 
39  using RftDate = std::tuple<int,int,int>;
40  template <typename T>
41  const std::vector<T>& getRft(const std::string& name, const std::string& wellName,
42  const RftDate& date) const;
43 
44  template <typename T>
45  const std::vector<T>& getRft(const std::string& name, const std::string& wellName,
46  int year, int month, int day) const;
47  template <typename T>
48  const std::vector<T>& getRft(const std::string& name, int reportIndex) const;
49 
50  std::vector<std::string> listOfWells() const;
51  std::vector<RftDate> listOfdates() const;
52 
53  using RftReportList = std::vector<std::tuple<std::string, RftDate, float>>;
54  const RftReportList& listOfRftReports() const { return rftReportList; }
55 
56  bool hasRft(const std::string& wellName, const RftDate& date) const;
57  bool hasRft(const std::string& wellName, int year, int month, int day) const;
58 
59  std::vector<EclEntry> listOfRftArrays(int reportIndex ) const;
60 
61  std::vector<EclEntry> listOfRftArrays(const std::string& wellName,
62  const RftDate& date) const;
63 
64  std::vector<EclEntry> listOfRftArrays(const std::string& wellName,
65  int year, int month, int day) const;
66 
67  bool hasArray(const std::string& arrayName, const std::string& wellName,
68  const RftDate& date) const;
69 
70  bool hasArray(const std::string& arrayName, int reportInd) const;
71 
72  int numberOfReports() { return numReports; }
73 
74 private:
75  std::map<int, std::tuple<int,int>> arrIndexRange;
76  int numReports;
77  std::vector<float> timeList;
78 
79  std::set<std::string> wellList;
80  std::set<RftDate> dateList;
81  RftReportList rftReportList;
82 
83  std::map<std::tuple<std::string,RftDate>,int> reportIndices; // mapping report index to wellName and date (tupe)
84 
85  int getReportIndex(const std::string& wellName, const RftDate& date) const;
86 
87  int getArrayIndex(const std::string& name, int reportIndex) const;
88  int getArrayIndex(const std::string& name, const std::string& wellName,
89  const RftDate& date) const;
90 };
91 
92 }} // namespace Opm::EclIO
93 
94 #endif // OPM_IO_ERFT_HPP
Definition: ERft.hpp:35
Definition: EclFile.hpp:35
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29