EclipseGrid.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2014 Statoil 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
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 ECLIPSE_GRID_HPP_
22 #define ECLIPSE_GRID_HPP_
23 
24 
27 
31 #include <ert/ecl/ecl_grid.h>
32 
33 #include <memory>
34 
35 namespace Opm {
36 
67  class EclipseGrid {
68  public:
69  explicit EclipseGrid(const std::string& filename);
70  explicit EclipseGrid(const ecl_grid_type * src_ptr);
71  explicit EclipseGrid(size_t nx, size_t ny, size_t nz,
72  double dx = 1.0, double dy = 1.0, double dz = 1.0);
73  explicit EclipseGrid(std::shared_ptr<const Deck> deck);
74  static bool hasCornerPointKeywords(std::shared_ptr<const Deck> deck);
75  static bool hasCartesianKeywords(std::shared_ptr<const Deck> deck);
76  size_t getNumActive( ) const;
77  size_t getNX( ) const;
78  size_t getNY( ) const;
79  size_t getNZ( ) const;
80  size_t getCartesianSize( ) const;
81  bool isPinchActive( ) const;
82  double getPinchThresholdThickness( ) const;
85 
87  double getMinpvValue( ) const;
88 
89  bool hasCellInfo() const;
90 
91  size_t getGlobalIndex(size_t i, size_t j, size_t k) const;
92  void assertGlobalIndex(size_t globalIndex) const;
93  void assertIJK(size_t i , size_t j , size_t k) const;
94  std::tuple<double,double,double> getCellCenter(size_t i,size_t j, size_t k) const;
95  std::tuple<double,double,double> getCellCenter(size_t globalIndex) const;
96  double getCellVolume(size_t globalIndex) const;
97  double getCellVolume(size_t i , size_t j , size_t k) const;
98  double getCellThicknes(size_t globalIndex) const;
99  double getCellThicknes(size_t i , size_t j , size_t k) const;
100  bool cellActive( size_t globalIndex ) const;
101  bool cellActive( size_t i , size_t , size_t k ) const;
102  double getCellDepth(size_t i,size_t j, size_t k) const;
103  double getCellDepth(size_t globalIndex) const;
104 
105 
106  void exportMAPAXES( std::vector<double>& mapaxes) const;
107  void exportCOORD( std::vector<double>& coord) const;
108  void exportZCORN( std::vector<double>& zcorn) const;
109  void exportACTNUM( std::vector<int>& actnum) const;
110  void resetACTNUM( const int * actnum);
111  bool equal(const EclipseGrid& other) const;
112  void fwriteEGRID( const std::string& filename, bool output_metric ) const;
113  const ecl_grid_type * c_ptr() const;
114  private:
115  std::shared_ptr<ecl_grid_type> m_grid;
116  double m_minpvValue;
117  MinpvMode::ModeEnum m_minpvMode;
118  Value<double> m_pinch;
119  PinchMode::ModeEnum m_pinchoutMode;
120  PinchMode::ModeEnum m_multzMode;
121  size_t m_nx;
122  size_t m_ny;
123  size_t m_nz;
124 
125  void assertCellInfo() const;
126 
127  void initCartesianGrid(const std::vector<int>& dims , DeckConstPtr deck);
128  void initCornerPointGrid(const std::vector<int>& dims , DeckConstPtr deck);
129  void initDTOPSGrid(const std::vector<int>& dims , DeckConstPtr deck);
130  void initDVDEPTHZGrid(const std::vector<int>& dims , DeckConstPtr deck);
131  void initGrid(const std::vector<int>& dims, DeckConstPtr deck);
132 
133  static void assertCornerPointKeywords(const std::vector<int>& dims, DeckConstPtr deck);
134  static bool hasDVDEPTHZKeywords(DeckConstPtr deck);
135  static bool hasDTOPSKeywords(DeckConstPtr deck);
136  static void assertVectorSize(const std::vector<double>& vector , size_t expectedSize , const std::string& msg);
137  static std::vector<double> createTOPSVector(const std::vector<int>& dims , const std::vector<double>& DZ , DeckConstPtr deck);
138  static std::vector<double> createDVector(const std::vector<int>& dims , size_t dim , const std::string& DKey , const std::string& DVKey, DeckConstPtr deck);
139  static void scatterDim(const std::vector<int>& dims , size_t dim , const std::vector<double>& DV , std::vector<double>& D);
140  };
141 
142  typedef std::shared_ptr<EclipseGrid> EclipseGridPtr;
143  typedef std::shared_ptr<const EclipseGrid> EclipseGridConstPtr;
144 }
145 
146 
147 
148 
149 #endif
size_t getNZ() const
bool isPinchActive() const
size_t getNY() const
std::shared_ptr< const EclipseGrid > EclipseGridConstPtr
Definition: EclipseGrid.hpp:143
void exportACTNUM(std::vector< int > &actnum) const
void fwriteEGRID(const std::string &filename, bool output_metric) const
Definition: Deck.hpp:29
bool cellActive(size_t globalIndex) const
size_t getNX() const
double getPinchThresholdThickness() const
double getCellVolume(size_t globalIndex) const
void exportZCORN(std::vector< double > &zcorn) const
MinpvMode::ModeEnum getMinpvMode() const
PinchMode::ModeEnum getPinchOption() const
std::shared_ptr< const Deck > DeckConstPtr
Definition: Deck.hpp:86
PinchMode::ModeEnum getMultzOption() const
std::tuple< double, double, double > getCellCenter(size_t i, size_t j, size_t k) const
std::shared_ptr< EclipseGrid > EclipseGridPtr
Definition: EclipseGrid.hpp:142
double getMinpvValue() const
bool equal(const EclipseGrid &other) const
EclipseGrid(const std::string &filename)
size_t getCartesianSize() const
ModeEnum
Definition: MinpvMode.hpp:28
double getCellThicknes(size_t globalIndex) const
bool hasCellInfo() const
ModeEnum
Definition: PinchMode.hpp:28
const ecl_grid_type * c_ptr() const
void assertIJK(size_t i, size_t j, size_t k) const
size_t getNumActive() const
size_t getGlobalIndex(size_t i, size_t j, size_t k) const
static bool hasCornerPointKeywords(std::shared_ptr< const Deck > deck)
double getCellDepth(size_t i, size_t j, size_t k) const
void assertGlobalIndex(size_t globalIndex) const
void resetACTNUM(const int *actnum)
void exportCOORD(std::vector< double > &coord) const
static bool hasCartesianKeywords(std::shared_ptr< const Deck > deck)
Definition: EclipseGrid.hpp:67
void exportMAPAXES(std::vector< double > &mapaxes) const