Loading...
Searching...
No Matches
Opm::UniformXTabulated2DFunction< Scalar > Class Template Reference

Implements a scalar function that depends on two variables and which is sampled uniformly in the X direction, but non-uniformly on the Y axis-. More...

`#include <UniformXTabulated2DFunction.hpp>`

## Public Types

enum | InterpolationPolicy { LeftExtreme , RightExtreme , Vertical }
| Indicates how interpolation will be performed. More...
typedef std::tuple< Scalar, Scalar, Scalar > | SamplePoint

## Public Member Functions

| UniformXTabulated2DFunction (const InterpolationPolicy interpolationGuide=Vertical)
| UniformXTabulated2DFunction (const std::vector< Scalar > &xPos, const std::vector< Scalar > &yPos, const std::vector< std::vector< SamplePoint > > &samples, InterpolationPolicy interpolationGuide)
Scalar | xMin () const
| Returns the minimum of the X coordinate of the sampling points.
Scalar | xMax () const
| Returns the maximum of the X coordinate of the sampling points.
Scalar | xAt (size_t i) const
| Returns the value of the X coordinate of the sampling points.
Scalar | yAt (size_t i, size_t j) const
| Returns the value of the Y coordinate of a sampling point.
Scalar | valueAt (size_t i, size_t j) const
| Returns the value of a sampling point.
size_t | numX () const
| Returns the number of sampling points in X direction.
Scalar | yMin (unsigned i) const
| Returns the minimum of the Y coordinate of the sampling points for a given column.
Scalar | yMax (unsigned i) const
| Returns the maximum of the Y coordinate of the sampling points for a given column.
size_t | numY (unsigned i) const
| Returns the number of sampling points in Y direction a given column.
Scalar | iToX (unsigned i) const
| Return the position on the x-axis of the i-th interval.
const std::vector< std::vector< SamplePoint > > & | samples () const
const std::vector< Scalar > & | xPos () const
const std::vector< Scalar > & | yPos () const
InterpolationPolicy | interpolationGuide () const
Scalar | jToY (unsigned i, unsigned j) const
| Return the position on the y-axis of the j-th interval.
template<class Evaluation>
unsigned | xSegmentIndex (const Evaluation &x, bool extrapolate=false) const
| Return the interval index of a given position on the x-axis.
template<class Evaluation>
Evaluation | xToAlpha (const Evaluation &x, unsigned segmentIdx) const
| Return the relative position of an x value in an intervall.
template<class Evaluation>
unsigned | ySegmentIndex (const Evaluation &y, unsigned xSampleIdx, bool extrapolate=false) const
| Return the interval index of a given position on the y-axis.
template<class Evaluation>
Evaluation | yToBeta (const Evaluation &y, unsigned xSampleIdx, unsigned ySegmentIdx) const
| Return the relative position of an y value in an interval.
template<class Evaluation>
bool | applies (const Evaluation &x, const Evaluation &y) const
| Returns true iff a coordinate lies in the tabulated range.
template<class Evaluation>
Evaluation | eval (const Evaluation &x, const Evaluation &y, bool extrapolate=false) const
| Evaluate the function at a given (x,y) position.
template<class Evaluation>
void | findPoints (unsigned &i, unsigned &j1, unsigned &j2, Evaluation &alpha, Evaluation &beta1, Evaluation &beta2, const Evaluation &x, const Evaluation &y, bool extrapolate) const
template<class Evaluation>
Evaluation | eval (const unsigned &i, const unsigned &j1, const unsigned &j2, const Evaluation &alpha, const Evaluation &beta1, const Evaluation &beta2) const
size_t | appendXPos (Scalar nextX)
| Set the x-position of a vertical line.
size_t | appendSamplePoint (size_t i, Scalar y, Scalar value)
| Append a sample point.
void | print (std::ostream &os) const
| Print the table for debugging purposes.
bool | operator== (const UniformXTabulated2DFunction< Scalar > &data) const

## Detailed Description

template<class Scalar>
class Opm::UniformXTabulated2DFunction< Scalar >

Implements a scalar function that depends on two variables and which is sampled uniformly in the X direction, but non-uniformly on the Y axis-.

"Uniform on the X-axis" means that all Y sampling points must be located along a line for this value. This class can be used when the sampling points are calculated at run time.

## Member Enumeration Documentation

## InterpolationPolicy

template<class Scalar>

enum Opm::UniformXTabulated2DFunction::InterpolationPolicy

Indicates how interpolation will be performed.

Normal interpolation is done by interpolating vertically between lines of sample points, whereas LeftExtreme or RightExtreme implies guided interpolation, where interpolation is done parallel to a guide line. With LeftExtreme the lowest Y values will be used for the guide, and the guide line slope extends unchanged to infinity. With RightExtreme, the highest Y values are used, and the slope decreases linearly down to 0 (normal interpolation) for y <= 0.

## Member Function Documentation

## appendSamplePoint()

template<class Scalar>

size_t Opm::UniformXTabulated2DFunction< Scalar >::appendSamplePoint | ( | size_t | i,
|  | Scalar | y,
|  | Scalar | value )

inline

Append a sample point.

Returns the i index of the new point within its line.

## appendXPos()

template<class Scalar>

size_t Opm::UniformXTabulated2DFunction< Scalar >::appendXPos | ( | Scalar | nextX | ) |

inline

Set the x-position of a vertical line.

Returns the i index of that line.

## eval()

template<class Scalar>
template<class Evaluation>

Evaluation Opm::UniformXTabulated2DFunction< Scalar >::eval | ( | const Evaluation & | x,
|  | const Evaluation & | y,
|  | bool | extrapolate = false ) const

inline

Evaluate the function at a given (x,y) position.

If this method is called for a value outside of the tabulated range, a `Opm::NumericalIssue` exception is thrown.

## print()

template<class Scalar>

template void Opm::UniformXTabulated2DFunction< Scalar >::print | ( | std::ostream & | os | ) | const

Print the table for debugging purposes.

It will produce the data in CSV format on stdout, so that it can be visualized using e.g. gnuplot.

## xToAlpha()

template<class Scalar>
template<class Evaluation>

Evaluation Opm::UniformXTabulated2DFunction< Scalar >::xToAlpha | ( | const Evaluation & | x,
|  | unsigned | segmentIdx ) const

inline

Return the relative position of an x value in an intervall.

The returned value can be larger than 1 or smaller than zero if it is outside of the range of the segment. In particular this happens for the extrapolation case.

## yToBeta()

template<class Scalar>
template<class Evaluation>

Evaluation Opm::UniformXTabulated2DFunction< Scalar >::yToBeta | ( | const Evaluation & | y,
|  | unsigned | xSampleIdx,
|  | unsigned | ySegmentIdx ) const

inline

Return the relative position of an y value in an interval.

The returned value can be larger than 1 or smaller than zero if it is outside of the range of the segment. In particular this happens for the extrapolation case.

The documentation for this class was generated from the following files:

- opm/material/common/UniformXTabulated2DFunction.hpp
- opm/material/common/UniformXTabulated2DFunction.cpp