ERft.hpp
Go to the documentation of this file.
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
23
24#include <ctime>
25#include <map>
26#include <set>
27#include <string>
28#include <tuple>
29#include <utility>
30#include <vector>
31
32namespace Opm { namespace EclIO {
33
34class ERft : public EclFile
35{
36public:
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
74private:
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
const char *const name
Definition: cJSON.h:258
const char *const string
Definition: cJSON.h:170
Definition: ERft.hpp:35
std::tuple< int, int, int > RftDate
Definition: ERft.hpp:39
const std::vector< T > & getRft(const std::string &name, const std::string &wellName, int year, int month, int day) const
std::vector< EclEntry > listOfRftArrays(int reportIndex) const
std::vector< std::string > listOfWells() const
bool hasArray(const std::string &arrayName, int reportInd) const
const RftReportList & listOfRftReports() const
Definition: ERft.hpp:54
ERft(const std::string &filename)
bool hasRft(const std::string &wellName, int year, int month, int day) const
std::vector< EclEntry > listOfRftArrays(const std::string &wellName, int year, int month, int day) const
const std::vector< T > & getRft(const std::string &name, const std::string &wellName, const RftDate &date) const
bool hasArray(const std::string &arrayName, const std::string &wellName, const RftDate &date) const
std::vector< EclEntry > listOfRftArrays(const std::string &wellName, const RftDate &date) const
std::vector< std::tuple< std::string, RftDate, float > > RftReportList
Definition: ERft.hpp:53
const std::vector< T > & getRft(const std::string &name, int reportIndex) const
int numberOfReports()
Definition: ERft.hpp:72
bool hasRft(const std::string &wellName, const RftDate &date) const
std::vector< RftDate > listOfdates() const
Definition: EclFile.hpp:36
constexpr const double year
Definition: custom-opm-common/opm-common/opm/parser/eclipse/Units/Units.hpp:108
constexpr const double day
Definition: custom-opm-common/opm-common/opm/parser/eclipse/Units/Units.hpp:107
Definition: A.hpp:4
static const char * date
Definition: exprtk.hpp:40020