opm-grid
MinpvProcessor.hpp
1 /*
2  Copyright 2014 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 #ifndef OPM_MINPVPROCESSOR_HEADER_INCLUDED
21 #define OPM_MINPVPROCESSOR_HEADER_INCLUDED
22 
23 #include <array>
24 #include <cstddef>
25 #include <functional>
26 #include <map>
27 #include <numeric>
28 #include <vector>
29 
30 namespace Opm
31 {
32 
35  {
36  public:
37 
38  struct Result {
39  std::vector<std::size_t> removed_cells;
40  std::map<int,int> nnc;
41 
42  void add_nnc(int cell1, int cell2);
43  };
44 
45 
50  MinpvProcessor(const int nx, const int ny, const int nz);
72  Result process(const std::vector<double>& thickness,
73  const double z_tolerance,
74  const double max_gap,
75  const std::vector<double>& pv,
76  const std::vector<double>& minpvv,
77  const std::vector<int>& actnum,
78  const bool mergeMinPVCells,
79  double* zcorn,
80  const bool pinchNOGAP = false,
81  const bool pinchOption4ALL = false,
82  const std::vector<double>& permz = {},
83  const std::function<double(int)>& multZ = [](int){ return 0;},
84  const double tolerance_unique_points = 0) const;
85  private:
86  double computeGap(const std::array<double,8>& coord_above, const std::array<double,8>& coord_below) const;
87  std::array<int,8> cornerIndices(const int i, const int j, const int k) const;
88  // Returns the eight z-values associated with a given cell.
89  // The ordering is such that i runs fastest. That is, with
90  // L = low and H = high:
91  // {LLL, HLL, LHL, HHL, LLH, HLH, LHH, HHH }.
92  std::array<double, 8> getCellZcorn(const int i, const int j, const int k, const double* z) const;
93  void setCellZcorn(const int i, const int j, const int k, const std::array<double, 8>& cellz, double* z) const;
94  std::array<int, 3> dims_;
95  std::array<int, 3> delta_;
96  };
97 
98 } // namespace Opm
99 
100 #endif // OPM_MINPVPROCESSOR_HEADER_INCLUDED
Holds the implementation of the CpGrid as a pimple.
Definition: CellQuadrature.cpp:71
Result process(const std::vector< double > &thickness, const double z_tolerance, const double max_gap, const std::vector< double > &pv, const std::vector< double > &minpvv, const std::vector< int > &actnum, const bool mergeMinPVCells, double *zcorn, const bool pinchNOGAP=false, const bool pinchOption4ALL=false, const std::vector< double > &permz={}, const std::function< double(int)> &multZ=[](int){ return 0;}, const double tolerance_unique_points=0) const
Change zcorn so that it respects the minpv property.
Definition: MinpvProcessor.cpp:61
Definition: MinpvProcessor.hpp:38
MinpvProcessor(const int nx, const int ny, const int nz)
Create a processor.
Definition: MinpvProcessor.cpp:39
Transform a corner-point grid ZCORN field to account for MINPV processing.
Definition: MinpvProcessor.hpp:34