My Project
Loading...
Searching...
No Matches
Opm::MathToolbox< ScalarT > Struct Template Reference

Public Types

typedef ScalarT Scalar
 The type used to represent "primitive" scalar values.
 
typedef ScalarT ValueType
 The type used to represent values.
 
typedef MathToolbox< ScalarInnerToolbox
 The toolbox for the type of value objects.
 

Static Public Member Functions

static OPM_HOST_DEVICE Scalar value (Scalar value)
 Return the value of the function at a given evaluation point.
 
static OPM_HOST_DEVICE Scalar scalarValue (Scalar value)
 Return the primitive scalar value of a value object.
 
static OPM_HOST_DEVICE Scalar createBlank (Scalar)
 Given a scalar value, return a "compatible" object.
 
static OPM_HOST_DEVICE Scalar createConstant (Scalar value)
 Given a scalar value, return an evaluation of a constant function.
 
static OPM_HOST_DEVICE Scalar createConstant (unsigned numDerivatives, Scalar value)
 Given a scalar value, return an evaluation of a constant function that features a given number of derivatives.
 
static OPM_HOST_DEVICE Scalar createConstant (Scalar, Scalar value)
 Given a scalar value, return an evaluation of a constant function that is compatible to a "template" variable.
 
static OPM_HOST_DEVICE Scalar createVariable (Scalar, unsigned)
 Given a scalar value, return an evaluation of a linear function.
 
static OPM_HOST_DEVICE Scalar createVariable (Scalar, Scalar, unsigned)
 Given a scalar value, return an evaluation of a linear function that is compatible with a "template" evaluation.
 
template<class LhsEval >
static OPM_HOST_DEVICE LhsEval decay (Scalar value)
 Given a function evaluation, constrain it to its value (if necessary).
 
static OPM_HOST_DEVICE bool isSame (Scalar a, Scalar b, Scalar tolerance)
 Returns true if two values are identical up to a specified tolerance.
 
static OPM_HOST_DEVICE Scalar max (Scalar arg1, Scalar arg2)
 The maximum of two arguments.
 
static OPM_HOST_DEVICE Scalar min (Scalar arg1, Scalar arg2)
 The minimum of two arguments.
 
static OPM_HOST_DEVICE Scalar abs (Scalar arg)
 The absolute value.
 
static OPM_HOST_DEVICE Scalar tan (Scalar arg)
 The tangens of a value.
 
static OPM_HOST_DEVICE Scalar atan (Scalar arg)
 The arcus tangens of a value.
 
static OPM_HOST_DEVICE Scalar atan2 (Scalar arg1, Scalar arg2)
 The arcus tangens of a value.
 
static OPM_HOST_DEVICE Scalar sin (Scalar arg)
 The sine of a value.
 
static OPM_HOST_DEVICE Scalar asin (Scalar arg)
 The arcus sine of a value.
 
static OPM_HOST_DEVICE Scalar sinh (Scalar arg)
 The sine hyperbolicus of a value.
 
static OPM_HOST_DEVICE Scalar asinh (Scalar arg)
 The arcus sine hyperbolicus of a value.
 
static OPM_HOST_DEVICE Scalar cos (Scalar arg)
 The cosine of a value.
 
static OPM_HOST_DEVICE Scalar acos (Scalar arg)
 The arcus cosine of a value.
 
static OPM_HOST_DEVICE Scalar cosh (Scalar arg)
 The cosine hyperbolicus of a value.
 
static OPM_HOST_DEVICE Scalar acosh (Scalar arg)
 The arcus cosine hyperbolicus of a value.
 
static OPM_HOST_DEVICE Scalar sqrt (Scalar arg)
 The square root of a value.
 
static OPM_HOST_DEVICE Scalar exp (Scalar arg)
 The natural exponentiation of a value.
 
static OPM_HOST_DEVICE Scalar log10 (Scalar arg)
 The 10 logarithm of a value.
 
static OPM_HOST_DEVICE Scalar log (Scalar arg)
 The natural logarithm of a value.
 
static OPM_HOST_DEVICE Scalar pow (Scalar base, Scalar exp)
 Exponentiation to an arbitrary base.
 
static OPM_HOST_DEVICE bool isfinite (Scalar arg)
 Return true iff the argument's value and all its derivatives are finite values.
 
static OPM_HOST_DEVICE bool isnan (Scalar arg)
 Return true iff the argument's value or any of its derivatives are NaN values.
 

