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