20 #ifndef OPM_MINPVPROCESSOR_HEADER_INCLUDED
21 #define OPM_MINPVPROCESSOR_HEADER_INCLUDED
24 #include <opm/common/ErrorMacros.hpp>
48 void process(
const std::vector<double>& pv,
50 const std::vector<int>& actnum,
53 std::array<int,8> cornerIndices(
const int i,
const int j,
const int k)
const;
54 std::array<double, 8> getCellZcorn(
const int i,
const int j,
const int k,
const double* z)
const;
55 void setCellZcorn(
const int i,
const int j,
const int k,
const std::array<double, 8>& cellz,
double* z)
const;
56 std::array<int, 3> dims_;
57 std::array<int, 3> delta_;
76 const std::vector<int>& actnum,
91 const size_t log_size = dims_[0] * dims_[1] * dims_[2];
92 if (pv.size() != log_size) {
93 OPM_THROW(std::runtime_error,
"Wrong size of PORV input, must have one element per logical cartesian cell.");
95 if (!actnum.empty() && actnum.size() != log_size) {
96 OPM_THROW(std::runtime_error,
"Wrong size of ACTNUM input, must have one element per logical cartesian cell.");
100 for (
int kk = 0; kk < dims_[2]; ++kk) {
101 for (
int jj = 0; jj < dims_[1]; ++jj) {
102 for (
int ii = 0; ii < dims_[0]; ++ii) {
103 const int c = ii + dims_[0] * (jj + dims_[1] * kk);
104 if (pv[c] < minpv && (actnum.empty() || actnum[c])) {
106 std::array<double, 8> cz = getCellZcorn(ii, jj, kk, zcorn);
107 for (
int count = 0; count < 4; ++count) {
108 cz[count + 4] = cz[count];
110 setCellZcorn(ii, jj, kk, cz, zcorn);
112 if (pv[c] > 0.0 && kk < dims_[2] - 1) {
114 std::array<double, 8> cz_below = getCellZcorn(ii, jj, kk + 1, zcorn);
115 for (
int count = 0; count < 4; ++count) {
116 cz_below[count] = cz[count];
118 setCellZcorn(ii, jj, kk + 1, cz_below, zcorn);
128 inline std::array<int,8> MinpvProcessor::cornerIndices(
const int i,
const int j,
const int k)
const
130 const int ix = 2*(i*delta_[0] + j*delta_[1] + k*delta_[2]);
131 std::array<int, 8> ixs = {{ ix, ix + delta_[0],
132 ix + delta_[1], ix + delta_[1] + delta_[0],
133 ix + delta_[2], ix + delta_[2] + delta_[0],
134 ix + delta_[2] + delta_[1], ix + delta_[2] + delta_[1] + delta_[0] }};
145 inline std::array<double, 8> MinpvProcessor::getCellZcorn(
const int i,
const int j,
const int k,
const double* z)
const
147 const std::array<int, 8> ixs = cornerIndices(i, j, k);
148 std::array<double, 8> cellz;
149 for (
int count = 0; count < 8; ++count) {
150 cellz[count] = z[ixs[count]];
157 inline void MinpvProcessor::setCellZcorn(
const int i,
const int j,
const int k,
const std::array<double, 8>& cellz,
double* z)
const
159 const std::array<int, 8> ixs = cornerIndices(i, j, k);
160 for (
int count = 0; count < 8; ++count) {
161 z[ixs[count]] = cellz[count];
169 #endif // OPM_MINPVPROCESSOR_HEADER_INCLUDED
Definition: AnisotropicEikonal.hpp:43
void process(const std::vector< double > &pv, const double minpv, const std::vector< int > &actnum, double *zcorn) const
Definition: MinpvProcessor.hpp:74
Transform a corner-point grid ZCORN field to account for MINPV processing.
Definition: MinpvProcessor.hpp:32
MinpvProcessor(const int nx, const int ny, const int nz)
Create a processor.
Definition: MinpvProcessor.hpp:60