My Project
Loading...
Searching...
No Matches
Opm::UniformTabulated2DFunction< Scalar, ContainerT > Class Template Reference

Implements a scalar function that depends on two variables and which is sampled on an uniform X-Y grid. More...

#include <UniformTabulated2DFunction.hpp>

Public Member Functions

 UniformTabulated2DFunction (Scalar minX, Scalar maxX, unsigned m, Scalar minY, Scalar maxY, unsigned n, const ContainerT &samples)
 
 UniformTabulated2DFunction (Scalar minX, Scalar maxX, unsigned m, Scalar minY, Scalar maxY, unsigned n)
 Constructor where the tabulation parameters are already provided.
 
 UniformTabulated2DFunction (Scalar minX, Scalar maxX, unsigned m, Scalar minY, Scalar maxY, unsigned n, const std::vector< std::vector< Scalar > > &vals)
 
 UniformTabulated2DFunction (Scalar minX, Scalar maxX, unsigned m, Scalar minY, Scalar maxY, unsigned n, const double vals[200][500])
 
void resize (Scalar minX, Scalar maxX, unsigned m, Scalar minY, Scalar maxY, unsigned n)
 Resize the tabulation to a new range.
 
OPM_HOST_DEVICE Scalar xMin () const
 Returns the minimum of the X coordinate of the sampling points.
 
OPM_HOST_DEVICE Scalar xMax () const
 Returns the maximum of the X coordinate of the sampling points.
 
OPM_HOST_DEVICE Scalar yMin () const
 Returns the minimum of the Y coordinate of the sampling points.
 
OPM_HOST_DEVICE Scalar yMax () const
 Returns the maximum of the Y coordinate of the sampling points.
 
OPM_HOST_DEVICE unsigned numX () const
 Returns the number of sampling points in X direction.
 
OPM_HOST_DEVICE unsigned numY () const
 Returns the number of sampling points in Y direction.
 
OPM_HOST_DEVICE const ContainerT & samples () const
 Returns the sampling points.
 
OPM_HOST_DEVICE Scalar iToX (unsigned i) const
 Return the position on the x-axis of the i-th interval.
 
OPM_HOST_DEVICE Scalar jToY (unsigned j) const
 Return the position on the y-axis of the j-th interval.
 
template<class Evaluation >
OPM_HOST_DEVICE Evaluation xToI (const Evaluation &x) const
 Return the interval index of a given position on the x-axis.
 
template<class Evaluation >
OPM_HOST_DEVICE Evaluation yToJ (const Evaluation &y) const
 Return the interval index of a given position on the y-axis.
 
template<class Evaluation >
OPM_HOST_DEVICE bool applies (const Evaluation &x, const Evaluation &y) const
 Returns true iff a coordinate lies in the tabulated range.
 
template<class Evaluation >
OPM_HOST_DEVICE Evaluation eval (const Evaluation &x, const Evaluation &y, bool extrapolate) const
 Evaluate the function at a given (x,y) position.
 
OPM_HOST_DEVICE Scalar getSamplePoint (unsigned i, unsigned j) const
 Get the value of the sample point which is at the intersection of the $i$-th interval of the x-Axis and the $j$-th of the y-Axis.
 
void setSamplePoint (unsigned i, unsigned j, Scalar value)
 Set the value of the sample point which is at the intersection of the $i$-th interval of the x-Axis and the $j$-th of the y-Axis.
 
OPM_HOST_DEVICE bool operator== (const UniformTabulated2DFunction< Scalar > &data) const
 

Friends

template<class ViewType , class ScalarT , class Container >
UniformTabulated2DFunction< ScalarT, ViewType > gpuistl::make_view (UniformTabulated2DFunction< ScalarT, Container > &)
 

Detailed Description

template<class Scalar, class ContainerT = std::vector<Scalar>>
class Opm::UniformTabulated2DFunction< Scalar, ContainerT >

Implements a scalar function that depends on two variables and which is sampled on an uniform X-Y grid.

This class can be used when the sampling points are calculated at run time.

Member Function Documentation

◆ eval()

template<class Scalar , class ContainerT = std::vector<Scalar>>
template<class Evaluation >
OPM_HOST_DEVICE Evaluation Opm::UniformTabulated2DFunction< Scalar, ContainerT >::eval ( const Evaluation &  x,
const Evaluation &  y,
bool  extrapolate 
) const
inline

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

Parameters
xx-position
yy-position
extrapolateWhether to extrapolate for untabulated values. If false then an exception might be thrown.

◆ xToI()

template<class Scalar , class ContainerT = std::vector<Scalar>>
template<class Evaluation >
OPM_HOST_DEVICE Evaluation Opm::UniformTabulated2DFunction< Scalar, ContainerT >::xToI ( const Evaluation &  x) 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 , class ContainerT = std::vector<Scalar>>
template<class Evaluation >
OPM_HOST_DEVICE Evaluation Opm::UniformTabulated2DFunction< Scalar, ContainerT >::yToJ ( const Evaluation &  y) 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: