VFPInjTable.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2015 SINTEF ICT, Applied Mathematics.
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
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 
21 #ifndef OPM_PARSER_ECLIPSE_ECLIPSESTATE_TABLES_VFPINJTABLE_HPP_
22 #define OPM_PARSER_ECLIPSE_ECLIPSESTATE_TABLES_VFPINJTABLE_HPP_
23 
25 
26 #include <opm/common/utility/platform_dependent/disable_warnings.h>
27 
28 #include <boost/multi_array.hpp>
29 
30 #include <opm/common/utility/platform_dependent/reenable_warnings.h>
31 
32 namespace Opm {
33 
37 class VFPInjTable {
38 public:
39  typedef boost::multi_array<double, 2> array_type;
40  typedef boost::array<array_type::index, 2> extents;
41 
43  enum FLO_TYPE {
44  FLO_OIL=1, //< Oil rate
45  FLO_WAT, //< Water rate
46  FLO_GAS, //< Gas rate
48  };
49 
53  inline VFPInjTable() : m_table_num(-1),
54  m_datum_depth(-1),
55  m_flo_type(FLO_INVALID) {
56 
57  }
58 
69  void init(int table_num,
70  double datum_depth,
71  FLO_TYPE flo_type,
72  const std::vector<double>& flo_data,
73  const std::vector<double>& thp_data,
74  const array_type& data);
75 
80  void init(DeckKeywordConstPtr table, std::shared_ptr<Opm::UnitSystem> deck_unit_system);
81 
86  inline int getTableNum() const {
87  return m_table_num;
88  }
89 
94  inline double getDatumDepth() const {
95  return m_datum_depth;
96  }
97 
102  inline FLO_TYPE getFloType() const {
103  return m_flo_type;
104  }
105 
110  inline const std::vector<double>& getFloAxis() const {
111  return m_flo_data;
112  }
113 
118  inline const std::vector<double>& getTHPAxis() const {
119  return m_thp_data;
120  }
121 
136  inline const array_type& getTable() const {
137  return m_data;
138  }
139 private:
140 
141  //"Header" variables
142  int m_table_num;
143  double m_datum_depth;
144  FLO_TYPE m_flo_type;
145 
146  //The actual table axes
147  std::vector<double> m_flo_data;
148  std::vector<double> m_thp_data;
149 
150  //The data itself, using the data ordering m_data[thp][flo]
151  array_type m_data;
152 
157  void check();
158 
159  static FLO_TYPE getFloType(std::string flo_string);
160 
161  static void scaleValues(std::vector<double>& values,
162  const double& scaling_factor);
163 
164  static void convertFloToSI(const FLO_TYPE& type,
165  std::vector<double>& values,
166  std::shared_ptr<Opm::UnitSystem> unit_system);
167  static void convertTHPToSI(std::vector<double>& values,
168  std::shared_ptr<Opm::UnitSystem> unit_system);
169 };
170 
171 
172 } //Namespace Opm
173 
174 
175 #endif /* OPM_PARSER_ECLIPSE_ECLIPSESTATE_TABLES_VFPINJTABLE_HPP_ */
const std::vector< double > & getTHPAxis() const
Definition: VFPInjTable.hpp:118
FLO_TYPE
Rate type.
Definition: VFPInjTable.hpp:43
Definition: Deck.hpp:29
boost::multi_array< double, 2 > array_type
Definition: VFPInjTable.hpp:39
std::shared_ptr< const DeckKeyword > DeckKeywordConstPtr
Definition: DeckKeyword.hpp:71
const array_type & getTable() const
Definition: VFPInjTable.hpp:136
Definition: VFPInjTable.hpp:44
FLO_TYPE getFloType() const
Definition: VFPInjTable.hpp:102
Definition: VFPInjTable.hpp:45
boost::array< array_type::index, 2 > extents
Definition: VFPInjTable.hpp:40
Definition: VFPInjTable.hpp:37
VFPInjTable()
Definition: VFPInjTable.hpp:53
void init(int table_num, double datum_depth, FLO_TYPE flo_type, const std::vector< double > &flo_data, const std::vector< double > &thp_data, const array_type &data)
Definition: VFPInjTable.hpp:46
int getTableNum() const
Definition: VFPInjTable.hpp:86
double getDatumDepth() const
Definition: VFPInjTable.hpp:94
const std::vector< double > & getFloAxis() const
Definition: VFPInjTable.hpp:110
Definition: VFPInjTable.hpp:47