upscale.hpp
Go to the documentation of this file.
1 #ifndef OPM_VERTEQ_UPSCALE_HPP_INCLUDED
2 #define OPM_VERTEQ_UPSCALE_HPP_INCLUDED
3 
4 // Copyright (C) 2013 Uni Research AS
5 // This file is licensed under the GNU General Public License v3.0
6 
7 #include <utility> // pair
8 
9 #ifndef OPM_VERTEQ_VISIBILITY_HPP_INCLUDED
11 #endif /* OPM_VERTEQ_VISIBILITY_HPP_INCLUDED */
12 
13 #ifndef OPM_VERTEQ_TOPSURF_HPP_INCLUDED
14 #include <opm/verteq/topsurf.hpp>
15 #endif /* OPM_VERTEQ_TOPSURF_HPP_INCLUDED */
16 
17 #ifndef OPM_VERTEQ_RUNLEN_HPP_INCLUDED
19 #endif /* OPM_VERTEQ_RUNLEN_HPP_INCLUDED */
20 
21 namespace Opm {
22 
34 struct Elevation : private std::pair <int, double> {
43  Elevation (int aBlock, double aFraction)
44  : std::pair <int, double> (aBlock, aFraction) {
45  }
46 
52  int block () const { return this->first; }
53 
60  double fraction () const { return this->second; }
61 
70  bool operator< (const Elevation& rhs) const;
71 };
72 
85  VertEqUpscaler (const TopSurf& topSurf)
86  : ts (topSurf) {
87  }
88 
112  void gather (int col, double* buf, const double* data, int stride, int offset) const;
113 
131  void wgt_dpt (int col, const double* val, rlw_double& res) const;
132 
147  double dpt_avg (int col, const double* val) const;
148 
164  double sum (int col, const double* val) const;
165 
171  int num_rows (int col) const;
172 
177  Elevation bottom (int col) const;
178 
196  double eval (int col, const rlw_double& dpt, const Elevation zeta) const;
197 
221  Elevation find (int col, const double* dpt, const double target) const;
222 
223 protected:
224  const TopSurf& ts;
225 };
226 
237 double snapToRange (const double value,
238  const double lo,
239  const double hi);
240 
241 } // namespace Opm
242 
243 #endif // OPM_VERTEQ_UPSCALE_HPP_INCLUDED
Definition: upscale.hpp:78
VertEqUpscaler(const TopSurf &topSurf)
Definition: upscale.hpp:85
bool operator<(const Elevation &rhs) const
Definition: opmfwd.hpp:15
const TopSurf & ts
Definition: upscale.hpp:224
double eval(int col, const rlw_double &dpt, const Elevation zeta) const
double sum(int col, const double *val) const
double dpt_avg(int col, const double *val) const
Definition: topsurf.hpp:27
Elevation(int aBlock, double aFraction)
Definition: upscale.hpp:43
STL namespace.
double fraction() const
Definition: upscale.hpp:60
void wgt_dpt(int col, const double *val, rlw_double &res) const
double snapToRange(const double value, const double lo, const double hi)
int num_rows(int col) const
Elevation bottom(int col) const
int block() const
Definition: upscale.hpp:52
Definition: upscale.hpp:34
void gather(int col, double *buf, const double *data, int stride, int offset) const
Elevation find(int col, const double *dpt, const double target) const
Definition: runlen.hpp:60