Loading...
Searching...
No Matches
Opm::utils::UniformTableLinear< T > Class Template Reference

This class uses linear interpolation to compute the value (and its derivative) of a function f sampled at uniform points. More...

`#include <UniformTableLinear.hpp>`

## Public Types

enum | RangePolicy { Throw = 0 , ClosestValue = 1 , Extrapolate = 2 }
| Policies for how to behave when trying to evaluate outside the domain.

## Public Member Functions

| UniformTableLinear ()
| Default constructor.
| UniformTableLinear (double xmin, double xmax, const std::vector< T > &y_values)
| Construct from vector of y-values.
| UniformTableLinear (double xmin, double xmax, const T *y_values, int num_y_values)
| Construct from array of y-values.
std::pair< double, double > | domain ()
| Get the domain.
void | rescaleDomain (std::pair< double, double > new_domain)
| Rescale the domain.
double | operator() (const double x) const
| Evaluate the value at x.
double | derivative (const double x) const
| Evaluate the derivative at x.
bool | operator== (const UniformTableLinear &other) const
| Equality operator.
void | setLeftPolicy (RangePolicy rp)
| Sets the behavioural policy for evaluation to the left of the domain.
void | setRightPolicy (RangePolicy rp)
| Sets the behavioural policy for evaluation to the right of the domain.

## Protected Attributes

double | xmin_ {}
double | xmax_ {}
double | xdelta_ {}
std::vector< T > | y_values_ {}
RangePolicy | left_ {}
RangePolicy | right_ {}

## Friends

template<typename U>
std::ostream & | operator<< (std::ostream &os, const UniformTableLinear< U > &t)

## Detailed Description

template<typename T>
class Opm::utils::UniformTableLinear< T >

This class uses linear interpolation to compute the value (and its derivative) of a function f sampled at uniform points.

Template Parameters

  T | the range type of the function (should be an algebraic ring type)

## Constructor & Destructor Documentation

## UniformTableLinear() [1/2]

template<typename T>

Opm::UniformTableLinear< T >::UniformTableLinear | ( | double | xmin,
|  | double | xmax,
|  | const std::vector< T > & | y_values )

inline

Construct from vector of y-values.

Parameters

  xmin | the x value corresponding to the first y value.
  xmax | the x value corresponding to the last y value.
  y_values | vector of range values.

## UniformTableLinear() [2/2]

template<typename T>

Opm::UniformTableLinear< T >::UniformTableLinear | ( | double | xmin,
|  | double | xmax,
|  | const T * | y_values,
|  | int | num_y_values )

inline

Construct from array of y-values.

Parameters

  xmin | the x value corresponding to the first y value.
  xmax | the x value corresponding to the last y value.
  y_values | array of range values.
  num_y_values | the number of values in y_values.

## Member Function Documentation

## derivative()

template<typename T>

double Opm::UniformTableLinear< T >::derivative | ( | const double | x | ) | const

inline

Evaluate the derivative at x.

Parameters

  x | a domain value

Returns
  f'(x)

## domain()

template<typename T>

std::pair< double, double > Opm::UniformTableLinear< T >::domain | ( |  | ) |

inline

Get the domain.

Returns
  the domain as a pair of doubles.

## operator()()

template<typename T>

double Opm::UniformTableLinear< T >::operator() | ( | const double | x | ) | const

inline

Evaluate the value at x.

Parameters

  x | a domain value

Returns
  f(x)

## operator==()

template<typename T>

bool Opm::UniformTableLinear< T >::operator== | ( | const UniformTableLinear< T > & | other | ) | const

inline

Equality operator.

Parameters

  other | another UniformTableLinear.

Returns
  true if they are represented exactly alike.

## rescaleDomain()

template<typename T>

void Opm::UniformTableLinear< T >::rescaleDomain | ( | std::pair< double, double > | new_domain | ) |

inline

Rescale the domain.

Parameters

  new_domain | the new domain as a pair of doubles.

## setLeftPolicy()

template<typename T>

void Opm::UniformTableLinear< T >::setLeftPolicy | ( | RangePolicy | rp | ) |

inline

Sets the behavioural policy for evaluation to the left of the domain.

Parameters

  rp | the policy

## setRightPolicy()

template<typename T>

void Opm::UniformTableLinear< T >::setRightPolicy | ( | RangePolicy | rp | ) |

inline

Sets the behavioural policy for evaluation to the right of the domain.

Parameters

  rp | the policy

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

- opm/common/utility/numeric/UniformTableLinear.hpp