Opm::NonuniformTableLinear< T > Class Template Reference

This class uses linear interpolation to compute the value (and its derivative) of a function f sampled at possibly nonuniform points. If values outside the domain are sought, values will be extrapolated linearly. More...

#include <NonuniformTableLinear.hpp>

Inheritance diagram for Opm::NonuniformTableLinear< T >:
Inheritance graph

Public Member Functions

 NonuniformTableLinear ()
 Default constructor. More...
 
 NonuniformTableLinear (const std::vector< double > &x_values, const std::vector< T > &y_values)
 Construct from vectors of x and y values. More...
 
std::pair< double, double > domain ()
 Get the domain. More...
 
void rescaleDomain (std::pair< double, double > new_domain)
 Rescale the domain. More...
 
double operator() (const double x) const
 Evaluate the value at x. More...
 
double derivative (const double x) const
 Evaluate the derivative at x. More...
 
double inverse (const double y) const
 Evaluate the inverse at y. Requires T to be a double. More...
 
bool operator== (const NonuniformTableLinear &other) const
 Equality operator. More...
 

Protected Attributes

std::vector< double > x_values_
 
std::vector< T > y_values_
 
std::vector< T > x_values_reversed_
 
std::vector< T > y_values_reversed_
 

Detailed Description

template<typename T>
class Opm::NonuniformTableLinear< T >

This class uses linear interpolation to compute the value (and its derivative) of a function f sampled at possibly nonuniform points. If values outside the domain are sought, values will be extrapolated linearly.

Template Parameters
Tthe range type of the function (should be an algebraic ring type)

Constructor & Destructor Documentation

template<typename T >
Opm::NonuniformTableLinear< T >::NonuniformTableLinear ( )
inline

Default constructor.

template<typename T>
Opm::NonuniformTableLinear< T >::NonuniformTableLinear ( const std::vector< double > &  x_values,
const std::vector< T > &  y_values 
)
inline

Construct from vectors of x and y values.

Parameters
x_valuesvector of domain values
y_valuesvector of corresponding range values.

References Opm::isNondecreasing().

Member Function Documentation

template<typename T >
double Opm::NonuniformTableLinear< T >::derivative ( const double  x) const
inline

Evaluate the derivative at x.

Parameters
xa domain value
Returns
f'(x)

References Opm::linearInterpolationDerivative().

template<typename T >
std::pair< double, double > Opm::NonuniformTableLinear< T >::domain ( )
inline

Get the domain.

Returns
the domain as a pair of doubles.
template<typename T >
double Opm::NonuniformTableLinear< T >::inverse ( const double  y) const
inline

Evaluate the inverse at y. Requires T to be a double.

Parameters
ya range value
Returns
f^{-1}(y)

References Opm::isNondecreasing(), and Opm::linearInterpolation().

template<typename T >
double Opm::NonuniformTableLinear< T >::operator() ( const double  x) const
inline

Evaluate the value at x.

Parameters
xa domain value
Returns
f(x)

References Opm::linearInterpolation().

template<typename T >
bool Opm::NonuniformTableLinear< T >::operator== ( const NonuniformTableLinear< T > &  other) const
inline

Equality operator.

Parameters
otheranother NonuniformTableLinear.
Returns
true if they are represented exactly alike.

References Opm::NonuniformTableLinear< T >::x_values_, and Opm::NonuniformTableLinear< T >::y_values_.

template<typename T >
void Opm::NonuniformTableLinear< T >::rescaleDomain ( std::pair< double, double >  new_domain)
inline

Rescale the domain.

Parameters
new_domainthe new domain as a pair of doubles.

Member Data Documentation

template<typename T>
std::vector<double> Opm::NonuniformTableLinear< T >::x_values_
protected
template<typename T>
std::vector<T> Opm::NonuniformTableLinear< T >::x_values_reversed_
mutableprotected
template<typename T>
std::vector<T> Opm::NonuniformTableLinear< T >::y_values_
protected
template<typename T>
std::vector<T> Opm::NonuniformTableLinear< T >::y_values_reversed_
mutableprotected

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