OpenTURNSPythonFieldFunction

class OpenTURNSPythonFieldFunction(inputMesh, inputDim, outputMesh, outputDim)

Override FieldFunction from Python.

Parameters:
inputMeshMesh

The input mesh

inputDimint, \geq 1

Dimension d of the values of the input field

outputMeshMesh

The output mesh

outputDimint, \geq 1

Dimension d' of the values of the output field

Methods

getInputDescription

getInputDimension

getInputMesh

getOutputDescription

getOutputDimension

getOutputMesh

setInputDescription

setOutputDescription

Notes

You have to overload the function:

_exec(X): single evaluation, X is a Field, returns a Field

Examples

>>> import openturns as ot
>>> mesh = ot.Mesh(1)
>>> class FUNC(ot.OpenTURNSPythonFieldFunction):
...     def __init__(self):
...         # first argument:
...         super(FUNC, self).__init__(mesh, 2, mesh, 2)
...         self.setInputDescription(['R', 'S'])
...         self.setOutputDescription(['T', 'U'])
...     def _exec(self, X):
...         Y = ot.Field(self.getOutputMesh(), X.getValues() * ([2.0]*X.getValues().getDimension()))
...         return Y
>>> F = FUNC()

Create the associated FieldFunction:

>>> myFunc = ot.FieldFunction(F)
__init__(inputMesh, inputDim, outputMesh, outputDim)

Examples using the class

Metamodel of a field function

Metamodel of a field function