My Project
EInit.hpp
1 /*
2  Copyright 2020 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_EINIT_HPP
20 #define OPM_IO_EINIT_HPP
21 
22 #include <opm/io/eclipse/EclFile.hpp>
23 
24 #include <array>
25 #include <vector>
26 #include <map>
27 
28 namespace Opm { namespace EclIO {
29 
30 class EInit : public EclFile
31 {
32 public:
33  explicit EInit(const std::string& filename);
34 
35  const std::vector<std::string>& list_of_lgrs() const { return lgr_names; }
36 
37  std::vector<EclFile::EclEntry> list_arrays() const;
38  std::vector<EclFile::EclEntry> list_arrays(const std::string& grid_name) const;
39 
40  const std::array<int, 3>& grid_dimension(const std::string& grid_name = "global") const;
41  int activeCells(const std::string& grid_name = "global") const;
42 
43  bool hasLGR(const std::string& name) const;
44 
45  template <typename T>
46  const std::vector<T>& getInitData(const std::string& name, const std::string& grid_name = "global")
47  {
48  return this->ImplgetInitData<T>(name, grid_name);
49  }
50 
51 protected:
52 
53  template <typename T>
54  const std::vector<T>& ImplgetInitData(const std::string& name, const std::string& grid_name = "global");
55 
56 private:
57  std::array<int, 3> global_nijk;
58  std::vector<std::array<int, 3>> lgr_nijk;
59 
60  int global_nactive;
61  std::vector<int> lgr_nactive;
62 
63  std::vector<std::string> lgr_names;
64 
65  std::map<std::string,int> global_array_index;
66  std::vector<std::map<std::string,int>> lgr_array_index;
67 
68  int get_array_index(const std::string& name, const std::string& grid_name) const;
69  int get_lgr_index(const std::string& grid_name) const;
70 };
71 
72 }} // namespace Opm::EclIO
73 
74 #endif // OPM_IO_EINIT_HPP
Definition: EInit.hpp:31
Definition: EclFile.hpp:35
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29