Member Typedef Documentation

◆ InnerToolbox

template<class ScalarT >
typedef MathToolbox<Scalar> Opm::MathToolbox< ScalarT >::InnerToolbox

The toolbox for the type of value objects.

For this class this is trivial because primitive floating point objects are endpoints in the "nesting graph". This typedef makes sense if nested automatic differentiation is used, though...

◆ ValueType

template<class ScalarT >
typedef ScalarT Opm::MathToolbox< ScalarT >::ValueType

The type used to represent values.

In general, these objects represent the function value at a given point plus a number of derivatives. In the case of the scalars, no derivatives will be evaluated.

Member Function Documentation

◆ createBlank()

template<class ScalarT >
static OPM_HOST_DEVICE Scalar Opm::MathToolbox< ScalarT >::createBlank ( Scalar  )
inlinestatic

Given a scalar value, return a "compatible" object.

This basically boils down to creating an uninitialized object of sufficient size. This is method only non-trivial for dynamically-sized Evaluation objects.

◆ createConstant() [1/3]

template<class ScalarT >
static OPM_HOST_DEVICE Scalar Opm::MathToolbox< ScalarT >::createConstant ( Scalar  value)
inlinestatic

Given a scalar value, return an evaluation of a constant function.

For this toolbox, an evaluation is the value, so this method is the identity function. In general, this returns an evaluation object for which all derivatives are zero.

◆ createConstant() [2/3]

template<class ScalarT >
static OPM_HOST_DEVICE Scalar Opm::MathToolbox< ScalarT >::createConstant ( Scalar  ,
Scalar  value 
)
inlinestatic

Given a scalar value, return an evaluation of a constant function that is compatible to a "template" variable.

For this toolbox, an evaluation is the value, so this method is the identity function. In general, this returns an evaluation object for which all derivatives are zero.

◆ createConstant() [3/3]

template<class ScalarT >
static OPM_HOST_DEVICE Scalar Opm::MathToolbox< ScalarT >::createConstant ( unsigned  numDerivatives,
Scalar  value 
)
inlinestatic

Given a scalar value, return an evaluation of a constant function that features a given number of derivatives.

For this toolbox, an evaluation is the value, so this method is the identity function. In general, this returns an evaluation object for which all derivatives are zero.

◆ createVariable() [1/2]

template<class ScalarT >
static OPM_HOST_DEVICE Scalar Opm::MathToolbox< ScalarT >::createVariable ( Scalar  ,
Scalar  ,
unsigned   
)
inlinestatic

Given a scalar value, return an evaluation of a linear function that is compatible with a "template" evaluation.

i.e., Create an evaluation which represents f(x) = x and the derivatives with regard to x. For scalars (which do not consider derivatives), this method does nothing.

◆ createVariable() [2/2]

template<class ScalarT >
static OPM_HOST_DEVICE Scalar Opm::MathToolbox< ScalarT >::createVariable ( Scalar  ,
unsigned   
)
inlinestatic

Given a scalar value, return an evaluation of a linear function.

i.e., Create an evaluation which represents f(x) = x and the derivatives with regard to x. For scalars (which do not consider derivatives), this method does nothing.

◆ decay()

template<class ScalarT >
template<class LhsEval >
static OPM_HOST_DEVICE LhsEval Opm::MathToolbox< ScalarT >::decay ( Scalar  value)
inlinestatic

Given a function evaluation, constrain it to its value (if necessary).

If the left hand side is a scalar and the right hand side is an evaluation, the scalar gets the value of the right hand side assigned. Also if both sides are scalars, this method returns the identity. The final case (left hand side being an evaluation, right hand side is a scalar) yields a compiler error.

The purpose of this method is to be able to transparantly use evaluation objects in scalar computations.

◆ scalarValue()

template<class ScalarT >
static OPM_HOST_DEVICE Scalar Opm::MathToolbox< ScalarT >::scalarValue ( Scalar  value)
inlinestatic

Return the primitive scalar value of a value object.

Since this toolbox's value objects are primitive scalars, this method just passes through the argument it was given.

◆ value()

template<class ScalarT >
static OPM_HOST_DEVICE Scalar Opm::MathToolbox< ScalarT >::value ( Scalar  value)
inlinestatic

Return the value of the function at a given evaluation point.

For this toolbox, there are no derivatives so this method is the identity function.


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