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