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 Member Functions

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 (size_t i) const
 Returns the minimum of the Y coordinate of the sampling points for a given column.
 
Scalar yMax (size_t i) const
 Returns the maximum of the Y coordinate of the sampling points for a given column.
 
size_t numY (size_t i) const
 Returns the number of sampling points in Y direction a given column.
 
Scalar iToX (size_t i) const
 Return the position on the x-axis of the i-th interval.
 
Scalar jToY (size_t i, size_t j) const
 Return the position on the y-axis of the j-th interval.
 
template<class Evaluation >
Evaluation xToI (const Evaluation &x, bool extrapolate OPM_OPTIM_UNUSED=false) const
 Return the interval index of a given position on the x-axis. More...
 
template<class Evaluation >
Evaluation yToJ (size_t i, const Evaluation &y, bool extrapolate OPM_OPTIM_UNUSED=false) const
 Return the interval index of a given position on the y-axis. More...
 
bool applies (Scalar x, Scalar 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. More...
 
size_t appendXPos (Scalar nextX)
 Set the x-position of a vertical line. More...
 
size_t appendSamplePoint (size_t i, Scalar y, Scalar value)
 Append a sample point. More...
 
void print (std::ostream &os=std::cout) const
 Print the table for debugging purposes. More...
 

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 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 that 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::NumericalProblem exception is thrown.

◆ print()

template<class Scalar >
void Opm::UniformXTabulated2DFunction< Scalar >::print ( std::ostream &  os = std::cout) const
inline

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.

◆ xToI()

template<class Scalar >
template<class Evaluation >
Evaluation Opm::UniformXTabulated2DFunction< Scalar >::xToI ( const Evaluation &  x,
bool extrapolate  OPM_OPTIM_UNUSED = false 
) const
inline

Return the interval index of a given position on the x-axis.

This method returns a floating point number. The integer part should be interpreted as interval, the decimal places are the position of the x value between the i-th and the (i+1)-th sample point.

◆ yToJ()

template<class Scalar >
template<class Evaluation >
Evaluation Opm::UniformXTabulated2DFunction< Scalar >::yToJ ( size_t  i,
const Evaluation &  y,
bool extrapolate  OPM_OPTIM_UNUSED = false 
) const
inline

Return the interval index of a given position on the y-axis.

This method returns a floating point number. The integer part should be interpreted as interval, the decimal places are the position of the y value between the j-th and the (j+1)-th sample point.


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