OpenTURNSPythonPointToFieldFunction

class OpenTURNSPythonPointToFieldFunction(inputDim, outputMesh, outputDim)

Override PointToFieldFunction from Python.

Parameters:
inputDimpositive int

Dimension \inputDim of the input vector

outputMeshMesh

The output mesh

outputDimpositive int

Dimension of the output field values d’

Methods

getInputDescription()

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

getInputDimension()

Accessor to the dimension of the input point of the function.

getOutputDescription()

Accessor to the description of the output field values.

getOutputDimension()

Accessor to the dimension of the output field values.

getOutputMesh()

Accessor to the mesh of the output field of the function.

setInputDescription(descIn)

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

setOutputDescription(descOut)

Accessor to the description of the output field values.

Notes

A OpenTURNSPythonPointToFieldFunction acts on points to produce fields:

f: \left| \begin{array}{rcl}
           \Rset^{d} &  \rightarrow & \cM_{N'} \times (\Rset^{d'})^{N'}  \\
            \vect{v} & \mapsto  & F' 
          \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^{d'}.

Using the class OpenTURNSPythonPointToFieldFunction allows one to define a persistent state between the evaluations of the function.

At least, you have to overload the function:

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

Examples

For example, we create the function which maps the point \vect{x}\in \Rset^2 into the field where the output values are (\vect{O}, \vect{x}, 2\vect{x}, \dots, 10\vect{x}) on the regular grid (0, 0.1, \dots, 1.0).

>>> import openturns as ot
>>> class FUNC(ot.OpenTURNSPythonPointToFieldFunction):
...     def __init__(self):
...         mesh = ot.RegularGrid(0.0, 0.1, 11)
...         super(FUNC, self).__init__(2, mesh, 2)
...         self.setInputDescription(['R', 'S'])
...         self.setOutputDescription(['T', 'U'])
...     def _exec(self, X):
...         size = self.getOutputMesh().getVerticesNumber()
...         Y = [ot.Point(X)*i for i in range(size)]
...         return Y
>>> F = FUNC()
__init__(inputDim, outputMesh, outputDim)
getInputDescription()

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

Returns:
descInsequence of str

The description of the input values of the function.

getInputDimension()

Accessor to the dimension of the input point of the function.

Returns:
inputPointDimint

The dimension of the input point of the function \inputDim.

getOutputDescription()

Accessor to the description of the output field values.

Returns:
descOutsequence of str

The description of the output field values of the function.

getOutputDimension()

Accessor to the dimension of the output field values.

Returns:
outputFieldDimint

The dimension of the output field values d'.

getOutputMesh()

Accessor to the mesh of the output field of the function.

Returns:
outputMeshint

The mesh of the output field of the function.

setInputDescription(descIn)

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

Parameters:
descInsequence of str

The description of the input values of the function.

setOutputDescription(descOut)

Accessor to the description of the output field values.

Parameters:
descOutsequence of str

The description of theof the output field values of the function.

Examples using the class

Logistic growth model

Logistic growth model