OpenTURNSPythonFieldToPointFunction

class OpenTURNSPythonFieldToPointFunction(inputMesh, inputDim, outputDim)

Override FieldToPointFunction from Python.

Parameters:
inputMeshMesh

The input mesh.

inputDimpositive int

Dimension of the input field values \inputDim.

outputDimpositive int

Dimension of the output vector d’.

Methods

getInputDescription()

Accessor to the description of the input field values.

getInputDimension()

Accessor to the dimension of the input field values.

getInputMesh()

Accessor to the mesh of the input field.

getOutputDescription()

Accessor to the description of the output values of the function.

getOutputDimension()

Accessor to the dimension of the output values of the function.

setInputDescription(descIn)

Accessor to the description of the input field values.

setOutputDescription(descOut)

Accessor to the description of the output values of the function.

Notes

A OpenTURNSPythonFieldToPointFunction function acts on fields to produce points:

f: \left| \begin{array}{rcl}
            \cM_N \times (\Rset^\inputDim)^N & \rightarrow &\Rset^{d'} \\
            F & \mapsto & \vect{v}'
          \end{array} \right.

with \cM_N a mesh of \cD \subset \Rset^n.

A field is represented by a collection (\vect{t}_i, \vect{v}_i)_{1 \leq i \leq N} of elements of \cM_N \times (\Rset^d)^N where \vect{t}_i is a vertex of \cM_N and \vect{v}_i the associated value in \Rset^\inputDim.

At least, you have to overload the function:

_exec(X): a single evaluation, where X is a Field. It returns a Point.

Examples

For example, we create the function that maps a field to the mean value of its values.

>>> import openturns as ot
>>> mesh = ot.Mesh(1)
>>> class FUNC(ot.OpenTURNSPythonFieldToPointFunction):
...    def __init__(self):
...         # first argument:
...         super(FUNC, self).__init__(mesh, 2, 2)
...         self.setInputDescription(['R', 'S'])
...         self.setOutputDescription(['T', 'U'])
...    def _exec(self, X):
...         Y = ot.Sample(X).computeMean()
...         return Y
>>> F = FUNC()
__init__(inputMesh, inputDim, outputDim)
getInputDescription()

Accessor to the description of the input field values.

Returns:
descInsequence of str

The description of the input field values.

getInputDimension()

Accessor to the dimension of the input field values.

Returns:
inputFieldDimint

The dimension of the input field values \inputDim.

getInputMesh()

Accessor to the mesh of the input field.

Returns:
inputMeshMesh

The mesh of the input field.

getOutputDescription()

Accessor to the description of the output values of the function.

Returns:
descOutsequence of str

The description of the output values of the function.

getOutputDimension()

Accessor to the dimension of the output values of the function.

Returns:
outputDimint

The dimension of the output values of the function d'.

setInputDescription(descIn)

Accessor to the description of the input field values.

Parameters:
descInsequence of str

The description of the input field values.

setOutputDescription(descOut)

Accessor to the description of the output values of the function.

Parameters:
descOutsequence of str

The description of the output values of the function.

Examples using the class

Estimate Sobol indices on a field to point function

Estimate Sobol indices on a field to point function