Opm::utils Namespace Reference

Functions

template<typename T , typename Tresult >
Tresult arithmeticAverage (const T &t1, const T &t2)
 
template<typename T >
geometricAverage (const T &t1, const T &t2)
 
template<typename T >
harmonicAverage (const T &t1, const T &t2)
 

Function Documentation

template<typename T , typename Tresult >
Tresult Opm::utils::arithmeticAverage ( const T &  t1,
const T &  t2 
)

Computes the arithmetic average: a_A(t_1, t_2) = (t_1 + t_2)/2.

template<typename T >
T Opm::utils::geometricAverage ( const T &  t1,
const T &  t2 
)

Computes the geometric average: a_G(t_1, t_2) = {t_1 t_2}. Since we use std::sqrt(), this function will only compile when T is convertible to and from double.

template<typename T >
T Opm::utils::harmonicAverage ( const T &  t1,
const T &  t2 
)

Computes the harmonic average: a_H(t_1, t_2) = {2}{1/t_1 + 1/t_2} = {2 t_1 t_2}{t_1 + t_2}.