opm-common
EModel.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 EMODEL_HPP
20 #define EMODEL_HPP
21 
22 #include <opm/io/eclipse/EclFile.hpp>
23 #include <opm/io/eclipse/ERst.hpp>
24 
25 #include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
26 
27 #include <cstddef>
28 #include <ctime>
29 #include <map>
30 #include <string>
31 #include <vector>
32 
33 class EModel
34 {
35 public:
36 
37  explicit EModel(const std::string& filename);
38 
39  bool hasParameter(const std::string &name) const;
40 
41  int getActiveReportStep() { return activeReportStep; }
42  bool hasReportStep(int rstep);
43  void setReportStep(int rstep);
44 
45  std::vector<std::tuple<std::string, Opm::EclIO::eclArrType>> getListOfParameters() const;
46 
47  std::vector<int> getListOfReportSteps() const {return rstfile->listOfReportStepNumbers(); };
48 
49  template <typename T>
50  const std::vector<T>& getParam(const std::string& name);
51 
52  void resetFilter();
53 
54  template <typename T>
55  void addFilter(const std::string& param1, const std::string& opperator, T num);
56 
57  template <typename T>
58  void addFilter(const std::string& param1, const std::string& opperator, T num1, T num2);
59 
60  void setDepthfwl(const std::vector<float>& fwl);
61 
62  void addHCvolFilter();
63 
64  int getNumberOfActiveCells();
65 
66  std::tuple<int, int, int> gridDims(){ return std::make_tuple(nI, nJ, nK); };
67 
68 private:
69 
70  int nI, nJ, nK;
71  int activeReportStep;
72 
73  std::size_t nActive;
74 
75  bool activeFilter, celVolCalculated;
76 
77  std::vector<float> filteredFloatVect;
78  std::vector<int> filteredIntVect;
79 
80  std::vector<float> PORV;
81  std::vector<float> CELLVOL;
82  std::vector<int> I, J, K;
83  std::vector<bool> ActFilter;
84 
85  Opm::EclIO::EclFile initfile;
86  std::optional<Opm::EclipseGrid> grid;
87  std::optional<Opm::EclIO::ERst> rstfile;
88 
89  std::map<std::string, int> initParam;
90  std::vector<std::string> initParamName;
91  std::vector<Opm::EclIO::eclArrType> initParamType;
92  std::vector<int> indInInitEclfile;
93 
94  std::map<std::string, int> solutionParam;
95  std::vector<std::string> solutionParamName;
96  std::vector<Opm::EclIO::eclArrType> solutionParamType;
97  std::vector<int> indInRstEclfile;
98 
99  int nEqlnum=0;
100  std::vector<float> FreeWaterlevel = {};
101 
102  void get_cell_volumes_from_grid();
103  void initSolutionData(int rstep);
104 
105  bool hasInitParameter(const std::string &name) const;
106  bool hasSolutionParameter(const std::string &name) const;
107 
108  const std::vector<float>& getInitFloat(const std::string& name);
109 
110  const std::vector<float>& getSolutionFloat(const std::string& name);
111 
112  template <typename T>
113  const std::vector<T>& get_filter_param(const std::string& param1);
114 
115  template <typename T>
116  void updateActiveFilter(const std::vector<T>& paramVect, const std::string& opperator, T value);
117 
118  template <typename T>
119  void updateActiveFilter(const std::vector<T>& paramVect, const std::string& opperator, T value1, T value2);
120 
121 };
122 
123 #endif
Definition: EModel.hpp:33
Definition: EclFile.hpp:34